templates/areas/AddInstagram/view.html.twig line 1

Open in your IDE?
  1. {% if editmode %}
  2.        <style>
  3.         .accordion {
  4.             margin: 37px;
  5.         }
  6.         .accordion dt {
  7.             padding: 10px;
  8.             font-size: 14px;
  9.             color: #a963e7;
  10.         }
  11.         .accordion dd {
  12.             padding: 10px;
  13.             background-color: #569dd5;
  14.             color: #ffffff;
  15.         }
  16.         .accordion dt a {
  17.             display: block;
  18.             color: #38659e;
  19.             font-weight: bold;
  20.             text-transform: uppercase;
  21.         }
  22.         dd {
  23.             font-size: 14px;
  24.             color: #000000;
  25.         }
  26.     </style>
  27.     <div class="areablock-main">
  28.         <div class="areablock-title area-box-padding">
  29.             Instagram Beiträge Einbinden
  30.         </div>
  31.         <div class="areablock-body area-box-padding">
  32.             <dl class="accordion">
  33.                 <dt><a href="">Hilfe zu Instagram Beitrag Einbinden</a></dt>
  34.                 <dd>
  35.                       <span>
  36.                           Um den HTML-Code einzubetten, müssen Sie den Post für den Artikel in Iherem  Account öffnen.<br/><br/>Klicken Sie auf die Schaltfläche mit den drei Punkten, die sich neben jedem Foto / Video befindet, und wählen Sie dann "Einbetten" => Code kopieren. Sehen Sie sich einfach den folgenden Screenshot an, wenn Sie Schwierigkeiten haben, diesen Knopf zu finden.<br/><br/><b>Fügen Sie nun den Code im CMS in das nachfolgende Textfeld!</b>
  37.                       </span>
  38.                     <br/>
  39.                     <img src="/bundles/app/static/backend/image/edm-style/instagram-hilfe-screen.png" height="250" style="margin-top: 30px;"/>
  40.                 </dd>
  41.             </dl>
  42.             {% for i in pimcore_block('instagramblock').iterator %}
  43.                 <div class="schreiben">
  44.                   <span class="parentbox">
  45.                       {{ pimcore_textarea("instagramCode",{
  46.                             "nl2br": true,
  47.                             "height": 100,
  48.                             "width": 735
  49.                         }) }}
  50.                   </span>
  51.                 </div>
  52.                 <div style="width:100%;height:1px;border-bottom: 1px solid #474747; margin-bottom: 30px;margin-top: 30px;"></div>
  53.               {% endfor %}
  54.             <br /><br /><br />
  55.           </div>
  56.       </div>
  57.     <script>
  58.         (function($) {
  59.             var allPanels = $('.accordion > dd');
  60.             $('.accordion > dd').hide();
  61.             $('.accordion > dt > a').click(function() {
  62.                 if($(this).parent().next().is(":visible")){
  63.                     allPanels.slideUp();
  64.                     return false;
  65.                 } else {
  66.                     $(this).parent().next().slideDown();
  67.                     return false;
  68.                 }
  69.             });
  70.         })(jQuery);
  71.     </script>
  72. {% else %}
  73.     {% set contInstagramblock = pimcore_block('instagramblock').getCount() %}
  74.     {% set counter = 1 %}
  75.     {% set randomID = random() %}
  76.     {% set direktausgabe = "" %}
  77.     {% set posts = "posts"~randomID %}
  78.    {% set posts = [] %}
  79.     {% for i in pimcore_block('instagramblock').iterator %}
  80.         {% set codepush = pimcore_textarea("instagramCode",{"htmlspecialchars": false}) %}
  81.         {% set direktausgabe = direktausgabe~'<div class="centered-flex">' ~ codepush ~ '</div>' %}
  82.         {% set posts = posts|merge([codepush]) %}
  83.         {% set counter = counter + 1 %}
  84.     {% endfor %}
  85.     {% set randomID = random() %}
  86.     {% set trackingObj = pimcore_website_config('konfiguration_tracking') %}
  87.     {% set buttontext = app_value(trackingObj, 'getButtontext') %}
  88.     {% set instagraminfotext = app_value(trackingObj, 'getInstagraminfotext') %}
  89.     {% set allowsocialmedia = allow_tracking() %}
  90.    
  91.     {% if allowsocialmedia is empty %}
  92.     <div class="text-center" data-social-feed="btn_{{ randomID }}">
  93.         <div>{{ instagraminfotext |raw }}</div>
  94.         <div class="btn-wrp">
  95.             <button data-showposts>{{ buttontext |raw}}</button>
  96.         </div>
  97.     </div>
  98.      {% endif %}
  99.         <div class="owl-carousel owl-theme" data-social-feed="content_{{ randomID }}" data-slider="{{ randomID }}"
  100.             {{ (allowsocialmedia is not empty) ? ' style="display:block;"' : '' }}>
  101.             {% if allowsocialmedia is not empty %} {{ direktausgabe |raw }} {% endif %}
  102.         </div>
  103.     <script type="text/javascript">
  104.         (function () {
  105.             var moduleName  = 'teaser_slider_{{ randomID }}_module', // naming convention XXX_module
  106.                 showFeedBtn = document.querySelector('[data-social-feed="btn_{{ randomID }}"]'),
  107.                 feedContainer = document.querySelector('[data-social-feed="content_{{ randomID }}"]');
  108.             if (typeof selt === 'undefined') {
  109.                 selt = {
  110.                     modules: {}
  111.                 };
  112.             } else if (!selt.modules) {
  113.                 selt.modules = {};
  114.             }
  115.             selt.modules[moduleName] = {
  116.                 name: moduleName,
  117.                 spritelist: 'instagram',
  118.                 scriptSrc: null,
  119.                 init: function () {
  120.                     selt.modules.addSprite(this);
  121.                     // only add feeds with user consent
  122.                     if (showFeedBtn) {
  123.                         showFeedBtn.addEventListener('click', callAllSprites, false)
  124.                     }
  125.                     {% if allowsocialmedia is not empty %}
  126.                     var itemCount = {{ contInstagramblock }},
  127.                         itemCountArray;
  128.                     switch (true) {
  129.                         case (itemCount > 2):
  130.                             itemCountArray = [3, 2];
  131.                             break;
  132.                         case (itemCount == 2):
  133.                             itemCountArray = [2, 2];
  134.                             break;
  135.                         default:
  136.                             itemCountArray = [1, 1];
  137.                     }
  138.                    initSlider(itemCountArray);
  139.                    {% endif %}
  140.                 },
  141.                 showFeed: function () {
  142.                     // post is an array of code snippets copied from instagram
  143.                     var posts     = {{ posts|json_encode() }},
  144.                         itemCount = posts.length,
  145.                         itemCountArray;
  146.                     showFeedBtn.parentNode.removeChild(showFeedBtn);
  147.                     posts.forEach(function (el) {
  148.                         // create a post from the code snippet copied from
  149.                         // instagram post
  150.                         var post = document.createElement("div");
  151.                         post.classList.add('centered-flex');
  152.                         post.innerHTML = el;
  153.                         // remove the script tag but capture the source
  154.                         var scripts = post.getElementsByTagName('script'),
  155.                             i       = scripts.length;
  156.                         while (i--) {
  157.                             this.scriptSrc = scripts[i].getAttribute('src');
  158.                             scripts[i].parentNode.removeChild(scripts[i]);
  159.                         }
  160.                         feedContainer.appendChild(post);
  161.                     });
  162.                     // used to tell the slider how many posts to show
  163.                     // based on the number of items
  164.                     switch (true) {
  165.                         case (itemCount > 2):
  166.                             itemCountArray = [3, 2];
  167.                             break;
  168.                         case (itemCount == 2):
  169.                             itemCountArray = [2, 2];
  170.                             break;
  171.                         default:
  172.                             itemCountArray = [1, 1];
  173.                     }
  174.                     // html is injected. Now init the slider
  175.                     initSlider(itemCountArray);
  176.                 }
  177.             };
  178.             function callAllSprites() {
  179.                // $.cookie("allowsocialmedia", 'allow');
  180.                 selt.modules.callSpriteListMethod('instagram', 'showFeed', function () {
  181.                     selt.loadExternalJavascript(scriptSrc);
  182.                 })
  183.             };
  184.             function initSlider(itemCountArray) {
  185.                 galleryEl = $('[data-slider="{{ randomID }}"]');
  186.                 galleryEl.owlCarousel({
  187.                     center: false,
  188.                     loop: false,
  189.                     items: 1,
  190.                     margin: 20,
  191.                     nav: true,
  192.                     navText: [
  193.                         '<svg viewBox="0 0 27.2 105.2" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><polygon class="st0" points="25.4,105.2 0,52 25.4,0 27.2,0.9 2.2,52 27.2,104.3"/></svg>',
  194.                         '<svg viewBox="0 0 27.2 105.2" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><polygon class="st0" points="25.4,105.2 0,52 25.4,0 27.2,0.9 2.2,52 27.2,104.3"/></svg>'
  195.                     ],
  196.                     responsive: {
  197.                         1280: {
  198.                             items: itemCountArray[0]
  199.                         },
  200.                         880: {
  201.                             items: itemCountArray[1]
  202.                         }
  203.                     }
  204.                 });
  205.             }
  206.         }());//EOS
  207.     </script>
  208. {% endif %}