Fixing drift between CVS and git

This commit is contained in:
Moodle HQ git importer 2009-05-07 00:35:40 +00:00
parent f3bdfe4be8
commit a54bf344c8
6 changed files with 10 additions and 33 deletions

View file

@ -38,9 +38,7 @@
$newpageid = $DB->insert_record("lesson_pages", $newpage); $newpageid = $DB->insert_record("lesson_pages", $newpage);
// update the linked list... // update the linked list...
if ($pageid != 0) { if ($pageid != 0) {
if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid))) { $DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid));
print_error('cannotupdatelink', 'lesson');
}
} }
if ($pageid == 0) { if ($pageid == 0) {
@ -48,9 +46,7 @@
} }
if ($page->nextpageid) { if ($page->nextpageid) {
// the new page is not the last page // the new page is not the last page
if (!$DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid))) { $DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid));
print_error('cannotupdatelink', 'lesson');
}
} }
// ..and the single "answer" // ..and the single "answer"
$newanswer = new stdClass; $newanswer = new stdClass;

View file

@ -39,14 +39,10 @@
$newpage->contents = get_string("endofbranch", "lesson"); $newpage->contents = get_string("endofbranch", "lesson");
$newpageid = $DB->insert_record("lesson_pages", $newpage); $newpageid = $DB->insert_record("lesson_pages", $newpage);
// update the linked list... // update the linked list...
if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid))) { $DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid));
print_error('cannotupdatelink', 'lesson');
}
if ($page->nextpageid) { if ($page->nextpageid) {
// the new page is not the last page // the new page is not the last page
if (!$DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid))) { $DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid));
print_error('cannotupdatelink', 'lesson');
}
} }
// ..and the single "answer" // ..and the single "answer"
$newanswer = new stdClass; $newanswer = new stdClass;

View file

@ -30,14 +30,10 @@
$newpage->contents = get_string("endofclustertitle", "lesson"); $newpage->contents = get_string("endofclustertitle", "lesson");
$newpageid = $DB->insert_record("lesson_pages", $newpage); $newpageid = $DB->insert_record("lesson_pages", $newpage);
// update the linked list... // update the linked list...
if (!$DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid))) { $DB->set_field("lesson_pages", "nextpageid", $newpageid, array("id" => $pageid));
print_error('cannotupdatelink', 'lesson');
}
if ($page->nextpageid) { if ($page->nextpageid) {
// the new page is not the last page // the new page is not the last page
if (!$DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid))) { $DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $page->nextpageid));
print_error('cannotupdatelink', 'lesson');
}
} }
// ..and the single "answer" // ..and the single "answer"
$newanswer = new stdClass; $newanswer = new stdClass;

View file

@ -109,13 +109,8 @@
$newpage->contents = trim($form->contents); $newpage->contents = trim($form->contents);
$newpage->title = $newpage->title; $newpage->title = $newpage->title;
$newpageid = $DB->insert_record("lesson_pages", $newpage); $newpageid = $DB->insert_record("lesson_pages", $newpage);
if (!$newpageid) {
print_error('cannotfindfirstpage', 'lesson');
}
// update the linked list // update the linked list
if (!$DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $newpage->nextpageid))) { $DB->set_field("lesson_pages", "prevpageid", $newpageid, array("id" => $newpage->nextpageid));
print_error('cannotupdatelink', 'lesson');
}
} }
} }
// now add the answers // now add the answers

View file

@ -47,9 +47,7 @@
$page->contents = trim($form->contents); $page->contents = trim($form->contents);
$page->title = $page->title; $page->title = $page->title;
if (!$DB->update_record("lesson_pages", $page)) { $DB->update_record("lesson_pages", $page);
print_error('cannotupdatepage', 'lesson');
}
if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_ESSAY || $page->qtype == LESSON_CLUSTER || $page->qtype == LESSON_ENDOFCLUSTER) { if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_ESSAY || $page->qtype == LESSON_CLUSTER || $page->qtype == LESSON_ENDOFCLUSTER) {
// there's just a single answer with a jump // there's just a single answer with a jump
$oldanswer = new stdClass; $oldanswer = new stdClass;

View file

@ -181,9 +181,7 @@
//Fix the forwards link of the previous page //Fix the forwards link of the previous page
if ($prevpageid) { if ($prevpageid) {
if (!$DB->set_field("lesson_pages", "nextpageid", $newid, array("id"=>$prevpageid))) { $DB->set_field("lesson_pages", "nextpageid", $newid, array("id"=>$prevpageid));
print_error('cannotupdatepage', 'lesson');
}
} }
$prevpageid = $newid; $prevpageid = $newid;
@ -251,9 +249,7 @@
// change the absolute page id // change the absolute page id
$page = backup_getid($restore->backup_unique_code,"lesson_pages",$answer->jumpto); $page = backup_getid($restore->backup_unique_code,"lesson_pages",$answer->jumpto);
if ($page) { if ($page) {
if (!$DB->set_field("lesson_answers", "jumpto", $page->new_id, array("id"=>$answer->id))) { $DB->set_field("lesson_answers", "jumpto", $page->new_id, array("id"=>$answer->id));
print_error('cannotresetjump', 'lesson');
}
} }
} }
} }