$id = required_param('id', PARAM_INT); // Course module ID
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
- print_error("Course Module ID was incorrect");
+ print_error('invalidcoursemodule');
}
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
- print_error("hotpot ID was incorrect");
+ print_error('invalidhotpotid', 'hotpot');
}
if (! $course = get_record("course", "id", $hotpot->course)) {
- print_error("Course is misconfigured");
+ print_error("invalidcourse");
}
require_login($course->id, false, $cm);
if (!isset($cm->sectionvisible)) {
if (! $section = get_record('course_sections', 'id', $cm->section)) {
- print_error('Course module record contains invalid section');
+ print_error('invalidsection');
}
$cm->sectionvisible = $section->visible;
}
$hotpot->reference = addslashes($hotpot->reference);
if (!$hotpot->instance = insert_record("hotpot", $hotpot)) {
- print_error("Could not add a new instance of $hotpot->modulename", '', "view.php?id=$hotpot->course");
+ print_error('cannotaddnewinstance', '', 'view.php?id='.$hotpot->course, $hotpot->modulename);
}
// store (hotpot table) id of start of chain
}
if (! $hotpot->coursemodule = add_course_module($hotpot)) {
- print_error("Could not add a new course module");
+ print_error('cannotaddcoursemodule');
}
if (! $sectionid = add_mod_to_section($hotpot) ) {
- print_error("Could not add the new course module to that section");
+ print_error('cannotaddcoursemoduletosection');
}
- if (! set_field("course_modules", "section", $sectionid, "id", $hotpot->coursemodule)) {
- print_error("Could not update the course module with the correct section");
+ if (! set_field('course_modules', 'section', $sectionid, "id", $hotpot->coursemodule)) {
+ print_error('cannotupdatecoursemodule');
}
add_to_log($hotpot->course, "course", "add mod",
// update $thishotpot, if required
if ($require_update && !update_record("hotpot", $thishotpot)) {
- print_error("Could not update the $hotpot->modulename", '', "view.php?id=$hotpot->course");
+ print_error('cannotupdatemod', '',
+ 'view.php?id='.$hotpot->course, $hotpot->modulename);
}
}
} // end foreach $ids
// check xmlize functions are available
if (! function_exists("xmlize")) {
- print_error('xmlize functions are not available');
+ print_error('xmlizeunavailable', 'debug');
}
$this->read_file = $read_file;
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('invalidhotpotid', 'hotpot');
}
} else {
if (! $hotpot = get_record("hotpot", "id", $hp)) {
- print_error("Course module is incorrect");
+ print_error('invalidhotpotid', 'hotpot');
}
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');
}
}
/// Open the selected hotpot report and display it
if (! is_readable("report/$mode/report.php")) {
- print_error("Report not known (".clean_text($mode).")", '', $course_homeurl);
+ print_error('unknownreport', 'hotpot', $course_homeurl, clean_text($mode));
}
include("report/default.php"); // Parent class
$report = new hotpot_report();
if (! $report->display($hotpot, $cm, $course, $users, $attempts, $questions, $formdata)) {
- print_error("Error occurred during report processing!", '', $course_homeurl);
+ print_error('error_processreport', 'hotpot', $course_homeurl);
}
if ($formdata['reportformat']=='htm') {
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('invalidhotpotid', 'hotpot');
}
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');
}
}
}
// open and parse the source file
if(!$hp = new hotpot_xml_quiz($hotpot)) {
- print_error("Quiz is unavailable at the moment");
+ print_error('quizunavailable', 'hotpot');
}
$get_js = optional_param('js', '', PARAM_ALPHA);
$get_css = optional_param('css', '', PARAM_ALPHA);
$attemptid = hotpot_add_attempt($hotpot->id);
if (! is_numeric($attemptid)) {
- print_error('Could not insert attempt record: '.$DB->get_last_error());
+ print_error('cannotinsertattempt', 'hotpot', '', $DB->get_last_error());
}
}
$hp->adjust_media_urls();