From 7e3c9767db64685b0d805d92db621dbc4b5b3a15 Mon Sep 17 00:00:00 2001
From: toyomoyo
$strgrade: " . $extra_info->finalgrade . "$openlink $stronascaleof $closelink
"; -} - // Form if in edit or add modes $mform->display(); -/* -if ($action != 'view') { - $mform->display(); -} else { // Feedback string and Back button if in View mode - echo $feedback; - echo "'; -} -*/ print_simple_box_end(); diff --git a/grade/report/grader/edit_grade_form.php b/grade/report/grader/edit_grade_form.php index a66d7019c0..31d2f637dd 100755 --- a/grade/report/grader/edit_grade_form.php +++ b/grade/report/grader/edit_grade_form.php @@ -19,9 +19,11 @@ class edit_grade_form extends moodleform { // scale grade $scaleopt[-1] = get_string('nograde'); + $i = 1; if ($scale = get_record('scale', 'id', $gradeitem->scaleid)) { foreach (split(",", $scale->scale) as $option) { - $scaleopt[] = $option; + $scaleopt[$i] = $option; + $i++; } } diff --git a/lib/grade/grade_grades.php b/lib/grade/grade_grades.php index f205df3625..e6db1f0603 100644 --- a/lib/grade/grade_grades.php +++ b/lib/grade/grade_grades.php @@ -214,6 +214,45 @@ class grade_grades extends grade_object { } } + + /** + * Set the locktime for this grade. + * + * @param int $locktime timestamp for lock to activate + * @return boolean true if sucessful, false if can not set new lock state for grade + */ + function set_locktime($locktime) { + + if ($locktime) { + // if current locktime is before, no need to reset + + if ($this->locktime && $this->locktime <= $locktime) { + return true; + } + + /* + if ($this->grade_item->needsupdate) { + //can not lock grade if final not calculated! + return false; + } + */ + + $this->locktime = $locktime; + $this->update(); + + return true; + + } else { + + // remove the locktime timestamp + $this->locktime = 0; + + $this->update(); + + return true; + } + } + /** * Check grade lock status. Uses both grade item lock and grade lock. * Internally any date in hidden field (including future ones) means hidden, diff --git a/lib/grade/grade_item.php b/lib/grade/grade_item.php index 2c7ba0a667..737c2c97e6 100644 --- a/lib/grade/grade_item.php +++ b/lib/grade/grade_item.php @@ -457,6 +457,44 @@ class grade_item extends grade_object { } } + + /** + * Set the locktime for this grade. + * + * @param int $locktime timestamp for lock to activate + * @return boolean true if sucessful, false if can not set new lock state for grade + */ + function set_locktime($locktime) { + + if ($locktime) { + // if current locktime is before, no need to reset + + if ($this->locktime && $this->locktime <= $locktime) { + return true; + } + + /* + if ($this->grade_item->needsupdate) { + //can not lock grade if final not calculated! + return false; + } + */ + + $this->locktime = $locktime; + $this->update(); + + return true; + + } else { + + // remove the locktime timestamp + $this->locktime = 0; + + $this->update(); + + return true; + } + } /** * Returns the hidden state of this grade_item (if the grade_item is hidden OR no specific -- 2.39.5