SimpleMarkdown-omeka-module/view/common/block-layout/panorama-viewer.phtml

92 lines
2.8 KiB
PHTML

<div class="pannemmul-wrap" style="position:relative;">
<?php
$this->headLink()->appendStylesheet($this->assetUrl('vendor/pannellum/pannellum.css',
'SimpleMDText'));
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js',
'SimpleMDText'));
if ($panorama_type == "video") {
$this->headLink()->appendStylesheet($this->assetUrl('vendor/video.js/video-js.css',
'SimpleMDText'));
$this->headScript()->appendFile($this->assetUrl('vendor/video.js/video.js',
'SimpleMDText'));
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/videojs-pannellum-plugin.js',
'SimpleMDText'));
}
if ($title !== false && $title !== "") {
$title = sprintf('<p id="panorama-viewer-title">%s</p>', $title);
} else {
$title = false;
}
?>
<style>
#<?= $id ?> {
height: <?= $height ?>px;
width: <?= $width ?>px;
}
</style>
<div class="pannellum-wrap">
<?php if ($panorama_type == "video") { ?>
<video id="<?= $id ?>"
class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="none"
poster="<?= $thumbnails[0]['medium'] ?>"
crossorigin="anonymous">
<?php for($i = 0; $i < count($urls); ++$i) { ?>
<source src="<?= $urls[$i] ?>" type="<?= $mediaTypes[$i] ?>"/>
<?php } ?>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to
a web browser that <a href="http://videojs.com/html5-video-support/"
target="_blank">supports HTML5 video</a>
</p>
</video>
<?php } else { ?>
<div id="<?= $id ?>" class="panorama-viewer"></div>
<?php } ?>
</div>
<script>
<?php if ($panorama_type == "equirectangular") { ?>
pannellum.viewer("<?= $id ?>", {
type: "equirectangular",
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
panorama: "<?= $urls[0]; ?>",
});
<?php } ?>
<?php if ($panorama_type == "cubemap") { ?>
pannellum.viewer("<?= $id ?>", {
type: "cubemap",
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
cubeMap: <?= json_encode($urls, JSON_UNESCAPED_SLASHES) ?>,
});
<?php } ?>
<?php if ($panorama_type == "partial") { ?>
pannellum.viewer("<?= $id ?>", {
type: "equirectangular",
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
panorama: "<?= $urls[0]; ?>",
haov: 149.87,
vaov: 54.15,
vOffset: 1.17
});
<?php } ?>
<?php if ($panorama_type == "video") { ?>
videojs("<?= $id ?>", {
plugins: {
pannellum: {}
}
});
<?php } ?>
<?php if ($title !== false): ?>
$('#pannellum-ui').append('<?= $title ?>');
<?php endif ?>
</script>
</div>