]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17463 - reparate capabilities for course and admin reports
authorskodak <skodak>
Sat, 29 Nov 2008 14:22:10 +0000 (14:22 +0000)
committerskodak <skodak>
Sat, 29 Nov 2008 14:22:10 +0000 (14:22 +0000)
51 files changed:
admin/qtypes.php
admin/report/capability/settings.php
admin/report/courseoverview/db/access.php [new file with mode: 0644]
admin/report/courseoverview/index.php
admin/report/courseoverview/reportsgraph.php
admin/report/courseoverview/settings.php
admin/report/courseoverview/version.php [new file with mode: 0644]
admin/report/log/index.php [deleted file]
admin/report/log/settings.php
admin/report/questioninstances/db/access.php [new file with mode: 0644]
admin/report/questioninstances/settings.php
admin/report/questioninstances/version.php [new file with mode: 0644]
admin/report/stats/index.php [deleted file]
admin/report/stats/settings.php
blocks/admin/block_admin.php
course/lib.php
course/report.php
course/report/log/db/access.php [new file with mode: 0644]
course/report/log/graph.php
course/report/log/index.php
course/report/log/lib.php
course/report/log/live.php
course/report/log/mod.php
course/report/log/version.php [new file with mode: 0644]
course/report/outline/db/access.php [new file with mode: 0644]
course/report/outline/index.php
course/report/outline/mod.php
course/report/outline/version.php [new file with mode: 0644]
course/report/participation/db/access.php [new file with mode: 0644]
course/report/participation/index.php
course/report/participation/mod.php
course/report/participation/version.php [new file with mode: 0644]
course/report/progress/index.php
course/report/progress/mod.php
course/report/stats/db/access.php [new file with mode: 0644]
course/report/stats/graph.php
course/report/stats/index.php
course/report/stats/lib.php
course/report/stats/mod.php
course/report/stats/report.php
course/report/stats/version.php [new file with mode: 0644]
course/user.php
lang/en_utf8/coursereport_log.php [new file with mode: 0644]
lang/en_utf8/coursereport_outline.php [new file with mode: 0644]
lang/en_utf8/coursereport_participation.php [new file with mode: 0644]
lang/en_utf8/coursereport_stats.php [new file with mode: 0644]
lang/en_utf8/report_courseoverview.php [new file with mode: 0644]
lang/en_utf8/report_questioninstances.php
lib/statslib.php
lib/weblib.php
version.php

index de4fa33f2618e53e4b20099623e1a41e35e23f5d..f9f789596e225f65ab2f7465066e2a5188685f10 100644 (file)
@@ -10,7 +10,7 @@
     require_login();
     $systemcontext = get_context_instance(CONTEXT_SYSTEM);
     require_capability('moodle/question:config', $systemcontext);
-    $canviewreports = has_capability('moodle/site:viewreports', $systemcontext);
+    $canviewreports = has_capability('report/questioninstances:view', $systemcontext);
 
     admin_externalpage_setup('manageqtypes');
 
index 009052d294bdb19fe8eac2ddb579230b14da0b50..0a1eeb34b8524c29cdcdb86bb661d2f9aff4718f 100644 (file)
@@ -1,5 +1,3 @@
 <?php  // $Id$
-if ($hassiteconfig) {
-    $ADMIN->add('roles', new admin_externalpage('reportcapability', get_string('capability', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage'));
-}
+$ADMIN->add('roles', new admin_externalpage('reportcapability', get_string('capability', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage'));
 ?>
\ No newline at end of file
diff --git a/admin/report/courseoverview/db/access.php b/admin/report/courseoverview/db/access.php
new file mode 100644 (file)
index 0000000..ebb0e44
--- /dev/null
@@ -0,0 +1,42 @@
+<?php  // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$report_courseoverview_capabilities = array(
+
+    'report/courseoverview:view' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'legacy' => array(
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'admin' => CAP_ALLOW
+        ),
+
+        'clonepermissionsfrom' => 'moodle/site:viewreports',
+    )
+);
+
+?>
index 712b32adc1ee9ac7fb6aae640e0a9d876f40f28f..645ce9665b64baeda42a948a1549f91aa85528f6 100644 (file)
     admin_externalpage_print_header();
 
     if (empty($CFG->enablestats)) {
-        redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
+        if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
+            redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
+        } else {
+            error("Stats is not enabled.");
+        }
     }
 
     $course = get_site();
index dc99e73013adbd1deef9322ea66ce2261c0ecf1f..db3e71a2a96380593b8f7c59be35f0a63062b14c 100644 (file)
@@ -10,7 +10,7 @@
 
     require_login();
 
-    require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM));
+    require_capability('report/courseoverview:view', get_context_instance(CONTEXT_SYSTEM));
 
     stats_check_uptodate();
 
index cb54298156a3e714711d8a6db4bd016458e690e0..16c390c4a86f275b5d9813205ed498fa23908ca8 100644 (file)
@@ -1,3 +1,3 @@
 <?php  // $Id$
-$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('courseoverview', 'admin'), "$CFG->wwwroot/$CFG->admin/report/courseoverview/index.php",'moodle/site:viewreports'));
+$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('courseoverview', 'admin'), "$CFG->wwwroot/$CFG->admin/report/courseoverview/index.php",'report/courseoverview:view'));
 ?>
