1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- require(__DIR__.'/../../config.php');
- require_once(__DIR__.'/lib.php');
- $id = optional_param('id', 0, PARAM_INT);
- $c = optional_param('c', 0, PARAM_INT);
- if ($id) {
- $cm = get_coursemodule_from_id('colab', $id, 0, false, MUST_EXIST);
- $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
- $moduleinstance = $DB->get_record('colab', array('id' => $cm->instance), '*', MUST_EXIST);
- } else if ($c) {
- $moduleinstance = $DB->get_record('colab', array('id' => $n), '*', MUST_EXIST);
- $course = $DB->get_record('course', array('id' => $moduleinstance->course), '*', MUST_EXIST);
- $cm = get_coursemodule_from_instance('colab', $moduleinstance->id, $course->id, false, MUST_EXIST);
- } else {
- print_error(get_string('missingidandcmid', colab));
- }
- require_login($course, true, $cm);
- $modulecontext = context_module::instance($cm->id);
- $event = \mod_colab\event\course_module_viewed::create(array(
- 'objectid' => $moduleinstance->id,
- 'context' => $modulecontext
- ));
- $event->add_record_snapshot('course', $course);
- $event->add_record_snapshot('colab', $moduleinstance);
- $event->trigger();
- $PAGE->set_url('/mod/colab/view.php', array('id' => $cm->id));
- $PAGE->set_title(format_string($moduleinstance->name));
- $PAGE->set_heading(format_string($course->fullname));
- $PAGE->set_context($modulecontext);
- echo $OUTPUT->header();
- echo $OUTPUT->footer();
|