change to print_paging_bar function to optionally support the use of a moodle_url...
[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*
516cf3eb 7* @author Martin Dougiamas and many others. This has recently been extensively
8* rewritten by Gustav Delius and other members of the Serving Mathematics project
9* {@link http://maths.york.ac.uk/serving_maths}
10* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
4323d029 11* @package questionbank
516cf3eb 12*/
e586cfb4 13 require_once("../config.php");
516cf3eb 14 require_once("editlib.php");
15
16 require_login();
17
b1f00c89 18 $courseid = required_param('courseid', PARAM_INT);
516cf3eb 19
2662cf46 20 // The optional parameter 'clean' allows us to clear module information,
21 // guaranteeing a module-independent question bank editing interface
22 if (optional_param('clean', false, PARAM_BOOL)) {
23 unset($SESSION->modform);
24 }
25
e586cfb4 26 if (! $course = get_record("course", "id", $courseid)) {
516cf3eb 27 error("This course doesn't exist");
28 }
3765fd53 29 $context = get_context_instance(CONTEXT_COURSE, $courseid);
516cf3eb 30 require_login($course->id, false);
3765fd53 31
2662cf46 32 $SESSION->returnurl = $FULLME;
516cf3eb 33
516cf3eb 34 // Print basic page layout.
e586cfb4 35 $streditingquestions = get_string('editquestions', "quiz");
567709c4 36
70c01adb 37 // TODO: generalise this to any activity
38 $strquizzes = get_string('modulenameplural', 'quiz');
39 $streditingquestions = get_string('editquestions', "quiz");
40 if (isset($SESSION->modform->instance) and $quiz = get_record('quiz', 'id', $SESSION->modform->instance)) {
17d6a25e 41 $strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))
70c01adb 42 ? update_module_button($SESSION->modform->cmid, $course->id, get_string('modulename', 'quiz'))
43 : "";
44 print_header_simple($streditingquestions, '',
45 "<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
2662cf46 46 " -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q={$SESSION->modform->instance}\">".format_string($SESSION->modform->name).'</a>'.
70c01adb 47 " -> $streditingquestions",
48 "", "", true, $strupdatemodule);
49
50 $currenttab = 'edit';
51 $mode = 'questions';
52 $quiz = &$SESSION->modform;
53 include($CFG->dirroot.'/mod/quiz/tabs.php');
54 } else {
55 print_header_simple($streditingquestions, '',
56 "$streditingquestions");
57
58 // print tabs
59 $currenttab = 'questions';
60 include('tabs.php');
61 }
567709c4 62
09275894 63 echo '<table class="boxaligncenter" border="0" cellpadding="2" cellspacing="0">';
e586cfb4 64 echo '<tr><td valign="top">';
516cf3eb 65
e586cfb4 66 include($CFG->dirroot.'/question/showbank.php');
516cf3eb 67
68 echo '</td></tr>';
69 echo '</table>';
70
516cf3eb 71 print_footer($course);
72?>