manage roles: MDL-8313 face lift allow override/assign, add labels and tooltips to the checkboxes for usability and accessibility.

This commit is contained in:
tjhunt 2008-11-18 10:33:38 +00:00
parent ad5616a934
commit 587a1ea358
3 changed files with 16 additions and 2 deletions

View file

@ -99,13 +99,19 @@
/// Now the rest of the table.
foreach ($roles as $fromrole) {
$row = array($fromrole->localname);
$a = new stdClass;
$a->fromrole = $fromrole->localname;
foreach ($roles as $targetrole) {
if ($allowed[$fromrole->id][$targetrole->id]) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
$row[] = '<input type="checkbox" name="s_' . $fromrole->id . '_' . $targetrole->id . '" value="1"' . $checked . ' />';
$a->targetrole = $targetrole->localname;
$name = 's_' . $fromrole->id . '_' . $targetrole->id;
$tooltip = get_string('allowroletoassign', 'role', $a);
$row[] = '<input type="checkbox" name="' . $name . '" id="' . $name . '" title="' . $tooltip . '" value="1"' . $checked . ' />' .
'<label for="' . $name . '" class="accesshide">' . $tooltip . '</label>';
}
$table->data[] = $row;
}

View file

@ -97,13 +97,19 @@
/// Now the rest of the table.
foreach ($roles as $fromrole) {
$row = array($fromrole->localname);
$a = new stdClass;
$a->fromrole = $fromrole->localname;
foreach ($roles as $targetrole) {
if ($allowed[$fromrole->id][$targetrole->id]) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
$row[] = '<input type="checkbox" name="s_' . $fromrole->id . '_' . $targetrole->id . '" value="1"' . $checked . ' />';
$a->targetrole = $targetrole->localname;
$name = 's_' . $fromrole->id . '_' . $targetrole->id;
$tooltip = get_string('allowroletooverride', 'role', $a);
$row[] = '<input type="checkbox" name="' . $name . '" id="' . $name . '" title="' . $tooltip . '" value="1"' . $checked . ' />' .
'<label for="' . $name . '" class="accesshide">' . $tooltip . '</label>';
}
$table->data[] = $row;
}