Format code, add intval

1.10.x
Julio Montoya 10 years ago
parent 6f7a4e3aec
commit ffbd684417
  1. 8
      main/newscorm/learnpath.class.php
  2. 6
      main/newscorm/lp_list.php

@ -10250,14 +10250,18 @@ EOD;
return $this->categoryId;
}
/**
* @param int $categoryId
* @return bool
*/
public function setCategoryId($categoryId)
{
$this->categoryId = $categoryId;
$this->categoryId = intval($categoryId);
$courseId = api_get_course_int_id();
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
$lp_id = $this->get_id();
$sql = "UPDATE $lp_table SET category_id = '".intval($categoryId)."'
$sql = "UPDATE $lp_table SET category_id = '".$this->categoryId."'
WHERE c_id = ".$courseId." AND id = '$lp_id'";
Database::query($sql);

@ -102,7 +102,7 @@ $token = Security::get_token();
/* DISPLAY SCORM LIST */
$categories_temp = learnpath::getCategories(api_get_course_int_id());
$categoriesTempList = learnpath::getCategories(api_get_course_int_id());
$categoryTest = new \Chamilo\CourseBundle\Entity\CLpCategory();
$categoryTest->setId(0);
$categoryTest->setName(get_lang('WithOutCategory'));
@ -112,8 +112,8 @@ $categories = array(
$categoryTest
);
if (!empty($categories_temp)) {
$categories = array_merge($categories, $categories_temp);
if (!empty($categoriesTempList)) {
$categories = array_merge($categories, $categoriesTempList);
}
$userId = api_get_user_id();

Loading…
Cancel
Save