file ongoing.html was added on branch MOODLE_15_STABLE on 2005-07-07 16:14:36 +0000
[moodle.git] / mod / quiz / tabs.php
blobc96737f987ed93c2bea19110ccf73423a142effa
1 <?php // $Id$
2 /// This file to be included so we can assume config.php has already been included.
4 if (empty($quiz)) {
5 error('You cannot call this script in that way');
7 if (!isset($currenttab)) {
8 $currenttab = '';
10 if (!isset($cm)) {
11 $cm = get_coursemodule_from_instance('quiz', $quiz->id);
13 if (!isset($course)) {
14 $course = get_record('course', 'id', $quiz->course);
17 //print_heading(format_string($quiz->name));
19 $tabs = array();
20 $row = array();
21 $inactive = array();
23 $row[] = new tabobject('info', "view.php?q=$quiz->id", get_string('info', 'quiz'));
24 $row[] = new tabobject('reports', "report.php?q=$quiz->id", get_string('reports', 'quiz'));
25 $row[] = new tabobject('preview', "attempt.php?q=$quiz->id", get_string('preview', 'quiz'));
26 if (isteacheredit($course->id)) {
27 $row[] = new tabobject('edit', "edit.php?quizid=$quiz->id", get_string('editquiz', 'quiz'));
28 //$row[] = new tabobject('update', "$CFG->wwwroot/course/mod.php?update=$cm->id&amp;sesskey=$USER->sesskey", get_string('updatethis', '', get_string('modulename', 'quiz')));
31 $tabs[] = $row;
33 if ($currenttab == 'reports' and isset($mode)) {
34 $inactive[] = 'reports';
35 $allreports = get_list_of_plugins("mod/quiz/report");
36 $reportlist = array ('overview', 'regrade', 'analysis'); // Standard reports we want to show first
38 foreach ($allreports as $report) {
39 if (!in_array($report, $reportlist)) {
40 $reportlist[] = $report;
44 $row = array();
45 $currenttab = '';
46 foreach ($reportlist as $report) {
47 $row[] = new tabobject($report, "report.php?q=$quiz->id&amp;mode=$report",
48 get_string("report$report", "quiz"));
49 if ($report == $mode) {
50 $currenttab = $report;
53 $tabs[] = $row;
56 print_tabs($tabs, $currenttab, $inactive);