Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / question / edit.php
blob9edd5cd7ff6f5344f3ca29a31cdfb8c5f67b6c1d
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, $courseid, $cmid, $cm, $module, $pagevars) = question_edit_setup();
19 if (! $course = get_record("course", "id", $courseid)) {
20 error("This course doesn't exist");
22 $context = get_context_instance(CONTEXT_COURSE, $courseid);
25 $streditingquestions = get_string('editquestions', "quiz");
26 if ($cm!==null) {
27 $strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))
28 ? update_module_button($cm->id, $course->id, get_string('modulename', $cm->modname))
29 : "";
30 $navlinks = array();
31 $navlinks[] = array('name' => get_string('modulenameplural', $cm->modname), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/index.php?id=$course->id", 'type' => 'activity');
32 $navlinks[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?cmid={$cm->id}", 'type' => 'title');
33 $navlinks[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
34 $navigation = build_navigation($navlinks);
35 print_header_simple($streditingquestions, '', $navigation, "", "", true, $strupdatemodule);
37 $currenttab = 'edit';
38 $mode = 'questions';
39 ${$cm->modname} = $module;
40 include($CFG->dirroot."/mod/$cm->modname/tabs.php");
41 } else {
42 // Print basic page layout.
43 $navlinks = array();
44 $navlinks[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
45 $navigation = build_navigation($navlinks);
47 print_header_simple($streditingquestions, '', $navigation);
49 // print tabs
50 $currenttab = 'questions';
51 include('tabs.php');
55 echo '<table class="boxaligncenter" border="0" cellpadding="2" cellspacing="0">';
56 echo '<tr><td valign="top">';
58 question_showbank($thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'],
59 $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
61 echo '</td></tr>';
62 echo '</table>';
64 print_footer($course);