Skip to content

Commit

Permalink
MDL-17372 admin reports: Added full plugin support for admin reports …
Browse files Browse the repository at this point in the history
…- fixed sorting regression, plugins now loaded as last category
  • Loading branch information
skodak committed Nov 28, 2008
1 parent 86ed86b commit b63a6a6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
23 changes: 23 additions & 0 deletions admin/settings/plugins.php
@@ -1,5 +1,9 @@
<?php //$Id$

/*
* Please note that is file is always loaded last - it means that you can inject entries into other categories too.
*/

if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {

require_once($CFG->libdir. '/portfoliolib.php');
Expand Down Expand Up @@ -260,3 +264,22 @@
}
}
}


/// Now add reports

foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) {
$settings_path = "$CFG->dirroot/$CFG->admin/report/$plugin/settings.php";
if (file_exists($settings_path)) {
include($settings_path);
continue;
}

$index_path = "$CFG->dirroot/$CFG->admin/report/$plugin/index.php";
if (!file_exists($index_path)) {
continue;
}
// old style 3rd party plugin without settings.php
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, $plugin, $index_path, 'moodle/site:viewreports'));
}

18 changes: 0 additions & 18 deletions admin/settings/report.php

This file was deleted.

3 changes: 0 additions & 3 deletions admin/settings/top.php
Expand Up @@ -24,9 +24,6 @@
}

$ADMIN->add('root', new admin_category('users', get_string('users','admin')));
$ADMIN->add('users', new admin_category('authsettings', get_string('authentication','admin')));
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
$ADMIN->add('root', new admin_category('courses', get_string('courses','admin')));
$ADMIN->add('root', new admin_category('grades', get_string('grades')));
$ADMIN->add('root', new admin_category('location', get_string('location','admin')));
Expand Down
4 changes: 4 additions & 0 deletions admin/settings/users.php
Expand Up @@ -11,6 +11,8 @@
or has_capability('moodle/role:assign', $systemcontext)) { // speedup for non-admins, add all caps used on this page


$ADMIN->add('users', new admin_category('authsettings', get_string('authentication','admin')));

$temp = new admin_settingpage('manageauths', get_string('authsettings', 'admin'));
$temp->add(new admin_setting_manageauths());
$temp->add(new admin_setting_heading('manageauthscommonheading', get_string('commonsettings', 'admin'), ''));
Expand Down Expand Up @@ -68,6 +70,7 @@
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
}
// stuff under the "accounts" subcategory
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
Expand All @@ -77,6 +80,7 @@


// stuff under the "roles" subcategory
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));

// "userpolicies" settingpage
$temp = new admin_settingpage('userpolicies', get_string('userpolicies', 'admin'));
Expand Down
10 changes: 8 additions & 2 deletions lib/adminlib.php
Expand Up @@ -5378,10 +5378,16 @@ function &admin_get_root($reload=false, $requirefulltree=true) {

// now we process all other files in admin/settings to build the admin tree
foreach (glob($CFG->dirroot.'/'.$CFG->admin.'/settings/*.php') as $file) {
if ($file != $CFG->dirroot.'/'.$CFG->admin.'/settings/top.php') {
include($file);
if ($file == $CFG->dirroot.'/'.$CFG->admin.'/settings/top.php') {
continue;
}
if ($file == $CFG->dirroot.'/'.$CFG->admin.'/settings/plugins.php') {
// plugins are loaded last - they may insert pages anywhere
continue;
}
include($file);
}
include($CFG->dirroot.'/'.$CFG->admin.'/settings/plugins.php');

if (file_exists($CFG->dirroot.'/local/settings.php')) {
include_once($CFG->dirroot.'/local/settings.php');
Expand Down

0 comments on commit b63a6a6

Please sign in to comment.