\ No newline at end of file
diff --git a/admin/report/courseoverview/version.php b/admin/report/courseoverview/version.php
new file mode 100644 (file)
index 0000000..702efd5
--- /dev/null
@@ -0,0 +1,29 @@
+<?PHP // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$plugin->version  = 2007101502;
+$plugin->requires = 2007101532;
+
+?>
diff --git a/admin/report/log/index.php b/admin/report/log/index.php
deleted file mode 100644 (file)
index 2878ee7..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php // $Id$
-
-    require_once('../../../config.php');
-    require_once($CFG->dirroot.'/course/lib.php');
-    require_once($CFG->dirroot.'/course/report/log/lib.php');
-    require_once($CFG->libdir.'/adminlib.php');
-
-    admin_externalpage_setup('reportlog');
-    admin_externalpage_print_header();
-
-
-    $course = get_site();
-
-    print_heading(get_string('chooselogs') .':');
-
-    print_mnet_log_selector_form($CFG->mnet_localhost_id, $course);
-
-    echo '<br />';
-    print_heading(get_string('chooselivelogs') .':');
-
-    $heading = link_to_popup_window('/course/report/log/live.php?id='. $course->id,
-                                    'livelog', get_string('livelogs'),
-                                    500, 800, '', 'none', true);
-
-    print_heading($heading, 'center', 3);
-
-
-    admin_externalpage_print_footer();
-
-?>
\ No newline at end of file
index 1f1133966879380ef7c5a24031f36f22062fadba..4bccaf7e7bafcff60cf3a9f6f3120e8beac502ad 100644 (file)
@@ -1,3 +1,4 @@
 <?php  // $Id$
-$ADMIN->add('reports', new admin_externalpage('reportlog', get_string('log', 'admin'), "$CFG->wwwroot/$CFG->admin/report/log/index.php",'moodle/site:viewreports'));
+// just a link to course report
+$ADMIN->add('reports', new admin_externalpage('reportlog', get_string('log', 'admin'), "$CFG->wwwroot/course/report/log/index.php?id=".SITEID, 'coursereport/log:view'));
 ?>
\ No newline at end of file
diff --git a/admin/report/questioninstances/db/access.php b/admin/report/questioninstances/db/access.php
new file mode 100644 (file)
index 0000000..0a73868
--- /dev/null
@@ -0,0 +1,39 @@
+<?php  // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$report_questioninstances_capabilities = array(
+
+    'report/questioninstances:view' => array(
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_SYSTEM,
+        'legacy' => array(
+            'admin' => CAP_ALLOW
+        ),
+
+        'clonepermissionsfrom' => 'moodle/site:config',
+    )
+);
+
+?>
index fea0d3c800914d25f911e39956fa10e912fcd0e2..3ef1808e5a48765ea1e6b407862e5fd1a8252e21 100644 (file)
@@ -1,3 +1,3 @@
 <?php  // $Id$
-$ADMIN->add('reports', new admin_externalpage('reportquestioninstances', get_string('questioninstances', 'report_questioninstances'), "$CFG->wwwroot/$CFG->admin/report/questioninstances/index.php", 'moodle/site:viewreports'));
+$ADMIN->add('reports', new admin_externalpage('reportquestioninstances', get_string('questioninstances', 'report_questioninstances'), "$CFG->wwwroot/$CFG->admin/report/questioninstances/index.php", 'report/questioninstances:view'));
 ?>
