Skip to content

Commit

Permalink
MDL-29030 migrate progress report to new type
Browse files Browse the repository at this point in the history
AMOS BEGIN
 MOV [pluginname,coursereport_progress],[pluginname,report_progress]
 MOV [pluginpagetype,coursereport_progress],[pluginpagetype,report_progress]
 MOV [progress:view,coursereport_progress],[progress:view,report_progress]
AMOS END
  • Loading branch information
skodak committed Nov 6, 2011
1 parent ee6000d commit 8619857
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 62 deletions.
17 changes: 0 additions & 17 deletions course/report/progress/mod.php

This file was deleted.

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

This file was deleted.

4 changes: 2 additions & 2 deletions 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(
'log', 'participation', 'progress', 'stats'
'log', 'participation', 'stats'
),

'datafield' => array(
Expand Down Expand Up @@ -407,7 +407,7 @@ public static function standard_plugins_list($type) {

'report' => array(
'backups', 'completion', 'configlog', 'courseoverview',
'log', 'outline', 'questioninstances', 'security', 'stats'
'log', 'outline', 'progress', 'questioninstances', 'security', 'stats'
),

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

$capabilities = array(

'coursereport/progress:view' => array(
'report/progress: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/progress:view',
)
);

Expand Down
33 changes: 33 additions & 0 deletions report/progress/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 completion
* @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_progress_install() {
// this is a hack which is needed for cleanup of original coursereport_progress stuff
unset_all_config_for_plugin('coursereport_progress');
capabilities_cleanup('coursereport_progress');
}

12 changes: 6 additions & 6 deletions course/report/progress/index.php → report/progress/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../../../config.php');
require_once('../../config.php');
require_once($CFG->libdir . '/completionlib.php');

define('COMPLETION_REPORT_PAGE', 25);
Expand Down Expand Up @@ -42,7 +42,7 @@ function csv_quote($value) {
}
}

$url = new moodle_url('/course/report/progress/index.php', array('course'=>$id));
$url = new moodle_url('/report/progress/index.php', array('course'=>$id));
if ($sort !== '') {
$url->param('sort', $sort);
}
Expand All @@ -59,7 +59,7 @@ function csv_quote($value) {

// Check basic permission
$context=get_context_instance(CONTEXT_COURSE,$course->id);
require_capability('coursereport/progress:view',$context);
require_capability('report/progress:view',$context);

// Get group mode
$group=groups_get_course_group($course,true); // Supposed to verify group
Expand Down Expand Up @@ -138,11 +138,11 @@ function csv_quote($value) {

if($svgcleverness) {
$PAGE->requires->yui2_lib('event');
$PAGE->requires->js('/course/report/progress/textrotate.js');
$PAGE->requires->js('/report/progress/textrotate.js');
}

// Handle groups (if enabled)
groups_print_course_menu($course,$CFG->wwwroot.'/course/report/progress/?course='.$course->id);
groups_print_course_menu($course,$CFG->wwwroot.'/report/progress/?course='.$course->id);
}

if(count($activities)==0) {
Expand All @@ -159,7 +159,7 @@ function csv_quote($value) {
}

// Build link for paging
$link = $CFG->wwwroot.'/course/report/progress/?course='.$course->id;
$link = $CFG->wwwroot.'/report/progress/?course='.$course->id;
if (strlen($sort)) {
$link .= '&amp;sort='.$sort;
}
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions course/report/progress/lib.php → report/progress/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
/**
* This file contains functions used by the progress report
*
* @since 2.0
* @package course-report
* @copyright 2009 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand All @@ -33,10 +32,10 @@
* @param stdClass $course The course to object for the report
* @param stdClass $context The context of the course
*/
function progress_report_extend_navigation($navigation, $course, $context) {
function report_progress_extend_navigation_course($navigation, $course, $context) {
global $CFG, $OUTPUT;

$showonnavigation = has_capability('coursereport/progress:view', $context);
$showonnavigation = has_capability('report/progress:view', $context);
$group=groups_get_course_group($course,true); // Supposed to verify group
if($group===0 && $course->groupmode==SEPARATEGROUPS) {
$showonnavigation = ($showonnavigation && has_capability('moodle/site:accessallgroups', $context));
Expand All @@ -45,8 +44,8 @@ function progress_report_extend_navigation($navigation, $course, $context) {
$completion = new completion_info($course);
$showonnavigation = ($showonnavigation && $completion->is_enabled() && count($completion->get_activities())>0);
if ($showonnavigation) {
$url = new moodle_url('/course/report/progress/index.php', array('course'=>$course->id));
$navigation->add(get_string('pluginname','coursereport_progress'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
$url = new moodle_url('/report/progress/index.php', array('course'=>$course->id));
$navigation->add(get_string('pluginname','report_progress'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
}
}

Expand All @@ -55,8 +54,9 @@ function progress_report_extend_navigation($navigation, $course, $context) {
* @param string $pagetype current page type
* @param stdClass $parentcontext Block's parent context
* @param stdClass $currentcontext Current context of block
* @return array
*/
function progress_page_type_list($pagetype, $parentcontext, $currentcontext) {
function report_progress_page_type_list($pagetype, $parentcontext, $currentcontext) {
$array = array(
'*' => get_string('page-x', 'pagetype'),
'course-report-*' => get_string('page-course-report-x', 'pagetype'),
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions report/progress/version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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/>.

/**
* Version details
*
* @package report
* @subpackage progress
* @copyright 2008 Sam Marshall
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2011110200; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011102700.01; // Requires this Moodle version
$plugin->component = 'report_progress'; // Full name of the plugin (used for diagnostics)

0 comments on commit 8619857

Please sign in to comment.