diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 435b1a818c1..9c07e200591 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -34,7 +34,8 @@ } if (! $context = get_context_instance_by_id($contextid)) { - print_error("Context ID was incorrect (can't find it)"); + print_error('wrongcontextid', 'error'); + } $inmeta = 0; @@ -43,13 +44,13 @@ if ($course = get_record('course', 'id', $courseid)) { $inmeta = $course->metacourse; } else { - print_error('Invalid course id'); + print_error('invalidcourse', 'error'); } $coursecontext = $context; } else if (!empty($courseid)){ // we need this for user tabs in user context if (!$course = get_record('course', 'id', $courseid)) { - print_error('Invalid course id'); + print_error('invalidcourse', 'error'); } $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); diff --git a/admin/roles/manage.php b/admin/roles/manage.php index 727ca64baa9..1d2b94b9ea7 100755 --- a/admin/roles/manage.php +++ b/admin/roles/manage.php @@ -222,7 +222,7 @@ $role->description = $description; if (!update_record('role', $role)) { - print_error('Could not update role!'); + print_error('cannotupdaterole', 'error'); } // set proper legacy type @@ -249,7 +249,7 @@ case 'delete': if (in_array($roleid, $defaultroles)) { - print_error('This role is used as one of the default system roles, it can not be deleted'); + print_error('cannotdeleterole', 'error', '', 'this role is used as one of the default system roles, it can not be deleted'); } if ($confirm and data_submitted() and confirm_sesskey()) { if (!delete_role($roleid)) { @@ -257,7 +257,7 @@ // partially deleted a role sitewide...? mark_context_dirty($sitecontext->path); - print_error('Could not delete role with ID '.$roleid); + print_error('cannotdeleterolewithid', 'error', '', $roleid); } // deleted a role sitewide... mark_context_dirty($sitecontext->path); @@ -286,7 +286,7 @@ $above = $roles[$rolesort[$role->sortorder - 1]]; if (!switch_roles($role, $above)) { - print_error("Cannot move role with ID $roleid"); + print_error('cannotmoverolewithid', 'error', '', $roleid); } } } @@ -301,7 +301,7 @@ $below = $roles[$rolesort[$role->sortorder + 1]]; if (!switch_roles($role, $below)) { - print_error("Cannot move role with ID $roleid"); + print_error('cannotmoverolewithid', 'error', '', $roleid); } } } @@ -436,7 +436,7 @@ $role = stripslashes_safe($newrole); } else { if(!$role = get_record('role', 'id', $roleid)) { - print_error('Incorrect role ID!'); + print_error('wrongroleid', 'error'); } $role->legacytype = get_legacy_type($role->id); } diff --git a/admin/roles/override.php b/admin/roles/override.php index a49409ad774..5b612b445ff 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -9,24 +9,24 @@ $cancel = optional_param('cancel', 0, PARAM_BOOL); if (!$context = get_record('context', 'id', $contextid)) { - print_error('Bad context ID'); + print_error('wrongcontextid', 'error'); } if (!$sitecontext = get_context_instance(CONTEXT_SYSTEM)) { - print_error('No site ID'); + print_error('nositeid', 'error'); } if ($context->id == $sitecontext->id) { - print_error('Can not override base role capabilities'); + print_error('cannotoverridebaserole', 'error'); } if (!has_capability('moodle/role:override', $context)) { - print_error('You do not have permission to change overrides in this context!'); + print_error('nopermissions', 'error', '', 'change overrides in this context!'); } if ($courseid) { if (!$course = get_record('course', 'id', $courseid)) { - print_error('Bad course ID'); + print_error('invalidcourse'); } $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index e19b81c704c..7b17019d48c 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -61,16 +61,16 @@ if ($currenttab != 'update') { case CONTEXT_MODULE: // get module type? if (!$cm = get_record('course_modules','id',$context->instanceid)) { - print_error('Bad course module ID'); + print_error('invalidcoursemodule', 'error'); } if (!$module = get_record('modules','id',$cm->module)) { //$module->name; - print_error('Bad module ID'); + print_error('invalidmodule', 'error'); } if (!$course = get_record('course','id',$cm->course)) { - print_error('Bad course ID'); + print_error('invalidcourse'); } if (!$instance = get_record($module->name, 'id', $cm->instance)) { - print_error("The required instance of this module doesn't exist"); + print_error('moduledoesnotexist', 'error'); } require_login($course);