From 6d40f12e5bd6686522a7afaa38290730ab74c289 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 5 May 2009 09:05:27 +0000 Subject: [PATCH] MDL-19067 removed obsoleted string (never used in any STABLE branch) --- lang/en_utf8/lesson.php | 4 ---- lang/en_utf8/survey.php | 1 - mod/lesson/action/addcluster.php | 4 +--- mod/lesson/action/addendofbranch.php | 4 +--- mod/lesson/action/addendofcluster.php | 4 +--- mod/lesson/action/insertpage.php | 14 ++------------ mod/lesson/action/updatepage.php | 12 +++--------- mod/lesson/format.php | 18 +++--------------- mod/lesson/highscores.php | 4 +--- mod/lesson/importppt.php | 16 ++++------------ mod/lesson/view.php | 4 +--- mod/survey/save.php | 4 +--- 12 files changed, 18 insertions(+), 71 deletions(-) diff --git a/lang/en_utf8/lesson.php b/lang/en_utf8/lesson.php index 55776f9179..75dd20eb3f 100644 --- a/lang/en_utf8/lesson.php +++ b/lang/en_utf8/lesson.php @@ -51,16 +51,12 @@ $string['cannotfindanswer'] = 'Error: could not find answer'; $string['cannotfindgrade'] = 'Error: could not find grades'; $string['cannotfindrecords'] = 'Error: could not find lesson records'; $string['cannotfinduser'] = 'Error: could not find users'; -$string['cannotdeleteanswer'] = 'Update page: unable to delete answer record'; -$string['cannotdeleteattempt'] = 'Error: could not delete old attempts'; -$string['cannotdeletebranch'] = 'Error: could not delete old seen branches'; $string['cannotinsertanswer'] = 'Cannot insert answer record'; $string['cannotinserthighscore'] = 'Insert of new high score Failed!'; $string['cannotinsertpage'] = 'Cannot insert new page'; $string['cannotinserttimer'] = 'Error: could not insert row into lesson_timer table'; $string['cannotupdateanswer'] = 'Update page: answer not updated'; $string['cannotupdatebook'] = 'Cannot update your book'; -$string['cannotupdategrade'] = 'Cannot update grade'; $string['cannotupdatelink'] = 'Cannot update link'; $string['cannotupdatepage'] = 'Update page: page not updated'; $string['cannotupdatetimer'] = 'Error: could not update lesson_timer table'; diff --git a/lang/en_utf8/survey.php b/lang/en_utf8/survey.php index 3d68f1f115..2910df937a 100644 --- a/lang/en_utf8/survey.php +++ b/lang/en_utf8/survey.php @@ -61,7 +61,6 @@ $string['attlsname'] = 'ATTLS (20 item version)'; $string['cannotfindsurveytmpt'] = 'No survey templates found!'; $string['cannotfindquestion'] = 'Question doesn\'t exist'; $string['cannotfindanswer'] = 'There are no answers for this survey yet.'; -$string['cannotinsertanswer'] = 'Encountered a problem trying to store your results. Sorry.'; $string['ciq1'] = 'At what moment in class were you most engaged as a learner?'; $string['ciq1short'] = 'Most engaged'; $string['ciq2'] = 'At what moment in class were you most distanced as a learner?'; diff --git a/mod/lesson/action/addcluster.php b/mod/lesson/action/addcluster.php index c67d0aeb8b..1735e11d42 100644 --- a/mod/lesson/action/addcluster.php +++ b/mod/lesson/action/addcluster.php @@ -35,9 +35,7 @@ $newpage->timecreated = $timenow; $newpage->title = get_string("clustertitle", "lesson"); $newpage->contents = get_string("clustertitle", "lesson"); - if (!$newpageid = $DB->insert_record("lesson_pages", $newpage)) { - print_error('cannotinsertpage', 'lesson'); - } + $newpageid = $DB->insert_record("lesson_pages", $newpage); // update the linked list... if ($pageid != 0) { if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid))) { diff --git a/mod/lesson/action/addendofbranch.php b/mod/lesson/action/addendofbranch.php index e29d127624..a052aa7fca 100644 --- a/mod/lesson/action/addendofbranch.php +++ b/mod/lesson/action/addendofbranch.php @@ -37,9 +37,7 @@ $newpage->timecreated = $timenow; $newpage->title = get_string("endofbranch", "lesson"); $newpage->contents = get_string("endofbranch", "lesson"); - if (!$newpageid = $DB->insert_record("lesson_pages", $newpage)) { - print_error('cannotinsertpage', 'lesson'); - } + $newpageid = $DB->insert_record("lesson_pages", $newpage); // update the linked list... if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid))) { print_error('cannotupdatelink', 'lesson'); diff --git a/mod/lesson/action/addendofcluster.php b/mod/lesson/action/addendofcluster.php index 2dcc30c48d..15fff40ad6 100644 --- a/mod/lesson/action/addendofcluster.php +++ b/mod/lesson/action/addendofcluster.php @@ -28,9 +28,7 @@ $newpage->timecreated = $timenow; $newpage->title = get_string("endofclustertitle", "lesson"); $newpage->contents = get_string("endofclustertitle", "lesson"); - if (!$newpageid = $DB->insert_record("lesson_pages", $newpage)) { - print_error('cannotinsertpage', 'lesson'); - } + $newpageid = $DB->insert_record("lesson_pages", $newpage); // update the linked list... if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid))) { print_error('cannotupdatelink', 'lesson'); diff --git a/mod/lesson/action/insertpage.php b/mod/lesson/action/insertpage.php index f8aa3ac7ae..4f9d37fbcb 100644 --- a/mod/lesson/action/insertpage.php +++ b/mod/lesson/action/insertpage.php @@ -47,18 +47,11 @@ $newpage->contents = trim($form->contents); $newpage->title = $newpage->title; $newpageid = $DB->insert_record("lesson_pages", $newpage); - if (!$newpageid) { - print_error('cannotinsertpage', 'lesson'); - } // update the linked list (point the previous page to this new one) - if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $newpage->prevpageid))) { - print_error('cannotupdatelink', 'lesson'); - } + $DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $newpage->prevpageid)); if ($page->nextpageid) { // new page is not the last page - if (!$DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid))) { - print_error('cannotupdatelink', 'lesson'); - } + $DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid)); } } else { // new page is the first page @@ -90,9 +83,6 @@ $newpage->contents = trim($form->contents); $newpage->title = $newpage->title; $newpageid = $DB->insert_record("lesson_pages", $newpage); - if (!$newpageid) { - print_error('cannotinsertpage', 'lesson'); - } } else { // there are existing pages put this at the start $newpage->lessonid = $lesson->id; diff --git a/mod/lesson/action/updatepage.php b/mod/lesson/action/updatepage.php index d42375cef0..85eab4e7f6 100644 --- a/mod/lesson/action/updatepage.php +++ b/mod/lesson/action/updatepage.php @@ -70,9 +70,7 @@ } } } - if (!$DB->update_record("lesson_answers", $oldanswer)) { - print_error('cannotupdateanswer', 'lesson'); - } + $DB->update_record("lesson_answers", $oldanswer); } else { // it's an "ordinary" page if ($page->qtype == LESSON_MATCHING) { @@ -105,9 +103,7 @@ if (isset($form->score[$i])) { $oldanswer->score = clean_param($form->score[$i], PARAM_INT); } - if (!$DB->update_record("lesson_answers", $oldanswer)) { - print_error('cannotupdateanswer', 'lesson'); - } + $DB->update_record("lesson_answers", $oldanswer); } else { // it's a new answer $newanswer = new stdClass; // need to clear id if more than one new answer is ben added @@ -152,9 +148,7 @@ $form->responseeditor[$i] * LESSON_RESPONSE_EDITOR; $oldanswer->timemodified = $timenow; $oldanswer->answer = NULL; - if (!$DB->update_record("lesson_answers", $oldanswer)) { - print_error('cannotupdateanswer', 'lesson'); - } + $DB->update_record("lesson_answers", $oldanswer); } } elseif (!empty($form->answerid[$i])) { // need to delete blanked out answer diff --git a/mod/lesson/format.php b/mod/lesson/format.php index faa1a3c512..34f73fe7b2 100644 --- a/mod/lesson/format.php +++ b/mod/lesson/format.php @@ -93,13 +93,9 @@ class qformat_default { $newpage->prevpageid = $pageid; $newpage->nextpageid = $page->nextpageid; // insert the page and reset $pageid - if (!$newpageid = $DB->insert_record("lesson_pages", $newpage)) { - print_error('cannotinsertpage', 'lesson'); - } + $newpageid = $DB->insert_record("lesson_pages", $newpage); // update the linked list - if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid))) { - print_error('cannotupdateanswer', 'lesson'); - } + $DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid)); } else { // new page is the first page @@ -110,21 +106,13 @@ class qformat_default { $newpage->prevpageid = 0; // this is a first page $newpage->nextpageid = 0; // this is the only page $newpageid = $DB->insert_record("lesson_pages", $newpage); - if (!$newpageid) { - print_error('cannotinsertpage', 'lesson'); - } } else { // there are existing pages put this at the start $newpage->prevpageid = 0; // this is a first page $newpage->nextpageid = $page->id; $newpageid = $DB->insert_record("lesson_pages", $newpage); - if (!$newpageid) { - print_error('cannotinsertpage', 'lesson'); - } // update the linked list - if (!$DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->id))) { - print_error('cannotupdatelink', 'lesson'); - } + $DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->id)); } } // reset $pageid and put the page ID in $question, used in save_question_option() diff --git a/mod/lesson/highscores.php b/mod/lesson/highscores.php index d2ba6a4780..c955773b05 100644 --- a/mod/lesson/highscores.php +++ b/mod/lesson/highscores.php @@ -116,9 +116,7 @@ $newhighscore->gradeid = $newgrade->id; $newhighscore->nickname = $name; - if (!$DB->insert_record('lesson_high_scores', $newhighscore)) { - print_error('cannotinserthighscore', 'lesson'); - } + $DB->insert_record('lesson_high_scores', $newhighscore); // Log it add_to_log($course->id, 'lesson', 'update highscores', "highscores.php?id=$cm->id", $name, $cm->id); diff --git a/mod/lesson/importppt.php b/mod/lesson/importppt.php index 44662e3094..ff69e1515a 100644 --- a/mod/lesson/importppt.php +++ b/mod/lesson/importppt.php @@ -543,15 +543,11 @@ function lesson_save_objects($branchtables, $lessonid, $after) { $branchtable->page->prevpageid = $prevpageid; // insert the page - if(!$id = $DB->insert_record('lesson_pages', $branchtable->page)) { - print_error('cannotinsertpage', 'lesson'); - } + $id = $DB->insert_record('lesson_pages', $branchtable->page); // 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('cannotupdatepage', 'lesson'); - } + $DB->set_field("lesson_pages", "nextpageid", $id, array("id" => $prevpageid)); } // insert the answers @@ -565,9 +561,7 @@ function lesson_save_objects($branchtables, $lessonid, $after) { // 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('cannotupdatepage', 'lesson'); - } + $DB->set_field("lesson_pages", "prevpageid", $id, array("id" => $nextpageid)); } return true; @@ -581,9 +575,7 @@ function book_save_objects($chapters, $bookid, $pageid='0') { // nothing fancy, just save them all in order foreach ($chapters as $chapter) { - if (!$chapter->id = $DB->insert_record('book_chapters', $chapter)) { - print_error('cannotupdatebook', 'lesson'); - } + $chapter->id = $DB->insert_record('book_chapters', $chapter); } return true; } diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 590a82b8c9..848de15e2b 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -326,9 +326,7 @@ $startlesson->starttime = time(); $startlesson->lessontime = time(); - if (!$DB->insert_record('lesson_timer', $startlesson)) { - print_error('cannotinserttimer', 'lesson'); - } + $DB->insert_record('lesson_timer', $startlesson); if ($lesson->timed) { lesson_set_message(get_string('maxtimewarning', 'lesson', $lesson->maxtime), 'center'); } diff --git a/mod/survey/save.php b/mod/survey/save.php index a405d4969f..bcc9e6202e 100644 --- a/mod/survey/save.php +++ b/mod/survey/save.php @@ -84,9 +84,7 @@ $newdata->answer2 = ""; } - if (! $DB->insert_record("survey_answers", $newdata)) { - print_error('cannotinsertanswer', 'survey'); - } + $DB->insert_record("survey_answers", $newdata); } // Print the page and finish up. -- 2.39.5