require_course_login($course, true, $cm); } } //check whether the given courseid exists if ($courseid and $courseid != SITEID) { if ($course2 = $DB->get_record('course', array('id' => $courseid))) { require_course_login($course2); //this overwrites the object $course :-( $course = $DB->get_record("course", array("id" => $cm->course)); // the workaround } else { print_error('invalidcourseid'); } } // Trigger module viewed event. $event = \mod_feedback\event\course_module_viewed::create(array('objectid' => $feedback->id, 'context' => $context, 'other' => array('cmid' => $cm->id, 'instanceid' => $feedback->id, 'anonymous' => $feedback->anonymous, 'content' => 'feedbackmoduleview'))); $event->add_record_snapshot('course_modules', $cm); $event->add_record_snapshot('course', $course); $event->add_record_snapshot('feedback', $feedback); $event->trigger(); /// Print the page header $strfeedbacks = get_string("modulenameplural", "feedback"); $strfeedback = get_string("modulename", "feedback"); if ($course->id == SITEID) { $PAGE->set_context($context); $PAGE->set_cm($cm, $course); // set's up global $COURSE $PAGE->set_pagelayout('incourse'); } $PAGE->set_url('/mod/feedback/view.php', array('id' => $cm->id, 'do_show' => 'view')); $PAGE->set_title(format_string($feedback->name));
require_course_login($course, true, $cm); } } //check whether the given courseid exists if ($courseid and $courseid != SITEID) { if ($course2 = $DB->get_record('course', array('id' => $courseid))) { require_course_login($course2); //this overwrites the object $course :-( $course = $DB->get_record("course", array("id" => $cm->course)); // the workaround } else { print_error('invalidcourseid'); } } // Trigger module viewed event. $event = \mod_feedback\event\course_module_viewed::create(array('objectid' => $feedback->id, 'context' => $context, 'anonymous' => $feedback->anonymous == FEEDBACK_ANONYMOUS_YES, 'other' => array('anonymous' => $feedback->anonymous))); $event->add_record_snapshot('course_modules', $cm); $event->add_record_snapshot('course', $course); $event->add_record_snapshot('feedback', $feedback); $event->trigger(); /// Print the page header $strfeedbacks = get_string("modulenameplural", "feedback"); $strfeedback = get_string("modulename", "feedback"); if ($course->id == SITEID) { $PAGE->set_context($context); $PAGE->set_cm($cm, $course); // set's up global $COURSE $PAGE->set_pagelayout('incourse'); } $PAGE->set_url('/mod/feedback/view.php', array('id' => $cm->id, 'do_show' => 'view')); $PAGE->set_title($feedback->name);
$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')); $previewlnk = new moodle_url('/mod/feedback/print.php', array('id' => $id)); if ($courseid) { $previewlnk->param('courseid', $courseid); } $preview = html_writer::link($previewlnk, $previewimg); echo $OUTPUT->heading(format_string($feedback->name) . $preview); // Print the tabs.