Skip to content

Commit

Permalink
Add option to copy gradebook with links to the new course-session #9966
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Jul 15, 2015
1 parent a0d41a3 commit 53e475a
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 51 deletions.
11 changes: 7 additions & 4 deletions main/gradebook/lib/be/category.class.php
Expand Up @@ -451,7 +451,9 @@ public static function load(

$categories = array();
if (Database::num_rows($result) > 0) {
$categories = Category::create_category_objects_from_sql_result($result);
$categories = Category::create_category_objects_from_sql_result(
$result
);
}

return $categories;
Expand Down Expand Up @@ -570,7 +572,8 @@ public function add()
$em->persist($category);
$em->flush();

$id = Database::insert_id();
$id = $category->getId();

$this->set_id($id);

if (!empty($id)) {
Expand Down Expand Up @@ -959,7 +962,6 @@ public function calc_score(
return array($ressum, $weightsum);
break;
case 'ranking':
//var_dump($students);
return null;
return AbstractLink::getCurrentUserRanking($students);
break;
Expand Down Expand Up @@ -1487,6 +1489,7 @@ public function get_subcategories($stud_id = null, $course_code = null, $session
// All students
// Course admin
if (api_is_allowed_to_edit() && !api_is_platform_admin()) {

// root
if ($this->id == 0) {
return $this->get_root_categories_for_teacher(api_get_user_id(), $course_code, $session_id, false);
Expand All @@ -1501,7 +1504,7 @@ public function get_subcategories($stud_id = null, $course_code = null, $session
}
} elseif (api_is_platform_admin()) {
// platform admin
//we explicitly avoid listing subcats from another session
// we explicitly avoid listing subcats from another session
return Category::load(null, null, $course_code, $this->id, null, $session_id, $order);
}
}
Expand Down

0 comments on commit 53e475a

Please sign in to comment.