| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 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/plats-individuels/lyon/administrator/components/com_djclassifieds/models/ |
Upload File : |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email: contact@dj-extensions.com
*/
defined('_JEXEC') or die;
class DJClassifiedsModelPoints extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'p.id',
'name', 'p.name',
'price', 'p.price',
'points', 'p.points',
'ordering', 'p.ordering',
'published', 'p.published'
);
}
parent::__construct($config);
}
protected function populateState($ordering = null, $direction = null)
{
// List state information.
parent::populateState('p.ordering', 'asc');
$search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
// Load the parameters.
$params = JComponentHelper::getParams('com_djclassifieds');
$this->setState('params', $params);
$order = $this->getUserStateFromRequest($this->context.'.filter.order', 'filter_order');
if($order){
$this->setState('list.ordering', $order);
}
$order_dir = $this->getUserStateFromRequest($this->context.'.filter.order_Dir', 'filter_order_Dir');
if($order_dir){
$this->setState('list.direction', $order_dir);
}
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
$id .= ':'.$this->getState('filter.published');
return parent::getStoreId($id);
}
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select('p.*');
$query->from('#__djcf_points AS p');
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('p.published = ' . (int) $published);
}
else if ($published === '') {
$query->where('(p.published = 0 OR p.published = 1)');
}
// Filter by search in title.
$search = $this->getState('filter.search');
if (!empty($search)) {
$search_id = $db->Quote($db->escape($search, true));
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('(p.name LIKE '.$search.' OR p.id='.$search_id.')');
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
$query->order($db->escape($orderCol.' '.$orderDirn));
return $query;
}
}