some UI change for roles
This commit is contained in:
+10
-1
@@ -458,6 +458,15 @@
|
||||
$testingdata = '<div class="adminlink"><a href="environment.php">'.get_string('environment', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpenvironment').'</span></div>';
|
||||
|
||||
$testingdata .= '<div class="adminlink"><a href="unittest/index.php">'.get_string('unittests', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpunittests').'</span></div>';
|
||||
|
||||
$table->data[] = array('<strong><a href="tests.php">'.get_string('tests','admin').'</a></strong>',
|
||||
$testingdata);
|
||||
|
||||
$testingdata = '<div class="adminlink"><a href="environment.php">'.get_string('environment', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpenvironment').'</span></div>';
|
||||
|
||||
$testingdata .= '<div class="adminlink"><a href="report/simpletest/index.php">'.get_string('simpletest', 'admin').
|
||||
'</a> - <span class="explanation">'.get_string('adminhelpsimpletest').'</span></div>';
|
||||
|
||||
@@ -537,4 +546,4 @@ epository').'</a></strong>',
|
||||
|
||||
print_footer($site);
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -61,6 +61,7 @@
|
||||
*/
|
||||
$straction = get_string('roleassignment');
|
||||
$context = get_record('context', 'id', $contextid);
|
||||
|
||||
$currenttab = '';
|
||||
$tabsmode = 'assign';
|
||||
include_once('tabs.php');
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
<input type="hidden" name="sesskey" value="<?php print (sesskey()); ?>">
|
||||
<input type="hidden" name="action" value="<?php echo $action; ?>">
|
||||
<br/>Role Name: <input type="text" name="name" value="<?php echo $role->name; ?>">
|
||||
<br/>Role Description: <input type="text" name="description" value="<?php echo $role->description; ?>">
|
||||
<br/>Role Description:
|
||||
|
||||
<?php print_textarea($CFG->htmleditor, 10, 50, 50, 10, 'description', "$role->description"); ?>
|
||||
|
||||
<input type="hidden" name="contextid" value="<?php echo $contextid; ?>">
|
||||
<p>
|
||||
<table>
|
||||
@@ -57,4 +60,4 @@
|
||||
</table>
|
||||
</p>
|
||||
<br/><input type="submit" value="<?php print_string($action);?>">
|
||||
</form>
|
||||
</form>
|
||||
+68
-42
@@ -24,10 +24,20 @@
|
||||
|
||||
$stradministration = get_string('administration');
|
||||
$strmanageroles = get_string('manageroles');
|
||||
|
||||
if ($roleid && $action!='delete') {
|
||||
$role = get_record('role', 'id', $roleid);
|
||||
|
||||
$edittingstr = '-> '.get_string('editting', $role->name);
|
||||
} else {
|
||||
$edittingstr ='';
|
||||
}
|
||||
|
||||
print_header("$site->shortname: $strmanageroles",
|
||||
"$site->fullname",
|
||||
"<a href=\"../index.php\">$stradministration</a> -> $strmanageroles");
|
||||
"<a href=\"../index.php\">$stradministration</a> -> <a href=\"manage.php\">$strmanageroles</a>
|
||||
$edittingstr
|
||||
");
|
||||
|
||||
// form processing, editting a role, adding a role or deleting a role
|
||||
if ($action && confirm_sesskey()) {
|
||||
@@ -136,52 +146,68 @@
|
||||
|
||||
}
|
||||
|
||||
if ($roleid) { // load the role if id is present
|
||||
$role = get_record('role', 'id', $roleid);
|
||||
$action = 'edit';
|
||||
} else {
|
||||
$role->name='';
|
||||
$role->description='';
|
||||
$action = 'add';
|
||||
}
|
||||
|
||||
$roles = get_records('role');
|
||||
|
||||
foreach ($roles as $rolex) {
|
||||
$options[$rolex->id] = $rolex->name;
|
||||
}
|
||||
|
||||
// prints a form to swap roles
|
||||
print ('<form name="rolesform1" action="manage.php" method="post">');
|
||||
print ('<div align="center">Select a Role: ');
|
||||
choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform1.submit()');
|
||||
print ('</div></form>');
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$contextid = $sitecontext->id;
|
||||
if (($roleid && $action!='delete') || $action=='new') { // load the role if id is present
|
||||
|
||||
if ($roleid) {
|
||||
$action='edit';
|
||||
$role = get_record('role', 'id', $roleid);
|
||||
} else {
|
||||
$action='add';
|
||||
$role->name='';
|
||||
$role->description='';
|
||||
}
|
||||
|
||||
foreach ($roles as $rolex) {
|
||||
$options[$rolex->id] = $rolex->name;
|
||||
}
|
||||
|
||||
// prints a form to swap roles
|
||||
print ('<form name="rolesform1" action="manage.php" method="post">');
|
||||
print ('<div align="center">Select a Role: ');
|
||||
choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform1.submit()');
|
||||
print ('</div></form>');
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
$contextid = $sitecontext->id;
|
||||
|
||||
// this is the array holding capabilities of this role sorted till this context
|
||||
$r_caps = role_context_capabilities($roleid, $sitecontext->id);
|
||||
|
||||
// this is the available capabilities assignable in this context
|
||||
$capabilities = fetch_context_capabilities($sitecontext->id);
|
||||
|
||||
print_simple_box_start();
|
||||
include_once('manage.html');
|
||||
print_simple_box_end();
|
||||
|
||||
// this is the array holding capabilities of this role sorted till this context
|
||||
$r_caps = role_context_capabilities($roleid, $sitecontext->id);
|
||||
|
||||
// this is the available capabilities assignable in this context
|
||||
$capabilities = fetch_context_capabilities($sitecontext->id);
|
||||
|
||||
if (!$roleid) {
|
||||
$action='add';
|
||||
} else {
|
||||
$action='edit';
|
||||
}
|
||||
|
||||
print_simple_box_start();
|
||||
include_once('manage.html');
|
||||
print_simple_box_end();
|
||||
/*************************************************
|
||||
* List all roles and link them to override page *
|
||||
*************************************************/
|
||||
|
||||
foreach ($roles as $role) {
|
||||
echo ('<br><a href="roleoverride.php?contextid=1&roleid='.$role->id.'">'.$role->name.'</a> <a href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">delete</a>');
|
||||
|
||||
$table->tablealign = "center";
|
||||
$table->align = array ("middle", "left");
|
||||
$table->wrap = array ("nowrap", "nowrap");
|
||||
$table->cellpadding = 5;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '40%';
|
||||
/*************************
|
||||
* List all current roles *
|
||||
**************************/
|
||||
|
||||
$table->data[] = array('roles', 'description', 'delete');
|
||||
foreach ($roles as $role) {
|
||||
|
||||
$table->data[] = array('<a href="manage.php?roleid='.$role->id.'&sesskey='.sesskey().'">'.$role->name.'</a>', $role->description, '<a href="manage.php?action=delete&roleid='.$role->id.'&sesskey='.sesskey().'">delete</a>');
|
||||
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
echo ('<form action="manage.php" method="POST">');
|
||||
echo ('<input type="hidden" name="sesskey" value="'.sesskey().'">');
|
||||
echo ('<input type="hidden" name="action" value="new">');
|
||||
echo ('<input type="submit" value="add new role">');
|
||||
}
|
||||
|
||||
use_html_editor("description");
|
||||
print_footer($course);
|
||||
?>
|
||||
|
||||
@@ -5,7 +5,8 @@ if ($currenttab != 'update') {
|
||||
switch ($context->level) {
|
||||
|
||||
case CONTEXT_SYSTEM:
|
||||
print_header($site->fullname, "$site->fullname","$straction");
|
||||
$stradministration = get_string('administration');
|
||||
print_header($site->fullname, "$site->fullname","<a href=\"../index.php\">$stradministration</a> -> $straction");
|
||||
break;
|
||||
|
||||
case CONTEXT_PERSONAL:
|
||||
@@ -110,7 +111,8 @@ if ($currenttab != 'update') {
|
||||
$tabs = array($toprow);
|
||||
}
|
||||
|
||||
print_tabs($tabs, $currenttab, $inactive);
|
||||
|
||||
if ($context->level != CONTEXT_SYSTEM) { // do not show tabs otherwise
|
||||
print_tabs($tabs, $currenttab, $inactive);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user