2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * print a printview of feedback-items
20 * @author Andreas Grabs
21 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
22 * @package mod_feedback
25 require_once("../../config.php");
26 require_once("lib.php");
28 $id = required_param('id', PARAM_INT
);
29 $courseid = optional_param('courseid', false, PARAM_INT
); // Course where this feedback is mapped to - used for return link.
31 $PAGE->set_url('/mod/feedback/print.php', array('id'=>$id));
33 list($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback');
34 require_course_login($course, true, $cm);
36 // This page should be only displayed to users with capability to edit or view reports (to include non-editing teachers too).
37 $context = context_module
::instance($cm->id
);
39 'mod/feedback:edititems',
40 'mod/feedback:viewreports',
42 if (!has_any_capability($capabilities, $context)) {
43 $capability = 'mod/feedback:edititems';
44 if (has_capability($capability, $context)) {
45 $capability = 'mod/feedback:viewreports';
47 throw new required_capability_exception($context, $capability, 'nopermissions', '');
50 $feedback = $PAGE->activityrecord
;
51 $feedbackstructure = new mod_feedback_structure($feedback, $cm, $courseid);
53 $PAGE->set_pagelayout('popup');
55 // Print the page header.
56 $strfeedbacks = get_string("modulenameplural", "feedback");
57 $strfeedback = get_string("modulename", "feedback");
59 $feedback_url = new moodle_url('/mod/feedback/index.php', array('id'=>$course->id
));
60 $PAGE->navbar
->add($strfeedbacks, $feedback_url);
61 $PAGE->navbar
->add(format_string($feedback->name
));
63 $PAGE->set_title($feedback->name
);
64 $PAGE->set_heading($course->fullname
);
65 $PAGE->activityheader
->set_title(format_string($feedback->name
));
66 echo $OUTPUT->header();
68 $continueurl = new moodle_url('/mod/feedback/view.php', array('id' => $id));
70 $continueurl->param('courseid', $courseid);
73 $form = new mod_feedback_complete_form(mod_feedback_complete_form
::MODE_PRINT
,
74 $feedbackstructure, 'feedback_print_form');
75 echo $OUTPUT->continue_button($continueurl);
77 echo $OUTPUT->continue_button($continueurl);
80 echo $OUTPUT->footer();