Skip to content

Commit

Permalink
MDL-29029 move unsuproles to admin tools
Browse files Browse the repository at this point in the history
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
  • Loading branch information
skodak committed Sep 17, 2011
1 parent 4211dfa commit a3c0e9b
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 18 deletions.
38 changes: 38 additions & 0 deletions admin/tool/unsuproles/db/install.php
@@ -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');
}
}
@@ -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
Expand All @@ -19,21 +18,21 @@
* 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);

$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);
Expand Down Expand Up @@ -64,15 +63,15 @@
$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();
}


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
Expand All @@ -92,7 +91,7 @@
$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();
Expand All @@ -109,7 +108,7 @@
$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%';
Expand Down
@@ -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
Expand All @@ -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
Expand Down
@@ -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
Expand All @@ -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
Expand All @@ -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'));
}
@@ -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
Expand All @@ -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)

4 changes: 2 additions & 2 deletions lib/pluginlib.php
Expand Up @@ -344,7 +344,7 @@ public static function standard_plugins_list($type) {
'report' => array(
'backups', 'configlog', 'courseoverview',
'customlang', 'log', 'profiling', 'questioninstances',
'security', 'spamcleaner', 'stats', 'unittest', 'unsuproles'
'security', 'spamcleaner', 'stats', 'unittest'
),

'repository' => array(
Expand All @@ -367,7 +367,7 @@ public static function standard_plugins_list($type) {
),

'tool' => array(
'capability'
'capability', 'unsuproles'
),

'webservice' => array(
Expand Down

0 comments on commit a3c0e9b

Please sign in to comment.