MDL-20927 fixed module login issue
[moodle.git] / question / edit.php
blobab82c42fdcd4d3e7ffe426405db755772e7a200f
1 <?php // $Id$
2 /**
3 * Page to edit the question bank
5 * TODO: add logging
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
11 * @package questionbank
14 require_once("../config.php");
15 require_once("editlib.php");
17 list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) = question_edit_setup('questions');
19 question_showbank_actions($thispageurl, $cm);
21 $context = $contexts->lowest();
22 $streditingquestions = get_string('editquestions', "quiz");
23 if ($cm!==null) {
24 $strupdatemodule = has_capability('moodle/course:manageactivities', $contexts->lowest())
25 ? update_module_button($cm->id, $COURSE->id, get_string('modulename', $cm->modname))
26 : "";
27 $navlinks = array();
28 $navlinks[] = array('name' => get_string('modulenameplural', $cm->modname), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/index.php?id=$COURSE->id", 'type' => 'activity');
29 $navlinks[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?id={$cm->id}", 'type' => 'title');
30 $navlinks[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
31 $navigation = build_navigation($navlinks);
32 print_header_simple($streditingquestions, '', $navigation, "", "", true, $strupdatemodule);
34 $currenttab = 'edit';
35 $mode = 'questions';
36 ${$cm->modname} = $module;
37 include($CFG->dirroot."/mod/$cm->modname/tabs.php");
38 } else {
39 // Print basic page layout.
40 $navlinks = array();
41 $navlinks[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
42 $navigation = build_navigation($navlinks);
44 print_header_simple($streditingquestions, '', $navigation);
46 // print tabs
47 $currenttab = 'questions';
48 include('tabs.php');
52 echo '<table class="boxaligncenter" border="0" cellpadding="2" cellspacing="0">';
53 echo '<tr><td valign="top">';
55 question_showbank('questions', $contexts, $thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'],
56 $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
58 echo '</td></tr>';
59 echo '</table>';
61 print_footer($COURSE);