\ No newline at end of file
diff --git a/admin/report/questioninstances/version.php b/admin/report/questioninstances/version.php
new file mode 100644 (file)
index 0000000..702efd5
--- /dev/null
@@ -0,0 +1,29 @@
+<?PHP // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$plugin->version  = 2007101502;
+$plugin->requires = 2007101532;
+
+?>
diff --git a/admin/report/stats/index.php b/admin/report/stats/index.php
deleted file mode 100644 (file)
index 8f0e868..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php  // $Id$
-
-    require_once('../../../config.php');
-    require_once($CFG->dirroot.'/lib/statslib.php');
-    require_once($CFG->dirroot.'/course/report/stats/lib.php');
-
-    require_once($CFG->libdir.'/adminlib.php');
-
-    $courseid = optional_param('course', SITEID, PARAM_INT);
-    $report   = optional_param('report', 0, PARAM_INT);
-    $time     = optional_param('time', 0, PARAM_INT);
-    $mode     = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT);
-    $userid   = optional_param('userid', 0, PARAM_INT);
-    $roleid   = 0;
-
-    admin_externalpage_setup('reportstats');
-    admin_externalpage_print_header();
-
-    if (empty($CFG->enablestats)) {
-        redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
-    }
-
-    if ($report > 50) {
-        $roleid = substr($report,1);
-        $report = 5;
-    }
-
-    if ($report == STATS_REPORT_USER_LOGINS) {
-        $courseid = SITEID; //override
-    }
-
-    if ($mode == STATS_MODE_RANKED) {
-        redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time, '', 3);
-    }
-
-    if (!$course = $DB->get_record("course", array("id"=>$courseid))) {
-        print_error('invalidcourse', 'error');
-    }
-
-    if (!empty($userid)) {
-        if (!$user = $DB->get_record('user', array('id'=>$userid))) {
-            print_error('invaliduser', 'error');
-        }
-    }
-
-    add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
-
-    stats_check_uptodate($course->id);
-
-
-//    $strreports = get_string("reports");
-//    $strstats = get_string('stats');
-//
-//    $menu = report_stats_mode_menu($course, $mode, $time); // add 4th $url parameter if uncommented!
-//
-//
-//    $crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
-//             <a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
-//             $strstats";
-
-//    print_header("$course->shortname: $strstats", "$course->fullname",
-//                  $crumb, '', '', true, '&nbsp;', $menu);
-
-
-    require_once($CFG->dirroot.'/course/report/stats/report.php');
-
-    admin_externalpage_print_footer();
-
-?>
index 5eca48c38efc8b921ae80d0d79bf59b804c99fa8..ce1d3e304797d95ce7a9b5d1190ad78ef0732ed7 100644 (file)
@@ -1,3 +1,4 @@
 <?php  // $Id$
-$ADMIN->add('reports', new admin_externalpage('reportstats', get_string('stats', 'admin'), "$CFG->wwwroot/$CFG->admin/report/stats/index.php",'moodle/site:viewreports'));
+// just a link to course report
+$ADMIN->add('reports', new admin_externalpage('reportstats', get_string('stats', 'admin'), "$CFG->wwwroot/course/report/stats/index.php", 'coursereport/stats:view'));
 ?>
\ No newline at end of file
index fea86c40cb0720a8d7f4832c4ff71ba9fb935fcb..892c00bcaef807c55bcc4ec918424e02469cf6d6 100644 (file)
@@ -154,7 +154,7 @@ class block_admin extends block_list {
         }
 
     /// View course reports
-        if ($course->id !== SITEID and has_capability('moodle/site:viewreports', $context)) {
+        if ($course->id !== SITEID and has_capability('moodle/site:viewreports', $context)) { // basic capability for listing of reports
             $this->content->items[]='<a href="'.$CFG->wwwroot.'/course/report.php?id='.$this->instance->pageid.'">'.get_string('reports').'</a>';
             $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/stats.gif" class="icon" alt="" />';
         }
index 0407eb820b6ce6af7f542f64bed4129738f92aad..a608c5e9c3af98cf5f2c007597cd4808485b90f8 100644 (file)
@@ -775,7 +775,7 @@ function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
         echo "(".get_string("gdneed").")";
     } else {
         // MDL-10818, do not display broken graph when user has no permission to view graph
-        if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id)) ||
+        if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_COURSE, $course->id)) ||
             ($course->showreports and $USER->id == $userid)) {
             echo '<img src="'.$CFG->wwwroot.'/course/report/log/graph.php?id='.$course->id.
                  '&amp;user='.$userid.'&amp;type='.$type.'&amp;date='.$date.'" alt="" />';
index 21e3632d27150c2391bde6afb86c848b2be49f21..593da6bc3b2c94da362916ae981be69ce5e885bc 100644 (file)
@@ -12,7 +12,7 @@
     require_login($course);
 
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
-    require_capability('moodle/site:viewreports', $context);
+    require_capability('moodle/site:viewreports', $context); // basic capability for listing of reports
 
     $strreports = get_string('reports');
 
diff --git a/course/report/log/db/access.php b/course/report/log/db/access.php
new file mode 100644 (file)
index 0000000..b8873df
--- /dev/null
@@ -0,0 +1,42 @@
+<?php  // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$coursereport_log_capabilities = array(
+
+    'coursereport/log:view' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'admin' => CAP_ALLOW
+        ),
+
+        'clonepermissionsfrom' => 'moodle/site:viewreports',
+    )
+);
+
+?>
index 11b4ba84a33fb14d752e04d1acc3903b3b86de41..f06b5e38acac2cd517a17cb14a540460f84bec31 100644 (file)
         print_error('invalidcourseid');
     }
 
