diff --git a/course/report/progress/mod.php b/course/report/progress/mod.php deleted file mode 100644 index db7ea0289f2..00000000000 --- a/course/report/progress/mod.php +++ /dev/null @@ -1,17 +0,0 @@ -libdir.'/completionlib.php'); - - if (has_capability('coursereport/progress:view', $context)) { - $completion = new completion_info($course); - if ($completion->is_enabled()) { - echo '

'; - echo ''.get_string('activitycompletion', 'completion').''; - echo '

'; - } - } - diff --git a/course/report/progress/version.php b/course/report/progress/version.php deleted file mode 100644 index 819c2f13db1..00000000000 --- a/course/report/progress/version.php +++ /dev/null @@ -1,29 +0,0 @@ -version = 2010090501; -$plugin->requires = 2010090501; - - diff --git a/lib/pluginlib.php b/lib/pluginlib.php index 0f963c3ff2b..3d4437c94fb 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -304,7 +304,7 @@ class plugin_manager { ), 'coursereport' => array( - 'log', 'participation', 'progress', 'stats' + 'log', 'participation', 'stats' ), 'datafield' => array( @@ -407,7 +407,7 @@ class plugin_manager { 'report' => array( 'backups', 'completion', 'configlog', 'courseoverview', - 'log', 'outline', 'questioninstances', 'security', 'stats' + 'log', 'outline', 'progress', 'questioninstances', 'security', 'stats' ), 'repository' => array( diff --git a/course/report/progress/db/access.php b/report/progress/db/access.php similarity index 95% rename from course/report/progress/db/access.php rename to report/progress/db/access.php index 89a0f385756..d6f3fb4ebfd 100644 --- a/course/report/progress/db/access.php +++ b/report/progress/db/access.php @@ -25,7 +25,7 @@ $capabilities = array( - 'coursereport/progress:view' => array( + 'report/progress:view' => array( 'riskbitmask' => RISK_PERSONAL, 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, @@ -35,7 +35,7 @@ $capabilities = array( 'manager' => CAP_ALLOW ), - 'clonepermissionsfrom' => 'moodle/site:viewreports', + 'clonepermissionsfrom' => 'coursereport/progress:view', ) ); diff --git a/report/progress/db/install.php b/report/progress/db/install.php new file mode 100644 index 00000000000..8d2a21810fa --- /dev/null +++ b/report/progress/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_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'); +} + diff --git a/course/report/progress/index.php b/report/progress/index.php similarity index 96% rename from course/report/progress/index.php rename to report/progress/index.php index 323d2b89025..c1bb36c5a2d 100644 --- a/course/report/progress/index.php +++ b/report/progress/index.php @@ -1,5 +1,5 @@ libdir . '/completionlib.php'); define('COMPLETION_REPORT_PAGE', 25); @@ -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); } @@ -59,7 +59,7 @@ require_login($course); // 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 @@ -138,11 +138,11 @@ if($csv && $grandtotal && count($activities)>0) { // Only show CSV if there are 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) { @@ -159,7 +159,7 @@ if (!$grandtotal) { } // 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 .= '&sort='.$sort; } diff --git a/course/report/progress/lang/en/coursereport_progress.php b/report/progress/lang/en/report_progress.php similarity index 100% rename from course/report/progress/lang/en/coursereport_progress.php rename to report/progress/lang/en/report_progress.php diff --git a/course/report/progress/lib.php b/report/progress/lib.php similarity index 81% rename from course/report/progress/lib.php rename to report/progress/lib.php index 6a5919f1c15..d677248ad21 100644 --- a/course/report/progress/lib.php +++ b/report/progress/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,10 +32,10 @@ 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 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)); @@ -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', '')); } } @@ -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'), diff --git a/course/report/progress/textrotate.js b/report/progress/textrotate.js similarity index 100% rename from course/report/progress/textrotate.js rename to report/progress/textrotate.js diff --git a/report/progress/version.php b/report/progress/version.php new file mode 100644 index 00000000000..aeb968bf347 --- /dev/null +++ b/report/progress/version.php @@ -0,0 +1,30 @@ +. + +/** + * 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)