From a9d5bde75d95cdde8b300d70491b6a760f9e173b Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 28 Jun 2007 05:54:01 +0000 Subject: [PATCH] MDL-10211 Show/hide and lock/unlock of final grades --- grade/report/grader/index.php | 14 ++++++++++++-- lib/gradelib.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index 73df5ee26b3..06672d26073 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -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; diff --git a/lib/gradelib.php b/lib/gradelib.php index 0399068e057..809758e148c 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -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 .= '