-    require_login($course->id);
+    require_login($course);
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
 
-    if (! (has_capability('moodle/site:viewreports', $context)
-                or ($course->showreports and $USER->id == $user)) ) {
-        print_error("nopermissions");
+    if ($course->showreports and $USER->id == $user and !isguestuser()) {
+        // no cap required to view own graph
+    } else {
+        require_capability('coursereport/log:view', $context);
     }
 
     if ($user) {
index 601cd4044b5da479751b711d5f0c8e8f59a878b6..b23670bf7ed79424b84fb4c4c40046581a9557cd 100644 (file)
         $course->fullname  = $course_stub->coursename;
     }
 
-    require_login($course->id);
+    require_login($course);
 
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
 
-    require_capability('moodle/site:viewreports', $context);
+    require_capability('coursereport/log:view', $context);
 
     add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id);
 
index 82297081cf43d256bf8a0170ad79f66eede2bba1..c2b2f325917f61ea4ddc4d72bf486923a741f4f0 100644 (file)
@@ -95,7 +95,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
         $courses = array();
         $sites = array();
         if ($CFG->mnet_localhost_id == $hostid) {
-            if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) {
+            if (has_capability('coursereport/log:view', $sitecontext) && $showcourses) {
                 if ($ccc = $DB->get_records("course", null, "fullname","id,fullname,category")) {
                     foreach ($ccc as $cc) {
                         if ($cc->id == SITEID) {
@@ -107,7 +107,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
                 }
             }
         } else {
-            if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) {
+            if (has_capability('coursereport/log:view', $sitecontext) && $showcourses) {
                 $sql = "SELECT DISTINCT course, coursename FROM {mnet_log} where hostid = ?";
                 if ($ccc = $DB->get_records_sql($sql, array($hostid))) {
                     foreach ($ccc as $cc) {
@@ -160,7 +160,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
         }
     }
 
-    if (has_capability('moodle/site:viewreports', $sitecontext) && !$course->category) {
+    if (has_capability('coursereport/log:view', $sitecontext) && !$course->category) {
         $activities["site_errors"] = get_string("siteerrors");
         if ($modid === "site_errors") {
             $selectedactivity = "site_errors";
@@ -214,14 +214,14 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
     echo "<input type=\"hidden\" name=\"chooselog\" value=\"1\" />\n";
     echo "<input type=\"hidden\" name=\"showusers\" value=\"$showusers\" />\n";
     echo "<input type=\"hidden\" name=\"showcourses\" value=\"$showcourses\" />\n";
-    if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) {
+    if (has_capability('coursereport/log:view', $sitecontext) && $showcourses) {
         $cid = empty($course->id)? '1' : $course->id; 
         choose_from_menu_nested($dropdown, "host_course", $hostid.'/'.$cid, "");
     } else {
         $courses = array();
         $courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' ('.get_string('site').') ' : '');
         choose_from_menu($courses,"id",$course->id,false);
-        if (has_capability('moodle/site:viewreports', $sitecontext)) {
+        if (has_capability('coursereport/log:view', $sitecontext)) {
             $a = new object();
             $a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
                 ."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showcourses=1&showusers=$showusers";
@@ -325,7 +325,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
         }
     }
 
-    if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) {
+    if (has_capability('coursereport/log:view', $sitecontext) && $showcourses) {
         if ($ccc = $DB->get_records("course", null, "fullname", "id,fullname,category")) {
             foreach ($ccc as $cc) {
                 if ($cc->category) {
@@ -372,7 +372,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
         }
     }
 
-    if (has_capability('moodle/site:viewreports', $sitecontext) && ($course->id == SITEID)) {
+    if (has_capability('coursereport/log:view', $sitecontext) && ($course->id == SITEID)) {
         $activities["site_errors"] = get_string("siteerrors");
         if ($modid === "site_errors") {
             $selectedactivity = "site_errors";
@@ -426,14 +426,14 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
     echo "<input type=\"hidden\" name=\"chooselog\" value=\"1\" />\n";
     echo "<input type=\"hidden\" name=\"showusers\" value=\"$showusers\" />\n";
     echo "<input type=\"hidden\" name=\"showcourses\" value=\"$showcourses\" />\n";
-    if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) { 
+    if (has_capability('coursereport/log:view', $sitecontext) && $showcourses) {
         choose_from_menu ($courses, "id", $course->id, "");
     } else {
         //        echo '<input type="hidden" name="id" value="'.$course->id.'" />';
         $courses = array();
         $courses[$course->id] = $course->fullname . (($course->id == SITEID) ? ' ('.get_string('site').') ' : '');
         choose_from_menu($courses,"id",$course->id,false);
-        if (has_capability('moodle/site:viewreports', $sitecontext)) {
+        if (has_capability('coursereport/log:view', $sitecontext)) {
             $a = new object();
             $a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
                 ."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showcourses=1&showusers=$showusers";
index 370b6a6d8a3e09109ce4c72c21298d581f4ade47..3f1f518ea32c6bf27ec812fb9242ca604e27004e 100644 (file)
@@ -14,9 +14,7 @@
     require_login($course);
 
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
-    if (!has_capability('moodle/site:viewreports', $context)) {
-        print_error('nopermissions');
-    }
+    require_capability('coursereport/log:view', $context);
 
     add_to_log($course->id, "course", "report live", "report/log/live.php?id=$course->id", $course->id); 
 
index e9470d8decce0fc0bb269440040d7468f38a7cab..a3eff2b78010a5b47ad724351dec50b8c2976b1d 100644 (file)
@@ -7,7 +7,7 @@
     require_once($CFG->dirroot.'/course/lib.php');
     require_once($CFG->dirroot.'/course/report/log/lib.php');
 
-    if (has_capability('moodle/site:viewreports', $context)) {
+    if (has_capability('coursereport/log:view', $context)) {
         print_heading(get_string('chooselogs') .':');
 
         print_log_selector_form($course);
diff --git a/course/report/log/version.php b/course/report/log/version.php
new file mode 100644 (file)
index 0000000..c62920f
--- /dev/null
@@ -0,0 +1,29 @@
+<?PHP // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$plugin->version  = 2007101500;
+$plugin->requires = 2007101532;
+
+?>
diff --git a/course/report/outline/db/access.php b/course/report/outline/db/access.php
new file mode 100644 (file)
index 0000000..05cfadc
--- /dev/null
@@ -0,0 +1,42 @@
+<?php  // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$coursereport_outline_capabilities = array(
+
+    'coursereport/outline:view' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'admin' => CAP_ALLOW
+        ),
+
+        'clonepermissionsfrom' => 'moodle/site:viewreports',
+    )
+);
+
+?>
index a7de0e597860498333db64426249d1360134a259..d21574704b1eb1ea5e10dc6d31949cb0173f73d7 100644 (file)
@@ -12,7 +12,7 @@
     }
 
     require_login($course);
-    require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id));
+    require_capability('coursereport/outline:view', get_context_instance(CONTEXT_COURSE, $course->id));
 
     add_to_log($course->id, 'course', 'report outline', "report/outline/index.php?id=$course->id", $course->id);
 
index 042e57b0f045293e3d5411a71b9de04b8d962cf5..1caf681ac30efcd008541c90373abf923ac0b93a 100644 (file)
@@ -4,7 +4,7 @@
         die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
     }
 
-    if (has_capability('moodle/site:viewreports', $context)) {
+    if (has_capability('coursereport/outline:view', $context)) {
         echo '<p>';
         $activityreport = get_string( 'activityreport' );
         echo "<a href=\"{$CFG->wwwroot}/course/report/outline/index.php?id={$course->id}\">";
diff --git a/course/report/outline/version.php b/course/report/outline/version.php
new file mode 100644 (file)
index 0000000..c62920f
--- /dev/null
@@ -0,0 +1,29 @@
+<?PHP // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$plugin->version  = 2007101500;
+$plugin->requires = 2007101532;
+
+?>
diff --git a/course/report/participation/db/access.php b/course/report/participation/db/access.php
new file mode 100644 (file)
index 0000000..420f633
--- /dev/null
@@ -0,0 +1,42 @@
+<?php  // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$coursereport_participation_capabilities = array(
+
+    'coursereport/participation:view' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'admin' => CAP_ALLOW
+        ),
+
+        'clonepermissionsfrom' => 'moodle/site:viewreports',
+    )
+);
+
+?>
index 5e59d69a4dd702b3f95b9f057c0acebec5c170e4..9ffc9fbacd59f3707f6ababb03487d36cf6ae321 100644 (file)
@@ -28,7 +28,7 @@
 
     require_login($course);
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
-    require_capability('moodle/site:viewreports', $context);
+    require_capability('coursereport/participation:view', $context);
 
     add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->id);
 
index 77c4472646d56334a01bb194034aed119334bb0c..38428141ecd7d1d1ee230bfedd656dd259409d78 100644 (file)
@@ -4,7 +4,7 @@
         die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
     }
 
-    if (has_capability('moodle/site:viewreports', $context)) {
+    if (has_capability('coursereport/participation:view', $context)) {
         echo '<p>';
         $participationreport = get_string('participationreport');
         echo "<a href=\"{$CFG->wwwroot}/course/report/participation/index.php?id={$course->id}\">";
diff --git a/course/report/participation/version.php b/course/report/participation/version.php
new file mode 100644 (file)
index 0000000..c62920f
--- /dev/null
@@ -0,0 +1,29 @@
+<?PHP // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$plugin->version  = 2007101500;
+$plugin->requires = 2007101532;
+
+?>
index 264c099fd0171d9b62488bf09c6a5ec3a6f6c11d..4d03f5ab2a290afc03dfe313e4fcb3d4804fefeb 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 require_once('../../../config.php');
-global $DB;
 
 define('COMPLETION_REPORT_PAGE',50);
 
@@ -38,7 +37,7 @@ function csv_quote($value) {
     }
 }
 
-require_login($course->id);
+require_login($course);
 
 // Check basic permission
 $context=get_context_instance(CONTEXT_COURSE,$course->id);
index 5ce896e280d917cdabeee080a4b8e537c6e94109..b6418bff30918272c73514358b4690c92c9c3ccc 100644 (file)
@@ -4,7 +4,7 @@
         die('Direct access to this script is forbidden.'); // It must be included from a Moodle page
     }
 
-    if (has_capability('moodle/site:viewreports', $context)) {
+    if (has_capability('moodle/course:viewprogress', $context)) {
         $completion = new completion_info($course);
         if ($completion->is_enabled() && has_capability('moodle/course:viewprogress', $context)) {
             echo '<p>';
diff --git a/course/report/stats/db/access.php b/course/report/stats/db/access.php
new file mode 100644 (file)
index 0000000..573b38b
--- /dev/null
@@ -0,0 +1,42 @@
+<?php  // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$coursereport_stats_capabilities = array(
+
+    'coursereport/stats:view' => array(
+        'riskbitmask' => RISK_PERSONAL,
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'legacy' => array(
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'admin' => CAP_ALLOW
+        ),
+
+        'clonepermissionsfrom' => 'moodle/site:viewreports',
+    )
+);
+
+?>
index aa45cb5bb33212f08ce045cfc0f5b59fbc55d490..dc8f89859e63290204874e611dd67a36cf8b8a62 100644 (file)
         }
     }
 
-    require_login();
+    require_login($course);
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
 
-    if (!has_capability('moodle/site:viewreports', $context)) {
-        print_error('nopermissions');
-    }
+    require_capability('coursereport/stats:view', $context);
 
     stats_check_uptodate($course->id);
 
index 99a4a603a66af6a9c4671271dc398a73c88ca107..453c33abc43b6ab26c7171162d260a612298ccba 100644 (file)
@@ -3,12 +3,9 @@
     require_once('../../../config.php');
     require_once($CFG->dirroot.'/lib/statslib.php');
     require_once($CFG->dirroot.'/course/report/stats/lib.php');
+    require_once($CFG->libdir.'/adminlib.php');
 
-    if (empty($CFG->enablestats)) {
-        print_error("statsdisable");
-    }
-
-    $courseid = required_param('course', PARAM_INT);
+    $courseid = optional_param('course', SITEID, PARAM_INT);
     $report   = optional_param('report', 0, PARAM_INT);
     $time     = optional_param('time', 0, PARAM_INT);
     $mode     = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT);
@@ -25,7 +22,7 @@
     }
 
     if ($mode == STATS_MODE_RANKED) {
-        redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time);
+        redirect($CFG->wwwroot.'/course/report/stats/index.php?time='.$time);
     }
 
     if (!$course = $DB->get_record("course", array("id"=>$courseid))) {
     require_login($course);
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
 
-    require_capability('moodle/site:viewreports', $context);
+    require_capability('coursereport/stats:view', $context);
 
     add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
     stats_check_uptodate($course->id);
 
+    if ($course->id == SITEID) {
+        admin_externalpage_setup('reportstats');
+        admin_externalpage_print_header();
+    } else {
+        $strreports = get_string("reports");
+        $strstats = get_string('stats');
 
-    $strreports = get_string("reports");
-    $strstats = get_string('stats');
-
-    $menu = report_stats_mode_menu($course, $mode, $time, "$CFG->wwwroot/course/report/stats/index.php");
+        $menu = report_stats_mode_menu($course, $mode, $time, "$CFG->wwwroot/course/report/stats/index.php");
 
-    $navlinks = array();
-    $navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc');
-    $navlinks[] = array('name' => $strstats, 'link' => null, 'type' => 'misc');
-    $navigation = build_navigation($navlinks);
+        $navlinks = array();
+        $navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc');
+        $navlinks[] = array('name' => $strstats, 'link' => null, 'type' => 'misc');
+        $navigation = build_navigation($navlinks);
 
-    print_header("$course->shortname: $strstats", $course->fullname, $navigation, '', '', true, '&nbsp;', $menu);
+        print_header("$course->shortname: $strstats", $course->fullname, $navigation, '', '', true, '&nbsp;', $menu);
+    }
 
+    require($CFG->dirroot.'/course/report/stats/report.php');
 
-    require_once($CFG->dirroot.'/course/report/stats/report.php');
+    if (empty($CFG->enablestats)) {
+        if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
+            redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
+        } else {
+            error("Stats is not enabled.");
+        }
+    }
 
     print_footer();
 
index 9cee9848e36d14efaaf3962746ec5866277fa361..237ea02bc2c5f94e6cc57799d2f38ccbb6936180 100644 (file)
@@ -4,7 +4,6 @@
     */
     
     
-    require_once('../../../config.php');
     require_once($CFG->dirroot.'/lib/statslib.php');
 
 
@@ -21,7 +20,7 @@
         $options = array();
         $options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
         $options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
-        if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM))) {
+        if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) {
             $options[STATS_MODE_RANKED] = get_string('reports');
         }
         
index a57ee59b8931d49c6b503dc60b99186e000338a2..e1257b4a9f356af256cdb11d8ff70987cdbd6ddd 100644 (file)
@@ -4,7 +4,7 @@
         die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
     }
 
