MDL-20636 updates to view/renderer code

This commit is contained in:
Dean Lennard 2011-05-03 13:45:37 +01:00 committed by Tim Hunt
parent 06eb64b8ba
commit 213d4cff9c
2 changed files with 11 additions and 7 deletions

View File

@ -660,6 +660,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
// 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 @@ class mod_quiz_renderer extends plugin_renderer_base {
// 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 File

@ -133,12 +133,9 @@ if ($attempts) {
$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->feedbackcolumn = $feedbackcolumn;
$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,