$viewobj->timenow = $timenow; $viewobj->numattempts = $numattempts; $viewobj->mygrade = $mygrade; $viewobj->moreattempts = $unfinished || !$accessmanager->is_finished($numattempts, $lastfinishedattempt); $viewobj->mygradeoverridden = $mygradeoverridden; $viewobj->gradebookfeedback = $gradebookfeedback; $viewobj->lastfinishedattempt = $lastfinishedattempt; $viewobj->canedit = has_capability('mod/quiz:manage', $context); $viewobj->editurl = new moodle_url('/mod/quiz/edit.php', array('cmid' => $cm->id)); $viewobj->backtocourseurl = new moodle_url('/course/view.php', array('id' => $course->id)); $viewobj->startattempturl = $quizobj->start_attempt_url(); $viewobj->startattemptwarning = $quizobj->confirm_start_attempt_message($unfinished); $viewobj->popuprequired = $accessmanager->attempt_must_be_in_popup(); $viewobj->popupoptions = $accessmanager->get_popup_options(); // Display information about this quiz. $viewobj->infomessages = $viewobj->accessmanager->describe_rules(); if ($quiz->attempts != 1) { $viewobj->infomessages[] = get_string('gradingmethod', 'quiz', quiz_get_grading_option_name($quiz->grademethod)); } // Determine wheter a start attempt button should be displayed. $viewobj->quizhasquestions = (bool) quiz_clean_layout($quiz->questions, true); $viewobj->preventmessages = array(); if (!$viewobj->quizhasquestions) { $viewobj->buttontext = ''; } else {