1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
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.
|
|
|
14 |
//
|
|
|
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/>.
|
|
|
17 |
|
|
|
18 |
/**
|
|
|
19 |
* Preview the assessment form.
|
|
|
20 |
*
|
|
|
21 |
* @package mod_workshop
|
|
|
22 |
* @copyright 2009 David Mudrak <david.mudrak@gmail.com>
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
require(__DIR__.'/../../config.php');
|
|
|
27 |
require_once(__DIR__.'/locallib.php');
|
|
|
28 |
|
|
|
29 |
$cmid = required_param('cmid', PARAM_INT);
|
|
|
30 |
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
|
|
|
31 |
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
|
|
32 |
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
|
|
|
33 |
|
|
|
34 |
require_login($course, false, $cm);
|
|
|
35 |
if (isguestuser()) {
|
|
|
36 |
throw new \moodle_exception('guestsarenotallowed');
|
|
|
37 |
}
|
|
|
38 |
$workshop = new workshop($workshop, $cm, $course);
|
|
|
39 |
|
|
|
40 |
require_capability('mod/workshop:editdimensions', $workshop->context);
|
|
|
41 |
$PAGE->set_url($workshop->previewform_url());
|
|
|
42 |
$PAGE->set_title($workshop->name);
|
|
|
43 |
$PAGE->set_heading($course->fullname);
|
|
|
44 |
$PAGE->navbar->add(get_string('editingassessmentform', 'workshop'), $workshop->editform_url(), navigation_node::TYPE_CUSTOM);
|
|
|
45 |
$PAGE->navbar->add(get_string('previewassessmentform', 'workshop'));
|
|
|
46 |
$PAGE->set_secondary_active_tab('workshopassessement');
|
|
|
47 |
$PAGE->activityheader->set_attrs([
|
|
|
48 |
"hidecompletion" => true,
|
|
|
49 |
"description" => ''
|
|
|
50 |
]);
|
|
|
51 |
$currenttab = 'editform';
|
|
|
52 |
|
|
|
53 |
// load the grading strategy logic
|
|
|
54 |
$strategy = $workshop->grading_strategy_instance();
|
|
|
55 |
|
|
|
56 |
// load the assessment form
|
|
|
57 |
$mform = $strategy->get_assessment_form($workshop->editform_url(), 'preview');
|
|
|
58 |
|
|
|
59 |
// output starts here
|
|
|
60 |
echo $OUTPUT->header();
|
|
|
61 |
echo $OUTPUT->heading(get_string('assessmentform', 'workshop'), 3);
|
|
|
62 |
$mform->display();
|
|
|
63 |
echo $OUTPUT->footer();
|