troodle-expcontent/view_content.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

66 lines
No EOL
1.9 KiB
PHP

<?php
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once(dirname(__FILE__) . '/lib.php');
$id = required_param('id', PARAM_INT); // Course Module 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);
require_login($course, true, $cm);
$content_id = $exp360->content_id;
?>
<!DOCTYPE html>
<html>
<head>
<style>
html,
body {
overflow: hidden;
}
</style>
</head>
<body>
<script src='https://cdn.exp360.com/embed/js/exp360-embed-3.8.59.js?v=3&d=d667dff2-97bb-437e-85d2-f7550d87a4d0&p=web'></script>
<script>
function startContent() {
exp360.openContent('<?php echo $content_id; ?>', {
popup: false,
autorotate: true,
autorotate_speed: 5,
autorotate_delay: 2500,
teleport_animation: false
});
}
var currentUrl = window.location.href;
var url = new URL(currentUrl);
var searchParams = new URLSearchParams(url.search);
var params = {};
searchParams.forEach((value, key) => {
params[key] = value;
});
function initialize() {
var newDiv = document.createElement('div');
newDiv.setAttribute('data-exp360-type', 'player');
newDiv.setAttribute('data-exp360-id', '<?php echo $content_id; ?>');
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
newDiv.setAttribute('data-exp360-params', `width=${windowWidth};height=${windowHeight};`);
document.body.appendChild(newDiv);
}
window.onload = initialize;
</script>
</body>
</html>