global $matches;
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
- print_error("Course Module ID was incorrect");
+ print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record("course", array("id" => $cm->course))) {
- print_error("Course is misconfigured");
+ print_error('coursemisconf');
}
// allows for adaption for multiple modules
if(! $modname = $DB->get_field('modules', 'name', array('id' => $cm->module))) {
- print_error("Could not find module name");
+ print_error('invalidmoduleid', '', '', $cm->module);
}
if (! $mod = $DB->get_record($modname, array("id" => $cm->instance))) {
- print_error("Course module is incorrect");
+ print_error('invalidcoursemodule');
}
require_login($course->id, false, $cm);
$objects = $mod_create_objects($pageobjects, $mod->id); // function to preps the data to be sent to DB
if(! $mod_save_objects($objects, $mod->id, $pageid)) { // sends it to DB
- print_error("could not save");
+ print_error('cannotsavedata');
}
} else {
- print_error('could not get data');
+ print_error('cannotgetdata');
}
echo "<hr>";
// set the depth number. So B1 is depth 1 and B2 is depth 2 and so on
$this_depth = substr($class, 1);
if (!is_numeric($this_depth)) {
- print_error("Depth not parsed!");
+ print_error('invalidnum');
}
}
if ($this_depth < $depth) {
// insert the page
if(!$id = $DB->insert_record('lesson_pages', $branchtable->page)) {
- print_error("insert page");
+ print_error('cannotinsertpage', 'lesson');
}
// update the link of the page previous to the one we just updated
if ($prevpageid != 0) { // if not the first page
if (!$DB->set_field("lesson_pages", "nextpageid", $id, array("id" => $prevpageid))) {
- print_error("Insert page: unable to update next link $prevpageid");
+ print_error('cannotupdatepage', 'lesson');
}
}
foreach ($branchtable->answers as $answer) {
$answer->pageid = $id;
if(!$DB->insert_record('lesson_answers', $answer)) {
- print_error("insert answer $id");
+ print_error('cannotinsertanswer', 'lesson');
}
}
// all done with inserts. Now check to update our last page (this is when we import between two lesson pages)
if ($nextpageid != 0) { // if the next page is not the end of lesson
if (!$DB->set_field("lesson_pages", "prevpageid", $id, array("id" => $nextpageid))) {
- print_error("Insert page: unable to update next link $prevpageid");
+ print_error('cannotupdatepage', 'lesson');
}
}
// nothing fancy, just save them all in order
foreach ($chapters as $chapter) {
if (!$chapter->id = $DB->insert_record('book_chapters', $chapter)) {
- print_error('Could not update your book');
+ print_error('cannotupdatebook', 'lesson');
}
}
return true;
$printclose = optional_param('printclose', 0, PARAM_INT);
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
- print_error('Course Module ID was incorrect');
+ print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record('course', array('id' => $cm->course))) {
- print_error('Course is misconfigured');
+ print_error('coursemisconf');
}
if (! $lesson = $DB->get_record('lesson', array('id' => $cm->instance))) {
- print_error('Course module is incorrect');
+ print_error('invalidcoursemodule');
}
require_login($course->id, false, $cm);
//} else if ($mimetype == "application/x-shockwave-flash") { // It's a flash file
- // print_error('Flash is not supported yet');
+ // print_error('noflash');
} else if ($mimetype == "audio/x-pn-realaudio") { // It's a realmedia file
}
print_footer();
-?>
\ No newline at end of file
+?>
//Fix the forwards link of the previous page
if ($prevpageid) {
if (!$DB->set_field("lesson_pages", "nextpageid", $newid, array("id"=>$prevpageid))) {
- print_error("Lesson restorelib: unable to update link");
+ print_error('cannotupdatepage', 'lesson');
}
}
$prevpageid = $newid;
$page = backup_getid($restore->backup_unique_code,"lesson_pages",$answer->jumpto);
if ($page) {
if (!$DB->set_field("lesson_answers", "jumpto", $page->new_id, array("id"=>$answer->id))) {
- print_error("Lesson restorelib: unable to reset jump");
+ print_error('cannotresetjump', 'lesson');
}
}
}