// get attempt, hotpot, course and course_module records
if (! $attempt = get_record("hotpot_attempts", "id", $attemptid)) {
- print_error("Hot Potatoes attempt record $attemptid could not be accessed: ".$DB->get_last_error());
+ print_error('invalidattemptid', 'hotpot');
}
if ($attempt->userid != $USER->id) {
- print_error("User ID is incorrect");
+ print_error("invaliduserid");
}
if (! $hotpot = get_record("hotpot", "id", $attempt->hotpot)) {
- print_error("Hot Potatoes ID is incorrect (attempt id = $attempt->id)");
+ print_error('invalidhotpotid', 'hotpot');
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- print_error("Course ID is incorrect (hotpot id = $hotpot->id)");
+ print_error('invalidcourseid');
}
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
- print_error("Course Module ID is incorrect");
+ print_error("invalidcoursemodule");
}
// make sure this user is enrolled in this course
$attempt->id = insert_record("hotpot_attempts", $attempt);
if (empty($attempt->id)) {
- print_error("Could not insert attempt record: ".$DB->get_last_error(), '', $next_url);
+ print_error('cannotinsertattempt', 'hotpot', $next_url, $DB->get_last_error());
}
// add attempt details record, if necessary
$details->attempt = $attempt->id;
$details->details = $attempt->details;
if (! insert_record("hotpot_details", $details, false)) {
- print_error("Could not insert attempt details record: ".$DB->get_last_error(), '', $next_url);
+ print_error('cannotinsertattempt', 'hotpot', $next_url, $DB->get_last_error());
}
}
} else {
// update the attempt record
if (! update_record("hotpot_attempts", $attempt)) {
- print_error("Could not update attempt record: ".$DB->get_last_error(), '', $next_url);
+ print_error('cannotupdateattempt', 'hotpot', $next_url, $DB->get_last_error());
}
// update grades for this user
$details->attempt = $attempt->id;
$details->details = $attempt->details;
if (! insert_record("hotpot_details", $details)) {
- print_error("Could not insert attempt details record: ".$DB->get_last_error(), '', $next_url);
+ print_error('cannotinsertattempt', 'hotpot', $next_url, $DB->get_last_error());
}
}
}
}
if (!$ok) {
return;
- // print_error('Quiz type is missing or invalid');
+ // print_error('QuizTypeIsMissingOrInvalid');
// print_error('error_invalidquiztype', 'hotpot');
//
// script finishes here if quiztype is invalid
$id = required_param('id', PARAM_INT); // course
if (!$course = $DB->get_record('course', array('id'=>$id))) {
- print_error("Course ID is incorrect");
+ print_error('invalidcourseid');
}
require_login($course->id);
if ($attempt->details) {
hotpot_add_attempt_details($attempt);
if (! update_record('hotpot_attempts', $attempt)) {
- print_error("Could not update attempt record: ".$DB->get_last_error(), '', $next_url);
+ print_error('cannotupdateattempt', 'hotpot', $next_url, $DB->get_last_error());
}
}
$attemptcount++;
if (!$question->id = get_field('hotpot_questions', 'id', 'hotpot', $attempt->hotpot, 'md5key', $question->md5key, 'name', $question->name)) {
// add question record
if (!$question->id = insert_record('hotpot_questions', $question)) {
- print_error("Could not add question record (attempt_id=$attempt->id): ".$DB->get_last_error(), '', $next_url);
+ print_error('cannotaddquestionrecord', 'hotpot', $next_url);
}
}
// add response record
if(!$response->id = insert_record('hotpot_responses', $response)) {
- print_error("Could not add response record (attempt_id=$attempt->id, question_id=$question->id): ".$DB->get_last_error(), '', $next_url);
+ print_error('cannotaddresprecord', 'hotpot', $next_url);
}
// we can stop looping now
// try and add the new string record
if (!$id = insert_record('hotpot_strings', $record)) {
global $DB;
- print_error("Could not add string record for '".htmlspecialchars($str)."': ".$DB->get_last_error());
+ print_error('cannotaddstrrecord', 'hotpot');
}
}
}
if ($id) {
if (! $cm = get_coursemodule_from_id('hotpot', $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');
}
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
- print_error("Course module is incorrect");
+ print_error('invalidcoursemodule');
}
} else {
if (! $hotpot = get_record("hotpot", "id", $hp)) {
- print_error("Course module is incorrect");
+ print_error('invalidcoursemodule');
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- print_error("Course is misconfigured");
+ print_error('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
- print_error("Course Module ID was incorrect");
+ print_error('invalidcoursemodule');
}
}
if (! $attempt = get_record("hotpot_attempts", "id", $attempt)) {
- print_error("Attempt ID was incorrect");
+ print_error('invalidattemptid', 'hotpot');
}
require_login($course, true, $cm);
// print_error("noreviewuntil", "quiz", '', userdate($hotpot->timeclose));
//}
if ($attempt->userid != $USER->id) {
- print_error("This is not your attempt!");
+ print_error('notyourattempt', 'hotpot');
}
}
add_to_log($course->id, "hotpot", "review", "review.php?id=$cm->id&attempt=$attempt->id", "$hotpot->id", "$cm->id");
require_login($params->course);
if (!has_capability('mod/hotpot:viewreport',get_context_instance(CONTEXT_COURSE, $params->course))) {
- print_error("You are not allowed to view this page!");
+ print_error('nopermissiontoviewpage');
}
if (has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_SYSTEM))) {
$params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES, PARAM_INT);