template.php 1.38 KB
<?
/** @var $item \SH\Entities\Partner */
require_once($_SERVER['DOCUMENT_ROOT'].'/mobile_detect.php');

if(empty($arResult['ITEMS'])) return;
?>
<? foreach($arResult['ITEMS'] as $i => $item) { ?>
<?
    $title = $item->getPropValue('TITLE');
    $subtitle = $item->getPropValue('SUBTITLE');
    $videos = $item->getFiles('VIDEO');
    $img = $item->hasPreviewImage()
        ? ($videos ? $item->getPreviewImageThumb(array('width' => 640, 'height' => 480, 'blur' => 5)) : $item->getPreivewImageUrl())
        : false;
    ?>

    <div class="mp-slide js-mp-slide<?= ($videos) ? ' _video' : '' ?><? if(!$i) { ?> _active<? } ?>" style="background-image: url(<?= $img ?>)">
<? if($videos) { ?>
<?
    $videoUrls = array();
    foreach($videos as $video) {
        $videoUrls[] = $video->getUrl();
    }
?>
        <div class="mp-slide-video">
            <video preload="auto" loop="loop" autoplay data-src='["<?= implode('","', $videoUrls) ?>"]'>
<? /*foreach($videos as $video) { ?>
                <source src="<?= $video->getUrl() ?>" type="video/<?= $video->getExtension() ?>">
<? }*/ ?>
            </video>
        </div>
<? } ?>
<? if($title) { ?>
<? if($i) { ?>
        <p class="mp-head-text _bigger"><?= $title ?></p>
<? } else { ?>
        <h1 class="mp-head-text _bigger"><?= $title ?></h1>
<? } ?>
<? } ?>
<? if($subtitle) { ?>
        <p class="mp-head-text"><?= $subtitle ?></p>
<? } ?>
    </div>
<? } ?>