File indexing completed on 2025-05-04 05:29:24
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 //$options = array(1 => 'ugh', 2=>'really bad',3=>'bad',4=>'soso',5=>'average', 6=>'okay',7=>'good', 8=>'great', 9=>'excellent',10=>'the best'); 0024 $options = Default_Model_DbTable_ProjectRating::$options; 0025 $scoreColor = new Default_View_Helper_FetchScoreColor(); 0026 ?> 0027 0028 0029 0030 <div align="right"> 0031 <table> 0032 <tr> 0033 <?php 0034 0035 foreach ($options as $key => $value) { 0036 echo '<td><span class="rating-label rating-label-btn" style="margin-left:10px; background-color:'.$this->fetchScoreColor($key).'">' 0037 .$key.'</span></td>'; 0038 } 0039 ?> </tr> 0040 0041 <tr> 0042 <?php 0043 0044 $datagroup = array(); 0045 foreach ($this->ratings as $this->productRating) { 0046 if($this->productRating['rating_active']==0 || $this->productRating['user_like']>1) continue; 0047 $datagroup[$this->productRating['score']][] = $this->productRating; 0048 } 0049 0050 foreach ($options as $key => $value) { 0051 echo '<td><span class="rating-label" style="margin-left:10px; color:'.$this->fetchScoreColor($key).'">' 0052 .(array_key_exists($key,$datagroup)?count($datagroup[$key]):"").'</span></td>'; 0053 } 0054 ?> 0055 </tr> 0056 </table> 0057 </div> 0058 0059 <?php 0060 $tmp=null; 0061 foreach ($this->ratings as $this->productRating) { 0062 if($this->productRating['user_like']>=6) 0063 { 0064 $tmp = $this->productRating; 0065 } 0066 if($this->productRating['rating_active']==0 || $this->productRating['user_like']>1) continue; 0067 ?> 0068 0069 <div class="productRating-rows <?='product-rating-'.$this->productRating['score']?> " > 0070 <div class="product-heading product-update-heading"> 0071 <a href="<?php echo $this->buildMemberUrl($this->productRating['username']); ?>" > 0072 <img class="userimg" 0073 src="<?= $this->Image(($this->productRating['profile_image_url']==null)?'hive/user-pics/nopic.png':$this->productRating['profile_image_url'], 0074 array('width' => 40, 'height' => 40)) ?>" 0075 alt="product-maker" 0076 /> 0077 </a> 0078 <span> 0079 <a href="<?php echo $this->buildMemberUrl($this->productRating['username']); ?>" style="font-weight: bold;"> 0080 <?=$this->productRating['username'] ?> 0081 </a> 0082 </span> 0083 <span class="small light lightgrey product-update-date"> 0084 <?=$this->printDate($this->productRating['created_at']) ?> 0085 </span> 0086 <span> 0087 <span class="rating-label" style="background-color:<?=$this->fetchScoreColor($this->productRating['score'])?>; "> 0088 <?=$this->productRating['score'] ?> 0089 </span> 0090 <span style="font-size: small;padding-left: 5px;"><?php echo ' '.$options[$this->productRating['score']]?></span> 0091 </span> 0092 </div> 0093 <div style="padding-left: 45px; padding-bottom: 15px;"> 0094 <?=$this->productRating['comment_text'] ?> 0095 </div> 0096 </div> 0097 <?php } ?> 0098 0099 <?php if($tmp){?> 0100 0101 <div class="productRating-rows"> 0102 <div class="product-heading product-update-heading"> 0103 <a href="<?php echo $this->buildMemberUrl($this->productRating['username']); ?>" > 0104 <img class="userimg" 0105 src="<?= $this->Image('hive/user-pics/nopic.png', 0106 array('width' => 40, 'height' => 40)) ?>" 0107 alt="product-maker" 0108 /> 0109 </a> 0110 <span> 0111 <a href="<?php echo $this->buildMemberUrl($this->productRating['username']); ?>" style="font-weight: bold;"> 0112 <?=$this->productRating['username'] ?> 0113 </a> 0114 </span> 0115 <span class="small light lightgrey product-update-date"> 0116 <?=$this->printDate($this->productRating['created_at']) ?> 0117 </span> 0118 <span> 0119 <span class="score label" style="background-color:<?=$this->fetchScoreColor(5)?>; "> 0120 Count:<?php echo $tmp['user_like']+$tmp['user_dislike']+2-12; ?> Rating: <?=number_format($this->fetchScore($tmp['user_like']-6,$tmp['user_dislike']-6),2)?> 0121 </span> 0122 </span> 0123 </div> 0124 </div> 0125 0126 <?php }else{?> 0127 <div class="productRating-rows"> 0128 <div class="product-heading product-update-heading"> 0129 <a href="<?php echo $this->buildMemberUrl($this->productRating['username']); ?>" > 0130 <img class="userimg" 0131 src="<?= $this->Image('hive/user-pics/nopic.png', 0132 array('width' => 40, 'height' => 40)) ?>" 0133 alt="product-maker" 0134 /> 0135 </a> 0136 0137 <span> 0138 <span class="score label" style="background-color:<?=$this->fetchScoreColor(5)?>; "> 0139 Base: 4 x 5.0 Ratings 0140 </span> 0141 </span> 0142 </div> 0143 </div> 0144 <?php } ?> 0145 0146 0147 <script type="text/javascript"> 0148 $(function() { 0149 $('span.rating-label-btn').on('click',function(){ 0150 if($(this).hasClass("rating-label-highlight")) 0151 { 0152 $(this).removeClass("rating-label-highlight"); 0153 $('div.productRating-rows').show(); 0154 }else{ 0155 $('span.rating-label-btn').not(this).removeClass( "rating-label-highlight" ); 0156 $(this).addClass("rating-label-highlight"); 0157 $('div.productRating-rows').hide(); 0158 $('.product-rating-'+$(this).text()).show(); 0159 } 0160 0161 }); 0162 0163 }); 0164 </script>