Browse files

MDL-32490 Offline assignment: do not display lateness information

  • Loading branch information...
1 parent b2313c4 commit 72d890d2d2bf4d3f83486d273d00634ec0fbb6ee @bostelm bostelm committed with stronk7 Apr 17, 2012
Showing with 16 additions and 4 deletions.
  1. +8 −2 mod/assignment/lib.php
  2. +4 −2 mod/assignment/mod_form.php
  3. +4 −0 mod/assignment/type/offline/assignment.class.php
View
10 mod/assignment/lib.php
@@ -408,6 +408,12 @@ function submittedlink($allgroups=false) {
return $submitted;
}
+ /**
+ * @return Whether this assignment type supports lateness information - true by default
+ */
+ function supports_lateness() {
+ return true;
+ }
/**
* @todo Document this function
@@ -1374,8 +1380,8 @@ function display_submissions($message='') {
if ($auser->timemodified > 0) {
$studentmodifiedcontent = $this->print_student_answer($auser->id)
. userdate($auser->timemodified);
- if ($assignment->timedue && $auser->timemodified > $assignment->timedue) {
- $studentmodifiedcontent .= assignment_display_lateness($auser->timemodified, $assignment->timedue);
+ if ($assignment->timedue && $auser->timemodified > $assignment->timedue && $this->supports_lateness()) {
+ $studentmodifiedcontent .= $this->display_lateness($auser->timemodified);
$rowclass = 'late';
}
} else {
View
6 mod/assignment/mod_form.php
@@ -55,8 +55,10 @@ function definition() {
$ynoptions = array( 0 => get_string('no'), 1 => get_string('yes'));
- $mform->addElement('select', 'preventlate', get_string('preventlate', 'assignment'), $ynoptions);
- $mform->setDefault('preventlate', 0);
+ if ($assignmentinstance->supports_lateness()) {
+ $mform->addElement('select', 'preventlate', get_string('preventlate', 'assignment'), $ynoptions);
+ $mform->setDefault('preventlate', 0);
+ }
// hack to support pluggable assignment type titles
if (get_string_manager()->string_exists('type'.$type, 'assignment')) {
View
4 mod/assignment/type/offline/assignment.class.php
@@ -11,6 +11,10 @@ function assignment_offline($cmid='staticonly', $assignment=NULL, $cm=NULL, $cou
$this->type = 'offline';
}
+ function supports_lateness() {
+ return false;
+ }
+
function display_lateness($timesubmitted) {
return '';
}

0 comments on commit 72d890d

Please sign in to comment.