Permalink
Browse files

MDL-34088: Advanced grading criteria is shown on assignment page (if …

…used) before the assignment submissions have been graded.
  • Loading branch information...
Raymond Wijaya
Raymond Wijaya committed Aug 27, 2012
1 parent 935c3d5 commit ec32d06834d16e24be6ec1a80864924e83d8daf2
Showing with 27 additions and 3 deletions.
  1. +1 −0 mod/assign/lang/en/assign.php
  2. +14 −2 mod/assign/locallib.php
  3. +5 −1 mod/assign/renderable.php
  4. +7 −0 mod/assign/renderer.php
@@ -154,6 +154,7 @@
$string['gradeoutofhelp_help'] = 'Enter the grade for the student\'s submission here. You may include decimals.';
$string['gradestudent'] = 'Grade student: (id={$a->id}, fullname={$a->fullname}). ';
$string['grading'] = 'Grading';
+$string['gradingmethodpreview'] = 'Grading criteria';
$string['gradingoptions'] = 'Options';
$string['gradingstatus'] = 'Grading status';
$string['gradingstudentprogress'] = 'Grading student {$a->index} of {$a->count}';
View
@@ -2023,7 +2023,8 @@ private function view_single_grade_page($mform, $offset=0) {
$viewfullnames,
$extensionduedate,
$this->get_context(),
- $this->is_blind_marking()));
+ $this->is_blind_marking(),
+ ''));
}
if ($grade) {
$data = new stdClass();
@@ -2460,6 +2461,15 @@ public function view_student_summary($user, $showlinks) {
$showedit = has_capability('mod/assign:submit', $this->context) &&
$this->submissions_open($user->id) && ($this->is_any_submission_plugin_enabled()) && $showlinks;
$gradelocked = ($grade && $grade->locked) || $this->grading_disabled($user->id);
+ // Grading criteria preview.
+ $gradingmanager = get_grading_manager($this->context, 'mod_assign', 'submissions');
+ $gradingcontrollerpreview = '';
+ if ($gradingmethod = $gradingmanager->get_active_method()) {
+ $controller = $gradingmanager->get_controller($gradingmethod);
+ if ($controller->is_form_defined()) {
+ $gradingcontrollerpreview = $controller->render_preview($PAGE);
+ }
+ }
$showsubmit = ($submission || $teamsubmission) && $showlinks;
if ($teamsubmission && ($teamsubmission->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED)) {
@@ -2496,7 +2506,9 @@ public function view_student_summary($user, $showlinks) {
$viewfullnames,
$extensionduedate,
$this->get_context(),
- $this->is_blind_marking()));
+ $this->is_blind_marking(),
+ $gradingcontrollerpreview));
+
require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->dirroot.'/grade/grading/lib.php');
@@ -338,6 +338,9 @@ class assign_submission_status implements renderable {
/** @var bool blindmarking - Should we hide student identities from graders? */
public $blindmarking = false;
+ /** @var string gradingcontrollerpreview */
+ public $gradingcontrollerpreview = '';
+
/**
* constructor
*
@@ -371,7 +374,7 @@ public function __construct($allowsubmissionsfromdate, $alwaysshowdescription, $
$submissiongroupmemberswhoneedtosubmit, $submissionsenabled,
$locked, $graded, $duedate, $cutoffdate, $submissionplugins, $returnaction, $returnparams,
$coursemoduleid, $courseid, $view, $canedit, $cansubmit, $canviewfullnames, $extensionduedate,
- $context, $blindmarking) {
+ $context, $blindmarking, $gradingcontrollerpreview) {
$this->allowsubmissionsfromdate = $allowsubmissionsfromdate;
$this->alwaysshowdescription = $alwaysshowdescription;
$this->submission = $submission;
@@ -396,6 +399,7 @@ public function __construct($allowsubmissionsfromdate, $alwaysshowdescription, $
$this->extensionduedate = $extensionduedate;
$this->context = $context;
$this->blindmarking = $blindmarking;
+ $this->gradingcontrollerpreview = $gradingcontrollerpreview;
}
}
View
@@ -544,6 +544,13 @@ public function render_assign_submission_status(assign_submission_status $status
$cell2 = new html_table_cell(get_string('submissionnoteditable', 'assign'));
$cell2->attributes = array('class'=>'submissionnoteditable');
}
+ }
+
+ // Grading criteria preview.
+ if (!empty($status->gradingcontrollerpreview)) {
+ $row = new html_table_row();
+ $cell1 = new html_table_cell(get_string('gradingmethodpreview', 'assign'));
+ $cell2 = new html_table_cell($status->gradingcontrollerpreview);
$row->cells = array($cell1, $cell2);
$t->data[] = $row;
}

0 comments on commit ec32d06

Please sign in to comment.