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

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 
0024 <?php
0025 $filterScore = $this->ls ? 'laplace_score:['.$this->ls.' TO '.($this->ls+9).']':null;
0026 $filterCat = $this->pci ? 'project_category_id:('.$this->pci.')' : null;
0027 $filterTags = $this->t ? 'tags:('.$this->t.')' : null;
0028 $filterPkg = $this->pkg ? 'package_names:('.$this->pkg.')' : null;
0029 $filterArch = $this->arch ? 'arch_names:('.$this->arch.')' : null;
0030 $filterLic = $this->lic ? 'license_names:('.$this->lic.')' : null;
0031 $store = $this->store;
0032 $param = array('q' => $this->searchText ,'store'=>$store,'page' => $this->page, 'count' => 10, 'qf' => $this->searchField, 'fq' => array($filterCat, $filterScore, $filterTags,$filterPkg,$filterArch,$filterLic));
0033 
0034 $tagDescription = null;
0035 if($this->t)
0036 {
0037     $tagsModel = new Default_Model_DbTable_Tags();
0038     $tag = $tagsModel->fetchTagByName($this->t);
0039     if($tag['tag_description'])
0040     {
0041         $tagDescription=$tag['tag_description'];
0042     }    
0043 }
0044 
0045 $modelSearch = new Default_Model_Solr();
0046 try {
0047     $this->result = $modelSearch->search($param);
0048 } catch (Exception $e) {
0049     Zend_Registry::get('logger')->err(__FILE__.'('.__LINE__.') -- params: '.print_r($param, true)."\n".' message: '."\n".$e->getMessage());
0050 
0051     $this->result = array('hits' => array(), 'highlighting' =>array(),'response' => array('numFound' => 0));
0052 }
0053 $this->pagination = $pagination = $modelSearch->getPagination();
0054 $this->products = $this->result['hits'];
0055 
0056 $this->highlighting = $this->result['highlighting'];
0057 
0058 $this->headTitle('Search: '.$this->searchText, 'SET');
0059 
0060 $helperBuildExploreUrl = new Default_View_Helper_BuildExploreUrl();
0061 $modelInfo = new Default_Model_Info();
0062 $this->headLink()->appendStylesheet('/theme/flatui/css/explore_index.css');
0063 $this->countSupporters = $modelInfo->getCountAllSupporters();
0064 $this->supporters = $modelInfo->getNewActiveSupporters(18);
0065 
0066 ?>
0067 <main id="explore-content" class="searchresults">
0068     <section class="wrapper" id="products-wrapper">
0069         <span class="glyphicon  togglesidebar" id="btnTogglesidebar" ></span>
0070         <div class="GridFlex">
0071             <div class="GridFlex-cell sidebar-left" >
0072                 <?php  $time_start = microtime(true);echo $this->render('product/partials/searchFilter.phtml'); $time_elapsed = microtime(true) - $time_start; ?>
0073                 <?php if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') {
0074                     echo '<div class="alert alert-warning" role="alert"><strong>Rendering Time: </strong>'.$time_elapsed.' s</div>';
0075                 }?>
0076             </div>
0077             <div class="GridFlex-cell content">
0078                 <section class="explore-products" id="explore-products">
0079                     <div style="display:flex;justify-content: space-between">
0080                         <div><h1 class="search-heading">Search results for "<?= $this->searchText; ?>"</h1>
0081                         </div>
0082                         <?php if($tagDescription):?>
0083                         <div style="display:block; float:right; border:1px solid #ccc; padding:5px; width:400px" >
0084                             <?php
0085                                 echo $tagDescription;
0086                             ?>
0087                         </div>
0088                         <?php endif;?>
0089                     </div>
0090                     <ul id="sort" class="nav nav-tabs">
0091                         <li class="text-right" style="text-align: right; width: 50%; float: right;">
0092                             <small><?=$this->result['response']['numFound']?> hit(s)</small>
0093                         </li>
0094                     </ul>
0095 
0096                     <div class="product-list">
0097                         <?php
0098                         if (count($this->products) == 0) { ?>
0099                             <p>Your search - <?=$this->searchText?> - did not match any documents.</p>
0100 
0101                             <p>Suggestions:
0102                             <ul>
0103                             <li>Make sure all words are spelled correctly.</li>
0104                             <li>Try keywords which are min 3 characters long.</li>
0105                             <li>Try different keywords.</li>
0106                             <li>Try more general keywords.</li>
0107                             <li>Try fewer keywords.</li>
0108                             <li>Use key words which start without wildcard symbols like "*" or "?".</li>
0109                             </ul>
0110                         <?php
0111                         } else {
0112                             $time_start = microtime(true);
0113                             echo $this->render('product/partials/listProducts.phtml');
0114                             $time_elapsed = microtime(true) - $time_start;
0115                         }
0116                         ?>
0117                         <?php if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') {
0118                             echo '<div class="explore-product col-lg-12 col-md-12 col-sm-12 col-xs-12">';
0119                             echo '<div class="alert alert-warning" role="alert"><strong>Rendering Time: </strong>'.$time_elapsed.' s</div>';
0120                             echo '</div>';
0121                         }?>
0122                     </div>
0123 
0124 
0125                     <section class="explore-footer">
0126                         <?php echo $this->paginationControl($this->pagination, 'Sliding', 'partials/paginationControl.phtml', array('params' => array('projectSearchText' => $this->searchText,'domain_store_id'=>$this->store), 'dom_target' => 'section.explore-products')); ?>
0127                     </section>
0128                 </section>
0129             </div>
0130 
0131         
0132             
0133         </div>
0134     </section>
0135     <div class="tooltip_templates" style="display: none">
0136     <span id="tooltip_content">
0137         <i class="fa fa-spinner"></i>
0138     </span>
0139 </div>
0140 </main>
0141 
0142 <?php $this->inlineScript()->appendScript(
0143     '    $(document).ready(function(){                               
0144               
0145                 TooltipUser.setup("tooltipuser","right");
0146                 TooltipUser.setup("tooltipuserleft","left");             
0147             });
0148         ');