MDL-18229 gradebook: Fixes for bulk insert and checkboxes.

This commit is contained in:
Zachary Durber 2014-10-14 13:18:45 +08:00
parent 57fac09a40
commit 1b2c1ccb4c
4 changed files with 13 additions and 12 deletions

View File

@ -25,6 +25,8 @@
namespace gradereport_singleview\local\screen;
use gradereport_singleview\local\ui\range;
use gradereport_singleview\local\ui\bulk_insert;
use grade_grade;
use grade_item;
use moodle_url;
use pix_icon;

View File

@ -263,14 +263,21 @@ abstract class screen {
continue;
}
if (!in_array($matches[1], $fields)) {
continue;
}
$gradeitem = grade_item::fetch(array(
'id' => $itemid, 'courseid' => $this->courseid
));
if (preg_match('/^old[oe]{1}/', $varname)) {
$elementname = preg_replace('/^old/', '', $varname);
if (!isset($data->$elementname)) {
$data->$elementname = false;
}
}
if (!in_array($matches[1], $fields)) {
continue;
}
if (!$gradeitem) {
continue;
}

View File

@ -293,7 +293,6 @@ class user extends tablelike implements selectable_items {
// Appropriately massage data that may not exist.
$userid = $this->item->id;
foreach ($this->items as $gradeitemid => $gradeitem) {
$null = $gradeitem->gradetype == GRADE_TYPE_SCALE ? -1 : '';
$field = "finalgrade_{$gradeitem->id}_{$gradeitemid}";

View File

@ -85,12 +85,6 @@ class checkbox_attribute extends element {
$attributes['disabled'] = 'DISABLED';
}
$alt = array(
'type' => 'hidden',
'name' => $this->name,
'value' => 0
);
$hidden = array(
'type' => 'hidden',
'name' => 'old' . $this->name
@ -111,7 +105,6 @@ class checkbox_attribute extends element {
}
return (
html_writer::empty_tag('input', $alt) .
html_writer::tag('label',
get_string($type . 'for', 'gradereport_singleview', $this->label),
array('for' => $this->name, 'class' => 'accesshide')) .