Just some cleanups and removed notices

This commit is contained in:
moodler 2006-09-16 14:22:59 +00:00
parent 27e1437616
commit 38a5e3d34a
2 changed files with 14 additions and 21 deletions

View File

@ -71,26 +71,18 @@
$localoverride = get_record_sql($SQL);
if ($localoverride) { // update current overrides
if ($value == 0) { // inherit = delete
unassign_capability($capname, $roleid, $sitecontext->id);
} else {
$localoverride->permission = $value;
$localoverride->timemodified = time();
$localoverride->modifierid = $USER->id;
update_record('role_capabilities', $localoverride);
}
} else { // insert a record
assign_capability($capname, $value, $roleid, $sitecontext->id);
}
}
// update normal role settings
@ -99,18 +91,22 @@
$role->name = $name;
$role->description = $description;
update_record('role', $role);
if (!update_record('role', $role)) {
error('Could not update role!');
}
break;
case 'delete':
if ($confirm) { // deletes a role
echo ('deleting...');
// check for depedencies
// check for depedencies XXX TODO
// delete all associated role-assignments?
delete_records('role', 'id', $roleid);
// delete all associated role-assignments? XXX TODO
if (!delete_records('role', 'id', $roleid)) {
error('Could not delete role!');
}
} else {
echo ('<form action="manage.php" method="POST">');
@ -118,13 +114,10 @@
echo ('<input type="hidden" name="roleid" value="'.$roleid.'">');
echo ('<input type="hidden" name="sesskey" value="'.sesskey().'">');
echo ('<input type="hidden" name="confirm" value="1">');
echo ('are you sure?');
echo ('<input type="submit" value="yes">');
notice_yesno(get_string('deleterolesure', 'role'),
'manage.php?action=delete&roleid='.$roleid.'&sesskey='.sesskey().'&confirm=1', 'manage.php');
admin_externalpage_print_footer($adminroot);
// print_footer($course);
exit;
// prints confirmation form
}
break;
@ -138,7 +131,7 @@
}
$roles = get_records('role');
$roles = get_records('role', '', '', 'sortorder ASC, id ASC');
if (($roleid && $action!='delete') || $action=='new') { // load the role if id is present

View File

@ -7,7 +7,7 @@ if ($currenttab != 'update') {
case CONTEXT_SYSTEM:
$stradministration = get_string('administration');
print_header($site->fullname, "$site->fullname","<a href=\"../index.php\">$stradministration</a> -> $straction");
print_header($SITE->fullname, "$SITE->fullname","<a href=\"../index.php\">$stradministration</a> -> $straction");
break;
case CONTEXT_PERSONAL:
@ -22,7 +22,7 @@ if ($currenttab != 'update') {
$strcategories = get_string("categories");
$strcategory = get_string("category");
$strcourses = get_string("courses");
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
print_header("$SITE->shortname: $category->name", "$SITE->fullname: $strcourses",
"<a href=\"$CFG->wwwroot/course/index.php\">$strcategories</a> -> <a href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a> -> $straction", "", "", true);
break;