Merge branch 'MDL-33122-master' of git://github.com/ankitagarwal/moodle
[moodle.git] / question / edit.php
blob411cb3790abaeffc42da4331ac7d50edc6253243
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Page to edit the question bank
20 * @package moodlecore
21 * @subpackage questionbank
22 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 require_once(dirname(__FILE__) . '/../config.php');
28 require_once($CFG->dirroot . '/question/editlib.php');
30 $url = new moodle_url('/question/edit.php');
31 if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
32 $url->param('lastchanged', $lastchanged);
34 if (($category = optional_param('category', 0, PARAM_TEXT)) !== 0) {
35 $url->param('category', $category);
37 if (($qpage = optional_param('qpage', 0, PARAM_INT)) !== 0) {
38 $url->param('qpage', $qpage);
40 if (($cat = optional_param('cat', 0, PARAM_TEXT)) !== 0) {
41 $url->param('cat', $cat);
43 if (($courseid = optional_param('courseid', 0, PARAM_INT)) !== 0) {
44 $url->param('courseid', $courseid);
46 if (($returnurl = optional_param('returnurl', 0, PARAM_INT)) !== 0) {
47 $url->param('returnurl', $returnurl);
49 if (($cmid = optional_param('cmid', 0, PARAM_INT)) !== 0) {
50 $url->param('cmid', $cmid);
52 $PAGE->set_url($url);
54 list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
55 question_edit_setup('questions', '/question/edit.php');
56 $questionbank = new question_bank_view($contexts, $thispageurl, $COURSE, $cm);
57 $questionbank->process_actions();
59 // TODO log this page view.
61 $context = $contexts->lowest();
62 $streditingquestions = get_string('editquestions', 'question');
63 $PAGE->set_title($streditingquestions);
64 $PAGE->set_heading($COURSE->fullname);
65 echo $OUTPUT->header();
67 echo '<div class="questionbankwindow boxwidthwide boxaligncenter">';
68 $questionbank->display('questions', $pagevars['qpage'], $pagevars['qperpage'],
69 $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'],
70 $pagevars['qbshowtext']);
71 echo "</div>\n";
73 echo $OUTPUT->footer();