Index: temp_moodle_dev/moodle/mod/quiz/tabs.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/tabs.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/tabs.php 14 Nov 2008 06:30:10 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/tabs.php 28 Oct 2009 07:32:02 -0000 1.2 @@ -6,6 +6,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ + if (empty($quiz)) { error('You cannot call this script in that way'); } @@ -27,24 +28,25 @@ $inactive = array(); $activated = array(); - if (has_capability('mod/quiz:view', $context)) { - $row[] = new tabobject('info', "$CFG->wwwroot/mod/quiz/view.php?q=$quiz->id", get_string('info', 'quiz')); - } - if (has_capability('mod/quiz:viewreports', $context)) { - $row[] = new tabobject('reports', "$CFG->wwwroot/mod/quiz/report.php?q=$quiz->id", get_string('results', 'quiz')); - } - if (has_capability('mod/quiz:preview', $context)) { - $row[] = new tabobject('preview', "$CFG->wwwroot/mod/quiz/attempt.php?q=$quiz->id", get_string('preview', 'quiz')); - } - if (has_capability('mod/quiz:manage', $context)) { - $row[] = new tabobject('edit', "$CFG->wwwroot/mod/quiz/edit.php?cmid=$cm->id", get_string('edit')); - } - - if ($currenttab == 'info' && count($row) == 1) { - // Don't show only an info tab (e.g. to students). - } else { - $tabs[] = $row; - } +if (has_capability('mod/quiz:view', $context)) { + $row[] = new tabobject('info', "$CFG->wwwroot/mod/quiz/view.php?q=$quiz->id", get_string('info', 'quiz')); +} +if (has_capability('mod/quiz:viewreports', $context)) { + $row[] = new tabobject('reports', "$CFG->wwwroot/mod/quiz/report.php?q=$quiz->id", get_string('results', 'quiz')); +} +if (has_capability('mod/quiz:preview', $context)) { + $row[] = new tabobject('preview', "$CFG->wwwroot/mod/quiz/attempt.php?q=$quiz->id", get_string('preview', 'quiz')); +} +if (has_capability('mod/quiz:manage', $context)) { + $row[] = new tabobject('edit', "$CFG->wwwroot/mod/quiz/edit.php?cmid=$cm->id", get_string('edit')); +} + +if ($currenttab == 'info' && count($row) == 1) { + // Don't show only an info tab (e.g. to students). +} else { + $tabs[] = $row; +} + if ($currenttab == 'reports' and isset($mode)) { $activated[] = 'reports'; @@ -66,9 +68,9 @@ $row = array(); $currenttab = ''; foreach ($reportlist as $report) { - if (!isset($reportrestrictions[$report]) || has_capability($reportrestrictions[$report], $context)) { - $row[] = new tabobject($report, "$CFG->wwwroot/mod/quiz/report.php?q=$quiz->id&mode=$report",get_string($report, 'quiz_'.$report)); - + if (!isset($reportrestrictions[$report]) || has_capability($reportrestrictions[$report], $context)) { + $row[] = new tabobject($report, "$CFG->wwwroot/mod/quiz/report.php?q=$quiz->id&mode=$report", + get_string($report, 'quiz_'.$report)); if ($report == $mode) { $currenttab = $report; } @@ -89,7 +91,7 @@ if (has_capability('mod/quiz:manage', $context) && $contexts->have_one_edit_tab_cap('editq')) { $row[] = new tabobject('editq', "$CFG->wwwroot/mod/quiz/edit.php?".$thispageurl->get_query_string(), $strquiz, $streditingquiz); } - questionbank_navigation_tabs($row, $contexts, $thispageurl->get_query_string()); + questionbank_navigation_tabs($row, $contexts, $thispageurl->get_query_string()); $tabs[] = $row; } @@ -100,5 +102,4 @@ print_tabs($tabs, $currenttab, $inactive, $activated); - ?>