Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-20636 updates to view/renderer code

  • Loading branch information...
commit 213d4cff9c23eb0d980c322e9bd80a59a910cc22 1 parent 06eb64b
authored May 03, 2011 timhunt committed May 09, 2011
3  mod/quiz/renderer.php
@@ -660,6 +660,7 @@ private function view_attempt_button($course, $quiz, $cm, $context, $viewobj){
660 660
         // Determine if we should be showing a start/continue attempt button,
661 661
         // or a button to go back to the course page.
662 662
         $output .= $this->box_start('quizattempt');
  663
+        $output .= 'TEST';
663 664
         $buttontext = ''; // This will be set something if as start/continue attempt button should appear.
664 665
         if (!quiz_clean_layout($quiz->questions, true)) {
665 666
             $output .= quiz_no_questions_message($quiz, $cm, $context);
@@ -703,7 +704,7 @@ private function view_attempt_button($course, $quiz, $cm, $context, $viewobj){
703 704
         
704 705
         // Now actually print the appropriate button.
705 706
         if ($buttontext) {
706  
-            $viewobj->accessmanager->print_start_attempt_button($viewobj->canpreview, $buttontext, $viewobj->unfinished);
  707
+            $output .= $viewobj->accessmanager->print_start_attempt_button($viewobj->canpreview, $buttontext, $viewobj->unfinished);
707 708
         } else if ($buttontext === '') {
708 709
             $output .= $this->single_button(new moodle_url('/course/view.php', array('id' => $course->id)),
709 710
                     get_string('backtocourse', 'quiz'), 'get', array('class' => 'continuebutton'));
15  mod/quiz/view.php
@@ -133,12 +133,9 @@
133 133
 
134 134
 $moreattempts = $unfinished || !$accessmanager->is_finished($numattempts, $lastfinishedattempt);
135 135
 
136  
-$title = $course->shortname . ': ' . format_string($quiz->name);
137  
-$PAGE->set_title($title);
138  
-$PAGE->set_heading($course->fullname);
139  
-$output = $PAGE->get_renderer('mod_quiz');
140  
-echo $OUTPUT->header();
141  
-
  136
+/*
  137
+ * Create view object for use within renderers file
  138
+ */
142 139
 $viewobj->attempts = $attempts;
143 140
 $viewobj->accessmanager = $accessmanager;
144 141
 $viewobj->canattempt = $canattempt;
@@ -160,6 +157,12 @@
160 157
 $viewobj->unfinished = $unfinished;
161 158
 $viewobj->lastfinishedattempt = $lastfinishedattempt;
162 159
 
  160
+$title = $course->shortname . ': ' . format_string($quiz->name);
  161
+$PAGE->set_title($title);
  162
+$PAGE->set_heading($course->fullname);
  163
+$output = $PAGE->get_renderer('mod_quiz');
  164
+echo $OUTPUT->header();
  165
+
163 166
 echo $output->view_page($course, $quiz, $cm, $context, $viewobj);
164 167
 
165 168
 // Mark module as viewed (note, we do this here and not in finish_page,

0 notes on commit 213d4cf

Please sign in to comment.
Something went wrong with that request. Please try again.