]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10211 Show/hide and lock/unlock of final grades
authornicolasconnault <nicolasconnault>
Thu, 28 Jun 2007 05:54:01 +0000 (05:54 +0000)
committernicolasconnault <nicolasconnault>
Thu, 28 Jun 2007 05:54:01 +0000 (05:54 +0000)
grade/report/grader/index.php
lib/gradelib.php

index 73df5ee26b3ad71e93b8a3e520e0bfd859908d25..06672d260733db2ff893a41d2f184ec1356980bc 100644 (file)
@@ -48,7 +48,7 @@ $perpage       = optional_param('perpage', 3, PARAM_INT); // number of users on
 $action        = optional_param('action', 0, PARAM_ALPHA);
 $move          = optional_param('move', 0, PARAM_INT);
 $type          = optional_param('type', 0, PARAM_ALPHA);
-$target        = optional_param('target', 0, PARAM_INT);
+$target        = optional_param('target', 0, PARAM_ALPHANUM);
 
 // Grab the grade_tree for this course
 $gtree = new grade_tree($courseid, false);
@@ -95,7 +95,17 @@ if ($sortitemid) {
 
 // Perform actions on categories, items and grades
 if (!empty($target) && !empty($action) && confirm_sesskey()) {
-    $element = $gtree->locate_element($target);
+
+    // If targetting a grade, create a pseudo-element
+    if (preg_match('/^grade([0-9]*)/', $target, $matches)) {
+        $grade_grades_id = $matches[1];
+        $element = new stdClass();
+        $grade_grades = new grade_grades(array('id' => $grade_grades_id));
+        $element->element = array('object' => $grade_grades);
+    } else { 
+        $element = $gtree->locate_element($target);
+    }
+
     switch ($action) {
         case 'edit':
             break;
index 0399068e057faebd723583a38f5d30923fa80bdd..809758e148c8dfa130485cafcce385631c73c2a3 100644 (file)
@@ -721,7 +721,7 @@ function grade_get_icons($object, $tree) {
     if (get_class($object) != 'grade_grades') {
         $identifier = $object->get_sortorder();
     } else {
-        $identifier = 'grade_grades_' . $object->id;
+        $identifier = 'grade' . $object->id;
     }
 
     $html .= '<a href="report.php?report=grader&amp;target=' . $identifier