Permalink
Browse files

MDL-35740 Assignment: Show students the status of own submission on o…

…verview page.

This is a minimal patch just for backporting to 23.
  • Loading branch information...
1 parent f2190ba commit c8aa33ea2cfeeb7c8e7cd18ab1fd622598e0e98f @damyon damyon committed Dec 10, 2012
Showing with 17 additions and 4 deletions.
  1. +17 −4 mod/assign/index.php
View
@@ -61,11 +61,24 @@
$date = userdate($assignment->duedate);
}
- $params = array('assignment'=>$cm->instance, 'status'=>ASSIGN_SUBMISSION_STATUS_SUBMITTED);
- $submissions = $DB->count_records('assign_submission', $params);
- $row = array($link, $date, $submissions);
- $table->data[] = $row;
+ $context = context_module::instance($cm->id);
+ $instance = new assign($context, $cm, $course);
+
+ $submitted = '';
+ if (has_capability('mod/assign:grade', $context)) {
+ $submitted = $instance->count_submissions_with_status(ASSIGN_SUBMISSION_STATUS_SUBMITTED);
+ } else if (has_capability('mod/assign:submit', $context)) {
+ $submission = $DB->get_record('assign_submission', array('assignment'=>$assignment->id, 'userid'=>$USER->id));
+ if (!empty($submission->status)) {
+ $submitted = get_string('submissionstatus_' . $submission->status, 'assign');
+ } else {
+ $submitted = get_string('submissionstatus_', 'assign');
+ }
+ }
+
+ $row = array($link, $date, $submitted);
+ $table->data[] = $row;
}
echo html_writer::table($table);
echo $OUTPUT->footer();

0 comments on commit c8aa33e

Please sign in to comment.