Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #24 from marinaglancy/wip-nov08-rubric

  • Loading branch information...
commit 3e5e7004c5f56838008531af54b4a4d35021614b 2 parents bb50c37 + c97933f
David Mudrák mudrd8mz authored
3  grade/grading/form/rubric/lib.php
View
@@ -504,7 +504,8 @@ public function get_or_create_instance($instanceid, $raterid, $itemid) {
if ($rs = $DB->get_records('grading_instances', array('raterid' => $raterid, 'itemid' => $itemid), 'timemodified DESC', '*', 0, 1)) {
$record = reset($rs);
$currentinstance = $this->get_current_instance($raterid, $itemid);
- if ($record->status == gradingform_rubric_instance::INSTANCE_STATUS_INCOMPLETE && $record->timemodified > $currentinstance->get_data('timemodified')) {
+ if ($record->status == gradingform_rubric_instance::INSTANCE_STATUS_INCOMPLETE &&
+ (!$currentinstance || $record->timemodified > $currentinstance->get_data('timemodified'))) {
$record->isrestored = true;
return $this->get_instance($record);
}
8 grade/lib.php
View
@@ -1177,7 +1177,11 @@ private function get_activity_link($element) {
// If module has grade.php, link to that, otherwise view.php
if ($hasgradephp[$itemmodule]) {
- return new moodle_url('/mod/' . $itemmodule . '/grade.php', array('id' => $cm->id, 'itemnumber' => $itemnumber));
+ $args = array('id' => $cm->id, 'itemnumber' => $itemnumber);
+ if (isset($element['userid'])) {
+ $args['userid'] = $element['userid'];
+ }
+ return new moodle_url('/mod/' . $itemmodule . '/grade.php', $args);
} else {
return new moodle_url('/mod/' . $itemmodule . '/view.php', array('id' => $cm->id));
}
@@ -1259,7 +1263,7 @@ public function get_grade_analysis_icon(grade_grade $grade) {
return '';
}
- return $OUTPUT->action_icon($url, new pix_icon('i/search',
+ return $OUTPUT->action_icon($url, new pix_icon('t/preview',
get_string('gradeanalysis', 'core_grades')));
}
15 grade/report/grader/lib.php
View
@@ -1007,10 +1007,10 @@ public function get_right_rows() {
if ($item->needsupdate) {
$itemcell->text .= html_writer::tag('span', get_string('error'), array('class'=>"gradingerror$hidden$gradepass"));
} else {
- if ($this->get_pref('showanalysisicon') and !is_null($gradeval)) {
+ $itemcell->text .= html_writer::tag('span', grade_format_gradevalue($gradeval, $item, true, $gradedisplaytype, null), array('class'=>"gradevalue$hidden$gradepass"));
+ if ($this->get_pref('showanalysisicon')) {
$itemcell->text .= $this->gtree->get_grade_analysis_icon($grade);
}
- $itemcell->text .= html_writer::tag('span', grade_format_gradevalue($gradeval, $item, true, $gradedisplaytype, null), array('class'=>"gradevalue$hidden$gradepass"));
}
}
@@ -1445,7 +1445,7 @@ public function get_right_avg_row($rows=array(), $grouponly=false) {
* figures out the state of the object and builds then returns a div
* with the icons needed for the grader report.
*
- * @param object $object
+ * @param array $object
* @return string HTML
*/
protected function get_icons($element) {
@@ -1467,7 +1467,6 @@ protected function get_icons($element) {
$lockunlockicon = '';
if (has_capability('moodle/grade:manage', $this->context)) {
-
if ($this->get_pref('showcalculations')) {
$editcalculationicon = $this->gtree->get_calculation_icon($element, $this->gpr);
}
@@ -1479,9 +1478,15 @@ protected function get_icons($element) {
if ($this->get_pref('showlocks')) {
$lockunlockicon = $this->gtree->get_locking_icon($element, $this->gpr);
}
+
+ }
+
+ $gradeanalysisicon = '';
+ if ($this->get_pref('showanalysisicon') && $element['type'] == 'grade') {
+ $gradeanalysisicon .= $this->gtree->get_grade_analysis_icon($element['object']);
}
- return $OUTPUT->container($editicon.$editcalculationicon.$showhideicon.$lockunlockicon, 'grade_icons');
+ return $OUTPUT->container($editicon.$editcalculationicon.$showhideicon.$lockunlockicon.$gradeanalysisicon, 'grade_icons');
}
/**
2  grade/report/grader/styles.css
View
@@ -471,6 +471,8 @@ width:2000px;
float:right;
}
+.path-grade-report-grader .action-icon {margin-left:0.3em;}
+
.path-grade-report-grader .gradestable th.user,
.path-grade-report-grader .gradestable th.range,
.path-grade-report-grader .flexible th,
5 grade/report/user/lib.php
View
@@ -304,6 +304,7 @@ private function fill_table_recursive(&$element) {
$depth = $element['depth'];
$grade_object = $element['object'];
$eid = $grade_object->id;
+ $element['userid'] = $this->user->id;
$fullname = $this->gtree->get_element_header($element, true, true, true);
$data = array();
$hidden = '';
@@ -393,10 +394,6 @@ private function fill_table_recursive(&$element) {
$data['grade']['class'] = $class;
$gradeval = $this->blank_hidden_total($this->courseid, $grade_grade->grade_item, $gradeval);
$data['grade']['content'] = grade_format_gradevalue($gradeval, $grade_grade->grade_item, true);
-
- if ($this->get_pref('showanalysisicon') and !is_null($gradeval)) {
- $data['grade']['content'] = $this->gtree->get_grade_analysis_icon($grade_grade) . $data['grade']['content'];
- }
}
}
27 mod/assignment/lib.php
View
@@ -1078,8 +1078,12 @@ function display_submission($offset=-1,$userid =-1, $display=true) {
if (!empty($submission->id)) {
$itemid = $submission->id;
}
- $instanceid = optional_param('advancedgradinginstanceid', 0, PARAM_INT);
- $mformdata->advancedgradinginstance = $controller->get_or_create_instance($instanceid, $USER->id, $itemid);
+ if ($gradingdisabled && $itemid) {
+ $mformdata->advancedgradinginstance = $controller->get_current_instance($USER->id, $itemid);
+ } else if (!$gradingdisabled) {
+ $instanceid = optional_param('advancedgradinginstanceid', 0, PARAM_INT);
+ $mformdata->advancedgradinginstance = $controller->get_or_create_instance($instanceid, $USER->id, $itemid);
+ }
} else {
$advancedgradingwarning = $controller->form_unavailable_notification();
}
@@ -1605,12 +1609,18 @@ function display_submissions($message='') {
* If validation passes, preprocess advanced grading (if applicable) and returns true.
*/
function validate_and_preprocess_feedback() {
- global $USER;
+ global $USER, $CFG;
+ require_once($CFG->libdir.'/gradelib.php');
if (!($feedback = data_submitted()) || !isset($feedback->userid) || !isset($feedback->offset)) {
return true; // No incoming data, nothing to validate
}
$userid = required_param('userid', PARAM_INT);
$offset = required_param('offset', PARAM_INT);
+ $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array($userid));
+ $gradingdisabled = $grading_info->items[0]->grades[$userid]->locked || $grading_info->items[0]->grades[$userid]->overridden;
+ if ($gradingdisabled) {
+ return true;
+ }
$submissiondata = $this->display_submission($offset, $userid, false);
$mform = $submissiondata->mform;
$gradinginstance = $mform->use_advanced_grading();
@@ -2391,9 +2401,13 @@ function add_grades_section() {
$grademenu = make_grades_menu($this->_customdata->assignment->grade);
if ($gradinginstance = $this->use_advanced_grading()) {
- $mform->addElement('hidden', 'advancedgradinginstanceid', $gradinginstance->get_id());
$gradinginstance->get_controller()->set_grade_range($grademenu);
- $mform->addElement('grading', 'advancedgrading', get_string('grade').':', array('gradinginstance' => $gradinginstance));
+ $gradingelement = $mform->addElement('grading', 'advancedgrading', get_string('grade').':', array('gradinginstance' => $gradinginstance));
+ if ($this->_customdata->gradingdisabled) {
+ $gradingelement->freeze();
+ } else {
+ $mform->addElement('hidden', 'advancedgradinginstanceid', $gradinginstance->get_id());
+ }
} else {
// use simple direct grading
$grademenu['-1'] = get_string('nograde');
@@ -2408,7 +2422,8 @@ function add_grades_section() {
$options = make_grades_menu(-$outcome->scaleid);
if ($outcome->grades[$this->_customdata->submission->userid]->locked) {
$options[0] = get_string('nooutcome', 'grades');
- echo $options[$outcome->grades[$this->_customdata->submission->userid]->grade];
+ $mform->addElement('static', 'outcome_'.$n.'['.$this->_customdata->userid.']', $outcome->name.':',
+ $options[$outcome->grades[$this->_customdata->submission->userid]->grade]);
} else {
$options[''] = get_string('nooutcome', 'grades');
$attributes = array('id' => 'menuoutcome_'.$n );
Please sign in to comment.
Something went wrong with that request. Please try again.