File indexing completed on 2024-12-29 05:24:44
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 //$helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl(); 0023 //$randomProducts = new Default_View_Helper_FetchRandomProducts(); 0024 0025 $domainCategoryFilterId = Zend_Registry::isRegistered('store_category_list') ? Zend_Registry::get('store_category_list') : null; 0026 0027 /* 0028 if (isset($domainCategoryFilterId)) { 0029 $products = $randomProducts->fetchRandomProductsForCategories($domainCategoryFilterId, 5); 0030 } else { 0031 $products = $randomProducts->fetchRandomProducts(5); 0032 } 0033 */ 0034 if (true === empty($this->catid) && true === empty($domainCategoryFilterId)) { 0035 $mainCategories = new Default_View_Helper_FetchMainCategories(); 0036 $categories = $mainCategories->fetchMainCategories(); 0037 } else { 0038 if (isset($domainCategoryFilterId)) { 0039 $subCategories = new Default_View_Helper_FetchSubCategories(); 0040 $categories = $subCategories->fetchSubCategories($domainCategoryFilterId); 0041 // it's a hack. 0042 if (empty($categories)) { 0043 $fetchCategories = new Default_View_Helper_FetchCategory(); 0044 $categories = array($fetchCategories->fetchCategory($domainCategoryFilterId)); 0045 } 0046 } else { 0047 $subCategories = new Default_View_Helper_FetchSubCategories(); 0048 $categories = $subCategories->fetchSubCategories($this->catid); 0049 // it' a hack. 0050 if (empty($categories)) { 0051 $fetchCategories = new Default_View_Helper_FetchCategory(); 0052 $categories = array($fetchCategories->fetchCategory($this->catid)); 0053 } 0054 } 0055 } 0056 ?> 0057 <style> 0058 body.home-page main section#intro.wrapper .container article .logo_template { 0059 background-image: <?=$this->template['homepage']['logo']['background-image']?>; 0060 background-position: <?=$this->template['homepage']['logo']['background-position']?>; 0061 background-repeat: <?=$this->template['homepage']['logo']['background-repeat']?>; 0062 float: none; 0063 height: <?=$this->template['homepage']['logo']['height']?>; 0064 margin-left: auto; 0065 margin-right: auto; 0066 text-align: center; 0067 width: <?=$this->template['homepage']['logo']['width']?>; 0068 } 0069 </style> 0070 <main> 0071 <section class="wrapper" id="intro"> 0072 <section class="container"> 0073 <div class="row"> 0074 <article> 0075 <figure class="logo_template"></figure> 0076 <?=$this->template['homepage']['headline']?> 0077 </article> 0078 </div> 0079 </section> 0080 </section> 0081 0082 <?php 0083 $helperSearchCategories = new Default_View_Helper_FetchDomainCategories(); 0084 $categories = $helperSearchCategories->fetchDomainCategories($domainCategoryFilterId); 0085 $helperProductCount = new Default_View_Helper_CategoryProductCount(); 0086 $helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl(); 0087 $helperSubCategories = new Default_View_Helper_FetchSubCategories(); 0088 ?> 0089 <section class="wrapper" id="cat-list"> 0090 0091 <div class="row"> 0092 <div class="card-wrapper"> 0093 <?php 0094 foreach ($categories as $key => $element) { 0095 echo '<div class="card-item"><div class="category" >'; 0096 $catProductCount = $helperProductCount->categoryProductCount($element['project_category_id']); 0097 if ($catProductCount > 0) { 0098 $productCount = '<span class="label label-default">' . $catProductCount . '</span>'; 0099 } else { 0100 $productCount = ''; 0101 } 0102 echo '<a class="title" href="' . $helperBuildExploreUrl->buildExploreUrl($element['project_category_id']) . '">' 0103 . $this->translate($element['title']) . $productCount . '</a>'; 0104 // $subCategories = $helperSubCategories->fetchSubCategories($element['project_category_id']); 0105 // $amount = count($subCategories); 0106 // if ($amount > 0) { 0107 if ($element['rgt']-$element['lft'] > 1 ){ 0108 $subCategories = $helperSubCategories->fetchSubCategories($element['project_category_id']); 0109 $amount = count($subCategories); 0110 echo '</div><div>'; 0111 $counter = 0; 0112 foreach ($subCategories as $subCat) { 0113 $comma = ', '; 0114 if ($counter == $amount - 1) { 0115 $comma = ''; 0116 } 0117 $subCatProductCount = $helperProductCount->categoryProductCount($subCat['project_category_id']); 0118 if ($subCatProductCount > 0) { 0119 $productSubCount = '<span class="label label-default">' . $subCatProductCount . '</span>'; 0120 } else { 0121 $productSubCount = ''; 0122 } 0123 echo '<div><a class="title" href="' . $helperBuildExploreUrl->buildExploreUrl($subCat['project_category_id']) . '">' 0124 . $this->translate($subCat['title']) . $productSubCount . '</a></div>'; 0125 $counter += 1; 0126 } 0127 0128 } 0129 echo '</div></div>'; 0130 } 0131 ?> 0132 </div> 0133 </div> 0134 </section> 0135 </main> 0136 0137 0138 <div id="homepage-video" class="code-embed-modal modal fade"> 0139 <div class="modal-dialog pling-modal"> 0140 <div class="modal-content"> 0141 <!-- dialog contents --> 0142 <div class="modal-header"> 0143 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 0144 <h3 class="center">OCS</h3> 0145 </div> 0146 <div class="modal-body"> 0147 <iframe width="640" height="480" src="https://www.youtube.com/embed/vfMia0UxzD0" frameborder="0" 0148 allowfullscreen></iframe> 0149 </div> 0150 </div> 0151 </div> 0152 </div> 0153 <script type="text/javascript"> 0154 $(document).ready(function () { 0155 var colCount = 0; 0156 var colWidth = 0; 0157 var windowWidth = 0; 0158 var blocks = []; 0159 0160 function positionBlocks() { 0161 $('.card-item').each(function () { 0162 var min = Array.min(blocks), 0163 index = $.inArray(min, blocks), 0164 leftPos = margin + (index * (colWidth + margin)); 0165 $(this).css({ 0166 'left': leftPos + 'px', 0167 'top': min + 'px' 0168 }); 0169 blocks[index] = min + $(this).outerHeight() + margin; 0170 }); 0171 } 0172 0173 function setupBlocks() { 0174 windowWidth = $('.card-wrapper').width(); 0175 if (windowWidth <= 768) { 0176 return; 0177 } 0178 colWidth = $('.card-item').outerWidth(); 0179 margin = (windowWidth - colWidth * 3) / 4; 0180 blocks = []; 0181 colCount = Math.floor(windowWidth / (colWidth + margin)); 0182 for (var i = 0; i < colCount; i++) { 0183 blocks.push(margin); 0184 } 0185 positionBlocks(); 0186 $('.card-wrapper').height(Array.max(blocks)); 0187 } 0188 0189 $(window).resize(setupBlocks); 0190 0191 // Function to get the Min value in Array 0192 Array.min = function (array) { 0193 return Math.min.apply(Math, array); 0194 }; 0195 // Function to get the Max value in Array 0196 Array.max = function (array) { 0197 return Math.max.apply(Math, array); 0198 }; 0199 0200 setupBlocks(); 0201 }); 0202 </script> 0203 <?php $this->inlineScript()->appendScript( 0204 ' $(document).ready(function(){ 0205 0206 }); 0207 ');