Permalink
Browse files

MDL-32490 Offline assignment: do not display lateness information

  • Loading branch information...
1 parent 89d13f6 commit 48dd268c8d547ffb4eda0c2847713e73ba6bf33c @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
@@ -415,6 +415,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
@@ -1443,8 +1449,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 {
@@ -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')) {
@@ -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 48dd268

Please sign in to comment.