From: tjhunt Date: Tue, 23 Oct 2007 16:27:25 +0000 (+0000) Subject: MDL-11784 - On the role assign page, list who is assigned the role for roles with... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dcd55b7e80b52a5af30af4c25d2fbf6a0fcd28c3;p=moodle.git MDL-11784 - On the role assign page, list who is assigned the role for roles with only a few assignments. Merged from MOODLE_19_STABLE. --- diff --git a/admin/roles/assign.php b/admin/roles/assign.php index ddeaa054e5..df682f79b9 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -6,6 +6,7 @@ require_once($CFG->libdir.'/adminlib.php'); define("MAX_USERS_PER_PAGE", 5000); + define("MAX_USERS_TO_LIST_PER_ROLE", 10); $contextid = required_param('contextid',PARAM_INT); // context id $roleid = optional_param('roleid', 0, PARAM_INT); // required role id @@ -424,14 +425,27 @@ $table->cellpadding = 5; $table->cellspacing = 0; $table->width = '60%'; - $table->head = array(get_string('roles', 'role'), get_string('description'), get_string('users')); - $table->wrap = array('nowrap', '', 'nowrap'); - $table->align = array('right', 'left', 'center'); + $table->head = array(get_string('roles', 'role'), get_string('description'), get_string('users'), ''); + $table->wrap = array('nowrap', '', 'nowrap', 'nowrap'); + $table->align = array('right', 'left', 'center', 'left'); foreach ($assignableroles as $roleid => $rolename) { $countusers = count_role_users($roleid, $context); + $strroleusers = ''; + if (0 < $countusers && $countusers <= MAX_USERS_TO_LIST_PER_ROLE) { + $roleusers = get_role_users($roleid, $context, false, 'u.id, u.lastname, u.firstname'); + if (!empty($roleusers)) { + $strroleusers = array(); + foreach ($roleusers as $user) { + $strroleusers[] = '' . fullname($user) . ''; + } + $strroleusers = implode('
', $strroleusers); + } + } else if ($countusers > MAX_USERS_TO_LIST_PER_ROLE) { + $strroleusers = get_string('morethan', 'role', MAX_USERS_TO_LIST_PER_ROLE); + } $description = format_string(get_field('role', 'description', 'id', $roleid)); - $table->data[] = array(''.$rolename.'',$description, $countusers); + $table->data[] = array(''.$rolename.'',$description, $countusers, $strroleusers); } print_table($table); diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index e04da18805..92a9cf727a 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -85,6 +85,7 @@ $string['listallroles'] = 'List all roles'; $string['manageroles'] = 'Manage roles'; $string['metaassignerror'] = 'Can not assign this role to user \"$a\" because Manage metacourse capability is needed.'; $string['metaunassignerror'] = 'Role of user \"$a\" was automatically reassigned, please unassign the role in child courses instead.'; +$string['morethan'] = 'More than $a'; $string['my:manageblocks'] = 'Manage myMoodle page blocks'; $string['nocapabilitiesincontext'] = 'No capabilities available in this context'; $string['notset'] = 'Not set'; diff --git a/theme/standard/styles_fonts.css b/theme/standard/styles_fonts.css index 2eb5094e0e..07da3c2e3a 100644 --- a/theme/standard/styles_fonts.css +++ b/theme/standard/styles_fonts.css @@ -251,6 +251,7 @@ body#admin-index .copyright { } #admin-roles-override .cell.c1, +#admin-roles-assign .cell.c3, #admin-roles-assign .cell.c1 { font-size: 0.7em; } diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index bf2869c5ad..da33152d9e 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -985,6 +985,7 @@ body#admin-modules table.generaltable td.c0 } #admin-roles-override .cell.c1, +#admin-roles-assign .cell.c3, #admin-roles-assign .cell.c1 { padding-top: 0.75em; }