templates/Resources/resource_detail.html.twig line 1

Open in your IDE?
  1. {% extends "layout/layout.html.twig" %}
  2. {# {% block title %}GFS - {{resource.name}}{% endblock %} #}
  3. {% block content %}
  4.     <section class="resource-banner">
  5.       <div class="resource-banner-media">
  6.         <figure class="resource-banner-media-img">
  7.           <img src="{{resource.resource_banner}}" alt="cooking-banner">
  8.           {# {% if resource.resource_banner %}
  9.           {{ resource.resource_banner.thumbnail('1903x1070').getHTML({imgAttributes: {class:'',alt: "cooking-banner"}}) | raw }}
  10.           {% endif %} #}
  11.         </figure>
  12.       </div>
  13.     </section>
  14.     <!-- End banner -->
  15.     <!--Start Main training search-->
  16.     <section class="bread-crumbs-section resources-breadcrumb">
  17.       <div class="container container-lg">
  18.         <div class="bread-crumbs-section-box">
  19.           <div class="breadcrumb-holder">
  20.             <ol class="breadcrumb">
  21.               <li class="breadcrumb-item"><a href="/{{app.request.locale}}">{{'Home'|trans}}</a></li>
  22.               <li class="breadcrumb-item"><a href="/{{app.request.locale}}/resources">{{'Resources'|trans}}</a></li>
  23.               {% if resource.category is defined %}
  24.               <li class="breadcrumb-item"><a href="/{{app.request.locale}}/resources/{{resource.category.url}}">{{resource.category.name}}</a></li>
  25.               {% endif %}
  26.               <li class="breadcrumb-item">{{resource.name}}</li>
  27.             </ol>
  28.           </div>
  29.         </div>
  30.       </div>
  31.     </section>
  32.     <!--End Main training search-->
  33. <div id ="invoice">
  34.     <!-- Start Article -->
  35.     <section class="resource-article">
  36.       <div class="container container-sm">
  37.   
  38.         {% if newsletter %}
  39.         <div class="col-12 newsletterBanner-v2">
  40.           <div class="row gy-4">
  41.             <div class="col-lg-6">
  42.               <h3 class="heading">
  43.                 {% if newsletter and newsletter.title is not null %}
  44.                   {{newsletter.title}}
  45.                 {% endif %}
  46.               </h3>
  47.               <div class="content">
  48.                 <div class="imgLeft d-md-none">
  49.                   {% if newsletter and newsletter.pdf is not null %}
  50.                     <a href="{{newsletter.pdf}}" target="_blank">
  51.                       {% if newsletter.detailImageMobile %}
  52.                         <img src="{{newsletter.detailImageMobile}}" alt="Newsletter-Image-Mobile">
  53.                       {% endif %}     
  54.                     </a>
  55.                   {% endif %}
  56.                   
  57.                 </div>
  58.                 <div class="contentDesc">
  59.                   <p>
  60.                     {% if newsletter and newsletter.description is not null %}
  61.                       {{newsletter.description}}
  62.                     {% endif %}
  63.                   </p>
  64.                   {% set user = app.session.get('loginUserName') %}
  65.                   {% if newsletterPdf %}
  66.                     {% if user is not null %}
  67.                       <a href="{{newsletterPdf}}" target="_blank" class="btn btn-custom btn-lg-o-yellow-white mt-md-5">
  68.                         {{"Read our Newsletter" | trans}}
  69.                       </a>
  70.                     {% else %}
  71.                       <a href="javascript:void(0);" onclick="storePdfForLater('{{ newsletterPdf }}')" class="btn btn-custom btn-lg-o-yellow-white mt-md-5">
  72.                         {{"Read our Newsletter" | trans}}
  73.                       </a>
  74.                     {% endif %}
  75.                   {% endif %}
  76.                 </div>
  77.               </div>
  78.             </div>
  79.             <div class="col-lg-6 d-none d-md-block pt-4 pt-lg-0">
  80.               <div class="imgRight">
  81.               {% if newsletter and newsletter.pdf is not null %}
  82.                 <a href="{{newsletter.pdf}}" class="w-100" target="_blank">
  83.                   {% if newsletter.detailImage %}
  84.                     <img src="{{newsletter.detailImage}}" class="w-100" alt="Newsletter-Image">
  85.                   {% endif %}     
  86.                 </a>
  87.               {% endif %}
  88.               </div>
  89.             </div>
  90.           </div>
  91.         </div>
  92.         {% endif %}
  93.       <div class="col-12">
  94.         <div class="row justify-content-center mb-5">
  95.           
  96.           <div class="col-12 px-0  d-none">
  97.           {% if (app.request.locale =='en') %}
  98.             <a href="https://zoom.us/webinar/register/6417301077993/WN_Uy4Xiz0OT2SuJn0cCsaSUQ" class="banner-transition-update">
  99.               <img class="img-fluid w-100" src="/resourcebanner/webinar-announcement-EN.jpg" alt="webinar announcement">
  100.             </a>
  101.             {% else %}
  102.             <a href="https://zoom.us/webinar/register/6417301077993/WN_Uy4Xiz0OT2SuJn0cCsaSUQ" class="banner-transition-update">
  103.               <img class="img-fluid w-100" src="/resourcebanner/webinar-announcement-AR.jpg" alt="webinar announcement">
  104.             </a>
  105.           {% endif %}
  106.           </div>
  107.           <div class="col-12 d-none ">
  108.             <a href="https://zoom.us/webinar/register/6417301077993/WN_Uy4Xiz0OT2SuJn0cCsaSUQ" >
  109.               <img class="img-fluid w-100" src="/resourcebanner/webinar-announcement-responsive.jpg" alt="webinar announcement responsive">
  110.             </a>
  111.           </div>
  112.         </div>
  113.       </div>
  114.         <div class="row">
  115.           <div class="col-xl-9">
  116.             <div class="resource-article-info">
  117.               <h5>{{resource.category.name}}</h5>
  118.               <h1 class="resource-blog">{{resource.name}}</h1>
  119.                {% set user = app.session.get('loginUserName') %}
  120.                {% if user is not null %}
  121.               <ul class="list-unstyled recipe-info">
  122.                 <li class="share"  onclick = "loyaltyProgram(this, {{ resource.id }},'{{ resource.name }}',10,'Article','Share')"><span onclick = "sharemodal('Article','{{ app.request.getSchemeAndHttpHost() ~ '/' ~ app.request.locale ~ '/resource/' ~ resource.url}}','{{ "SHARE KNOWLEDGE WITH YOUR FRIENDS"|trans }}')">{{'Share'|trans}}</span></li>
  123.                 {% if Liked_detail_article|length == 0 %}
  124.                 <li class="like article-detail"  onclick = "loyaltyProgram(this, {{ resource.id }},'{{ resource.name }}',10,'Article','Like', '{{app.request.locale}}')">{{'Like'|trans}}</li>
  125.                 {% else %}
  126.                       <li class= 'liked'>{{'Like'|trans}}</li>
  127.                 {% endif %}
  128.                 <li class="download-black d-none" id ="download" onclick = "loyaltyProgram(this, {{ resource.id }},'{{ resource.name }}',10,'Article','Save')">{{'Download'|trans}}</li>
  129.               </ul>
  130.               {% else %}
  131.               <ul class="list-unstyled recipe-info">
  132.                 <li class="share" onclick = "sharemodal('Article','{{ app.request.getSchemeAndHttpHost() ~ '/' ~ app.request.locale ~ '/resource/' ~ resource.url}}','{{ "SHARE KNOWLEDGE WITH YOUR FRIENDS"|trans }}')">{{'Share'|trans}}</li>
  133.                 <li class="like logged-out">{{'Like'|trans}}</li>
  134.                 <li class="download-black d-none" id ="download">{{'Download'|trans}}</li>
  135.               </ul>
  136.               {% endif %}
  137.               <p class="resource-article-info-qoute">{{resource.main_description | raw}}</p>              
  138.               {% for description in resource.resources %}
  139.                 {% if description.localizedfields.data.getLocalizedValue('resource_heading') %}
  140.                   <h2 class="resource-blog">{{description.localizedfields.data.getLocalizedValue('resource_heading')}}</h2>
  141.                 {% endif %}
  142.                 <p>{{description.localizedfields.data.getLocalizedValue('description')|raw}}</p>
  143.                 {% if description.localizedfields.data.getLocalizedValue('resource_video') %}
  144.                   <div class="media-section">
  145.                     <video poster="assets/images/media-01.png">
  146.                       <source src="/static/assets/videos/oceans.mp4" type="video/mp4">
  147.                       Your browser does not support the video tag.
  148.                     </video>
  149.                     <div class="control-options">
  150.                       <i class="fas fa-play-circle"></i>
  151.                       <i class="fas fa-pause-circle"></i>
  152.                     </div>
  153.                   </div>
  154.                 {% endif %}
  155.                 {% if description.localizedfields.data.getLocalizedValue('resource_image') %}
  156.                 <div class="resource-article-info-media">
  157.                   <figure class="resource-article-info-media-img">
  158.                     <img src="{{description.localizedfields.data.getLocalizedValue('resource_image')}}" alt="article-img">
  159.                   </figure>
  160.                 </div>
  161.                 {% endif %}
  162.               {% endfor %}
  163.               {% set user = app.session.get('loginUserName') %}
  164.                {% if user is not null %}
  165.               <ul class="list-unstyled recipe-info">
  166.                 <li class="share"  onclick = "loyaltyProgram(this,{{ resource.id }},'{{ resource.name }}',10,'Article','Share')"><span onclick = "sharemodal('Article','{{ app.request.getSchemeAndHttpHost() ~ '/' ~ app.request.locale ~ '/resource/' ~ resource.url}}','{{ "SHARE KNOWLEDGE WITH YOUR FRIENDS"|trans }}')">{{'Share'|trans}}</span></li>
  167.                 {% if Liked_detail_article|length == 0 %}
  168.                 
  169.                 <li class="like article-detail"  onclick = "loyaltyProgram(this,{{ resource.id }},'{{ resource.name }}',10,'Article','Like', '{{app.request.locale}}')">{{'Like'|trans}}</li>
  170.                 {% else %}
  171.                       <li class= 'liked'>{{'Like'|trans}}</li>
  172.                 {% endif %}
  173.                 <li class="download-black d-none" id ="download" onclick = "loyaltyProgram(this,{{ resource.id }},'{{ resource.name }}',10,'Article','Save')">{{'Download'|trans}}</li>
  174.               </ul>
  175.               {% else %}
  176.               <ul class="list-unstyled recipe-info">
  177.                 <li class="share" onclick = "sharemodal('Article','{{ app.request.getSchemeAndHttpHost() ~ '/' ~ app.request.locale ~ '/resource/' ~ resource.url}}','{{ "SHARE KNOWLEDGE WITH YOUR FRIENDS"|trans }}')">{{'Share'|trans}}</li>
  178.                 <li class="like logged-out">{{'Like'|trans}}</li>
  179.                 <li class="download-black d-none" id ="download">{{'Download'|trans}}</li>
  180.               </ul>
  181.               {% endif %}
  182.               {# <div class = "refrances">
  183.               {% if resource.references_links %}
  184.                 <div class = "refrances-links">
  185.                   <h3>{{'References'|trans}}</h3>
  186.                   <ul class="list-unstyled">
  187.                   
  188.                   {% for refrences in resource.references_links %}
  189.                     <li><a href = "{{refrences.references.data}}">{{refrences.references.data}}</a></li>
  190.                     {% endfor %}
  191.                     
  192.                 
  193.               </ul>
  194.                 </div>
  195.                 {% endif %}
  196.               </div> #}
  197.             </div>
  198.           </div>
  199.           <div class="col-xl-3">
  200.             <div class="resource-article-related">
  201.               <!--Start Featured Recipes Section-->
  202.               <section class="featured-recipes-section inner-frecipes-section all-event-section related-article-section">
  203.                 <div class="container container-sm">
  204.                   <h2 class="heading related-article-headingg">{{'Related Articles'|trans}}</h2>
  205.                   <div class="featured-recipes">
  206.                     <div class="custom-slider">
  207.                       {% if resource.related_article %}
  208.                         {% for article in resource.related_article %}
  209.                         <div class="slide-holder">
  210.                           <div class="slide-holder">
  211.                            <a href="/{{app.request.locale}}/resource/{{article.url}}">
  212.                             <figure class="slide-img">
  213.                               <img src="{{article.image}}" alt="{{ article.name }}">
  214.                             </figure><a/>
  215.                             <div class="slide-content">
  216.                               <div class="frecipes-box">
  217.                                 <a href="/{{app.request.locale}}/resource/{{article.url}}" class="text-decoration-none"><h3>{{article.name}}</h3></a>
  218.                                 <p>{{article.main_description}}</p>
  219.                               </div>
  220.                               {% set user = app.session.get('loginUserName') %}
  221.                               {% if user is not null %}  
  222.                               <ul class="list-unstyled recipe-info">
  223.                                 <li class="share"  onclick = "loyaltyProgram(this,{{ article.id }},'{{ article.name }}',10,'Article','Share')"><span onclick = "sharemodal('Article','{{ app.request.getSchemeAndHttpHost() ~ '/' ~ app.request.locale ~ '/resource/' ~ article.url}}','{{ "SHARE KNOWLEDGE WITH YOUR FRIENDS"|trans }}')">{{'Share'|trans}}</span></li>
  224.                                 {% if article.id in Liked_related_article_Ids %}
  225.                                  <li class= 'liked'>{{'Like'|trans}}</li>
  226.                                   {% else %}
  227.                                     <li class="like related_article"  onclick = "loyaltyProgram(this,{{ article.id }},'{{ article.name }}',10,'Article','Like', '{{app.request.locale}}')">{{'Like'|trans}}</li>
  228.                                   {% endif %}
  229.                                 
  230.                                 <li class="download-black d-none"  onclick = "loyaltyProgram(this,{{ article.id }},'{{ article.name }}',10,'Article','Save')">{{'Download'|trans}}</li>
  231.                               </ul>
  232.                               {% else %}
  233.                               <ul class="list-unstyled recipe-info">
  234.                                 <li class="share" onclick = "sharemodal('Article','{{ app.request.getSchemeAndHttpHost() ~ '/' ~ app.request.locale ~ '/resource/' ~ article.url}}','{{ "SHARE KNOWLEDGE WITH YOUR FRIENDS"|trans }}')">{{'Share'|trans}}</li>
  235.                                 <li class="like logged-out"  >{{'Like'|trans}}</li>
  236.                                 <li class="download-black d-none"  >{{'Download'|trans}}</li>
  237.                               </ul>
  238.                               {% endif %}
  239.                             </div>
  240.                           </div>
  241.                         </div>
  242.                         {% endfor %}
  243.                       {% else %}
  244.                       No Related Article
  245.                       {% endif %}
  246.                     </div>
  247.                   </div>
  248.                 </div>
  249.               </section>
  250.               <!--End Featured Recipes Section-->
  251.             </div>
  252.           </div>
  253.         </div>
  254.       </div>
  255.     </section>
  256.     <!-- End Article -->
  257. </div>
  258.         <!--Start Category Section -->
  259.            <section class="featured-categories resource-featured-categories">
  260.             <div class="container container-sm">
  261.               <div class="featured-categories-section">
  262.                 <h2 class="heading">{{'More Topics'|trans}}</h2>
  263.                 <div class="featured-categories-section-wrapper">
  264.                   {%  for topic in more_topics %}
  265.                   <div class="featured-categories-section-wrapper-item">
  266.                   <a href="/{{app.request.locale}}/resources/{{topic.url}}">
  267.                     <figure class="featured-categories-section-wrapper-item-video">
  268.                       <div class="media-section">                
  269.                         <video poster="{{topic.image}}" playsinline>
  270.                           {% if topic.video.data is defined %}                  
  271.                           <source src="{{ topic.video.data }}" type="video/mp4">
  272.                           {% endif %}
  273.                           Your browser does not support the video tag.
  274.                         </video>
  275.                         {# <div class="control-options">
  276.                           <i class="fas fa-play-circle"></i>
  277.                           <i class="fas fa-pause-circle"></i>
  278.                         </div> #}
  279.                       </div>
  280.                     </figure></a>
  281.                     <div class="featured-categories-section-wrapper-item-content">
  282.                       <a href="/{{app.request.locale}}/resources/{{topic.url}}" class="featured-categories-section-wrapper-item-content-btn">
  283.                         {{topic.name}}
  284.                       </a>
  285.                     </div>
  286.                   </div>
  287.                   {% endfor %}
  288.                 </div>
  289.               </div>
  290.             </div>
  291.           </section>
  292.         <!--End Category Section -->
  293.     {% if (app.request.locale =='ar') %}
  294.       {% set topMenu ="/en/resource/" ~ resource.url('en') %}
  295.     {% else %}
  296.       {% set topMenu ="/ar/resource/" ~ resource.url('en') %}
  297.     {% endif %}
  298.  <script>
  299.  var _TopMenuLink = "{{ topMenu }}";
  300.  $(document).ready(function(){
  301.   //loyaltyProgram(this,{{ resource.id }},'{{ resource.name }}',50,'Article','Viewed')
  302.  });
  303.  {# document.addEventListener("DOMContentLoaded", () => {
  304.     const start = new Date().getTime();
  305.     window.addEventListener("beforeunload", () => {
  306.         const end = new Date().getTime();
  307.         const totalTime = (end - start) / 1000
  308.     
  309.         console.log(totalTime)
  310.     });
  311. }); #}
  312.  </script>
  313.  <script type="text/javascript">
  314.     // This code is Vanilla JS, you can equivalently use jQuery
  315.     // $(document).ready() or $(window).on()
  316.     let timeSpentScrolling = 0;
  317.     let isHalted = false;
  318.     let haltedStartTime, haltedEndTime;
  319.     let totalHaltedTime = 0;
  320.     const update_halt_state = () => {
  321.       if (isHalted) {
  322.         isHalted = false;
  323.         haltedEndTime = new Date().getTime()
  324.         totalHaltedTime += (haltedEndTime - haltedStartTime) / 1000
  325.       } else {
  326.         isHalted = true;
  327.         haltedStartTime = new Date().getTime()
  328.       }
  329.     }
  330.     // Listen for scroll events
  331.     window.addEventListener('scroll', () => {
  332.       timeSpentScrolling += 1.8;
  333.       update_halt_state()
  334.     });
  335.     document.addEventListener("DOMContentLoaded", () => {
  336.       const start = new Date().getTime();
  337.       // AVERAGE SCROLLING INTERVAL - 60 seconds
  338.       setInterval(() => {
  339.         if (new Date().getTime() - start > 60000) {
  340.           update_halt_state()
  341.            $(document).ready(function(){
  342.           loyaltyProgram(this,{{ resource.id }},'{{ resource.name }}',50,'Article','Viewed')
  343.         });
  344.         }
  345.       }, 39000)
  346.       window.addEventListener("beforeunload", () => {
  347.         const end = new Date().getTime();
  348.         update_halt_state()
  349.         const totalTime = ((end - start) / 1000) - (timeSpentScrolling / 1000) - totalHaltedTime
  350.         //navigator.sendBeacon("https://topapi2.free.beeceptor.com", totalTime)
  351.       });
  352.     });
  353. </script>
  354.   <!-- Resource Listing More Topics End -->
  355. {% endblock %}
  356. {% block footer %}
  357.   {% include "includes/footer.html.twig" %}
  358. {% endblock %}