]> git.mjollnir.org Git - moodle.git/commitdiff
Tidied up error reporting in course overview
authormoodler <moodler>
Sun, 24 Sep 2006 04:29:12 +0000 (04:29 +0000)
committermoodler <moodler>
Sun, 24 Sep 2006 04:29:12 +0000 (04:29 +0000)
admin/report/courseoverview/index.php

index 36b9cf45fda8c1342bd7d451549f443f7af98be4..f83812e604f952227853e774e2327c5fcf137ca4 100644 (file)
         $courses = get_records_sql($sql);
 
         if (empty($courses)) {
-            error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/index.php');
-        }
-
-        echo '<center><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></center>';
+            notify(get_string('statsnodata'));
 
-        $table = new object();
-        $table->align = array('left','center','center','center');
-        $table->head = array(get_string('course'),$param->line1);
-        if (!empty($param->line2)) {
-            $table->head[] = $param->line2;
-        }
-        if (!empty($param->line3)) {
-            $table->head[] = $param->line3;
-        }
+        } else {
+            echo '<div align="center"><img src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
 
-        foreach  ($courses as $c) {
-            $a = array();
-            $a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
-
-            $a[] = $c->line1;
-            if (isset($c->line2)) {
-                $a[] = $c->line2;
+            $table = new object();
+            $table->align = array('left','center','center','center');
+            $table->head = array(get_string('course'),$param->line1);
+            if (!empty($param->line2)) {
+                $table->head[] = $param->line2;
+            }
+            if (!empty($param->line3)) {
+                $table->head[] = $param->line3;
             }
-            if (isset($c->line3)) {
-                $a[] = $c->line3;
+
+            foreach  ($courses as $c) {
+                $a = array();
+                $a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
+
+                $a[] = $c->line1;
+                if (isset($c->line2)) {
+                    $a[] = $c->line2;
+                }
+                if (isset($c->line3)) {
+                    $a[] = $c->line3;
+                }
+                $table->data[] = $a;
             }
-            $table->data[] = $a;
+            print_table($table);
         }
-        print_table($table);
     }
 
     admin_externalpage_print_footer($adminroot);