moodle-expcontent/view.php

62 lines
1.8 KiB
PHP
Raw Normal View History

2021-07-06 14:08:32 +00:00
<?php
require('../../config.php');
2021-12-07 10:02:33 +00:00
require_once($CFG->dirroot.'/mod/expcontent/lib.php');
require_once($CFG->libdir.'/completionlib.php');
2021-07-06 14:08:32 +00:00
$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;
2021-12-07 10:02:33 +00:00
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
2021-07-06 14:08:32 +00:00
if ($baseurl[-1] != "/") $baseurl += "/";
?>
2022-09-07 14:02:59 +00:00
<!DOCTYPE html>
2021-07-06 14:08:32 +00:00
<html>
<head>
2022-01-11 13:56:43 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
2022-09-07 14:02:59 +00:00
<link rel="stylesheet" type="text/css" href="/mod/expcontent/css/expcontent.css">
<link rel="stylesheet" type="text/css" href="/mod/expcontent/vendor/font-awesome/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="#" onclick="goToCourse();"><i class="fas fa-times"></i></a></li>
</ul>
<iframe src='<?php echo($baseurl . "view-content/" . $expcontent->contentid . "?autoplay=true"); ?>' allow="autoplay; fullscreen"></iframe>
2021-09-27 08:00:34 +00:00
2022-09-07 14:02:59 +00:00
<script>
<?php
$modinfo = get_fast_modinfo($course);
2021-07-06 14:08:32 +00:00
2022-09-07 14:02:59 +00:00
$quizzes = array();
2021-09-27 08:00:34 +00:00
2022-09-07 14:02:59 +00:00
foreach ($modinfo->get_instances_of("quiz") as $quiz) {
$quizzes[] = $quiz->id;
2021-07-06 14:08:32 +00:00
}
2022-09-07 14:02:59 +00:00
echo("var thiscourse = $course->id;\n");
echo("var quizzes = " . json_encode($quizzes) . ";\n\n");
?>
2021-07-06 14:08:32 +00:00
2022-09-07 14:02:59 +00:00
function goToCourse(courseid=thiscourse) {
window.location.href = "/course/view.php?id=" + courseid;
2021-07-06 14:08:32 +00:00
}
2022-09-07 14:02:59 +00:00
function goToQuiz(quizindex=1) {
quizid = quizzes[quizindex-1];
window.location.href = "/mod/quiz/view.php?id=" + quizid;
2022-01-11 13:56:43 +00:00
}
2022-09-07 14:02:59 +00:00
</script>
2022-01-11 13:56:43 +00:00
2021-07-06 14:08:32 +00:00
</body>
</html>