From 7215ff4efab6cdf1f001f724aa436bf6ae010a5e Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 27 Feb 2013 09:50:40 +0800 Subject: [PATCH] MDL-35127 Assignment - declare the variables in the outer scope (for readability) --- mod/assign/lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mod/assign/lib.php b/mod/assign/lib.php index 3545586357e..240a8f7be00 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -311,6 +311,8 @@ function assign_print_overview($courses, &$htmlarray) { // NOTE: we do all possible database work here *outside* of the loop to ensure this scales // list($sqlassignmentids, $assignmentidparams) = $DB->get_in_or_equal($assignmentids); + $mysubmissions = null; + $unmarkedsubmissions = null; foreach ($assignments as $assignment) { // Do not show assignments that are not open @@ -370,7 +372,8 @@ function assign_print_overview($courses, &$htmlarray) { $link = new moodle_url('/mod/assign/view.php', array('id'=>$assignment->coursemodule, 'action'=>'grading')); $str .= '
'.get_string('submissionsnotgraded', 'assign', $submissions).'
'; } - } if (has_capability('mod/assign:submit', $context)) { + } + if (has_capability('mod/assign:submit', $context)) { if (!isset($mysubmissions)) { // get all user submissions, indexed by assignment id $mysubmissions = $DB->get_records_sql("SELECT a.id AS assignment, a.nosubmissions AS nosubmissions, g.timemodified