-    if (has_capability('moodle/site:viewreports', $context)) {
+    if (has_capability('coursereport/stats:view', $context)) {
         if (!empty($CFG->enablestats)) {
             echo '<p>';
             echo '<a href="'.$CFG->wwwroot.'/course/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
index bd18a6db6e7bcbd94fa1426cc34e23bfdb1bc94d..edefe6aad8fee5bdb11ea23d855a067a374d68ce 100644 (file)
@@ -10,7 +10,7 @@
     foreach ($courses as $c) {
         $context = get_context_instance(CONTEXT_COURSE, $c->id);
 
-        if (has_capability('moodle/site:viewreports', $context)) {
+        if (has_capability('coursereport/stats:view', $context)) {
             $courseoptions[$c->id] = $c->shortname;
         }
     }
diff --git a/course/report/stats/version.php b/course/report/stats/version.php
new file mode 100644 (file)
index 0000000..c62920f
--- /dev/null
@@ -0,0 +1,29 @@
+<?PHP // $Id$
+
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.com                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
+
+$plugin->version  = 2007101500;
+$plugin->requires = 2007101532;
+
+?>
index ee52a3b7d7ff3ebf54b4a3f113f4bbe004294be0..e8b21c299418ee68535446238dd1cce9625f0e9a 100644 (file)
             }
 
             // MDL-10818, do not display broken graph when user has no permission to view graph
-            if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $id)) ||
+            if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_COURSE, $id)) ||
                 ($course->showreports and $USER->id == $user->id)) {
                 echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.STATS_MODE_DETAILED.'&course='.$course->id.'&time='.$time.'&report='.STATS_REPORT_USER_VIEW.'&userid='.$user->id.'" alt="'.get_string('statisticsgraph').'" /></center>';
             }
