Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-36167-23' of git://github.com/damyon/moodle into MO…

…ODLE_23_STABLE
  • Loading branch information...
commit ae4e512f665ab3d8703b01f95e38baa180684da2 2 parents b0473b9 + 7cc7277
@danpoltawski danpoltawski authored
Showing with 25 additions and 20 deletions.
  1. +25 −20 mod/assign/locallib.php
View
45 mod/assign/locallib.php
@@ -968,6 +968,8 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
static $scalegrades = array();
+ $o = '';
+
if ($this->get_instance()->grade >= 0) {
// Normal number
if ($editing && $this->get_instance()->grade > 0) {
@@ -976,15 +978,18 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
} else {
$displaygrade = format_float($grade);
}
- $o = '<input type="text" name="quickgrade_' . $userid . '" value="' . $displaygrade . '" size="6" maxlength="10" class="quickgrade"/>';
+ $o .= '<input type="text" name="quickgrade_' . $userid . '" value="' . $displaygrade . '" size="6" maxlength="10" class="quickgrade"/>';
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade,2);
$o .= '<input type="hidden" name="grademodified_' . $userid . '" value="' . $modified . '"/>';
return $o;
} else {
+ $o .= '<input type="hidden" name="grademodified_' . $userid . '" value="' . $modified . '"/>';
if ($grade == -1 || $grade === null) {
- return '-';
+ $o .= '-';
+ return $o;
} else {
- return format_float(($grade),2) .'&nbsp;/&nbsp;'. format_float($this->get_instance()->grade,2);
+ $o .= format_float(($grade),2) .'&nbsp;/&nbsp;'. format_float($this->get_instance()->grade,2);
+ return $o;
}
}
@@ -994,11 +999,12 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
if ($scale = $DB->get_record('scale', array('id'=>-($this->get_instance()->grade)))) {
$this->cache['scale'] = make_menu_from_list($scale->scale);
} else {
- return '-';
+ $o .= '-';
+ return $o;
}
}
if ($editing) {
- $o = '<select name="quickgrade_' . $userid . '" class="quickgrade">';
+ $o .= '<select name="quickgrade_' . $userid . '" class="quickgrade">';
$o .= '<option value="-1">' . get_string('nograde') . '</option>';
foreach ($this->cache['scale'] as $optionid => $option) {
$selected = '';
@@ -1013,9 +1019,11 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
} else {
$scaleid = (int)$grade;
if (isset($this->cache['scale'][$scaleid])) {
- return $this->cache['scale'][$scaleid];
+ $o .= $this->cache['scale'][$scaleid];
+ return $o;
}
- return '-';
+ $o .= '-';
+ return $o;
}
}
}
@@ -2620,19 +2628,16 @@ private function process_save_quick_grades() {
// gets a list of possible users and look for values based upon that.
foreach ($participants as $userid => $unused) {
$modified = optional_param('grademodified_' . $userid, -1, PARAM_INT);
- if ($modified >= 0) {
- // gather the userid, updated grade and last modified value
- $record = new stdClass();
- $record->userid = $userid;
- $record->grade = unformat_float(required_param('quickgrade_' . $record->userid, PARAM_TEXT));
- $record->lastmodified = $modified;
- $record->gradinginfo = grade_get_grades($this->get_course()->id, 'mod', 'assign', $this->get_instance()->id, array($userid));
- $users[$userid] = $record;
- }
- }
- if (empty($users)) {
- // Quick check to see whether we have any users to update and we don't
- return get_string('quickgradingchangessaved', 'assign'); // Technical lie
+ // Gather the userid, updated grade and last modified value.
+ $record = new stdClass();
+ $record->userid = $userid;
+ $gradevalue = optional_param('quickgrade_' . $userid, '', PARAM_TEXT);
+ if($modified >= 0) {
+ $record->grade = unformat_float(optional_param('quickgrade_' . $record->userid, -1, PARAM_TEXT));
+ }
+ $record->lastmodified = $modified;
+ $record->gradinginfo = grade_get_grades($this->get_course()->id, 'mod', 'assign', $this->get_instance()->id, array($userid));
+ $users[$userid] = $record;
}
list($userids, $params) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED);
Please sign in to comment.
Something went wrong with that request. Please try again.