Skip to content

Commit

Permalink
MDL-29030 migrate completion report to new report type
Browse files Browse the repository at this point in the history
AMOS BEGIN
 MOV [completion:view,coursereport_completion],[completion:view,report_completion]
 MOV [completiondate,coursereport_completion],[completiondate,report_completion]
 MOV [pluginpagetype,coursereport_completion],[pluginpagetype,report_completion]
 MOV [pluginname,coursereport_completion],[pluginname,report_completion]
AMOS END
  • Loading branch information
skodak committed Nov 6, 2011
1 parent 3f5389b commit 13fdaaa
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 61 deletions.
17 changes: 0 additions & 17 deletions course/report/completion/mod.php

This file was deleted.

27 changes: 0 additions & 27 deletions course/report/completion/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(
'completion', 'log', 'participation', 'progress', 'stats'
'log', 'participation', 'progress', 'stats'
),

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

$capabilities = array(

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

'clonepermissionsfrom' => 'moodle/site:viewreports',
'clonepermissionsfrom' => 'coursereport/completion:view',
)
);
33 changes: 33 additions & 0 deletions report/completion/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_completion_install() {
// this is a hack which is needed for cleanup of original coursereport_completion stuff
unset_all_config_for_plugin('coursereport_online');
capabilities_cleanup('coursereport_online');
}

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author Aaron Barnes <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../../config.php');
require_once('../../config.php');
require_once($CFG->libdir.'/completionlib.php');

/**
Expand All @@ -46,7 +46,7 @@

$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);

$url = new moodle_url('/course/report/completion/index.php', array('course'=>$course->id));
$url = new moodle_url('/report/completion/index.php', array('course'=>$course->id));
$PAGE->set_url($url);
$PAGE->set_pagelayout('report');

Expand Down Expand Up @@ -78,7 +78,7 @@ function csv_quote($value) {
require_login($course);

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

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

$PAGE->requires->js('/course/report/completion/textrotate.js');
$PAGE->requires->js('/report/completion/textrotate.js');

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


Expand Down Expand Up @@ -227,7 +227,7 @@ function csv_quote($value) {


// Build link for paging
$link = $CFG->wwwroot.'/course/report/completion/?course='.$course->id;
$link = $CFG->wwwroot.'/report/completion/?course='.$course->id;
if (strlen($sort)) {
$link .= '&amp;sort='.$sort;
}
Expand Down
14 changes: 7 additions & 7 deletions course/report/completion/lib.php → report/completion/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,14 +32,14 @@
* @param stdClass $course The course to object for the report
* @param stdClass $context The context of the course
*/
function completion_report_extend_navigation($navigation, $course, $context) {
function report_completion_extend_navigation_course($navigation, $course, $context) {
global $CFG, $OUTPUT;

if (has_capability('coursereport/completion:view', $context)) {
if (has_capability('report/completion:view', $context)) {
$completion = new completion_info($course);
if ($completion->is_enabled() && $completion->has_criteria()) {
$url = new moodle_url('/course/report/completion/index.php', array('course'=>$course->id));
$navigation->add(get_string('pluginname','coursereport_completion'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
$url = new moodle_url('/report/completion/index.php', array('course'=>$course->id));
$navigation->add(get_string('pluginname','report_completion'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
}
}
}
Expand All @@ -50,12 +49,13 @@ function completion_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 completion_page_type_list($pagetype, $parentcontext, $currentcontext) {
function report_completion_page_type_list($pagetype, $parentcontext, $currentcontext) {
$array = array(
'*' => get_string('page-x', 'pagetype'),
'course-report-*' => get_string('page-course-report-x', 'pagetype'),
'course-report-completion-index' => get_string('pluginpagetype', 'coursereport_completion')
'course-report-completion-index' => get_string('pluginpagetype', 'report_completion')
);
return $array;
}
File renamed without changes.
30 changes: 30 additions & 0 deletions report/completion/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 completion
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @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_completion'; // Full name of the plugin (used for diagnostics)

0 comments on commit 13fdaaa

Please sign in to comment.