$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);
$newanswer->optionid = $formanswer;
$newanswer->timemodified = time();
if (! update_record("choice_answers", $newanswer)) {
- print_error("Could not update your choice because of a database error");
+ print_error('cannotupdatechoice', 'choice');
}
add_to_log($courseid, "choice", "choose again", "view.php?id=$cm->id", $choice->id, $cm->id);
} else {
$newanswer->optionid = $formanswer;
$newanswer->timemodified = time();
if (! insert_record("choice_answers", $newanswer)) {
- print_error("Could not save your choice");
+ print_error('cannotsavechoice', 'choice');
}
add_to_log($courseid, "choice", "choose", "view.php?id=$cm->id", $choice->id, $cm->id);
}
} else {
if (!($current->optionid==$formanswer)) { //check to see if current choice already selected - if not display error
- print_error("this choice is full!");
+ print_error('choicefull', 'choice');
}
}
}
$action = optional_param('action', '', PARAM_ALPHA);
if (! $cm = get_coursemodule_from_id('choice', $id)) {
- print_error("Course Module ID was incorrect");
+ print_error("invalidcoursemodule");
}
if (! $course = get_record("course", "id", $cm->course)) {
- print_error("Course module is misconfigured");
+ print_error("coursemisconf");
}
require_login($course->id, false, $cm);
require_capability('mod/choice:readresponses', $context);
if (!$choice = choice_get_choice($cm->instance)) {
- print_error("Course module is incorrect");
+ print_error('invalidcoursemodule');
}
$strchoice = get_string("modulename", "choice");
$attemptids = optional_param('attemptid', array(), PARAM_INT); // array of attempt ids for delete action
if (! $cm = get_coursemodule_from_id('choice', $id)) {
- print_error("Course Module ID was incorrect");
+ print_error('invalidcoursemodule');
}
if (! $course = get_record("course", "id", $cm->course)) {
- print_error("Course is misconfigured");
+ print_error('coursemisconf');
}
require_course_login($course, false, $cm);
if (!$choice = choice_get_choice($cm->instance)) {
- print_error("Course module is incorrect");
+ print_error('invalidcoursemodule');
}
$strchoice = get_string('modulename', 'choice');