]> git.mjollnir.org Git - moodle.git/commitdiff
FIxed up log headers etc MDL-6714
authormoodler <moodler>
Wed, 27 Sep 2006 09:22:29 +0000 (09:22 +0000)
committermoodler <moodler>
Wed, 27 Sep 2006 09:22:29 +0000 (09:22 +0000)
course/report/log/index.php

index 850415781223f5620eaaf10e558350118e2fbcd6..f14862d01900eaa50e3fb72be4174b9b912c07f4 100644 (file)
@@ -4,6 +4,7 @@
     require_once('../../../config.php');
     require_once('../../lib.php');
     require_once('lib.php');
+    require_once($CFG->libdir.'/adminlib.php');
 
     $id          = required_param('id', PARAM_INT);// Course ID
     $group       = optional_param('group', -1, PARAM_INT); // Group to display
@@ -26,9 +27,8 @@
     }
     
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
-    if (!has_capability('moodle/site:viewreports', $context)) {
-        error('You need do not have the required permission to view this report');
-    }
+
+    require_capability('moodle/site:viewreports', $context);
 
     add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id); 
 
         
         switch ($logformat) {
             case 'showashtml':
-                if ($course->category) {
+                if ($course->id == SITEID) {
+                    $adminroot = admin_get_root();
+                    admin_externalpage_setup('reportlog', $adminroot);
+                    admin_externalpage_print_header($adminroot);
+
+                } else {
                     print_header($course->shortname .': '. $strlogs, $course->fullname, 
                                  "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
                                   <a href=\"$CFG->wwwroot/course/report.php?id=$course->id\">$strreports</a> ->
                                   <a href=\"index.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", '');
-                } else {
-                    print_header($course->shortname .': '. $strlogs, $course->fullname, 
-                                 "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> ->
-                                  <a href=\"$CFG->wwwroot/$CFG->admin/report.php\">$strreports</a> ->
-                                  <a href=\"index.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", '');
                 }
 
                 print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
 
 
     } else {
-        if ($course->category) {
+        if ($course->id == SITEID) {
+                    $adminroot = admin_get_root();
+                    admin_externalpage_setup('reportlog', $adminroot);
+                    admin_externalpage_print_header($adminroot);
+        } else {
             print_header($course->shortname .': '. $strlogs, $course->fullname, 
                      "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> 
                       <a href=\"$CFG->wwwroot/course/report.php?id=$course->id\">$strreports</a> ->
                       $strlogs", '');
-        } else {
-            print_header($course->shortname .': '. $strlogs, $course->fullname, 
-                     "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> 
-                      <a href=\"$CFG->wwwroot/$CFG->admin/report.php\">$strreports</a> ->
-                      $strlogs", '');
         }
 
         print_heading(get_string('chooselogs') .':');
 
     }
 
-    print_footer($course);
+    if ($course->id == SITEID) {
+        admin_externalpage_print_footer($adminroot);
+    } else {
+        print_footer($course);
+    }
 
     exit;
-?>
\ No newline at end of file
+?>