Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

1.10.x
Yannick Warnier 10 years ago
commit c7310de3a1
  1. 8
      main/newscorm/learnpath.class.php
  2. 58
      main/newscorm/lp_add_category.php
  3. 11
      src/Chamilo/CourseBundle/Entity/CLpCategory.php

@ -10045,11 +10045,11 @@ EOD;
public static function updateCategory($params)
{
$em = Database::getManager();
/** @var CLpCategory $item */
$item = $em->find('ChamiloCourseBundle:CLpCategory', $params['id']);
if ($item) {
$item->setName($params['name']);
$item->setCId($params['c_id']);
$em->persist($item);
$em->merge($item);
$em->flush();
}
}
@ -10060,6 +10060,7 @@ EOD;
public static function moveUpCategory($id)
{
$em = Database::getManager();
/** @var CLpCategory $item */
$item = $em->find('ChamiloCourseBundle:CLpCategory', $id);
if ($item) {
$position = $item->getPosition() - 1;
@ -10075,6 +10076,7 @@ EOD;
public static function moveDownCategory($id)
{
$em = Database::getManager();
/** @var CLpCategory $item */
$item = $em->find('ChamiloCourseBundle:CLpCategory', $id);
if ($item) {
$position = $item->getPosition() + 1;
@ -10114,7 +10116,7 @@ EOD;
array('name' => 'ASC')
);*/
//Using doctrine extensions
// Using doctrine extensions
$items = $em->getRepository('ChamiloCourseBundle:CLpCategory')->getBySortableGroupsQuery(
array('cId' => $courseId)
)->getResult();

@ -12,68 +12,36 @@ api_protect_course_script();
require 'learnpath_functions.inc.php';
require 'resourcelinker.inc.php';
$language_file = 'learnpath';
/* Header and action code */
$currentstyle = api_get_setting('stylesheets');
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#learnpath_title").focus();
}
$(document).ready(function () {
setFocus();
});
function activate_start_date() {
if(document.getElementById(\'start_date_div\').style.display == \'none\') {
document.getElementById(\'start_date_div\').style.display = \'block\';
} else {
document.getElementById(\'start_date_div\').style.display = \'none\';
}
}
function activate_end_date() {
if(document.getElementById(\'end_date_div\').style.display == \'none\') {
document.getElementById(\'end_date_div\').style.display = \'block\';
} else {
document.getElementById(\'end_date_div\').style.display = \'none\';
}
}
</script>';
/* Constants and variables */
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$isStudentView = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView'] : null;
$learnpath_id = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : null;
/* MAIN CODE */
if ((!$is_allowed_to_edit) || ($isStudentView)) {
//error_log('New LP - User not authorized in lp_add.php');
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
if (!$is_allowed_to_edit) {
header('location:lp_controller.php?action=list&'.api_get_cidreq());
exit;
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array(
'url' => 'lp_controller.php?action=list?'.api_get_cidreq(),
'name' => get_lang('LearningPaths'),
);
$form = new FormValidator('lp_add_category', 'post', 'lp_controller.php');
$form = new FormValidator(
'lp_add_category',
'post',
'lp_controller.php?'.api_get_cidreq()
);
// Form title
$form->addElement('header', null, get_lang('AddLPCategory'));
// Title
$form->addElement('text', 'name', api_ucfirst(get_lang('Name')), array('class' => 'span6'));
$form->addElement('text', 'name', api_ucfirst(get_lang('Name')));
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'action', 'add_lp_category');
$form->addElement('hidden', 'c_id', api_get_course_int_id());
$form->addElement('hidden', 'id', 0);
$form->addElement('style_submit_button', 'Submit', get_lang('Save'),'class="save"');
$form->addButtonSave(get_lang('Save'));
if ($form->validate()) {
$values = $form->getSubmitValues();

@ -19,7 +19,7 @@ class CLpCategory
*
* @ORM\Column(name="iid", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\GeneratedValue
*/
private $iid;
@ -51,6 +51,7 @@ class CLpCategory
public function setCId($cId)
{
$this->cId = $cId;
return $this;
}
@ -111,11 +112,19 @@ class CLpCategory
return $this->name;
}
/**
* @param int $position
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
/**
* @return int
*/
public function getPosition()
{
return $this->position;

Loading…
Cancel
Save