MDL-37037 assign Show message if no files to download
authorMichael Aherne <michael.aherne@strath.ac.uk>
Fri, 7 Dec 2012 15:34:58 +0000 (15:34 +0000)
committerDamyon Wiese <damyon@moodle.com>
Tue, 18 Dec 2012 00:54:10 +0000 (08:54 +0800)
mod/assign/locallib.php

index 6163841..6430e31 100644 (file)
@@ -2040,7 +2040,16 @@ class assign {
                 }
             }
         }
-        if ($zipfile = $this->pack_files($filesforzipping)) {
+        if (count($filesforzipping) == 0) {
+            $result = $this->get_renderer()->render(new assign_header($this->get_instance(),
+                $this->get_context(),
+                '',
+                $this->get_course_module()->id,
+                get_string('downloadall', 'assign')));
+            $result .= $this->get_renderer()->notification(get_string('nosubmission', 'assign'));
+            $result .= $this->view_footer();
+            return $result;
+        } else if ($zipfile = $this->pack_files($filesforzipping)) {
             $this->add_to_log('download all submissions', get_string('downloadall', 'assign'));
             // Send file and delete after sending.
             send_temp_file($zipfile, $filename);