Adding the new h2.header
[moodle.git] / question / edit.php
CommitLineData
516cf3eb 1<?php // $Id$
2/**
e586cfb4 3* Page to edit the question bank
516cf3eb 4*
e586cfb4 5* TODO: add logging
516cf3eb 6*
7* @version $Id$
8* @author Martin Dougiamas and many others. This has recently been extensively
9* rewritten by Gustav Delius and other members of the Serving Mathematics project
10* {@link http://maths.york.ac.uk/serving_maths}
11* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
e586cfb4 12* @package question
516cf3eb 13*/
e586cfb4 14 require_once("../config.php");
516cf3eb 15 require_once("editlib.php");
16
17 require_login();
18
e586cfb4 19 $courseid = required_param('courseid', 0, PARAM_INT);
516cf3eb 20
e586cfb4 21 if (! $course = get_record("course", "id", $courseid)) {
516cf3eb 22 error("This course doesn't exist");
23 }
24
25 require_login($course->id, false);
26
27 if (!isteacheredit($course->id)) {
28 error("You can't modify this course!");
29 }
30
516cf3eb 31 // Print basic page layout.
32
e586cfb4 33 $streditingquestions = get_string('editquestions', "quiz");
567709c4 34
70c01adb 35 // TODO: generalise this to any activity
36 $strquizzes = get_string('modulenameplural', 'quiz');
37 $streditingquestions = get_string('editquestions', "quiz");
38 if (isset($SESSION->modform->instance) and $quiz = get_record('quiz', 'id', $SESSION->modform->instance)) {
39 $strupdatemodule = isteacheredit($course->id)
40 ? update_module_button($SESSION->modform->cmid, $course->id, get_string('modulename', 'quiz'))
41 : "";
42 print_header_simple($streditingquestions, '',
43 "<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
44 " -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q=$SESSION->modform->instance\">".format_string($SESSION->modform->name).'</a>'.
45 " -> $streditingquestions",
46 "", "", true, $strupdatemodule);
47
48 $currenttab = 'edit';
49 $mode = 'questions';
50 $quiz = &$SESSION->modform;
51 include($CFG->dirroot.'/mod/quiz/tabs.php');
52 } else {
53 print_header_simple($streditingquestions, '',
54 "$streditingquestions");
55
56 // print tabs
57 $currenttab = 'questions';
58 include('tabs.php');
59 }
567709c4 60
e586cfb4 61 echo '<table align="center" border="0" cellpadding="2" cellspacing="0">';
62 echo '<tr><td valign="top">';
516cf3eb 63
e586cfb4 64 include($CFG->dirroot.'/question/showbank.php');
516cf3eb 65
66 echo '</td></tr>';
67 echo '</table>';
68
516cf3eb 69 print_footer($course);
70?>