$feedback = $PAGE->activityrecord; $feedbackcompletion = new mod_feedback_completion($feedback, $cm, $courseid); $context = context_module::instance($cm->id); if ($course->id == SITEID) { $PAGE->set_pagelayout('incourse'); } $PAGE->set_url('/mod/feedback/view.php', array('id' => $cm->id)); $PAGE->set_title($feedback->name); $PAGE->set_heading($course->fullname); // Check access to the given courseid. if ($courseid and $courseid != SITEID) { require_course_login(get_course($courseid)); // This overwrites the object $COURSE . } // Check whether the feedback is mapped to the given courseid. if (!has_capability('mod/feedback:edititems', $context) && !$feedbackcompletion->check_course_is_mapped()) { echo $OUTPUT->header(); echo $OUTPUT->notification(get_string('cannotaccess', 'mod_feedback')); echo $OUTPUT->footer(); exit; } // Trigger module viewed event. $event = \mod_feedback\event\course_module_viewed::create_from_record($feedback, $cm, $course); $event->trigger(); /// Print the page header echo $OUTPUT->header(); /// Print the main part of the page /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// $previewimg = $OUTPUT->pix_icon('t/preview', get_string('preview'));