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 $modelCategory = new Default_Model_DbTable_ProjectCategory();
0023 $this->dataCategory = $modelCategory->findSingleRow($this->cat_id);
0024 $store_config = Zend_Registry::get('store_config');
0025 $host = $store_config->host;
0026 $site_name = $store_config->name;
0027 $og_server = $this->serverUrl(true);
0028 $catTitle = '';
0029 if($this->dataCategory['project_category_id'])
0030 {
0031   $catTitle = $this->dataCategory['title'];
0032 }
0033 if($this->filters['order'] == 'latest'){
0034   $og_title = 'Browse '.$catTitle.' Latest | '.$og_server;
0035 }else if($this->filters['order'] == 'top'){
0036   $og_title = 'Browse '.$catTitle.' Top | '.$og_server;
0037 }else{
0038   $og_title='Browse '.$catTitle.' | '.$og_server;
0039 }
0040 $og_description = $og_title .' | A community for free and open source software and libre content';
0041 $this->templateConfigData = Zend_Registry::get('store_template');
0042 $og_image = 'https://' . $_SERVER['HTTP_HOST'] .$this->templateConfigData['header-logo']['image-src'];
0043 $this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA);
0044 $this->headMeta()->appendProperty('og:type', 'website');
0045 $this->headMeta()->appendProperty('og:url', $og_server);
0046 $this->headMeta()->appendProperty('og:title', $og_title);
0047 $this->headMeta()->appendProperty('og:description',$og_description);
0048 $this->headMeta()->appendProperty('og:image',$og_image);
0049 $this->headMeta()->appendProperty('og:site_name',$og_server);
0050 
0051 
0052 $helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl();
0053 $modelInfo = new Default_Model_Info();
0054 
0055 $this->countSupporters = $modelInfo->getCountAllSupporters();
0056 $this->supporters = $modelInfo->getNewActiveSupporters(7);
0057 $this->headLink()->appendStylesheet('/theme/flatui/css/explore_index.css');
0058 
0059 
0060 if($this->inputFilterOriginal ==1)
0061 {
0062     $checkedOriginal = ' checked';
0063 }else
0064 {
0065    $checkedOriginal = '';
0066 }
0067 
0068 ?>
0069 
0070 <style>
0071 
0072   @media (max-width:720px){
0073 
0074     body > .panel.panel-default.pull-left {
0075       max-width: 100%;
0076       overflow-y: hidden;
0077     }
0078 
0079     #explore-content .GridFlex .content {
0080       padding-right: 15px;
0081       min-width: 400px;
0082     }
0083 
0084     #explore-content .GridFlex .sidebar-right {
0085       width: 400px;
0086       flex: none !important;
0087       margin: 0 auto;
0088     }
0089 
0090     #explore-content .GridFlex .content .explore-products {
0091       padding: 0 !important;
0092     }
0093 
0094     .explore-products .product-list .explore-product {
0095       position: relative;
0096       padding-left: 20px;
0097       padding-right: 50px;
0098     }
0099 
0100     .explore-products .product-list .explore-product > .col-xs-1 {
0101       position: absolute;
0102       top: 10px;
0103       left: 10px;
0104       padding: 0;
0105     }
0106 
0107     .explore-products .product-list .explore-product .explore-product-imgcolumn {
0108       width: 20%;
0109     }
0110 
0111     .explore-products .product-list .explore-product .explore-product-details {
0112       width: 80%;
0113     }
0114 
0115     .explore-products .product-list .explore-product .explore-product-plings {
0116       position: absolute;
0117       top: 10px;
0118       right: 0;
0119       width: 50px;
0120     }
0121 
0122     .explore-products .product-list .explore-product .explore-product-plings .rating {
0123       width: 100%;
0124     }
0125 
0126     .pling-nav-tabs ul.nav-tabs>li:last-child {
0127       float: right;
0128       padding: 10px;
0129       font-size: 12px;
0130     }
0131 
0132     #explore-content .sidebar-right-info .prod-widget-box {
0133       width: 100%;
0134     }
0135 
0136   }
0137 
0138   @media (max-width:611px){
0139     #explore-content .GridFlex .content {
0140       padding-right: 0;
0141       min-width: 100%;
0142     }
0143 
0144     #explore-content .GridFlex .sidebar-left {
0145       flex: none !important;
0146       width: 100%;
0147     }
0148 
0149     #explore-content .GridFlex .sidebar-right {
0150       flex: none !important;
0151       width: 100%;
0152       padding: 0;
0153     }
0154   }
0155 
0156   .filter_browse_tag_group {
0157       margin-right: 5px;
0158   }
0159 
0160 </style>
0161 
0162 <main id="explore-content">
0163     <section class="wrapper" id="products-wrapper">
0164     <span class="glyphicon  togglesidebar" id="btnTogglesidebar" ></span>
0165     <div class="GridFlex">
0166       <div class="GridFlex-cell sidebar-left" >
0167           <?php  $time_start = microtime(true);echo $this->render('explore/partials/filter.phtml'); $time_elapsed = microtime(true) - $time_start; ?>
0168           <?php if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') {
0169              echo '<div class="alert alert-warning" role="alert"><strong>Rendering Time: </strong>'.$time_elapsed.' s</div>';
0170           }?>
0171       </div>
0172       <div class="GridFlex-cell content">
0173         <section class="explore-products" id="explore-products">
0174 
0175             <div class="pling-nav-tabs">
0176               <ul class="nav nav-tabs pling-nav-tabs" id="sort">
0177                   <li  <?=$this->filters['order'] == 'latest' ? 'class="active"' :'' ?>>
0178                       <a href="<?= $helperBuildExploreUrl->buildExploreUrl($this->filters['category'], null,
0179                           'latest') ?>"><span><?= $this->translate('Latest') ?></span></a>
0180                   </li>
0181                   <li <?=$this->filters['order'] == 'rating' ? 'class="active"' :'' ?>>
0182                       <a href="<?= $helperBuildExploreUrl->buildExploreUrl($this->filters['category'], null,
0183                           'rating') ?>"><span><?= $this->translate('Score') ?></span></a>
0184                   </li>
0185                   <li <?=$this->filters['order'] == 'plinged' ? 'class="active"' :'' ?>>
0186                       <a href="<?= $helperBuildExploreUrl->buildExploreUrl($this->filters['category'], null,
0187                           'plinged') ?>"><span><?= $this->translate('Plinged') ?></span></a>
0188                   </li>
0189                    <?php if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') {?>
0190                   <li <?=$this->filters['order'] == 'top' ? 'class="active"' :'' ?>>
0191                       <a href="<?= $helperBuildExploreUrl->buildExploreUrl($this->filters['category'], null,
0192                           'top') ?>"><span><?= $this->translate('Score_old') ?></span></a>
0193                   </li>
0194                   <li <?=$this->filters['order'] == 'test' ? 'class="active"' :'' ?>>
0195                       <a href="<?= $helperBuildExploreUrl->buildExploreUrl($this->filters['category'], null,
0196                           'test') ?>"><span><?= $this->translate('Score_test') ?></span></a>
0197                   </li>
0198                 <?php }?>
0199                   <li style="float: right">
0200                       
0201 
0202 
0203                   <?php //Insert flexible tag-group-filter
0204                   $tagGroupFilter  = Zend_Registry::isRegistered('config_store_taggroups') ? Zend_Registry::get('config_store_taggroups') : null;
0205                   $tagGroupHelper = new Default_View_Helper_FetchTagsForTagGroup();
0206 
0207                   if(!empty($tagGroupFilter)) {
0208                       foreach ($tagGroupFilter as $tagGroup ) {
0209                           $tags = $tagGroupHelper->fetchList($tagGroup);
0210                           $select = $this->tag_group_filter[$tagGroup];
0211                           echo "<select id='tag_group_filter_".$tagGroup."' data_group_id='".$tagGroup."' class='filter_browse_tag_group'>";
0212                           echo "<option value=''></option>";
0213                           foreach (array_keys($tags) as $tag_id) {
0214                               if($select == $tag_id) {
0215                                   echo "<option value='".$tag_id."' selected>".$tags[$tag_id]."</option>";
0216                               } else {
0217                                   echo "<option value='".$tag_id."'>".$tags[$tag_id]."</option>";
0218                               }
0219 
0220                           }
0221 
0222                           echo "</select>";
0223                       }
0224 
0225 
0226                   }
0227                   ?>
0228                   </li>
0229               </ul>
0230             </div>
0231 
0232               <div class="product-list">
0233                   <?php
0234                   if (count($this->products) == 0) {
0235                       echo '<div class="empty">No products to show in this category.</div>';
0236                   } else {
0237                        $time_start = microtime(true);
0238                        echo $this->render('explore/partials/products.phtml');
0239                        $time_elapsed = microtime(true) - $time_start;
0240                   }
0241                   ?>
0242                   <?php if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') {
0243                       echo '<div class="explore-product col-lg-12 col-md-12 col-sm-12 col-xs-12">';
0244                       echo '<div class="alert alert-warning" role="alert"><strong>Rendering Time: </strong>'.$time_elapsed.' s</div>';
0245                       echo '</div>';
0246                   }?>
0247               </div>
0248 
0249 
0250               <section class="explore-footer">
0251                   <?php echo $this->paginationControl($this->products, 'Sliding',
0252                       'explore/partials/paginationControl.phtml',
0253                       array('params' => $this->filters, 'dom_target' => 'section.explore-products')); ?>
0254               </section>
0255           </section>
0256       </div>
0257 
0258 <?php
0259 $time_start = microtime(true);
0260      $this->comments = $modelInfo->getLatestComments(5, $this->cat_id, $this->tags);
0261      //$donations = $modelInfo->getLatestPlings(5, $this->cat_id);
0262      $topprods = $modelInfo->getMostDownloaded(100, $this->cat_id, $this->tags);
0263      $asidehide = '';
0264      if(!$this->catabout && count($this->comments)==0  && count($topprods)==0 )
0265      {
0266         $asidehide = 'hide';
0267      }
0268      $this->show_git = false;
0269 ?>
0270       <div class="GridFlex-cell sidebar-right">
0271           <aside  id="explore-sidebar <?=$asidehide?>" >
0272              <?php
0273                 echo $this->render('/home/partials/common_rightsidebar.phtml');
0274             ?>
0275 
0276             <div  class="row sidebar-right-info" >
0277               <?php
0278               if (count($topprods) > 0) {
0279                   ?>
0280                   <span class="commentTitle"> Popularity <span class="small light"> (based on plings, downloads, etc.)</span></span>
0281 
0282                   <div class="prod-widget-box right bgwhite" id="mostdownloaded">
0283                       <?php
0284                       $this->rownum = 1;
0285                       foreach ($topprods as $this->product) {
0286                           echo $this->render('explore/partials/productTop.phtml');
0287                           $this->rownum++;
0288                       }
0289                       ?>
0290                   </div>
0291               <?php } ?>
0292 
0293             </div>
0294         </aside>
0295           <?php
0296           $time_elapsed = microtime(true) - $time_start;
0297           if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') {
0298               echo '<div class="alert alert-warning" role="alert"><strong>Rendering Time: </strong>'.$time_elapsed.' s</div>';
0299           }?>
0300       </div>
0301     </div>
0302     </section>
0303 
0304     <div class="tooltip_templates" style="display: none">
0305     <span id="tooltip_content">
0306         <i class="fa fa-spinner"></i>
0307     </span>
0308 </div>
0309 </main>
0310 
0311 <?php $this->inlineScript()->appendScript(
0312     '    $(document).ready(function(){
0313             TooltipUser.setup("tooltipuserleft","left");
0314             TooltipUser.setup("tooltipuser","right");            
0315             FilterBrowseTagGroupFn.setup();
0316         });
0317     ');