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