|
|
|
@ -330,8 +330,8 @@ class Category implements GradebookItem |
|
|
|
|
return $cats; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$courseCode = api_get_course_info_by_id(api_get_course_int_id()); |
|
|
|
|
$courseCode = $courseCode['code']; |
|
|
|
|
$courseInfo = api_get_course_info_by_id(api_get_course_int_id()); |
|
|
|
|
$courseCode = $courseInfo['code']; |
|
|
|
|
$session_id = intval($session_id); |
|
|
|
|
|
|
|
|
|
if (!empty($session_id)) { |
|
|
|
@ -582,7 +582,6 @@ class Category implements GradebookItem |
|
|
|
|
$this->set_id($id); |
|
|
|
|
|
|
|
|
|
if (!empty($id)) { |
|
|
|
|
|
|
|
|
|
$parent_id = $this->get_parent_id(); |
|
|
|
|
$grade_model_id = $this->get_grade_model_id(); |
|
|
|
|
if ($parent_id == 0) { |
|
|
|
@ -614,7 +613,10 @@ class Category implements GradebookItem |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$gradebook= new Gradebook(); |
|
|
|
|
$gradebook->update_skills_to_gradebook($this->id, $this->get_skills(false)); |
|
|
|
|
$gradebook->update_skills_to_gradebook( |
|
|
|
|
$this->id, |
|
|
|
|
$this->get_skills(false) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $id; |
|
|
|
|
} |
|
|
|
@ -657,7 +659,6 @@ class Category implements GradebookItem |
|
|
|
|
$parent_id = $this->get_parent_id(); |
|
|
|
|
$grade_model_id = $this->get_grade_model_id(); |
|
|
|
|
if ($parent_id == 0) { |
|
|
|
|
|
|
|
|
|
if (isset($grade_model_id) && !empty($grade_model_id) && $grade_model_id != '-1') { |
|
|
|
|
$obj = new GradeModel(); |
|
|
|
|
$components = $obj->get_components($grade_model_id); |
|
|
|
@ -673,7 +674,6 @@ class Category implements GradebookItem |
|
|
|
|
foreach ($components as $component) { |
|
|
|
|
$gradebook = new Gradebook(); |
|
|
|
|
$params = array(); |
|
|
|
|
|
|
|
|
|
$params['name'] = $component['acronym']; |
|
|
|
|
$params['description'] = $component['title']; |
|
|
|
|
$params['user_id'] = api_get_user_id(); |
|
|
|
@ -681,7 +681,6 @@ class Category implements GradebookItem |
|
|
|
|
$params['weight'] = $component['percentage'] / 100 * $default_weight; |
|
|
|
|
$params['session_id'] = api_get_session_id(); |
|
|
|
|
$params['course_code'] = $this->get_course_code(); |
|
|
|
|
|
|
|
|
|
$gradebook->save($params); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -732,7 +731,8 @@ class Category implements GradebookItem |
|
|
|
|
public function update_category_delete($course_id) |
|
|
|
|
{ |
|
|
|
|
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
|
|
|
|
$sql = 'UPDATE '.$tbl_grade_categories.' SET visible=3 |
|
|
|
|
$sql = 'UPDATE '.$tbl_grade_categories.' SET |
|
|
|
|
visible = 3 |
|
|
|
|
WHERE course_code ="'.Database::escape_string($course_id).'"'; |
|
|
|
|
Database::query($sql); |
|
|
|
|
} |
|
|
|
@ -743,7 +743,8 @@ class Category implements GradebookItem |
|
|
|
|
public function show_message_resource_delete($course_id) |
|
|
|
|
{ |
|
|
|
|
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
|
|
|
|
$sql = 'SELECT count(*) AS num from '.$tbl_grade_categories.' |
|
|
|
|
$sql = 'SELECT count(*) AS num |
|
|
|
|
FROM '.$tbl_grade_categories.' |
|
|
|
|
WHERE |
|
|
|
|
course_code = "'.Database::escape_string($course_id).'" AND |
|
|
|
|
visible = 3'; |
|
|
|
@ -805,10 +806,10 @@ class Category implements GradebookItem |
|
|
|
|
} else { |
|
|
|
|
$sql .= ' AND user_id = '.api_get_user_id(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
$sql .= ' AND user_id = '.api_get_user_id(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isset($parent)) { |
|
|
|
|
$sql.= ' AND parent_id is null'; |
|
|
|
|
} else { |
|
|
|
@ -1195,7 +1196,11 @@ class Category implements GradebookItem |
|
|
|
|
|
|
|
|
|
// course independent categories |
|
|
|
|
if (empty($course_code)) { |
|
|
|
|
$cats = Category::get_independent_categories_with_result_for_student (0, $stud_id, $cats); |
|
|
|
|
$cats = Category::get_independent_categories_with_result_for_student( |
|
|
|
|
0, |
|
|
|
|
$stud_id, |
|
|
|
|
$cats |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $cats; |
|
|
|
@ -1241,7 +1246,14 @@ class Category implements GradebookItem |
|
|
|
|
$cats = Category::create_category_objects_from_sql_result($result); |
|
|
|
|
// course independent categories |
|
|
|
|
if (isset($course_code)) { |
|
|
|
|
$indcats = Category::load(null,$user_id,$course_code,0,null,$session_id); |
|
|
|
|
$indcats = Category::load( |
|
|
|
|
null, |
|
|
|
|
$user_id, |
|
|
|
|
$course_code, |
|
|
|
|
0, |
|
|
|
|
null, |
|
|
|
|
$session_id |
|
|
|
|
); |
|
|
|
|
$cats = array_merge($cats, $indcats); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|