"MDL-14129, fix print_error"
This commit is contained in:
+7
-7
@@ -110,7 +110,7 @@
|
||||
print_error('invalidevent');
|
||||
}
|
||||
if(!calendar_edit_event_allowed($event)) {
|
||||
print_error('You are not authorized to do this');
|
||||
print_error('nopermissions');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -120,10 +120,10 @@
|
||||
$repeats = optional_param('repeats', 0, PARAM_INT);
|
||||
|
||||
if($event === false) {
|
||||
print_error('Invalid event');
|
||||
print_error('invalidevent');
|
||||
}
|
||||
if(!calendar_edit_event_allowed($event)) {
|
||||
print_error('You are not authorized to do this');
|
||||
print_error('nopermissions');
|
||||
}
|
||||
|
||||
if($form = data_submitted()) {
|
||||
@@ -211,7 +211,7 @@
|
||||
$form->timeduration = 0;
|
||||
}
|
||||
if(!calendar_add_event_allowed($form)) {
|
||||
print_error('You are not authorized to do this');
|
||||
print_error('nopermissions');
|
||||
}
|
||||
validate_form($form, $err);
|
||||
if (count($err) == 0) {
|
||||
@@ -488,7 +488,7 @@
|
||||
case 'select':
|
||||
break;
|
||||
default:
|
||||
print_error('Unsupported event type');
|
||||
print_error('unsupportedevent');
|
||||
}
|
||||
|
||||
$form->format = $defaultformat;
|
||||
@@ -504,7 +504,7 @@
|
||||
$courseid = SITEID;
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
print_error('Incorrect course ID');
|
||||
print_error('invalidcourse');
|
||||
}
|
||||
|
||||
$groupid = groups_get_course_group($course);
|
||||
@@ -593,7 +593,7 @@ function validate_form(&$form, &$err) {
|
||||
// Timestamps must be >= course startdate
|
||||
$course = get_record('course', 'id', $form->courseid);
|
||||
if($course === false) {
|
||||
print_error('Event belongs to invalid course');
|
||||
print_error('invalidcourse');
|
||||
}
|
||||
else if($form->timestart < $course->startdate) {
|
||||
$err['timestart'] = get_string('errorbeforecoursestart', 'calendar');
|
||||
|
||||
+1
-1
@@ -431,7 +431,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
|
||||
// TODO: rewrite this hack somehow
|
||||
if (!calendar_edit_event_allowed($event)){ // cannot manage entries, eg. student
|
||||
if(!$assignment = get_record('assignment','id',$event->instance)){
|
||||
// print_error("assignment ID was incorrect");
|
||||
// print_error("invalidid", 'assignment');
|
||||
continue;
|
||||
}
|
||||
// assign assignment to assignment object to use hidden_is_hidden method
|
||||
|
||||
+5
-5
@@ -108,7 +108,7 @@
|
||||
if (!empty($moveto) and $data = data_submitted() and confirm_sesskey()) { // Some courses are being moved
|
||||
|
||||
if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
|
||||
print_error("Error finding the category");
|
||||
print_error('cannotfindcategory', '', '', $data->moveto);
|
||||
}
|
||||
|
||||
$courses = array();
|
||||
@@ -124,7 +124,7 @@
|
||||
if (!empty($blocklist) and confirm_sesskey()) {
|
||||
$blockid = $blocklist;
|
||||
if (!$blocks = get_records('block_instance', 'blockid', $blockid)) {
|
||||
print_error( "Could not read data for blockid=$blockid" );
|
||||
print_error( 'blockcannotread', '', '', $blockid);
|
||||
}
|
||||
|
||||
// run through blocks and get (unique) courses
|
||||
@@ -137,7 +137,7 @@
|
||||
continue;
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
print_error( "Could not read data for courseid=$courseid" );
|
||||
print_error('invalidcourseid', '', '', $courseid);
|
||||
}
|
||||
$courses[$courseid] = $course;
|
||||
}
|
||||
@@ -147,7 +147,7 @@
|
||||
elseif (!empty($modulelist) and confirm_sesskey()) {
|
||||
$modulename = $modulelist;
|
||||
if (!$modules = get_records($modulename)) {
|
||||
print_error( "Could not read data for module=$modulename" );
|
||||
print_error('invalidmodulename', '', '', $modulename);
|
||||
}
|
||||
|
||||
// run through modules and get (unique) courses
|
||||
@@ -158,7 +158,7 @@
|
||||
continue;
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
print_error( "Could not read data for courseid=$courseid" );
|
||||
print_error('invalidcourseid', '', '', $courseid);
|
||||
}
|
||||
$courses[$courseid] = $course;
|
||||
}
|
||||
|
||||
+7
-6
@@ -22,11 +22,11 @@
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
print_error('Invalid course id');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
|
||||
print_error('Invalid context');
|
||||
print_error('invalidcontext');
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@@ -43,7 +43,8 @@
|
||||
// verify user may unassign all roles at course context
|
||||
foreach($roles as $role) {
|
||||
if (!user_can_assign($context, $role->roleid)) {
|
||||
print_error('Can not unassign this user from role id:'.$role->roleid);
|
||||
print_error('cannotunassignrolefrom', '', '',
|
||||
$role->roleid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +60,7 @@
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
if ($userid) {
|
||||
if (! role_unassign(0, $userid, 0, $context->id)) {
|
||||
print_error("An error occurred while trying to unenrol that person.");
|
||||
print_error("unenrolerror");
|
||||
}
|
||||
|
||||
add_to_log($course->id, 'course', 'unenrol', "view.php?id=$course->id", $userid);
|
||||
@@ -67,7 +68,7 @@
|
||||
|
||||
} else {
|
||||
if (! role_unassign(0, $USER->id, 0, $context->id)) {
|
||||
print_error("An error occurred while trying to unenrol you.");
|
||||
print_error("unenrolerror");
|
||||
}
|
||||
|
||||
// force a refresh of mycourses
|
||||
@@ -88,7 +89,7 @@
|
||||
|
||||
if ($userid) {
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
print_error('That user does not exist!');
|
||||
print_error('nousers');
|
||||
}
|
||||
$strunenrolsure = get_string('unenrolsure', '', fullname($user, true));
|
||||
notice_yesno($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes&sesskey=".sesskey(),
|
||||
|
||||
@@ -81,6 +81,7 @@ $string['helpuploadsingle'] = '<p>This type of assignment allows each participan
|
||||
a zipped web site, or anything you ask them to submit.</p>';
|
||||
$string['hideintro'] = 'Hide description before available date';
|
||||
$string['itemstocount'] = 'Count';
|
||||
$string['invalidid'] = 'assignment ID was incorrect';
|
||||
$string['late'] = '$a late';
|
||||
$string['maximumgrade'] = 'Maximum grade';
|
||||
$string['maximumsize'] = 'Maximum size';
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
$string['adminprimarynoedit'] = 'The primary admin cannot be edited by others';
|
||||
$string['blockdoesnotexist'] = 'This block does not exist';
|
||||
$string['blockcannotinistantiate'] = 'Problem in instantiating block object';
|
||||
$string['blockcannotread'] = 'Could not read data for blockid= $a ';
|
||||
$string['blockcannotconfig'] = 'This block does not support global configuration';
|
||||
$string['backupcontainexternal'] = 'This backup file contains external Moodle Network Hosts that are not configured locally.';
|
||||
$string['backuptablefail'] = 'Backup tables could NOT be set up successfully!';
|
||||
$string['cannotassignrole'] = 'Cannot assign role in course';
|
||||
$string['cannotunassignrolefrom'] = 'Can not unassign this user from role id: $a';
|
||||
$string['cannotaddrss'] = 'You do not have permission to add rss feeds';
|
||||
$string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"';
|
||||
$string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
|
||||
@@ -91,6 +93,7 @@ $string['invalidaccessparameter'] = 'Invalid access parameter.';
|
||||
$string['invalidcourse'] = 'Invalid course';
|
||||
$string['invalidcourseid'] = 'You are tring to use an invalid course ID: ($a)';
|
||||
$string['invalidcoursemodule'] = 'Bad course module ID';
|
||||
$string['invalidcontext'] = 'Invalid context';
|
||||
$string['invalidevent'] = 'Invalid event';
|
||||
$string['invalidcoursenameshort'] = 'Invalid short course name';
|
||||
$string['invalidevent'] = 'Invalid event';
|
||||
@@ -99,7 +102,9 @@ $string['invalidfiletype'] = '\"$a\" is not a valid file type';
|
||||
$string['invalidgroupid'] = 'INcorrect group id specified.';
|
||||
$string['invalidipformat'] = 'Invalid IP address format';
|
||||
$string['invalidmd5'] = 'Invalid md5';
|
||||
$string['invalidmodule'] = 'Invalid module ID';
|
||||
$string['invalidmodule'] = 'Invalid module';
|
||||
$string['invalidmoduleid'] = 'Invalid module ID: $a';
|
||||
$string['invalidmodulename'] = 'Invalid module name: $a';
|
||||
$string['invalidpagesize'] = 'Invalid page size';
|
||||
$string['invalidrequest'] = 'Invalid request';
|
||||
$string['invalidrole'] = 'Invalid role';
|
||||
@@ -168,6 +173,7 @@ $string['unicodeupgradeerror'] = 'Sorry, but your database is not already in Uni
|
||||
$string['unspecifycourseid'] = 'Must specify course id, short name or idnumber';
|
||||
$string['statsnodata'] = 'There is no available data for that combination of course and time period.';
|
||||
$string['statsdisable'] = 'Stats is not enabled.';
|
||||
$string['unenrolerror'] = 'An error occurred while trying to unenrol that person.';
|
||||
$string['unknowaction']= 'Unknown action!';
|
||||
$string['unknowncourse'] = 'Unknown course named \"$a\"';
|
||||
$string['unknowncourseidnumber'] = 'Unknown Course ID \"$a\"';
|
||||
|
||||
Reference in New Issue
Block a user