Skip to content

Commit

Permalink
MDL-29030 migration and cleanup of stats report
Browse files Browse the repository at this point in the history
AMOS BEGIN
 MOV [pluginpagetype,coursereport_stats],[pluginpagetype,report_stats]
 MOV [stats:view,coursereport_stats],[stats:view,report_stats]
AMOS END
  • Loading branch information
skodak committed Nov 6, 2011
1 parent bb13777 commit a2a444a
Show file tree
Hide file tree
Showing 14 changed files with 340 additions and 269 deletions.
77 changes: 0 additions & 77 deletions course/report/stats/index.php

This file was deleted.

108 changes: 0 additions & 108 deletions course/report/stats/lib.php

This file was deleted.

18 changes: 0 additions & 18 deletions course/report/stats/mod.php

This file was deleted.

29 changes: 0 additions & 29 deletions course/report/stats/version.php

This file was deleted.

2 changes: 1 addition & 1 deletion lib/pluginlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public static function standard_plugins_list($type) {
),

'coursereport' => array(
'stats'
//deprecated!
),

'datafield' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

$capabilities = array(

'coursereport/stats:view' => array(
'report/stats:view' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
Expand All @@ -35,7 +35,7 @@
'manager' => CAP_ALLOW
),

'clonepermissionsfrom' => 'moodle/site:viewreports',
'clonepermissionsfrom' => 'coursereport/stats:view',
)
);

Expand Down
33 changes: 33 additions & 0 deletions report/stats/db/install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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 3 of the License, or
// (at your option) any later version.
//
// Moodle 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.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Post installation and migration code.
*
* @package report
* @subpackage stats
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;

function xmldb_report_stats_install() {
// this is a hack which is needed for cleanup of original coursereport_stats stuff
unset_all_config_for_plugin('coursereport_stats');
capabilities_cleanup('coursereport_stats');
}

14 changes: 7 additions & 7 deletions course/report/stats/graph.php → report/stats/graph.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
Expand All @@ -18,12 +17,13 @@
/**
* This file is part of the User section Moodle
*
* @copyright 1999 Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package course
* @package report
* @subpackage stats
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once('../../../config.php');
require('../../config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->dirroot.'/lib/graphlib.php');

Expand All @@ -34,7 +34,7 @@
$userid = optional_param('userid', 0, PARAM_INT);
$roleid = optional_param('roleid',0,PARAM_INT);

$url = new moodle_url('/course/report/stats/graph.php', array('course'=>$courseid, 'report'=>$report, 'time'=>$time, 'mode'=>$mode));
$url = new moodle_url('/report/stats/graph.php', array('course'=>$courseid, 'report'=>$report, 'time'=>$time, 'mode'=>$mode));
if ($userid !== 0) {
$url->param('userid', $userid);
}
Expand All @@ -57,7 +57,7 @@
$context = get_context_instance(CONTEXT_COURSE, $course->id);

if (!$course->showreports or $USER->id != $userid) {
require_capability('coursereport/stats:view', $context);
require_capability('report/stats:view', $context);
}

stats_check_uptodate($course->id);
Expand Down
Loading

0 comments on commit a2a444a

Please sign in to comment.