From 927bf46f3c8aa77e9293f900619430eabf70d4a8 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 9 Aug 2006 05:37:53 +0000 Subject: [PATCH] Tidy-ups --- admin/roles/assign.html | 14 +++----------- admin/roles/assign.php | 32 ++++++++++---------------------- admin/roles/override.php | 36 ++++++++++++++++++------------------ admin/roles/tabs.php | 7 ++++--- 4 files changed, 35 insertions(+), 54 deletions(-) diff --git a/admin/roles/assign.html b/admin/roles/assign.html index 389dcf7eff..d4d1f3785b 100755 --- a/admin/roles/assign.html +++ b/admin/roles/assign.html @@ -1,5 +1,5 @@ -
+ @@ -7,19 +7,11 @@ diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 5884d0d603..65b6020eed 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -32,34 +32,21 @@ * end of permission checking */ -/* - if ($course->metacourse) { - redirect("$CFG->wwwroot/course/importstudents.php?id=$course->id"); - } -*/ require_login($course->id); if (!isteacheredit($course->id)) { error("You must be an editing teacher in this course, or an admin"); } - $strassignusers = get_string('assignusers'); - $strpotentialusers = get_string('potentialusers'); - $strexistingusers = get_string('existingusers'); + $strassignusers = get_string('assignusers', 'role'); + $strpotentialusers = get_string('potentialusers', 'role'); + $strexistingusers = get_string('existingusers', 'role'); + $straction = get_string('assignroles', 'role'); + $strcurrentrole = get_string('currentrole', 'role'); + $strcurrentcontext = get_string('currentcontext', 'role'); $strsearch = get_string('search'); $strshowall = get_string('showall'); -/* - if ($course && $course->id != SITEID) { // course header - print_header("$course->shortname: $strassignusers", - "$site->fullname", - "id\">$course->shortname -> $strassignusers"); - } else { // site header - print_header("$site->shortname: $strassignusers", - "$site->fullname", - "$strassignusers"); - } - */ - $straction = get_string('roleassignment'); + $context = get_record('context', 'id', $contextid); $currenttab = ''; @@ -106,6 +93,7 @@ $existinguserarray = array(); $SQL = "select u.* from {$CFG->prefix}role_assignments r, {$CFG->prefix}user u where contextid = $contextid and roleid = $roleid and u.id = r.userid"; // join now so that we can just use fullname() later + if (!$contextusers = get_records_sql($SQL)) { $contextusers = array(); } @@ -146,8 +134,8 @@ // prints a form to swap roles print (''); - print ('
Current Context: '.print_context_name($contextid).'
'); - print ('Select a Role: '); + print ('
'.$strcurrentcontext.': '.print_context_name($contextid).'
'); + print (''.$strcurrentrole.': '); choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()'); print ('
'); diff --git a/admin/roles/override.php b/admin/roles/override.php index f5f531b8d3..39ae39fa6a 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -1,5 +1,4 @@ - wwwroot/$CFG->admin/index.php"); } - $stroverrides = get_string('roleoverries'); -/* - if ($course && $course->id != SITEID) { // course header - print_header("$course->shortname: $stroverrides", - "$site->fullname", - "id\">$course->shortname -> $stroverrides"); - } else { // site header - print_header("$site->shortname: $stroverrides", - "$site->fullname", - "$stroverrides"); - } -*/ + $strassignusers = get_string('assignusers', 'role'); + $strpotentialusers = get_string('potentialusers', 'role'); + $strexistingusers = get_string('existingusers', 'role'); + $straction = get_string('assignroles', 'role'); + $strcurrentrole = get_string('currentrole', 'role'); + $strcurrentcontext = get_string('currentcontext', 'role'); + $strsearch = get_string('search'); + $strshowall = get_string('showall'); + $context = get_record('context', 'id', $contextid); - $straction = get_string('editoverride'); + + $straction = get_string('overrideroles', 'role'); $currenttab = ''; + $tabsmode = 'override'; include_once('tabs.php'); + + /************************* * form processing here * *************************/ @@ -88,9 +88,9 @@ $options[$rolex->id] = $rolex->name; } - print ('
'); - print ('
Current Context: '.print_context_name($contextid).'
'); - print ('Select a Role: '); + print (''); + print ('
'.$strcurrentcontext.': '.print_context_name($contextid).'
'); + print (''.$strcurrentrole.': '); choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()'); print ('
'); diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index 151d00edfe..4e5834abd7 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -87,12 +87,13 @@ if ($currenttab != 'update') { if (isset($tabsmode)) { $inactive[] = 'roles'; - $secondrow[] = new tabobject('assign', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('roleassignments')); + $secondrow[] = new tabobject('assign', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('assignroles', 'role')); if ($context->level == CONTEXT_SYSTEM) { - $secondrow[] = new tabobject('override', '', get_string('roleoverrides')); + $secondrow[] = new tabobject('override', '', get_string('overrideroles', 'role')); } else { - $secondrow[] = new tabobject('override', $CFG->wwwroot.'/admin/roles/override.php?contextid='.$context->id, get_string('roleoverrides')); + $secondrow[] = new tabobject('override', $CFG->wwwroot.'/admin/roles/override.php?contextid='.$context->id, + get_string('overrideroles', 'role')); } if ($tabsmode == 'override') { -- 2.39.5
- count = count($contextusers); - $a->items = $strexistingusers; - print_string('counteditems', '', $a); - ?> + - count = $usercount; - $a->items = $strpotentialusers; - print_string('counteditems', '', $a); - ?> +