fixing some warnings
[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*/
85c375c3 13
e586cfb4 14 require_once("../config.php");
516cf3eb 15 require_once("editlib.php");
16
b72ff476 17 list($thispageurl, $courseid, $cmid, $cm, $module, $pagevars) = question_edit_setup();
36e298bc 18
e586cfb4 19 if (! $course = get_record("course", "id", $courseid)) {
516cf3eb 20 error("This course doesn't exist");
21 }
3765fd53 22 $context = get_context_instance(CONTEXT_COURSE, $courseid);
3765fd53 23
516cf3eb 24
70c01adb 25 $streditingquestions = get_string('editquestions', "quiz");
b72ff476 26 if ($cm!==null) {
17d6a25e 27 $strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))
b72ff476 28 ? update_module_button($cm->id, $course->id, get_string('modulename', $cm->modname))
70c01adb 29 : "";
b72ff476 30 $crumbs = array();
31 $crumbs[] = array('name' => get_string('modulenameplural', $cm->modname), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/index.php?id=$course->id", 'type' => 'activity');
32 $crumbs[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?cmid={$cm->id}", 'type' => 'title');
33 $crumbs[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
34 $navigation = build_navigation($crumbs);
35 print_header_simple($streditingquestions, '', $navigation, "", "", true, $strupdatemodule);
70c01adb 36
37 $currenttab = 'edit';
38 $mode = 'questions';
b72ff476 39 ${$cm->modname} = $module;
40 include($CFG->dirroot."/mod/$cm->modname/tabs.php");
70c01adb 41 } else {
b72ff476 42 // Print basic page layout.
43 $crumbs = array();
44 $crumbs[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
45 $navigation = build_navigation($crumbs);
46
47 print_header_simple($streditingquestions, '', $navigation);
48
70c01adb 49 // print tabs
50 $currenttab = 'questions';
51 include('tabs.php');
52 }
b72ff476 53
54
09275894 55 echo '<table class="boxaligncenter" border="0" cellpadding="2" cellspacing="0">';
e586cfb4 56 echo '<tr><td valign="top">';
516cf3eb 57
36e298bc 58 question_showbank($thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'],
59 $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
516cf3eb 60
61 echo '</td></tr>';
62 echo '</table>';
63
516cf3eb 64 print_footer($course);
65?>