diff --git a/admin/roles/manage.php b/admin/roles/manage.php index 42990014b40..56c46af845f 100755 --- a/admin/roles/manage.php +++ b/admin/roles/manage.php @@ -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 ('
'); @@ -118,13 +114,10 @@ echo (''); echo (''); echo (''); - echo ('are you sure?'); - echo (''); + 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 diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index c2d8c5780ca..efb5432f72d 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -7,7 +7,7 @@ if ($currenttab != 'update') { case CONTEXT_SYSTEM: $stradministration = get_string('administration'); - print_header($site->fullname, "$site->fullname","$stradministration -> $straction"); + print_header($SITE->fullname, "$SITE->fullname","$stradministration -> $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", "wwwroot/course/index.php\">$strcategories -> wwwroot/course/category.php?id=$category->id\">$category->name -> $straction", "", "", true); break;