moodle/question/edit.php

66 lines
2.6 KiB
PHP
Raw Normal View History

<?php // $Id$
/**
* Page to edit the question bank
*
* TODO: add logging
*
* @author Martin Dougiamas and many others. This has recently been extensively
* rewritten by Gustav Delius and other members of the Serving Mathematics project
* {@link http://maths.york.ac.uk/serving_maths}
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package questionbank
*/
require_once("../config.php");
require_once("editlib.php");
list($thispageurl, $courseid, $cmid, $cm, $module, $pagevars) = question_edit_setup();
if (! $course = get_record("course", "id", $courseid)) {
error("This course doesn't exist");
}
$context = get_context_instance(CONTEXT_COURSE, $courseid);
2006-03-01 09:30:21 +00:00
$streditingquestions = get_string('editquestions', "quiz");
if ($cm!==null) {
2006-09-13 09:08:14 +00:00
$strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))
? update_module_button($cm->id, $course->id, get_string('modulename', $cm->modname))
2006-03-01 09:30:21 +00:00
: "";
$crumbs = array();
$crumbs[] = array('name' => get_string('modulenameplural', $cm->modname), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/index.php?id=$course->id", 'type' => 'activity');
$crumbs[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?cmid={$cm->id}", 'type' => 'title');
$crumbs[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
$navigation = build_navigation($crumbs);
print_header_simple($streditingquestions, '', $navigation, "", "", true, $strupdatemodule);
2006-03-01 09:30:21 +00:00
$currenttab = 'edit';
$mode = 'questions';
${$cm->modname} = $module;
include($CFG->dirroot."/mod/$cm->modname/tabs.php");
2006-03-01 09:30:21 +00:00
} else {
// Print basic page layout.
$crumbs = array();
$crumbs[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title');
$navigation = build_navigation($crumbs);
print_header_simple($streditingquestions, '', $navigation);
2006-03-01 09:30:21 +00:00
// print tabs
$currenttab = 'questions';
include('tabs.php');
}
2007-01-09 09:07:16 +00:00
echo '<table class="boxaligncenter" border="0" cellpadding="2" cellspacing="0">';
echo '<tr><td valign="top">';
question_showbank($thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'],
$pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
echo '</td></tr>';
echo '</table>';
print_footer($course);
?>