diff --git a/lang/en_utf8/coursereport_log.php b/lang/en_utf8/coursereport_log.php
new file mode 100644 (file)
index 0000000..6b1de33
--- /dev/null
@@ -0,0 +1,5 @@
+<?PHP // $Id$
+
+$string['log:view'] = 'View course logs';
+
+?>
diff --git a/lang/en_utf8/coursereport_outline.php b/lang/en_utf8/coursereport_outline.php
new file mode 100644 (file)
index 0000000..fa57c1a
--- /dev/null
@@ -0,0 +1,5 @@
+<?PHP // $Id$
+
+$string['outline:view'] = 'View course outline report';
+
+?>
diff --git a/lang/en_utf8/coursereport_participation.php b/lang/en_utf8/coursereport_participation.php
new file mode 100644 (file)
index 0000000..9afda3c
--- /dev/null
@@ -0,0 +1,5 @@
+<?PHP // $Id$
+
+$string['participation:view'] = 'View course participation report';
+
+?>
diff --git a/lang/en_utf8/coursereport_stats.php b/lang/en_utf8/coursereport_stats.php
new file mode 100644 (file)
index 0000000..0ca5602
--- /dev/null
@@ -0,0 +1,5 @@
+<?PHP // $Id$
+
+$string['stats:view'] = 'View course statistics report';
+
+?>
diff --git a/lang/en_utf8/report_courseoverview.php b/lang/en_utf8/report_courseoverview.php
new file mode 100644 (file)
index 0000000..88e1c4b
--- /dev/null
@@ -0,0 +1,5 @@
+<?PHP // $Id$
+
+$string['courseoverview:view'] = 'View course overview report';
+
+?>
index a11580cf72510af974444adee7f8a75ac54a8200..e928176a7a533e9fbe08e745247d60245e7620b9 100644 (file)
@@ -1,5 +1,7 @@
 <?PHP  // $Id$
 
