File indexing completed on 2025-05-04 05:29:20

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 echo $this->buildProductUrl;
0023 ?>
0024 <main id="explore-content" class="carousel-page">
0025     <!-- FILTERS -->
0026     <section class="fixed-filter absolute">
0027         <section class="wrapper">
0028             <?php
0029             echo $this->render('explore/partials/filter.phtml');
0030             ?>
0031         </section>
0032     </section>
0033     <!-- /FILTERS -->
0034     <!-- PRODUCT LIST -->
0035     <section class="wrapper" id="products-wrapper">
0036 
0037         <section class="explore-products">
0038 
0039             <div id="explore-carousel">
0040 
0041                 <!-- arrows -->
0042                 <a class="carousel-arrow" id="left">
0043                     <span class="glyphicon glyphicon-chevron-left"></span>
0044                 </a>
0045                 <a class="carousel-arrow" id="right">
0046                     <span class="glyphicon glyphicon-chevron-right"></span>
0047                 </a>
0048                 <!-- /arrows -->
0049 
0050                 <!-- navigation -->
0051                 <div class="navigation">
0052                     <ol></ol>
0053                 </div>
0054                 <!-- /navigation -->
0055 
0056                 <div class="items">
0057                     <?php
0058                     echo $this->partialLoop('explore/partials/product.phtml', $this->products);
0059                     echo $this->formHidden('page', $this->page, array('id' => 'page'));
0060                     echo $this->formHidden('ranking', $this->inputFilter['ranking'], array('id' => 'ranking'));
0061                     echo $this->formHidden('category', $this->inputFilter['category'], array('id' => 'category'));
0062                     ?>
0063                 </div>
0064 
0065             </div>
0066 
0067         </section>
0068 
0069     </section>
0070 
0071     <!-- /PRODUCT LIST -->
0072 </main>
0073 
0074 <main id="product-showcase"></main>
0075 
0076 <script>
0077 
0078     var catpage_url;
0079 
0080     var exploreCarousel = (function () {
0081 
0082         return {
0083 
0084 
0085             setup: function () {
0086 
0087                 $(document).ready(function () {
0088 
0089                     // This event is triggered when you visit a page in the history
0090                     // like when yu push the "back" button
0091                     $(window).on('popstate', function (e) {
0092                         //alert('State: ' + e.originalEvent.state.command);
0093                         if (e.originalEvent.state.command == 'showList') {
0094                             $('.bootstrap-dialog').hide();
0095                             $('#explore-content').css('visibility', 'visible');
0096                             $('body > #page_header').css('visibility', 'visible');
0097                             $('body > footer').css('visibility', 'visible');
0098 
0099                         } else {
0100                             $('body > #page_header').css('visibility', 'hidden');
0101                             $('#explore-content').css('visibility', 'hidden');
0102                             $('body > footer').css('visibility', 'hidden');
0103                             $('.bootstrap-dialog').show();
0104 
0105                         }
0106                         //console.log(e.originalEvent.state);
0107                     });
0108 
0109 
0110                     adjustMainHeight();
0111                     /*
0112                      adjustMainHeight();
0113                      initializeCarousel();
0114 
0115                      // carousel slide animation
0116                      $('.navigation').delegate('ul > li', 'click', function () {
0117                      var this_li = $(this);
0118                      //slotMachineAnimation(this_li);
0119                      animateExploreCarousel(this_li);
0120                      });
0121 
0122                      // carousel arrows
0123                      $('#explore-carousel').delegate('a.carousel-arrow', 'click', function () {
0124                      if ($(this).attr('id') == 'right') {
0125                      this_li = $('li.active').next('li');
0126                      } else {
0127                      this_li = $('li.active').prev('li');
0128                      }
0129                      if (this_li.size()) {
0130                      animateExploreCarousel(this_li);
0131                      }
0132                      });
0133                      */
0134                     // show product
0135                     $('.explore-product').delegate('a', 'click', function (e) {
0136                         e.preventDefault();
0137                         var this_url = $(this).attr('href');
0138                         catpage_url = window.location.href;
0139                         var app_elememnt = $('#explore-product-modal').find('.modal-body').find('#support-widget');
0140 
0141                         var stateObj = {url: this_url, title: "a title", command: 'showDetail'};
0142                         history.pushState(stateObj, "Product", this_url);
0143 
0144                         BootstrapDialog.show({
0145                             //id: 'product_popup',
0146                             message: function (dialog) {
0147                                 var $message = $('<div></div>');
0148                                 var pageToLoad = dialog.getData('pageToLoad');
0149 
0150                                 $('#explore-content').css('visibility', 'hidden');
0151                                 $('body > #page_header').css('visibility', 'hidden');
0152                                 $('body > footer').css('visibility', 'hidden');
0153 
0154 
0155                                 $.get(pageToLoad, function (data) {
0156                                     $message.html(data);
0157 
0158                                     var slideShowInterval;
0159                                     SlideShowRender.setup();
0160                                     ProductSlideShow.setup();
0161 
0162                                     var app_elememnt = $('#support-widget');
0163                                     angular.bootstrap(app_elememnt, ['widgetApp']);
0164                                 });
0165 
0166                                 /*
0167                                  $message.load(pageToLoad, function(response, status, xhr) {
0168 
0169                                  })
0170                                  */
0171                                 return $message;
0172                             },
0173                             data: {
0174                                 'pageToLoad': this_url
0175                             },
0176                             onhide: function (dialogRef) {
0177                                 //window.history.replaceState('object or string', 'title', catpage_url);
0178                                 var stateObj = {url: catpage_url, title: "a title", command: 'showList'};
0179                                 history.pushState(stateObj, "Product List", catpage_url);
0180 
0181                                 $('body > #page_header').css('visibility', 'visible');
0182                                 $('body > footer').css('visibility', 'visible');
0183                                 $('#explore-content').css('visibility', 'visible');
0184                             },
0185                             onshow: function (dialogRef) {
0186                                 adjustMainHeight();
0187                             },
0188                             onshown: function (dialogRef) {
0189                                 $('body > #page_header').css('visibility', 'hidden');
0190                                 $('body > footer').css('visibility', 'hidden');
0191                                 $('#explore-content').css('visibility', 'hidden');
0192                             }
0193                         });
0194 
0195                     });
0196                     /**
0197                      e.preventDefault();
0198                      var this_url = $(this).attr('href');
0199                      var catpage_url = window.location.href;
0200 
0201 
0202                      $( "#dialog_iframe" ).attr('src',this_url);
0203 
0204                      $( "#dialog" ).dialog( "open" );
0205                      });
0206                      $("#dialog").dialog({
0207                       autoOpen: false,
0208                       position: 'center' ,
0209                       title: false,
0210                       draggable: false,
0211                       width : '100%',
0212                       height : '100%',
0213                       resizable : false,
0214                       modal : true,
0215                   });
0216                      */
0217                     /**
0218                      $.ajax({
0219                         url: this_url,
0220                         type: 'post',
0221                         success: function (results) {
0222                             var $response = $(results);
0223                             //var product_page = $response.filter('#product-page-content').html();
0224                             var header = $response.html();
0225                             var product_page = $response.filter('#product-page-content').html();
0226                             var app_elememnt = $('#explore-product-modal').find('.modal-body').find('#support-widget');
0227 
0228 
0229                             window.history.replaceState('object or string', 'title', this_url);
0230                             $('#explore-product-modal').find('.modal-body').html(header);
0231                             //$('#explore-product-modal').find('.modal-body').html(product_page);
0232                             angular.bootstrap(app_elememnt,['widgetApp']);
0233                             $('#explore-product-modal').modal('show');
0234                             adjustMainHeight();
0235 
0236                             $('#explore-product-modal').on('hide.bs.modal', function (e) {
0237                                 window.history.replaceState('object or string', 'title', catpage_url);
0238                                 $('#explore-product-modal').find('.modal-body').html('');
0239                             });
0240                         }
0241                     });
0242 
0243                      });
0244                      */
0245                 });
0246 
0247                 $(window).on('resize', function () {
0248                     adjustMainHeight();
0249                 });
0250 
0251                 /** ADJUST MAIN SIZE **/
0252 
0253                 function adjustMainHeight() {
0254                     if ($('#product-showcase').is(':empty')) {
0255                         var win_height = $(window).height();
0256                         var header_height = $('header').height();
0257                         var modal_body_height = win_height - header_height;
0258                         $('#explore-product-modal').find('.modal-body').css('height', modal_body_height);
0259                     }
0260                 }
0261 
0262                 /** ADJUST MAIN SIZE **/
0263 
0264                 /** CAROUSEL INITIALIZATION **/
0265 
0266                 function initializeCarousel() {
0267 
0268                     var crousel_items = $(".explore-product");
0269 
0270                     for (var i = 0; i < crousel_items.length; i += 10) {
0271                         var carousel_i = i / 10;
0272 
0273                         if (carousel_i == 0) {
0274                             crousel_items.slice(i, i + 10).wrapAll('<div class="item active" id="slide-' + carousel_i + '"></div>');
0275                             var this_indicator = '<li class="active" rel="' + carousel_i + '"><a>1</a></li>';
0276                         } else {
0277                             var carousel_slide_number = parseInt(carousel_i) + 1;
0278                             crousel_items.slice(i, i + 10).wrapAll('<div class="item" id="slide-' + carousel_i + '"></div>');
0279                             var this_indicator = '<li rel="' + carousel_i + '"><a>' + carousel_slide_number + '</a></li>';
0280                         }
0281 
0282                         $('#explore-carousel').find('ul').append(this_indicator);
0283                     }
0284 
0285                     $('.item').each(function () {
0286                         var item_number = 0;
0287                         var this_item = $(this);
0288                         $(this).find('.explore-product').each(function () {
0289                             item_number++;
0290                             $(this).addClass('col-' + item_number);
0291                             if (this_item.hasClass('active')) {
0292                                 $(this).css('top', '0px');
0293                             }
0294                         });
0295                     });
0296                 }
0297 
0298                 /** /CAROUSEL INITIALIZATION **/
0299 
0300                 /** ANIMATE EXPLORE CAROUSEL **/
0301 
0302                 function animateExploreCarousel(this_li) {
0303                     var current_li = $('li.active');
0304                     var current_slide_id = current_li.attr('rel');
0305                     var next_slide_id = this_li.attr('rel');
0306                     var current_slide = $('.item.active');
0307                     var next_slide = $('.item#slide-' + next_slide_id);
0308 
0309                     if (current_slide_id < next_slide_id) {
0310                         var cur_left = '-100%';
0311                         var next_left = '100%';
0312                     } else {
0313                         var cur_left = '100%';
0314                         var next_left = '-100%';
0315                     }
0316                     next_slide.css('left', next_left);
0317 
0318                     current_slide.stop().animate({left: cur_left}, 300, 'easeInCubic', function () {
0319                         current_slide.removeClass('active');
0320                         current_li.removeClass('active');
0321                     });
0322 
0323                     next_slide.stop().animate({left: '0px'}, 300, 'easeInCubic', function () {
0324                         next_slide.addClass('active');
0325                         this_li.addClass('active');
0326                     });
0327 
0328                 }
0329 
0330                 /** /ANIMATE EXPLORE CAROUSEL **/
0331 
0332                 /** SLOT MACHINE SLIDE EFFECT
0333 
0334                  function slotMachineAnimation(this_li){
0335                     var this_rel = this_li.attr('rel');
0336                     var this_slide = $('.item#slide-'+this_rel);
0337                     var active_slide = $('.item.active');
0338                     if ( (!this_slide.hasClass('active')) && ($(":animated").length == 0 ) ) {
0339 
0340                         var speed_1 = Math.floor(Math.random()*1000) + 300;
0341                         var speed_2 = Math.floor(Math.random()*1000) + 300;
0342                         var speed_3 = Math.floor(Math.random()*1000) + 300;
0343                         var speed_4 = Math.floor(Math.random()*1000) + 300;
0344                         var speed_5 = Math.floor(Math.random()*1000) + 300;
0345 
0346                         var item_height = $('.items').height();
0347                         var item_animation_counter = 0;
0348 
0349                         this_slide.find('.explore-product').each(function(){
0350                             if ($(this).hasClass('col-1')){
0351                                 $(this).animate({top:'0px'},speed_1,function(){
0352 
0353                                 });
0354                             } else if ($(this).hasClass('col-2')){
0355                                 $(this).animate({top:'0px'},speed_2,function(){
0356 
0357                                 });
0358                             } else if ($(this).hasClass('col-3')){
0359                                 $(this).animate({top:'0px'},speed_3,function(){
0360 
0361                                 });
0362                             } else if ($(this).hasClass('col-4')){
0363                                 $(this).animate({top:'0px'},speed_4,function(){
0364 
0365                                 });
0366                             } else if ($(this).hasClass('col-5')){
0367                                 $(this).animate({top:'0px'},speed_5,function(){
0368 
0369                                 });
0370                             }
0371                         });
0372 
0373                         $('.item.active').find('.explore-product').each(function(){
0374 
0375                             item_animation_counter++;
0376 
0377                             if ($(this).hasClass('col-1')){
0378                                 $(this).animate({top:'-'+item_height+'px'},speed_1,function(){
0379                                     $(this).css('top',item_height);
0380                                 });
0381                             } else if ($(this).hasClass('col-2')){
0382                                 $(this).animate({top:'-'+item_height+'px'},speed_2,function(){
0383                                     $(this).css('top',item_height);
0384                                 });
0385                             } else if ($(this).hasClass('col-3')){
0386                                 $(this).animate({top:'-'+item_height+'px'},speed_3,function(){
0387                                     $(this).css('top',item_height);
0388                                 });
0389                             } else if ($(this).hasClass('col-4')){
0390                                 $(this).animate({top:'-'+item_height+'px'},speed_4,function(){
0391                                     $(this).css('top',item_height);
0392                                 });
0393                             } else if ($(this).hasClass('col-5')){
0394                                 $(this).animate({top:'-'+item_height+'px'},speed_5,function(){
0395                                     $(this).css('top',item_height);
0396                                 });
0397                             }
0398 
0399                             if (item_animation_counter == 5){
0400                                 $('.item.active').removeClass('active');
0401                                 this_slide.addClass('active');
0402                                 $('#explore-carousel').find('li.active').removeClass('active');
0403                                 this_li.addClass('active');
0404                             }
0405                         });
0406                     }
0407                 }
0408 
0409                  /SLOT MACHINE SLIDE EFFECT **/
0410 
0411             }
0412         }
0413 
0414     })();
0415 
0416     exploreCarousel.setup();
0417 </script>