Current File : /home/pacjaorg/public_html/km/administrator/components/com_djclassifieds/models/emails.php
<?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 DjClassifiedsModelEmails extends JModelList{
	
	public function __construct($config = array())
	{
		if (empty($config['filter_fields'])) {
			$config['filter_fields'] = array(
				'title', 'e.title',
				'id', 'e.id',				
				'label', 'e.label'				
			);
		}

		parent::__construct($config);
	}
	
	protected function populateState($ordering = null, $direction = null)
	{
		$search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
		$this->setState('filter.search', $search);
		
		// List state information.
		parent::populateState('e.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');
		
		return parent::getStoreId($id);
	}
	
	public function _buildWhere()
	{
		$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 (e.label LIKE ".$search." OR e.title LIKE ".$search." OR e.content LIKE ".$search." OR e.id=".$search_id.") ";
		}

		$where .= "AND e.id != 32 "; // not used
		if(!JPluginHelper::isEnabled('djclassifieds', 'offers')){
			$where .= "AND e.id NOT IN (24,25,26,31) ";
		}
		if(!JPluginHelper::isEnabled('djclassifieds', 'searchalerts')){
			$where .= "AND e.id != 28 ";
		}
		if(!JPluginHelper::isEnabled('djclassifieds', 'badwords')){
			$where .= "AND e.id != 30 ";
		}
		if(!JPluginHelper::isEnabled('djclassifieds', 'plans')){
			$where .= "AND e.id != 37 ";
		}
		if(!JPluginHelper::isEnabled('djclassifiedsmessage', 'djmessages') && !JPluginHelper::isEnabled('djclassifiedsmessage', 'djcfmsguddeim')){
			$where .= "AND e.id NOT IN (27,36) ";
		}

		return $where;
	}

	protected function getListQuery()
	{
		$orderCol = $this->getState('list.ordering', 'e.label');
		$orderDirn	= $this->getState('list.direction');
	
		$query = "SELECT e.* FROM #__djcf_emails e "
		."WHERE 1 ".$this->_buildWhere()
		."ORDER BY ".$orderCol." ".$orderDirn;

		return $query;
	}
	
}
?>
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!