+$string['questioninstances:view'] = 'View question instances report';
+
 $string['editquestionshere'] = 'Edit questions in this context';
 $string['getreport'] = 'Get the report';
 $string['hiddenquestions'] = 'Hidden';
index 61547f0e29e5c7773a93771f200d1af05587d465..691ba7b38ea4722a2ee670006f0d7a93193d3965 100644 (file)
@@ -1371,13 +1371,13 @@ function stats_get_report_options($courseid,$mode) {
     case STATS_MODE_DETAILED:
         $reportoptions[STATS_REPORT_USER_ACTIVITY] = get_string('statsreport'.STATS_REPORT_USER_ACTIVITY);
         $reportoptions[STATS_REPORT_USER_ALLACTIVITY] = get_string('statsreport'.STATS_REPORT_USER_ALLACTIVITY);
-        if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM))) {
+        if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) {
             $site = get_site();
             $reportoptions[STATS_REPORT_USER_LOGINS] = get_string('statsreport'.STATS_REPORT_USER_LOGINS);
         }
         break;
     case STATS_MODE_RANKED:
-        if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM))) {
+        if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) {
             $reportoptions[STATS_REPORT_ACTIVE_COURSES] = get_string('statsreport'.STATS_REPORT_ACTIVE_COURSES);
             $reportoptions[STATS_REPORT_ACTIVE_COURSES_WEIGHTED] = get_string('statsreport'.STATS_REPORT_ACTIVE_COURSES_WEIGHTED);
             $reportoptions[STATS_REPORT_PARTICIPATORY_COURSES] = get_string('statsreport'.STATS_REPORT_PARTICIPATORY_COURSES);
index 80954a606f9b45f4260c0bb8c21792765b308921..7ac9dc9c3dbd35e4aa402a24e1c3ce82275ade1f 100644 (file)
@@ -2469,7 +2469,7 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
                     } else {
                         $menu .= get_string('failedloginattemptsall', '', $count);
                     }
-                    if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM))) {
+                    if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_SYSTEM))) {
                         $menu .= ' (<a href="'.$CFG->wwwroot.'/course/report/log/index.php'.
                                              '?chooselog=1&amp;id=1&amp;modid=site_errors">'.get_string('logs').'</a>)';
                     }
@@ -5497,7 +5497,7 @@ function navmenu($course, $cm=NULL, $targetwindow='self') {
     }
     //Accessibility: added Alt text, replaced &gt; &lt; with 'silent' character and 'accesshide' text.
 
-    if ($selectmod and has_capability('moodle/site:viewreports', $context)) {
+    if ($selectmod and has_capability('coursereport/log:view', $context)) {
         $logstext = get_string('alllogs');
         $logslink = '<li>'."\n".'<a title="'.$logstext.'" '.
                     $CFG->frametarget.'onclick="this.target=\''.$CFG->framename.'\';"'.' href="'.
index dd2aea32bf1aeca9676b3356392cce9ca96a9cd4..466df6e87ae3f6264173136c212e238356543966 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2008112600;  // YYYYMMDD   = date of the last version bump
+    $version = 2008112900;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20081128)';  // Human-friendly version name