troodle-expcontent/view.php
Kumi 5b45d9ea82
feat(exp360): add EXP360 module for embedding 360° content
Introduce the EXP360 activity module to embed interactive 360° content
in Moodle. This update includes:

- Database schema for the exp360 table.
- Language support for the module.
- Frontend form to create exp360 activities.
- Script to handle 360° content embedding within a modal.
- Two new PHP scripts to display and serve 360° content.
- Version and plugin initialization.

These changes allow users to seamlessly integrate and interact with
360° content within Moodle courses.
2024-07-05 11:13:58 +02:00

36 lines
1.3 KiB
PHP

<?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();