mirror of
https://github.com/moodle/moodle.git
synced 2025-03-15 05:00:06 +01:00
"MDL-14129, fix print_error call"
This commit is contained in:
parent
d07fe1a930
commit
a939f681bb
mod/assignment
@ -8,25 +8,25 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $assignment = get_record('assignment', 'id', $cm->instance)) {
|
||||
print_error("assignment ID was incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
} else {
|
||||
if (!$assignment = get_record('assignment', 'id', $a)) {
|
||||
print_error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
if (! $course = get_record('course', 'id', $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignement');
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance('assignment', $assignment->id, $course->id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,15 +5,15 @@
|
||||
$id = required_param('id', PARAM_INT); // Course module ID
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $assignment = get_record("assignment", "id", $cm->instance)) {
|
||||
print_error("assignment ID was incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
@ -7,7 +7,7 @@
|
||||
$id = required_param('id', PARAM_INT); // course
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
print_error("Course ID is incorrect");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
require_course_login($course);
|
||||
|
@ -52,7 +52,7 @@ class assignment_base {
|
||||
if ($cm) {
|
||||
$this->cm = $cm;
|
||||
} else if (! $this->cm = get_coursemodule_from_id('assignment', $cmid)) {
|
||||
print_error('Course Module ID was incorrect');
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
$this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
|
||||
@ -62,13 +62,13 @@ class assignment_base {
|
||||
} else if ($this->cm->course == $COURSE->id) {
|
||||
$this->course = $COURSE;
|
||||
} else if (! $this->course = get_record('course', 'id', $this->cm->course)) {
|
||||
print_error('Course is misconfigured');
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if ($assignment) {
|
||||
$this->assignment = $assignment;
|
||||
} else if (! $this->assignment = get_record('assignment', 'id', $this->cm->instance)) {
|
||||
print_error('assignment ID was incorrect');
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
$this->assignment->cmidnumber = $this->cm->id; // compatibility with modedit assignment obj
|
||||
@ -235,7 +235,7 @@ class assignment_base {
|
||||
|
||||
/// We need the teacher info
|
||||
if (!$teacher = get_record('user', 'id', $graded_by)) {
|
||||
print_error('Could not find the teacher');
|
||||
print_error('cannotfindteacher');
|
||||
}
|
||||
|
||||
/// Print the feedback
|
||||
@ -787,7 +787,7 @@ class assignment_base {
|
||||
$offset = required_param('offset', PARAM_INT);//offset for where to start looking for student.
|
||||
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
print_error('No such user!');
|
||||
print_error('nousers');
|
||||
}
|
||||
|
||||
if (!$submission = $this->get_submission($user->id)) {
|
||||
@ -1490,7 +1490,7 @@ class assignment_base {
|
||||
}
|
||||
$newsubmission = $this->prepare_new_submission($userid, $teachermodified);
|
||||
if (!insert_record("assignment_submissions", $newsubmission)) {
|
||||
print_error("Could not insert a new empty submission");
|
||||
print_error('cannotinsertempty', 'assignment');
|
||||
}
|
||||
|
||||
return get_record('assignment_submissions', 'assignment', $this->assignment->id, 'userid', $userid);
|
||||
|
@ -12,7 +12,7 @@ class mod_assignment_mod_form extends moodleform_mod {
|
||||
if($ass = get_record('assignment', 'id', (int)$this->_instance)) {
|
||||
$type = $ass->assignmenttype;
|
||||
} else {
|
||||
print_error('incorrect assignment');
|
||||
print_error('invalidassignment', 'assignment');
|
||||
}
|
||||
} else {
|
||||
$type = required_param('type', PARAM_ALPHA);
|
||||
|
@ -9,25 +9,25 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $assignment = get_record("assignment", "id", $cm->instance)) {
|
||||
print_error("assignment ID was incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
} else {
|
||||
if (!$assignment = get_record("assignment", "id", $a)) {
|
||||
print_error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,29 +8,29 @@
|
||||
$userid = required_param('userid', PARAM_INT); // User ID
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $assignment = get_record("assignment", "id", $cm->instance)) {
|
||||
print_error("Assignment ID was incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
|
||||
if (! $user = get_record("user", "id", $userid)) {
|
||||
print_error("User is misconfigured");
|
||||
print_error('usermisconf', 'assignment');
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
if (($USER->id != $user->id) && !has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
|
||||
print_error("You can not view this assignment");
|
||||
print_error('cannotviewassignment', 'assignment');
|
||||
}
|
||||
|
||||
if ($assignment->assignmenttype != 'online') {
|
||||
print_error("Incorrect assignment type");
|
||||
print_error('invalidtype', 'assignment');
|
||||
}
|
||||
|
||||
$assignmentinstance = new assignment_online($cm->id, $assignment, $cm, $course);
|
||||
|
@ -105,7 +105,7 @@ class assignment_upload extends assignment_base {
|
||||
|
||||
/// We need the teacher info
|
||||
if (!$teacher = get_record('user', 'id', $graded_by)) {
|
||||
print_error('Could not find the teacher');
|
||||
print_error('cannotfindteacher');
|
||||
}
|
||||
|
||||
/// Print the feedback
|
||||
@ -466,7 +466,7 @@ class assignment_upload extends assignment_base {
|
||||
case 'editnotes':
|
||||
$this->upload_notes();
|
||||
default:
|
||||
print_error('Error: Unknow upload action ('.$action.').');
|
||||
print_error('unknowuploadaction', '', '', $action);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,29 +10,29 @@
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA);
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $assignment = get_record('assignment', 'id', $cm->instance)) {
|
||||
print_error("Assignment ID was incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
|
||||
if (! $user = get_record('user', 'id', $userid)) {
|
||||
print_error("User is misconfigured");
|
||||
print_error("invaliduserid");
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
if (!has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
|
||||
print_error("You can not view this assignment");
|
||||
print_error('cannotviewassignment', 'assignment');
|
||||
}
|
||||
|
||||
if ($assignment->assignmenttype != 'upload') {
|
||||
print_error("Incorrect assignment type");
|
||||
print_error('invalidtype', 'assignment');
|
||||
}
|
||||
|
||||
$assignmentinstance = new assignment_upload($cm->id, $assignment, $cm, $course);
|
||||
|
@ -8,25 +8,25 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $assignment = get_record("assignment", "id", $cm->instance)) {
|
||||
print_error("assignment ID was incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
} else {
|
||||
if (!$assignment = get_record("assignment", "id", $a)) {
|
||||
print_error("Course module is incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule', 'assignement');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,25 +8,25 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $assignment = get_record("assignment", "id", $cm->instance)) {
|
||||
print_error("assignment ID was incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
} else {
|
||||
if (!$assignment = get_record("assignment", "id", $a)) {
|
||||
print_error("Course module is incorrect");
|
||||
print_error('invalidid', 'assignment');
|
||||
}
|
||||
if (! $course = get_record("course", "id", $assignment->course)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf', 'assignment');
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user