���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/thietkewebvumi.com/lib/ |
<? class class_rating{ /* www.boedesign.com Used CSS from komodomedia.com. */ function getRating($id){ global $DB,$CORE; $total = 0; $rows = 0; $sel = $DB->query("SELECT rating_num FROM ratings WHERE rating_id = '$id'"); if($DB->get_num_rows($sel) > 0){ while($data = $DB->fetch_row($sel)){ $total = $total + $data['rating_num']; $rows++; } $perc = ($total/$rows) * 20; //$newPerc = round($perc/5)*5; //return $newPerc.'%'; $newPerc = round($perc,2); return $newPerc.'%'; } else { return '0%'; } } function outOfFive($id){ global $DB,$CORE; $total = 0; $rows = 0; $sel = $DB->query("SELECT rating_num FROM ratings WHERE rating_id = '$id'"); if($DB->get_num_rows($sel) > 0){ while($data = $DB->fetch_row($sel)){ $total = $total + $data['rating_num']; $rows++; } $perc = ($total/$rows); return round($perc,2); //return round(($perc*2), 0)/2; // 3.5 } else { return '0'; } } function getVotes($id){ global $DB,$CORE; $sel = $DB->query("SELECT rating_num FROM ratings WHERE rating_id = '$id'"); $rows = $DB->get_num_rows($sel); if ($CORE->lang_type=='vi'){ if($rows == 0){ $votes = '0 Lần'; } else if($rows == 1){ $votes = '1 Lần'; } else { $votes = $rows.' Lần'; } }else{ if($rows == 0){ $votes = '0 Votes'; } else if($rows == 1){ $votes = '1 Votes'; } else { $votes = $rows.' Votes'; } } return $votes; } function pullRating($id,$show5 = false, $showPerc = false, $showVotes = false, $static = NULL){ global $DB,$CORE, $homeurl; // Check if they have already voted... $text = ''; $sel = $DB->query("SELECT id FROM ratings WHERE IP = '".$_SERVER['REMOTE_ADDR']."' AND rating_id = '$id'"); if($DB->get_num_rows($sel) > 0 || $static == 'novote' || isset($_COOKIE['has_voted_'.$id])){ if($show5 || $showPerc || $showVotes){ $text .= '<div class="rated_text">'; } if($show5){ if ($CORE->lang_type=='vi'){ $text .= 'Đánh giá <span id="outOfFive_'.$id.'" class="out5Class">'.$this->outOfFive($id).'</span>/5'; }else{ $text .= 'Vote <span id="outOfFive_'.$id.'" class="out5Class">'.$this->outOfFive($id).'</span>/5'; } } if($showPerc){ $text .= ' (<span id="percentage_'.$id.'" class="percentClass">'.$this->getRating($id).'</span>)'; } if($showVotes){ $text .= ' (<span id="showvotes_'.$id.'" class="votesClass">'.$this->getVotes($id).'</span>)'; } if($show5 || $showPerc || $showVotes){ $text .= '</div>'; } return $text.' <ul class="star-rating2" id="rater_'.$id.'"> <li class="current-rating" style="width:'.$this->getRating($id).';" id="ul_'.$id.'"></li> <li><a onclick="return false;" href="#" title="Tệ " class="one-star" >1</a></li> <li><a onclick="return false;" href="#" title="Trung bình" class="two-stars">2</a></li> <li><a onclick="return false;" href="#" title="Khá " class="three-stars">3</a></li> <li><a onclick="return false;" href="#" title="Tốt " class="four-stars">4</a></li> <li><a onclick="return false;" href="#" title="Rất tốt" class="five-stars">5</a></li> </ul> <div id="loading_'.$id.'"></div>'; } else { if($show5 || $showPerc || $showVotes){ $text .= '<div class="rated_text">'; } if($show5){ $show5bool = 'true'; $text .= 'Đánh giá <span id="outOfFive_'.$id.'" class="out5Class">'.$this->outOfFive($id).'</span>/5'; } else { $show5bool = 'false'; } if($showPerc){ $showPercbool = 'true'; $text .= ' (<span id="percentage_'.$id.'" class="percentClass">'.$this->getRating($id).'</span>)'; } else { $showPercbool = 'false'; } if($showVotes){ $showVotesbool = 'true'; $text .= ' (<span id="showvotes_'.$id.'" class="votesClass">'.$this->getVotes($id).'</span>)'; } else { $showVotesbool = 'false'; } if($show5 || $showPerc || $showVotes){ $text .= '</div>'; } return $text.' <ul class="star-rating" id="rater_'.$id.'"> <li class="current-rating" style="width:'.$this->getRating($id).';" id="ul_'.$id.'"></li> <li><a onclick="xajax_rate(\'1\',\''.$id.'\','.$show5bool.','.$showPercbool.','.$showVotesbool.'); return false;" href="javascript:void(0)" title=" Tệ " class="one-star" >1</a></li> <li><a onclick="xajax_rate(\'2\',\''.$id.'\','.$show5bool.','.$showPercbool.','.$showVotesbool.'); return false;" href="javascript:void(0)" title=" Bình thường " class="two-stars">2</a></li> <li><a onclick="xajax_rate(\'3\',\''.$id.'\','.$show5bool.','.$showPercbool.','.$showVotesbool.'); return false;" href="javascript:void(0)" title=" Khá " class="three-stars">3</a></li> <li><a onclick="xajax_rate(\'4\',\''.$id.'\','.$show5bool.','.$showPercbool.','.$showVotesbool.'); return false;" href="javascript:void(0)" title=" Tốt " class="four-stars">4</a></li> <li><a onclick="xajax_rate(\'5\',\''.$id.'\','.$show5bool.','.$showPercbool.','.$showVotesbool.'); return false;" href="javascript:void(0)" title=" Rất tốt " class="five-stars">5</a></li> </ul> <div id="loading_'.$id.'"></div>'; } } // Added in version 1.5 // Fixed sort in version 1.7 function getTopRated($limit, $table, $idfield, $namefield){ global $DB,$CORE; $result = ''; $sql = "SELECT COUNT(ratings.id) as rates,ratings.rating_id,".$table.".".$namefield." as thenamefield,ROUND(AVG(ratings.rating_num),2) as rating FROM ratings,".$table." WHERE ".$table.".".$idfield." = ratings.rating_id GROUP BY rating_id ORDER BY rates DESC,rating DESC LIMIT ".$limit.""; $sel = $DB->query($sql); $result .= '<ul class="topRatedList">'."\n"; while($data = $DB->get_num_rows($sel)){ $result .= '<li>'.$data['thenamefield'].' ('.$data['rating'].')</li>'."\n"; } $result .= '</ul>'."\n"; return $result; } }//end class ?>