moodle-expcontent/view.php

133 lines
2.5 KiB
PHP

<?php
require('../../config.php');
require_once($CFG->dirroot.'/mod/expcontent/lib.php');
require_once($CFG->libdir.'/completionlib.php');
$id = required_param('id', PARAM_INT);
list ($course, $cm) = get_course_and_cm_from_cmid($id, 'expcontent');
$expcontent = $DB->get_record('expcontent', array('id'=> $cm->instance), '*', MUST_EXIST);
$expconfig = get_config('mod_expcontent');
$baseurl = $expconfig->baseurl;
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
if ($baseurl[-1] != "/") $baseurl += "/";
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>
ul {
list-style-type: none;
height: 52px;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
flex: 0 0 auto;
pointer-events: none;
}
li {
height: auto;
position: absolute;
font-family: "sans-serif";
box-sizing: border-box;
}
li.logo {
left: 0;
margin-left: 1em;
margin-right: 1em;
padding-top: 6px;
padding-bottom: 6px;
height: 52px;
box-sizing: border-box;
}
li.title {
position: relative;
width: 100%;
padding-left: 72px;
padding-right: 52px;
height: 52px;
}
li.title .container {
position:relative;
height:52px;
}
li.title .text {
position: absolute;
top: 50%;
transform: translateY(-50%);
margin-top: auto;
margin-bottom: auto;
}
li.right {
top: 0;
right: 0;
margin: 4px;
pointer-events: all;
}
li.logo img {
display: block;
height: 100%;
width: auto;
height: 40px;
}
li a,.text {
display: block;
color: white;
text-decoration: none;
font-family: sans-serif;
}
li a {
padding: 14px 16px;
}
li a.hover:hover {
background-color: #111;
}
body {
display: flex;
flex-flow: column;
margin: 0;
}
/* prevent overscroll */
html,body {
position: fixed;
overflow: hidden;
width: 100vw;
height: 100vh;
}
iframe {
flex: 1 1 auto;
border: 0;
}
</style>
<link rel="stylesheet" type="text/css" href="/mod/expcontent/vendor/fa/css/all.css">
<title><?php echo($expcontent->name); ?></title>
</head>
<body>
<ul>
<li class="logo"><img src="pix/icon.png"></li>
<li class="title"><div class="container"><div class="text"><?php echo($expcontent->name); ?></div></div></li>
<li class="right"><a class="hover" href="javascript:history.back();"><i class="fas fa-times"></i></a></li>
</ul>
<iframe src='<?php echo($baseurl . "view-content/" . $expcontent->contentid . "?autoplay=true"); ?>' allow="autoplay; fullscreen"></iframe>
</body>
</html>