Bumped to 1.6.8
[moodle.git] / question / edit.php
blobd13a996f133e2f76720ce7ee4bcacf803ec648f6
1 <?php // $Id$
2 /**
3 * Page to edit the question bank
5 * TODO: add logging
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
12 * @package question
14 require_once("../config.php");
15 require_once("editlib.php");
17 require_login();
19 $courseid = required_param('courseid', PARAM_INT);
21 // The optional parameter 'clean' allows us to clear module information,
22 // guaranteeing a module-independent question bank editing interface
23 if (optional_param('clean', false, PARAM_BOOL)) {
24 unset($SESSION->modform);
27 if (! $course = get_record("course", "id", $courseid)) {
28 error("This course doesn't exist");
31 require_login($course->id, false);
33 if (!isteacheredit($course->id)) {
34 error("You can't modify this course!");
37 $SESSION->returnurl = $FULLME;
39 // Print basic page layout.
41 $streditingquestions = get_string('editquestions', "quiz");
43 // TODO: generalise this to any activity
44 $strquizzes = get_string('modulenameplural', 'quiz');
45 $streditingquestions = get_string('editquestions', "quiz");
46 if (isset($SESSION->modform->instance) and $quiz = get_record('quiz', 'id', $SESSION->modform->instance)) {
47 $strupdatemodule = isteacheredit($course->id)
48 ? update_module_button($SESSION->modform->cmid, $course->id, get_string('modulename', 'quiz'))
49 : "";
50 print_header_simple($streditingquestions, '',
51 "<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
52 " -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q={$SESSION->modform->instance}\">".format_string($SESSION->modform->name).'</a>'.
53 " -> $streditingquestions",
54 "", "", true, $strupdatemodule);
56 $currenttab = 'edit';
57 $mode = 'questions';
58 $quiz = &$SESSION->modform;
59 include($CFG->dirroot.'/mod/quiz/tabs.php');
60 } else {
61 print_header_simple($streditingquestions, '',
62 "$streditingquestions");
64 // print tabs
65 $currenttab = 'questions';
66 include('tabs.php');
69 echo '<table align="center" border="0" cellpadding="2" cellspacing="0">';
70 echo '<tr><td valign="top">';
72 include($CFG->dirroot.'/question/showbank.php');
74 echo '</td></tr>';
75 echo '</table>';
77 print_footer($course);