| 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/amisdesseniors-fr/nice2/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('Restricted access');
class DjClassifiedsModelFields extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'name', 'f.name',
'id', 'f.id',
'label', 'f.label',
'tooltip', 'f.tooltip',
'source', 'f.source',
'type', 'f.type',
'in_search', 'f.in_search',
'search_type', 'f.search_type',
'group_name', 'fg.name',
'published', 'f.published',
'ordering','f.ordering',
'category', 'group'
);
}
parent::__construct($config);
}
protected function populateState($ordering = null, $direction = null)
{
$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);
$source = $this->getUserStateFromRequest($this->context.'.filter.source', 'filter_source', '');
$this->setState('filter.source', $source);
$category = $this->getUserStateFromRequest($this->context.'.filter.category', 'filter_category', '');
$this->setState('filter.category', $category);
$group = $this->getUserStateFromRequest($this->context.'.filter.group', 'filter_group', '');
$this->setState('filter.group', $group);
$type = $this->getUserStateFromRequest($this->context.'.filter.type', 'filter_type', '');
$this->setState('filter.type', $type);
$in_search = $this->getUserStateFromRequest($this->context.'.filter.in_search', 'filter_in_search', '');
$this->setState('filter.in_search', $in_search);
// List state information.
parent::populateState('f.label', 'asc');
$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');
$id .= ':'.$this->getState('filter.source');
$id .= ':'.$this->getState('filter.category');
$id .= ':'.$this->getState('filter.group');
return parent::getStoreId($id);
}
protected function getListQuery()
{
$orderCol = $this->getState('list.ordering', 'f.label');
$orderDirn = $this->getState('list.direction');
$cat_fx = "";
$source = $this->getState('filter.source');
if (is_numeric($source) && $source == 0) {
$category = $this->getState('filter.category');
if (is_numeric($category) && $category != 0) {
$cat_fx = " INNER JOIN (SELECT *, IF((field_id IS NULL), NULL, 1) as active FROM #__djcf_fields_xref WHERE cat_id=".$category.") as fx ON fx.field_id=f.id ";
}
}
$where = '';
$search = $this->getState('filter.search');
if (!empty($search)) {
$db = JFactory::getDBO();
$search_id = $db->Quote($db->escape($search, true));
$search = $db->Quote('%'.$db->escape($search, true).'%');
$where .= " AND (CONCAT_WS(' ',f.name, f.label) LIKE ".$search." OR f.id=".$search_id.") ";
}
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$where .= ' AND f.published = ' . (int) $published;
}
$source = $this->getState('filter.source');
if (is_numeric($source)) {
$where .= ' AND f.source = ' . (int) $source;
}
$group = $this->getState('filter.group');
if ($group) {
$where .= ' AND f.group_id = ' . (int) $group;
}
$type = $this->getState('filter.type');
if ($type) {
$where .= ' AND f.type = "' . $type . '"';
}
$in_search = $this->getState('filter.in_search');
if (is_numeric($in_search)) {
$where .= ' AND f.in_search = ' . (int) $in_search;
}
$query = "SELECT f.*, fg.name group_name "
."FROM #__djcf_fields f "
."LEFT JOIN #__djcf_fields_groups fg ON f.group_id=fg.id "
.$cat_fx
." WHERE 1 ".$where." order by ".$orderCol." ".$orderDirn." ";
return $query;
}
protected function getReorderConditions($table)
{
$condition = array();
$condition[] = 'cat_id = '.(int) $table->cat_id;
return $condition;
}
function getBatchForm()
{
return JForm::getInstance('batch_fields', JPATH_ROOT.'/administrator/components/com_djclassifieds/models/forms/batch_fields.xml');
}
}