diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php
index 6e85b521fcc..00d7f87b265 100644
--- a/lib/ajax/ajaxlib.php
+++ b/lib/ajax/ajaxlib.php
@@ -616,12 +616,27 @@ class required_js extends linked_requirement {
* is responsible for outputting this HTML promptly.
*/
public function asap() {
- if ($this->is_done()) {
- return;
- }
if (!$this->manager->is_head_done()) {
$this->in_head();
return '';
+ } else {
+ return $this->now();
+ }
+ }
+
+ /**
+ * Return the required JavaScript immediately, so it can be included in some
+ * HTML that is being built.
+ *
+ * This is not really recommeneded. But is necessary in some legacy code that
+ * includes a .js files that does document.write.
+ *
+ * @return string The HTML for the script tag. The caller
+ * is responsible for making sure it is output.
+ */
+ public function now() {
+ if ($this->is_done()) {
+ return '';
}
$output = $this->get_html();
$this->mark_done();
diff --git a/mod/lesson/action/continue.html b/mod/lesson/action/continue.html
index 8fd055055a6..1f78ba6d903 100644
--- a/mod/lesson/action/continue.html
+++ b/mod/lesson/action/continue.html
@@ -7,26 +7,6 @@
**/
?>
-
-
\n";
print_footer($course);
exit();
@@ -147,10 +147,10 @@
if (!empty($errors)) { // print out the errors if any
lesson_print_header($cm, $course, $lesson);
echo '
';
- print_simple_box_end();
+ print_box_end();
lesson_print_submit_link(get_string('pleaseenteryouranswerinthebox', 'lesson'), 'answerform');
break;
default: // close the tags MDL-7861
echo ('');
- print_simple_box_end();
+ print_box_end();
break;
}
if ($page->qtype != LESSON_BRANCHTABLE) { // To fix XHTML problem (BT have their own forms)
@@ -813,7 +821,7 @@
// Finish of the page
lesson_print_progress_bar($lesson, $course);
- require($CFG->dirroot.'/mod/lesson/viewend.html');
+
} else {
// end of lesson reached work out grade
@@ -833,12 +841,13 @@
$DB->update_record("lesson_timer", $timer);
}
-
+
add_to_log($course->id, "lesson", "end", "view.php?id=$cm->id", "$lesson->id", $cm->id);
-
+
+ lesson_add_pretend_blocks($PAGE, $cm, $lesson, $timer);
lesson_print_header($cm, $course, $lesson, 'view');
print_heading(get_string("congratulations", "lesson"));
- print_simple_box_start("center");
+ print_box_start('generalbox boxaligncenter');
$ntries = $DB->count_records("lesson_grades", array("lessonid"=>$lesson->id, "userid"=>$USER->id));
if (isset($USER->modattempts[$lesson->id])) {
$ntries--; // need to look at the old attempts :)
@@ -920,7 +929,7 @@
// display for teacher
echo "
".get_string("displayofgrade", "lesson")."
\n";
}
- print_simple_box_end(); //End of Lesson button to Continue.
+ print_box_end(); //End of Lesson button to Continue.
// after all the grade processing, check to see if "Show Grades" is off for the course
// if yes, redirect to the course page
diff --git a/mod/lesson/viewend.html b/mod/lesson/viewend.html
deleted file mode 100644
index f2760960a28..00000000000
--- a/mod/lesson/viewend.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-