Skip to content

Commit

Permalink
MDL-34272: Assignment module displays all assignments on my moodle in…
Browse files Browse the repository at this point in the history
…stead of just open ones
  • Loading branch information
Damyon Wiese authored and Sam Hemelryk committed Jul 22, 2012
1 parent 145a300 commit 9430363
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mod/assign/lib.php
Expand Up @@ -212,16 +212,13 @@ function assign_print_overview($courses, &$htmlarray) {
// Do assignment_base::isopen() here without loading the whole thing for speed
foreach ($assignments as $key => $assignment) {
$time = time();
$isopen = $assignment->allowsubmissionsfromdate <= $time;
if ($assignment->duedate) {
if ($assignment->preventlatesubmissions) {
$isopen = ($assignment->allowsubmissionsfromdate <= $time && $time <= $assignment->duedate);
} else {
$isopen = ($assignment->allowsubmissionsfromdate <= $time);
$isopen = ($isopen && $time <= $assignment->duedate);
}
}
if (empty($isopen) || empty($assignment->duedate)) {
$assignmentids[] = $assignment->id;
} else {
if ($isopen) {
$assignmentids[] = $assignment->id;
}
}
Expand Down Expand Up @@ -265,6 +262,10 @@ function assign_print_overview($courses, &$htmlarray) {
AND a.id $sqlassignmentids", array_merge(array($USER->id, $USER->id), $assignmentidparams));

foreach ($assignments as $assignment) {
// Do not show assignments that are not open
if (!in_array($assignment->id, $assignmentids)) {
continue;
}
$str = '<div class="assign overview"><div class="name">'.$strassignment. ': '.
'<a '.($assignment->visible ? '':' class="dimmed"').
'title="'.$strassignment.'" href="'.$CFG->wwwroot.
Expand Down

0 comments on commit 9430363

Please sign in to comment.