MDL-29195 Remove duplicate Participants -> Notes from navbar
[moodle.git] / mod / workshop / editformpreview.php
bloba1185d46e610e9b544d2f576ad9384320dd27735
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Preview the assessment form.
21 * @package mod
22 * @subpackage workshop
23 * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
28 require_once(dirname(__FILE__).'/locallib.php');
30 $cmid = required_param('cmid', PARAM_INT);
31 $cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
32 $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
33 $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
35 require_login($course, false, $cm);
36 if (isguestuser()) {
37 print_error('guestsarenotallowed');
39 $workshop = new workshop($workshop, $cm, $course);
41 require_capability('mod/workshop:editdimensions', $workshop->context);
42 $PAGE->set_url($workshop->previewform_url());
43 $PAGE->set_title($workshop->name);
44 $PAGE->set_heading($course->fullname);
45 $PAGE->navbar->add(get_string('editingassessmentform', 'workshop'), $workshop->editform_url(), navigation_node::TYPE_CUSTOM);
46 $PAGE->navbar->add(get_string('previewassessmentform', 'workshop'));
47 $currenttab = 'editform';
49 // load the grading strategy logic
50 $strategy = $workshop->grading_strategy_instance();
52 // load the assessment form
53 $mform = $strategy->get_assessment_form($workshop->editform_url(), 'preview');
55 // output starts here
56 echo $OUTPUT->header();
57 echo $OUTPUT->heading(get_string('assessmentform', 'workshop'), 2);
58 $mform->display();
59 echo $OUTPUT->footer();