From da099b12a0dacff83b2f09bd3c0c061a18a30bf7 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Fri, 13 Jul 2012 10:38:13 +0800 Subject: [PATCH] MDL-34272: Assignment module displays all assignments on my moodle instead of just open ones --- mod/assign/lib.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mod/assign/lib.php b/mod/assign/lib.php index caccf102877..a6cdba7f1fc 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -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; } } @@ -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 = '