/** * Create the event from course record. * * @param \stdClass $course * @return course_module_instance_list_viewed */ public static function create_from_course(\stdClass $course) { $params = array('context' => \context_course::instance($course->id)); $event = \mod_rcontent\event\course_module_instance_list_viewed::create($params); $event->add_record_snapshot('course', $course); return $event; }
require_once '../../config.php'; require_once 'locallib.php'; $id = required_param('id', PARAM_INT); // course // Filter by status, get parameter with the filterby $filterby = optional_param('filterby', '', PARAM_RAW); if (($course = $DB->get_record('course', array('id' => $id))) === false) { print_error('Course ID is incorrect'); } require_course_login($course); $context = context_course::instance($course->id); $PAGE->set_url(new moodle_url('/mod/rcontent/index.php', array('id' => $id))); // Report index make text translatable $strrcontent = get_string('modulename', 'rcontent'); \mod_rcontent\event\course_module_instance_list_viewed::create_from_course($course)->trigger(); /// Print the header echo $PAGE->set_heading($course->fullname); echo $OUTPUT->header($course); // Filter by status, add select field $filteroptionsurl = 'index.php?id=' . $id; $filteroptionsparam = '&filterby='; $filteroptionsurlandparam = $filterselected = $filteroptionsurl . $filteroptionsparam; $filterselected .= $filterby; $filteroptionsparam = $filterby != '' ? $filteroptionsparam . $filterby : ''; // ********** FI /// Get all the appropriate data if (($rcontents = get_all_instances_in_course('rcontent', $course)) === false) { notice('There are no rcontents', '../../course/view.php?id=' . $course->id); die; }