From: moodler Date: Fri, 25 Aug 2006 08:54:22 +0000 (+0000) Subject: Just a slight tidy-up X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a72784d3c6e48e0ea60fbf071329ba6d429f13bf;p=moodle.git Just a slight tidy-up --- diff --git a/user/index.php b/user/index.php index 9aeb8811dd..793b3c1d04 100644 --- a/user/index.php +++ b/user/index.php @@ -157,21 +157,26 @@ } - /***************************************** - * drop down for swapping between roles * - *****************************************/ +/// If there are multiple Roles in the course, then show a drop down menu for switching - if (!$roleid) { - if ($options) { - $roleid = array_shift(array_keys($options)); // get first element + if ($roles = get_roles_used_in_context($context)) { + + $rolenames = array(); + + foreach ($roles as $role) { + $rolenames[$role->id] = $role->name; + } + + if (empty($roleid)) { + $roleid = array_shift(array_keys($rolenames)); // get first element } - } - echo '
'; - echo '
'; - echo ''.get_string('currentrole', 'role').': '; - choose_from_menu ($options, 'roleid', $roleid, '', $script='rolesform.submit()'); - echo '
'; + echo '
'; + echo '
'; + echo ''.get_string('currentrole', 'role').': '; + choose_from_menu ($rolenames, 'roleid', $roleid, '', $script='rolesform.submit()'); + echo '
'; + } @@ -179,7 +184,7 @@ echo ''; - //print my course menus +/// Print my course menus echo ''; @@ -312,9 +316,7 @@ function checkchecked(form) { $guest = get_guest(); $exceptions[] = $guest->id; -/************************************ - * start of foreach $roles as $role * - ************************************/ +/// Define a table showing a list of users in the current role. $tablecolumns = array('picture', 'fullname'); $tableheaders = array('', get_string('fullname'));
'; print_string('mycourses'); echo ': '; @@ -187,7 +192,6 @@ foreach ($mycourses as $mycourse) { $my_course[$mycourse->id] = $mycourse->shortname; } - //choose_from_menu($my_course, 'id', $course->id, '', 'courseform.submit()'); popup_form($CFG->wwwroot.'/user/index.php?contextid='.$context->id.'&roleid='.$roleid.'&id=',$my_course,'courseform',$course->id); echo '