Skip to content

Commit

Permalink
Add the Jeff Elkner feature ofr Liberia
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed May 18, 2024
1 parent ab146db commit d742e0a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/UI/Lessons.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ public function renderSingle($buffer=false) {

if ( isset($module->videos) ) {
$videos = $module->videos;
$media_folder = $CFG->getExtension('media_folder', null);
$media_base = $CFG->getExtension('media_base', null);
echo('<li typeof="oer:SupportingMaterial" class="tsugi-lessons-module-videos">');
$videotitle = __(self::getSetting('videos-title', 'Videos'));
echo("<p>");
Expand All @@ -477,11 +479,19 @@ public function renderSingle($buffer=false) {
echo('<ul class="tsugi-lessons-module-videos-ul">'."\n");
$lecno = 0;
foreach($videos as $video ) {
$media_file = $video->media ?? null;
echo('<li typeof="oer:SupportingMaterial" class="tsugi-lessons-module-video">');
$yurl = 'https://www.youtube.com/watch?v='.$video->youtube;
$lecno = $lecno + 1;
$navid = md5($lecno.$yurl);
// https://www.w3schools.com/howto/howto_js_fullscreen_overlay.asp
if ( is_string($media_file) && is_string($media_base) && is_string($media_folder) &&
file_exists($media_folder . '/' . $media_file) ) {
$media_path = $media_base . '/' . $media_file;
?>
<a href="<?= $media_path ?>" target="_blank"><?= htmlentities($video->title) ?></a>
<?php
} else {
$yurl = 'https://www.youtube.com/watch?v='.$video->youtube;
$lecno = $lecno + 1;
$navid = md5($lecno.$yurl);
// https://www.w3schools.com/howto/howto_js_fullscreen_overlay.asp
?>
<div id="<?= $navid ?>" class="w3schools-overlay">
<div class="w3schools-overlay-content" style="background-color: black;">
Expand All @@ -490,6 +500,7 @@ public function renderSingle($buffer=false) {
</div>
<a href="#" onclick="document.getElementById('<?= $navid ?>').style.display = 'block';"><?= htmlentities($video->title) ?></a>
<?php
}
echo("</li>\n");
}
echo("</ul></li>\n");
Expand Down

0 comments on commit d742e0a

Please sign in to comment.