File indexing completed on 2024-12-29 05:24:38

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 
0023 $helperSearchCategories = new Default_View_Helper_ListCategories();
0024 $categories = $helperSearchCategories->listCategories();
0025 $helperTagProductCounter = new Default_View_Helper_CategoryProductCount();
0026 $helperFetchTotalProductsCount = new Default_View_Helper_FetchTotalProductsCount();
0027 $helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl();
0028 ?>
0029 <main id="browse-page">
0030 
0031     <section class="head-wrap">
0032 
0033         <section class="wrapper">
0034 
0035             <div class="page-title">
0036                 <div class="center">
0037                     <div><h1>Browse</h1></div>
0038                 </div>
0039                 <hr/>
0040             </div>
0041 
0042             <div class="row">
0043 
0044                 <div class="banner col-lg-5 col-md-5 col-sm-6 col-xs-8">
0045 
0046                     <div class="top">
0047 
0048                         <div class="large"><?= $helperFetchTotalProductsCount->fetchTotalProductsCount() ?></div>
0049                         <div clas="small">Products</div>
0050 
0051                     </div>
0052 
0053                     <div class="bottom">
0054 
0055                         <a class="btn btn-native" href="/register">Register</a> to add your product
0056 
0057                     </div>
0058 
0059                 </div>
0060 
0061             </div>
0062 
0063         </section>
0064 
0065     </section>
0066 
0067     <section class="body-wrap" id="cat-list">
0068 
0069         <section class="wrapper">
0070 
0071             <div class="row">
0072                 <!-- Main Cat -->
0073                 <div>
0074                     <div>
0075                         <!-- SubCat -->
0076                         <div class="scroll-pane">
0077                             <div class="sub-categories">
0078 
0079                                 <?php
0080                                 $lastSubMenueElement = 0;
0081                                 $startSubmenue = 0;
0082                                 $parentCategory = 0;
0083                                 $lastMainCat = 0;
0084                                 foreach ($categories as $key => $element) {
0085 
0086                                     $element['product_counter'] = (int)$element['product_counter'];
0087 
0088                                     $element['product_counter'] = $helperTagProductCounter->categoryProductCount($element['project_category_id']);
0089 
0090                                     $depth = (int)$element['depth'];
0091 
0092                                     if ($depth == 2) {
0093                                         echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cat-cont">
0094                                 <div class="category ' . $this->translate($element['title']) . '" >
0095                                     <a class="title" href="' . $helperBuildExploreUrl->buildExploreUrl($parentCategory, $element['project_category_id']) . '/">'
0096                                             . $this->translate($element['title']) . '<span class="label label-default">' . $element['product_counter'] . '</span>
0097                                     </a></div></div>';
0098                                     } else if ($depth == 1) {
0099                                         echo '</div></div><!-- /SubCat -->';
0100                                         echo '</div></div><!-- /MainCat -->';
0101 
0102                                         echo '<!-- MainCat --><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cat-cont">
0103                                 <div class="category ' . $this->translate($element['title']) . '" >
0104                                     <a class="title" href="' . $helperBuildExploreUrl->buildExploreUrl($element['project_category_id']) . '">'
0105                                             . $this->translate($element['title']) . '<span class="label label-default">' . $element['product_counter'] . '</span>
0106                                     </a>';
0107 
0108                                         echo '<!-- SubCat --><div class="scroll-pane"><div class="sub-categories">';
0109                                     }
0110 
0111                                 }
0112                                 ?>
0113                             </div>
0114 
0115         </section>
0116 
0117     </section>
0118 
0119 </main>
0120 
0121 <script>
0122     $(document).ready(function () {
0123         var BrowseCategoriesPage = (function () {
0124 
0125             return {
0126 
0127                 setup: function () {
0128 
0129                     $(window).load(function () {
0130 
0131                         $('#cat-list').find('.container').each(function () {
0132 
0133                             var $container = $(this).find('.row');
0134 
0135                             $container.masonry({
0136                                 itemSelector: '.item'
0137                             });
0138 
0139                         });
0140 
0141                     });
0142 
0143                 }
0144             }
0145 
0146         })();
0147 
0148 
0149         BrowseCategoriesPage.setup();
0150     });
0151 </script>