Skip to content

Commit

Permalink
MDL-20636 updates to view/renderer code
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Lennard authored and timhunt committed May 9, 2011
1 parent 06eb64b commit 213d4cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion mod/quiz/renderer.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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'));
Expand Down
15 changes: 9 additions & 6 deletions mod/quiz/view.php
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 213d4cf

Please sign in to comment.