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     $i = 0;
0023     
0024 
0025     foreach ($this->collection_projects as $project): 
0026         $project=(object)$project;         
0027         $ppload_collection_id = $project->ppload_collection_id;
0028         $files=array();
0029         $files_toinstall=array();
0030         foreach ($this->collection_projects_dls as $f) {
0031             if($f['collection_id']==$ppload_collection_id) $files[]=$f;
0032             if($f['collection_id']==$ppload_collection_id && $f['ocs_compatible']==1){
0033               $xdgType = $this->catXdgType($project->project_category_id);
0034               if($xdgType) $files_toinstall[]=$f;
0035             } 
0036         }
0037         $project->description = Default_Model_BBCode::renderHtml(Default_Model_HtmlPurify::purify($project->description));
0038         $i++;
0039 ?>
0040         <div class="row smaller row-collection" >
0041             <div class="col-lg-1 col-md-1">
0042                 <figure>
0043                     <?= $i ?>.
0044                 </figure>  
0045                 <div>
0046                     <button data-id="<?=$project->project_id?>" class="toggleCollectionRowBtn">
0047                         <i class="fa fa-angle-right"></i> </button>
0048                 </div>
0049             </div> 
0050             <div class="col-lg-5 col-md-5">
0051                 <figure style="display: block;float: left;">
0052                     <a href="<?= $this->buildProductUrl($project->project_id) ?>"><img width="80" src="<?php echo $this->Image($project->image_small, array('width' => 80, 'height' => 80)); ?>" class="downloadhistory-image" /></a>
0053                 </figure>   
0054                 <div style="margin-left: 95px">
0055                     <a href="<?= $this->buildProductUrl($project->project_id) ?>"><?=$project->title?></a>                           
0056                 </div>
0057                 <div style="margin-left: 95px; font-size: small;">
0058                      by <a href="/u/<?php echo $project->username?>"><?php echo $project->username?></a>                          
0059                 </div>
0060               
0061             </div>      
0062                     
0063             <div class="col-lg-2 col-md-1">  
0064                 <?=$project->cat_title?>                                          
0065             </div>
0066             <div class="col-lg-2 col-md-1">  
0067                
0068                 <?php 
0069                  if(sizeof($files_toinstall)>0)
0070                  {
0071                 ?>
0072                 <div id="project_btn_grp_install" class="btn-group dropleft " style="width: 100%;">
0073                     <button style="width: 100%" id="project_btn_install" class="btn active btn-primary dropdown-toggle " type="button" data-toggle="dropdown">Install
0074                     <span class="caret"></span></button>
0075                     <ul class="dropdown-menu active" id="dropdown_installs" style="min-width: 270px; top:50px">           
0076                     <?php
0077                     foreach ($files_toinstall as $f) {
0078                         echo '<li>'.$this->buildDownloadLink($f,$project,'install').'</li>';
0079                     }
0080                     ?>           
0081                     </ul>                
0082                 </div>
0083             <?php } ?>
0084                 
0085             </div>
0086 
0087             <div class="col-lg-2 col-md-1" >                                                                    
0088                 <?php 
0089                  if(sizeof($files)>0)
0090                  {
0091                 ?>
0092                 <div  class="btn-group dropleft" style="width: 100%">
0093                     <button style="width: 100%" id="project_btn_download" class="btn active btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Download
0094                     <span class="caret"></span></button>
0095                     <ul class="dropdown-menu active" id="dropdown_downloads" style="min-width: 270px;">   
0096                     <?php
0097                     foreach ($files as $f) {
0098                         echo '<li>'.$this->buildDownloadLink($f,$project,'download').'</li>';
0099                     }
0100                     ?>                
0101                     </ul>
0102                 </div>
0103                 <?php } ?>
0104             </div>
0105 
0106       </div>
0107       <div class="row row-detail" style="display: none" id="row-<?=$project->project_id?>">
0108         <div class="col-lg-1 col-md-1">
0109         </div>
0110         <div class="col-lg-9 col-md-9">
0111             <div>
0112                 <?php echo $project->description?>
0113 
0114             </div>
0115               
0116         </div>
0117         <div class="col-lg-2 col-md-1" >
0118             <div class="rating text-center" style="width: 80px; padding-top: 10px;float: right ">               
0119                 <?php                
0120                         $this->widgetRating = new stdClass();
0121                         $this->widgetRating->project_id =$project->project_id;
0122                         $this->widgetRating->laplace_score = $project->laplace_score;
0123                         $this->widgetRating->count_likes =$project->count_likes; 
0124                         $this->widgetRating->count_dislikes =$project->count_dislikes;
0125                         echo $this->render('partials/widgetRating.phtml'); 
0126                 ?>          
0127             </div>
0128         </div>
0129              
0130       </div>
0131 
0132  <?php endforeach; ?>
0133 
0134 <script type="text/javascript">
0135         $(document).ready(function(){
0136             $('body').on('click', 'button.toggleCollectionRowBtn', function (event) {                
0137                 $('#row-'+$(this).attr("data-id")).toggle();                
0138                 $(this).find('i').toggleClass( "fa-angle-right" );
0139                 $(this).find('i').toggleClass( "fa-angle-down" );
0140                 
0141             });
0142 
0143         });
0144 </script>
0145