Permalink
Browse files

MDL-20636 updates to view/renderer code

  • Loading branch information...
Dean Lennard authored and timhunt committed May 3, 2011
1 parent 06eb64b commit 213d4cff9c23eb0d980c322e9bd80a59a910cc22
Showing with 11 additions and 7 deletions.
  1. +2 −1 mod/quiz/renderer.php
  2. +9 −6 mod/quiz/view.php
View
@@ -660,6 +660,7 @@ private function view_attempt_button($course, $quiz, $cm, $context, $viewobj){
// Determine if we should be showing a start/continue attempt button,
// or a button to go back to the course page.
$output .= $this->box_start('quizattempt');
+ $output .= 'TEST';
$buttontext = ''; // This will be set something if as start/continue attempt button should appear.
if (!quiz_clean_layout($quiz->questions, true)) {
$output .= quiz_no_questions_message($quiz, $cm, $context);
@@ -703,7 +704,7 @@ private function view_attempt_button($course, $quiz, $cm, $context, $viewobj){
// Now actually print the appropriate button.
if ($buttontext) {
- $viewobj->accessmanager->print_start_attempt_button($viewobj->canpreview, $buttontext, $viewobj->unfinished);
+ $output .= $viewobj->accessmanager->print_start_attempt_button($viewobj->canpreview, $buttontext, $viewobj->unfinished);
} else if ($buttontext === '') {
$output .= $this->single_button(new moodle_url('/course/view.php', array('id' => $course->id)),
get_string('backtocourse', 'quiz'), 'get', array('class' => 'continuebutton'));
View
@@ -133,12 +133,9 @@
$moreattempts = $unfinished || !$accessmanager->is_finished($numattempts, $lastfinishedattempt);
-$title = $course->shortname . ': ' . format_string($quiz->name);
-$PAGE->set_title($title);
-$PAGE->set_heading($course->fullname);
-$output = $PAGE->get_renderer('mod_quiz');
-echo $OUTPUT->header();
-
+/*
+ * Create view object for use within renderers file
+ */
$viewobj->attempts = $attempts;
$viewobj->accessmanager = $accessmanager;
$viewobj->canattempt = $canattempt;
@@ -160,6 +157,12 @@
$viewobj->unfinished = $unfinished;
$viewobj->lastfinishedattempt = $lastfinishedattempt;
+$title = $course->shortname . ': ' . format_string($quiz->name);
+$PAGE->set_title($title);
+$PAGE->set_heading($course->fullname);
+$output = $PAGE->get_renderer('mod_quiz');
+echo $OUTPUT->header();
+
echo $output->view_page($course, $quiz, $cm, $context, $viewobj);
// Mark module as viewed (note, we do this here and not in finish_page,

0 comments on commit 213d4cf

Please sign in to comment.