Also, when the quiz has no questions, disable the Info, Reports and Preview tabs, which, in this case, just redirect back to the Edit tab anyway.
Finally, change a redirect in quiz view.php, which used a relative URL, to a full url starting $CFG->wwwroot.
/// if no questions have been set up yet redirect to edit.php
if (!$quiz->questions && has_capability('mod/quiz:manage', $context)) {
- redirect($CFG->wwwroot . '/mod/quiz/edit.php?quizid=' . $quiz->id);
+ redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id);
}
/// Check capabilites.
}
if ($currenttab == 'reports' and isset($mode)) {
- $inactive[] = 'reports';
$activated[] = 'reports';
// Standard reports we want to show first.
}
if ($currenttab == 'edit' and isset($mode)) {
- $inactive[] = 'edit';
$activated[] = 'edit';
$row = array();
}
+if (!$quiz->questions) {
+ $inactive += array('info', 'reports', 'preview');
+}
+
print_tabs($tabs, $currenttab, $inactive, $activated);
?>
/// If no questions have been set up yet redirect to edit.php
if (!$quiz->questions && has_capability('mod/quiz:manage', $context)) {
- redirect('edit.php?cmid='.$cm->id);
+ redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id);
}
/// Log this request.