| Server IP : 54.36.91.62 / Your IP : 216.73.217.111 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/annonces/components/com_jlexreview/models/ |
Upload File : |
<?php
/**
* @package JLex Review
* @version 4.2.3
* @copyright Copyright (c) 2013-2018 JLexArt. All rights reserved
* @license GNU General Public License version 2 or later;
* @author www.jlexart.com
*/
defined ( "_JEXEC" ) or die;
class JLexReviewModelRanking extends JModelLegacy
{
public $offset = 0;
public $limit = 10;
public $total = 0;
public function getList()
{
$config = JLexReviewHelperAdmin::getConfig();
$rating_point = $config->get("ranking_rating_point", 10)*1;
$cm_point = $config->get("ranking_cm_point", 5)*1;
$helpful_point = $config->get("ranking_helpful_point", 1)*1;
if($config->get("helpful_vote",1)==0)
{
$helpful_point = 0;
}
if ($config->get("comment_enable",1)==0)
{
$cm_point =0;
}
$query = $this->_db->getQuery(true);
$query->select("SQL_CALC_FOUND_ROWS u.id,u.name,u.username")
->select("(ju.count_rating*{$rating_point}+ju.count_cm*{$cm_point}+ju.count_helpful*{$helpful_point}) AS total_point")
->from("#__users AS u")
->leftJoin("#__jlexreview_users AS ju ON ju.userid=u.id")
->where("u.block=0")
->order("total_point DESC, u.id ASC");
$this->limit = $config->get("ranking_page_limit",20)*1;
$items = $this->_db->setQuery($query, $this->offset, $this->limit)->loadObjectList();
$this->total = (int) $this->_db->setQuery("SELECT FOUND_ROWS()")->loadResult();
if (!$items)
{
return null;
}
$userProfile = JLexReviewHelperSite::getProfile();
foreach ($items as $k=>&$item)
{
$item->profile = $userProfile->getUser($item->id);
$item->rank = $this->offset+$k+1;
$item->total_point = $item->total_point*1;
}
return $items;
}
public function getPagination()
{
jimport ( 'joomla.html.pagination' );
return new JPagination ( $this->total, $this->offset, $this->limit );
}
}