troodle-expcontent/view.php

37 lines
1.3 KiB
PHP
Raw Normal View History

<?php
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once(dirname(__FILE__) . '/lib.php');
$id = optional_param('id', 0, PARAM_INT); // Course Module ID
$n = optional_param('n', 0, PARAM_INT); // exp360 instance ID
if ($id) {
$cm = get_coursemodule_from_id('exp360', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$exp360 = $DB->get_record('exp360', array('id' => $cm->instance), '*', MUST_EXIST);
} else if ($n) {
$exp360 = $DB->get_record('exp360', array('id' => $n), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $exp360->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('exp360', $exp360->id, $course->id, false, MUST_EXIST);
} else {
print_error('You must specify a course_module ID or an instance ID');
}
require_login($course, true, $cm);
$PAGE->set_url('/mod/exp360/view.php', array('id' => $cm->id));
$PAGE->set_title(format_string($exp360->name));
$PAGE->set_heading(format_string($course->fullname));
echo $OUTPUT->header();
$content_id = $exp360->content_id;
echo "<script
data-activity-id='$content_id'
src='/mod/exp360/script.js'>
</script>";
echo $OUTPUT->footer();