$CFG->tabselectedtofront is out. Part of MDL-8746
[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
b1f00c89 19 $courseid = required_param('courseid', PARAM_INT);
516cf3eb 20
2662cf46 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);
25 }
26
e586cfb4 27 if (! $course = get_record("course", "id", $courseid)) {
516cf3eb 28 error("This course doesn't exist");
29 }
3765fd53 30 $context = get_context_instance(CONTEXT_COURSE, $courseid);
516cf3eb 31 require_login($course->id, false);
3765fd53 32
2662cf46 33 $SESSION->returnurl = $FULLME;
36703ed7 34 $SESSION->fromurl = $FULLME;
516cf3eb 35
516cf3eb 36 // Print basic page layout.
37
e586cfb4 38 $streditingquestions = get_string('editquestions', "quiz");
567709c4 39
70c01adb 40 // TODO: generalise this to any activity
41 $strquizzes = get_string('modulenameplural', 'quiz');
42 $streditingquestions = get_string('editquestions', "quiz");
43 if (isset($SESSION->modform->instance) and $quiz = get_record('quiz', 'id', $SESSION->modform->instance)) {
17d6a25e 44 $strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))
70c01adb 45 ? update_module_button($SESSION->modform->cmid, $course->id, get_string('modulename', 'quiz'))
46 : "";
47 print_header_simple($streditingquestions, '',
48 "<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
2662cf46 49 " -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q={$SESSION->modform->instance}\">".format_string($SESSION->modform->name).'</a>'.
70c01adb 50 " -> $streditingquestions",
51 "", "", true, $strupdatemodule);
52
53 $currenttab = 'edit';
54 $mode = 'questions';
55 $quiz = &$SESSION->modform;
56 include($CFG->dirroot.'/mod/quiz/tabs.php');
57 } else {
58 print_header_simple($streditingquestions, '',
59 "$streditingquestions");
60
61 // print tabs
62 $currenttab = 'questions';
63 include('tabs.php');
64 }
567709c4 65
09275894 66 echo '<table class="boxaligncenter" border="0" cellpadding="2" cellspacing="0">';
e586cfb4 67 echo '<tr><td valign="top">';
516cf3eb 68
e586cfb4 69 include($CFG->dirroot.'/question/showbank.php');
516cf3eb 70
71 echo '</td></tr>';
72 echo '</table>';
73
516cf3eb 74 print_footer($course);
75?>