MDL-29029 move unsuproles to admin tools

AMOS BEGIN
 MOV [contextlevel,report_unsuproles],[contextlevel,tool_unsuproles]
 MOV [count,report_unsuproles],[count,tool_unsuproles]
 MOV [confirmdelete,report_unsuproles],[confirmdelete,tool_unsuproles]
 MOV [noprolbems,report_unsuproles],[noprolbems,tool_unsuproles]
 MOV [pluginname,report_unsuproles],[pluginname,tool_unsuproles]
AMOS END
This commit is contained in:
Petr Skoda 2011-09-17 09:39:42 +02:00
parent 4211dfa4b4
commit a3c0e9bbb0
6 changed files with 54 additions and 18 deletions

View File

@ -0,0 +1,38 @@
<?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 tool
* @subpackage unsuproles
* @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_tool_unsuproles_install() {
global $CFG;
// this is a hack - this plugin used to live in admin/report/unsuproles,
// we want to remove the orphaned version info unless there is a new
// report type with the same name
if (!file_exists("$CFG->dirroot/report/report_unsuproles")) {
unset_all_config_for_plugin('report_unsuproles');
}
}

View File

@ -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
@ -19,13 +18,13 @@
* Report of unsupported role assignments,
* unsupported role assignments can be dropped from here.
*
* @package report
* @package tool
* @subpackage unsuproles
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__).'/../../../config.php');
require_once(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = optional_param('action', '', PARAM_ACTION);
@ -33,7 +32,7 @@ $action = optional_param('action', '', PARAM_ACTION);
$syscontext = get_context_instance(CONTEXT_SYSTEM);
require_login();
admin_externalpage_setup('reportunsuproles'); // checks permissions specified in settings.php
admin_externalpage_setup('toolunsuproles'); // checks permissions specified in settings.php
if ($action === 'delete') {
$contextlevel = required_param('contextlevel', PARAM_INT);
@ -64,7 +63,7 @@ if ($action === 'delete') {
$yesurl = new moodle_url($PAGE->url, array('roleid'=>$roleid, 'contextlevel'=>$contextlevel, 'action'=>'delete', 'confirm'=>1, 'sesskey'=>sesskey()));
$levelname = get_contextlevel_name($contextlevel);
$rolename = format_string($role->name);
$message = get_string('confirmdelete', 'report_unsuproles', array('level'=>$levelname, 'role'=>$rolename));
$message = get_string('confirmdelete', 'tool_unsuproles', array('level'=>$levelname, 'role'=>$rolename));
echo $OUTPUT->confirm($message, $yesurl, $PAGE->url);
echo $OUTPUT->footer();
die();
@ -72,7 +71,7 @@ if ($action === 'delete') {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'report_unsuproles'));
echo $OUTPUT->heading(get_string('pluginname', 'tool_unsuproles'));
$sql = "SELECT r.id AS roleid, c.contextlevel, r.sortorder, COUNT(ra.id) AS racount
FROM {role} r
@ -92,7 +91,7 @@ foreach ($rs as $problem) {
$rs->close();
if (!$problems) {
echo $OUTPUT->notification(get_string('noprolbems', 'report_unsuproles'), 'notifysuccess');
echo $OUTPUT->notification(get_string('noprolbems', 'tool_unsuproles'), 'notifysuccess');
} else {
$roles = get_all_roles();
$data = array();
@ -109,7 +108,7 @@ if (!$problems) {
$data[] = array($levelname, $rolename, $count, implode('&nbsp;', $edit));
}
$table = new html_table();
$table->head = array(get_string('contextlevel', 'report_unsuproles'), get_string('role'), get_string('count', 'report_unsuproles'), get_string('edit'));
$table->head = array(get_string('contextlevel', 'tool_unsuproles'), get_string('role'), get_string('count', 'tool_unsuproles'), get_string('edit'));
$table->size = array('40%', '40%', '10%', '10%');
$table->align = array('left', 'left', 'center', 'center');
$table->width = '90%';

View File

@ -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
@ -16,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'report_unsuproles', language 'en', branch 'MOODLE_20_STABLE'
* Strings for component 'tool_unsuproles', language 'en', branch 'MOODLE_22_STABLE'
*
* @package report
* @subpackage unsuproles

View File

@ -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
@ -18,7 +17,7 @@
/**
* Link to unsupported roles report
*
* @package report
* @package tool
* @subpackage unsuproles
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@ -27,5 +26,5 @@
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
$ADMIN->add('roles', new admin_externalpage('reportunsuproles', get_string('pluginname', 'report_unsuproles'), "$CFG->wwwroot/$CFG->admin/report/unsuproles/index.php"), array('moodle/site:config', 'moodle/role:assign'));
$ADMIN->add('roles', new admin_externalpage('toolunsuproles', get_string('pluginname', 'tool_unsuproles'), "$CFG->wwwroot/$CFG->admin/tool/unsuproles/index.php"), array('moodle/site:config', 'moodle/role:assign'));
}

View File

@ -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
@ -18,12 +17,14 @@
/**
* Plugin version info
*
* @package report
* @package tool
* @subpackage unsuproles
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2010071800;
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011091600; // Requires this Moodle version
$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)

View File

@ -344,7 +344,7 @@ class plugin_manager {
'report' => array(
'backups', 'configlog', 'courseoverview',
'customlang', 'log', 'profiling', 'questioninstances',
'security', 'spamcleaner', 'stats', 'unittest', 'unsuproles'
'security', 'spamcleaner', 'stats', 'unittest'
),
'repository' => array(
@ -367,7 +367,7 @@ class plugin_manager {
),
'tool' => array(
'capability'
'capability', 'unsuproles'
),
'webservice' => array(