{% if editmode %}
{{ include('includes/backend-kopf.html.twig') }}
{% set tabContentArray = {1: 'Optional', 2: 'Video'} %}
{% set tab = 1 %}
<div id="content">
{% if tabContentArray is defined and tab in tabContentArray|keys %}
{{ admin_tabs(tab, tabContentArray) | raw }}
{% endif %}
<section class="tabContent">
<p class="hl">Optionale Einstellung:</p>
{% set element = 'artikel' %}
<div id="{{ element }} ">
{{ pimcore_multiselect(element, {
'width': 200,
'height': 100,
'store': [
['abstand-top', 'Abstand nach oben'],
['abstand-bottom', 'Abstand nach unten']
]
}) }}
</div>
</section>
{% if tabContentArray is defined and 2 in tabContentArray|keys %}
{{ admin_tabs(2, tabContentArray) | raw }}
<section class="tabContent">
<table border="0" cellspacing="0" cellpadding="0"><tr><td>
<div style="padding:7px;margin-bottom:25px; background-color:#74b9d9;color:#ffffff;"> Video Konfiguration</div>
<div style="width:100%;">
<div style="padding-left:37px;margin-bottom:4px;margin-top:8px;">Bitte wählen Sie:</div>
<div style="padding-left:37px;margin-bottom:10px;">
{% if pimcore_select('videoFormatSelect').isEmpty() %}
{% do pimcore_select('videoFormatSelect').setDataFromResource('---') %}
{% endif %}
{{ pimcore_select("videoFormatSelect", {
"store": [
["videodatei", "Video-Datei"],
["youtube", "Youtube"]
],
"reload" : true
}) }}
</div>
{% set AusgabevideoFormatSelect = pimcore_select("videoFormatSelect").getData() %}
{% set youtube = AusgabevideoFormatSelect == 'youtube' ? 'block' : 'none' %}
<div style="display:{{ youtube }};">
<div style="padding-left:37px;margin-bottom:4px;margin-top:30px;">Bitte Youtube Video-Key in das Feld übertragen:</div>
<div class="schreiben"><span class="parentbox">
{{ pimcore_input("youtubeKey", {'width': 540, "height": 25}) }}
</span></div>
<br /><br />
</div>
{% set videodatei = AusgabevideoFormatSelect == 'videodatei' ? 'block' : 'none' %}
<div style="display:{{ videodatei }}">
<div style="padding-left:37px;margin-bottom:4px;margin-top:30px;">Video 'mp4' - Format:</div>
<div class="dragdrop"><span class="parentbox">
{{ pimcore_relation("PfadMp4",{
"width": 520,
"reload": true
}) }}</span></div>
<br /><br />
<div style="padding-left:37px;margin-bottom:4px;">Video 'webm' - Format:</div>
<div class="dragdrop"><span class="parentbox">
{{ pimcore_relation("PfadWebm",{
"width": 520,
"reload": true
}) }}
</span></div>
<br /><br /><br /><hr /><br /><br />
<div style="padding-left:37px;margin-bottom:4px;">Video Startbild (2400 x 1360 Pixel):</div>
<div style="width:520px;">
<div style="float:left;margin-bottom:10px;" class="dragimage"><span class="parentbox">
{{ pimcore_image("posterImage", {
"width": 100,
"height": 67,
"hidetext": true,
"thumbnail": "singleImage-edm"
}) }}
</span>
</div>
</div>
</div>
</td></tr>
</table>
<br /><br /><br /><br />
</section>
{% endif %}
</div>
{{ include('includes/backend-fuss.html.twig') }}
{% else %}
{% set abstand_top_class = (checkMultiselect(pimcore_multiselect("artikel"),'abstand-top') == true)? ' abstand-top' : '' %}
{% set abstand_bottom_class = (checkMultiselect(pimcore_multiselect("artikel"),'abstand-bottom') == true)? ' abstand-bottom' : '' %}
{% set abstandClasses = abstand_top_class ~ abstand_bottom_class %}
{% set IDself = document.getId() %}
<div class="module-video constrainer-inner edgepadding {{ abstandClasses }}">
<div class="video-wrp">
<div data-video="{{ IDself }}">
<div class="video-item">
{% set AusgabevideoFormatSelect = pimcore_select("videoFormatSelect").getData() %}
{% if AusgabevideoFormatSelect != "---" %}
{% if AusgabevideoFormatSelect == "youtube" %}
<iframe class="videoextern" width="1600" height="900"
src="https://www.youtube.com/embed/{{ pimcore_input('youtubeKey') }}?rel=0" frameborder="0" allowfullscreen></iframe>
{% endif %}
{% if AusgabevideoFormatSelect == "videodatei" %}
{% set thumbnail = pimcore_image("posterImage").getThumbnail("videoposter") %}
<video class="videoextern" id='videoplayer_{{ IDself }}' preload='metadata' controls poster="{{ thumbnail }}">
<source src="{{ bugfiximageurl }} {{ pimcore_relation("PfadMp4").getFullPath()|trim }}" type='video/mp4' />
<source src="<?=$bugfiximageurl?>{{ pimcore_relation("PfadWebm").getFullPath()|trim }}" type='video/webm' />
</video>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
{% if AusgabevideoFormatSelect == "videodatei" %}
<script>
//------------------------------------------------------------------------------------------------
// Video einbinden
//------------------------------------------------------------------------------------------------
(function () {
var video = $("#videoplayer_{{ IDself }}");
var windowObj = $(window);
if (typeof selt === 'undefined') {
selt = {
modules: {}
};
} else if (!selt.modules) {
selt.modules = {};
}
selt.modules[moduleName] = {
name: moduleName,
init: function () {
video.on("loadedmetadata", onLoadMetaData);
windowObj.resize(onResizeWindow);
}
};
function onResizeWindow() {
resizeVideo(video[0]);
}
function onLoadMetaData(e) {
resizeVideo(e.target);
}
function resizeVideo(videoObject) {
var percentWidth = videoObject.clientWidth * 100 / videoObject.videoWidth;
var videoHeight = videoObject.videoHeight * percentWidth / 100;
video.height(videoHeight);
}
}());//EOS
</script>
{% endif %}
{% endif %}