mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merged from 1.9
Improvements to the tabs for assigning and overriding roles. MDL-12120 Tabs are now all on the top row Tabs have clearer titles Other help texts improved
This commit is contained in:
parent
b8faa9a7d1
commit
21090e447a
7 changed files with 54 additions and 56 deletions
|
@ -153,12 +153,10 @@
|
|||
} else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
admin_externalpage_setup('frontpageroles');
|
||||
admin_externalpage_print_header();
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
$currenttab = 'assign';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
$currenttab = 'assign';
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
|
|
|
@ -147,12 +147,10 @@
|
|||
require_once($CFG->libdir.'/adminlib.php');
|
||||
admin_externalpage_setup('frontpageroles');
|
||||
admin_externalpage_print_header();
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
$currenttab = 'override';
|
||||
include_once('tabs.php');
|
||||
} else {
|
||||
$currenttab = '';
|
||||
$tabsmode = 'override';
|
||||
$currenttab = 'override';
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
|
@ -168,7 +166,7 @@
|
|||
}
|
||||
|
||||
|
||||
print_heading_with_help(get_string('overriderolesin', 'role', print_context_name($context)), 'overrides');
|
||||
print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides');
|
||||
|
||||
if ($roleid) {
|
||||
/// prints a form to swap roles
|
||||
|
|
|
@ -159,48 +159,41 @@ if ($currenttab != 'update') {
|
|||
}
|
||||
|
||||
|
||||
$toprow = array();
|
||||
$inactive = array();
|
||||
$activetwo = array();
|
||||
|
||||
|
||||
if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything except SYSTEM context
|
||||
|
||||
if ($context->contextlevel == CONTEXT_MODULE) { // only show update button if module?
|
||||
if ($context->contextlevel == CONTEXT_MODULE) { // Only show update button if module
|
||||
|
||||
$toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='.
|
||||
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('update'));
|
||||
$context->instanceid.'&return=true&sesskey='.sesskey(), get_string('settings'));
|
||||
|
||||
}
|
||||
|
||||
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.
|
||||
$context->id, get_string('roles'));
|
||||
|
||||
if (!empty($tabsmode)) {
|
||||
|
||||
if (!empty($assignableroles)) {
|
||||
$secondrow[] = new tabobject('assign',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
|
||||
get_string('assignroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
if (!empty($overridableroles)) {
|
||||
$secondrow[] = new tabobject('override',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
|
||||
get_string('overrideroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
$inactive[] = 'roles';
|
||||
$activetwo = array('roles');
|
||||
$currenttab = $tabsmode;
|
||||
|
||||
} else {
|
||||
$inactive[] = '';
|
||||
$activetwo = array();
|
||||
if (!empty($assignableroles)) {
|
||||
$toprow[] = new tabobject('assign',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id,
|
||||
get_string('localroles', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
if (!empty($overridableroles)) {
|
||||
$toprow[] = new tabobject('override',
|
||||
$CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id,
|
||||
get_string('overridepermissions', 'role'),
|
||||
get_string('showallroles', 'role'),
|
||||
true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Here other core tabs should go (always calling tabs.php files)
|
||||
/// All the logic to decide what to show must be self-cointained in the tabs file
|
||||
/// ej.:
|
||||
/// All the logic to decide what to show must be self-contained in the tabs file
|
||||
/// eg:
|
||||
/// include_once($CFG->dirroot . '/grades/tabs.php');
|
||||
|
||||
/// Finally, we support adding some 'on-the-fly' tabs here
|
||||
|
@ -209,7 +202,7 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
|||
if ($extratabs = explode(',', $CFG->extratabs)) {
|
||||
asort($extratabs);
|
||||
foreach($extratabs as $extratab) {
|
||||
/// Each extra tab mus be one $CFG->dirroot relative file
|
||||
/// Each extra tab must be one $CFG->dirroot relative file
|
||||
if (file_exists($CFG->dirroot . '/' . $extratab)) {
|
||||
include_once($CFG->dirroot . '/' . $extratab);
|
||||
}
|
||||
|
@ -217,13 +210,11 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($secondrow)) {
|
||||
$tabs = array($toprow, $secondrow);
|
||||
} else {
|
||||
$tabs = array($toprow);
|
||||
}
|
||||
$inactive = array($currenttab);
|
||||
|
||||
$tabs = array($toprow);
|
||||
|
||||
print_tabs($tabs, $currenttab, $inactive, $activetwo);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue