]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14363 - Fix a broken redirect from mod/quiz/ attempt.php to edit.php when the...
authortjhunt <tjhunt>
Tue, 22 Apr 2008 15:19:50 +0000 (15:19 +0000)
committertjhunt <tjhunt>
Tue, 22 Apr 2008 15:19:50 +0000 (15:19 +0000)
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.

mod/quiz/attempt.php
mod/quiz/tabs.php
mod/quiz/view.php

index 31fec0ea51fe6c856e7e58710aea5744f9620c46..18c4f8d2b93fb79c563b0683da7d8fa8122f1ac9 100644 (file)
@@ -68,7 +68,7 @@
 
 /// 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.
index a6f9b75c6b6ecd8f22b1552e4d600febb2035a6e..096f61c6baa7566e7412fe6a67c1e671cbfe3a21 100644 (file)
@@ -48,7 +48,6 @@ if ($currenttab == 'info' && count($row) == 1) {
 }
 
 if ($currenttab == 'reports' and isset($mode)) {
-    $inactive[] = 'reports';
     $activated[] = 'reports';
 
     // Standard reports we want to show first.
@@ -81,7 +80,6 @@ if ($currenttab == 'reports' and isset($mode)) {
 }
 
 if ($currenttab == 'edit' and isset($mode)) {
-    $inactive[] = 'edit';
     $activated[] = 'edit';
 
     $row  = array();
@@ -98,6 +96,10 @@ if ($currenttab == 'edit' and isset($mode)) {
 
 }
 
+if (!$quiz->questions) {
+    $inactive += array('info', 'reports', 'preview');
+}
+
 print_tabs($tabs, $currenttab, $inactive, $activated);
 
 ?>
index c28ebc0ca9090dbfbc8d76f1138d1435025eb15b..b4c9b35a7bb774e2c02f3ddd4954a862c70628f7 100644 (file)
@@ -49,7 +49,7 @@
 
 /// 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.