diff --git a/course/report/completion/mod.php b/course/report/completion/mod.php
deleted file mode 100644
index 44cca9a2b5a..00000000000
--- a/course/report/completion/mod.php
+++ /dev/null
@@ -1,17 +0,0 @@
-libdir.'/completionlib.php');
-
- if (has_capability('coursereport/completion:view', $context)) {
- $completion = new completion_info($course);
- if ($completion->is_enabled() && $completion->has_criteria()) {
- echo '
';
- echo ''.get_string('coursecompletion').'';
- echo '
';
- }
- }
-
diff --git a/course/report/completion/version.php b/course/report/completion/version.php
deleted file mode 100644
index a2be4bb557a..00000000000
--- a/course/report/completion/version.php
+++ /dev/null
@@ -1,27 +0,0 @@
-version = 2010090501;
-$plugin->requires = 2010090501;
diff --git a/lib/pluginlib.php b/lib/pluginlib.php
index dc10fec27a3..0f963c3ff2b 100644
--- a/lib/pluginlib.php
+++ b/lib/pluginlib.php
@@ -304,7 +304,7 @@ class plugin_manager {
),
'coursereport' => array(
- 'completion', 'log', 'participation', 'progress', 'stats'
+ 'log', 'participation', 'progress', 'stats'
),
'datafield' => array(
@@ -406,7 +406,7 @@ class plugin_manager {
),
'report' => array(
- 'backups', 'configlog', 'courseoverview',
+ 'backups', 'completion', 'configlog', 'courseoverview',
'log', 'outline', 'questioninstances', 'security', 'stats'
),
diff --git a/course/report/completion/db/access.php b/report/completion/db/access.php
similarity index 94%
rename from course/report/completion/db/access.php
rename to report/completion/db/access.php
index ac82f587f8c..851b4b38e90 100644
--- a/course/report/completion/db/access.php
+++ b/report/completion/db/access.php
@@ -25,7 +25,7 @@
$capabilities = array(
- 'coursereport/completion:view' => array(
+ 'report/completion:view' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
@@ -35,6 +35,6 @@ $capabilities = array(
'manager' => CAP_ALLOW
),
- 'clonepermissionsfrom' => 'moodle/site:viewreports',
+ 'clonepermissionsfrom' => 'coursereport/completion:view',
)
);
diff --git a/report/completion/db/install.php b/report/completion/db/install.php
new file mode 100644
index 00000000000..ce7911c1f6c
--- /dev/null
+++ b/report/completion/db/install.php
@@ -0,0 +1,33 @@
+.
+
+/**
+ * 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');
+}
+
diff --git a/course/report/completion/index.php b/report/completion/index.php
similarity index 98%
rename from course/report/completion/index.php
rename to report/completion/index.php
index af07f65774c..7385220eed7 100644
--- a/course/report/completion/index.php
+++ b/report/completion/index.php
@@ -24,7 +24,7 @@
* @author Aaron Barnes
* @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');
/**
@@ -46,7 +46,7 @@ $edituser = optional_param('edituser', 0, PARAM_INT);
$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');
@@ -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
@@ -177,10 +177,10 @@ if ($csv) {
)
);
- $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);
}
@@ -227,7 +227,7 @@ if ($total) {
// 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 .= '&sort='.$sort;
}
diff --git a/course/report/completion/lang/en/coursereport_completion.php b/report/completion/lang/en/report_completion.php
similarity index 100%
rename from course/report/completion/lang/en/coursereport_completion.php
rename to report/completion/lang/en/report_completion.php
diff --git a/course/report/completion/lib.php b/report/completion/lib.php
similarity index 76%
rename from course/report/completion/lib.php
rename to report/completion/lib.php
index 21874c68d12..2a862bc806d 100644
--- a/course/report/completion/lib.php
+++ b/report/completion/lib.php
@@ -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
@@ -33,14 +32,14 @@ require_once($CFG->libdir.'/completionlib.php');
* @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', ''));
}
}
}
@@ -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;
}
diff --git a/course/report/completion/textrotate.js b/report/completion/textrotate.js
similarity index 100%
rename from course/report/completion/textrotate.js
rename to report/completion/textrotate.js
diff --git a/report/completion/version.php b/report/completion/version.php
new file mode 100644
index 00000000000..c368e665ae3
--- /dev/null
+++ b/report/completion/version.php
@@ -0,0 +1,30 @@
+.
+
+/**
+ * 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)