MDL-20601 fixed fatal SQL upgrade error, missing {} around table names
[moodle.git] / question / edit.php
CommitLineData
516cf3eb 1<?php // $Id$
f4b879dd 2
3///////////////////////////////////////////////////////////////////////////
4// //
5// NOTICE OF COPYRIGHT //
6// //
7// Moodle - Modular Object-Oriented Dynamic Learning Environment //
8// http://moodle.org //
9// //
10// Copyright (C) 1999 onwards Martin Dougiamas and others //
11// //
12// This program is free software; you can redistribute it and/or modify //
13// it under the terms of the GNU General Public License as published by //
14// the Free Software Foundation; either version 2 of the License, or //
15// (at your option) any later version. //
16// //
17// This program is distributed in the hope that it will be useful, //
18// but WITHOUT ANY WARRANTY; without even the implied warranty of //
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20// GNU General Public License for more details: //
21// //
22// http://www.gnu.org/copyleft/gpl.html //
23// //
24///////////////////////////////////////////////////////////////////////////
25
516cf3eb 26/**
e586cfb4 27* Page to edit the question bank
516cf3eb 28*
516cf3eb 29* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
4323d029 30* @package questionbank
f4b879dd 31*//** */
85c375c3 32
e586cfb4 33 require_once("../config.php");
516cf3eb 34 require_once("editlib.php");
35
b0f4e4e4 36 $url = new moodle_url($CFG->wwwroot.'/question/edit.php');
37 if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
38 $url->param('lastchanged', $lastchanged);
39 }
40 if (($category = optional_param('category', 0, PARAM_TEXT)) !== 0) {
41 $url->param('category', $category);
42 }
43 if (($qpage = optional_param('qpage', 0, PARAM_INT)) !== 0) {
44 $url->param('qpage', $qpage);
45 }
46 if (($cat = optional_param('cat', 0, PARAM_TEXT)) !== 0) {
47 $url->param('cat', $cat);
48 }
49 if (($courseid = optional_param('courseid', 0, PARAM_INT)) !== 0) {
50 $url->param('courseid', $courseid);
51 }
52 if (($returnurl = optional_param('returnurl', 0, PARAM_INT)) !== 0) {
53 $url->param('returnurl', $returnurl);
54 }
55 $PAGE->set_url($url);
56
271e6dec 57 list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) = question_edit_setup('questions');
971c6fca 58 $questionbank = new question_bank_view($contexts, $thispageurl, $COURSE, $cm);
5bd22790 59 $questionbank->process_actions();
271e6dec 60
f4b879dd 61 // TODO log this page view.
516cf3eb 62
cd120b23 63 $localcss = '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.
64 '/lib/yui/container/assets/container.css" />';
271e6dec 65 $context = $contexts->lowest();
70c01adb 66 $streditingquestions = get_string('editquestions', "quiz");
b72ff476 67 if ($cm!==null) {
271e6dec 68 $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest())
1d58b567 69 ? $OUTPUT->update_module_button($cm->id, $cm->modname)
70c01adb 70 : "";
ea3c6b74 71 $PAGE->navbar->add(get_string('modulenameplural', $cm->modname), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/index.php', array('id'=>$COURSE->id)));
72 $PAGE->navbar->add(format_string($module->name), new moodle_url($CFG->wwwroot.'/mod/'.$cm->modname.'/view.php', array('id'=>$cm->id)));
73 $PAGE->navbar->add($streditingquestions);
74 $PAGE->set_title($streditingquestions);
75 $PAGE->set_button($strupdatemodule);
76 echo $OUTPUT->header();
70c01adb 77
78 $currenttab = 'edit';
79 $mode = 'questions';
b72ff476 80 ${$cm->modname} = $module;
81 include($CFG->dirroot."/mod/$cm->modname/tabs.php");
70c01adb 82 } else {
b72ff476 83 // Print basic page layout.
ea3c6b74 84 $PAGE->navbar->add($streditingquestions);
85 $PAGE->set_title($streditingquestions);
86 echo $OUTPUT->header();
271e6dec 87
70c01adb 88 // print tabs
89 $currenttab = 'questions';
90 include('tabs.php');
91 }
271e6dec 92
cd120b23 93 echo '<div class="questionbankwindow boxwidthwide boxaligncenter">';
5bd22790 94 $questionbank->display('questions', $pagevars['qpage'],
f4b879dd 95 $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'],
96 $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
cd120b23 97 echo "</div>\n";
516cf3eb 98
9b59580b 99 echo $OUTPUT->footer();
516cf3eb 100?>