Source for file featured.php
Documentation is available at featured.php
* @subpackage com_contact
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @subpackage com_contact
* The category that applies.
* The list of other cotnact categories.
* @param array An optional associative array of configuration settings.
if (empty($config['filter_fields']))
$config['filter_fields'] =
array(
'con_position', 'a.con_position',
'ordering', 'a.ordering',
* Method to get a list of items.
* @return mixed An array of objects on success, false on failure.
// Invoke the parent getItems method to get the main list
// Convert the params field into an object, saving original in _params
for ($i =
0, $n =
count($items); $i <
$n; $i++
)
if (!isset
($this->_params))
$params->loadString($item->params);
* Method to build an SQL query to load the list data.
* @return string An SQL query
$groups =
implode(',', $user->getAuthorisedViewLevels());
// Create a new query object.
$query =
$db->getQuery(true);
// Select required fields from the categories.
$query->select($this->getState('list.select', 'a.*'))
->from($db->quoteName('#__contact_details') .
' AS a')
->where('a.access IN (' .
$groups .
')')
->join('INNER', '#__categories AS c ON c.id = a.catid')
->where('c.access IN (' .
$groups .
')');
if ($categoryId =
$this->getState('category.id'))
$query->where('a.catid = ' . (int)
$categoryId);
//sqlsrv change... aliased c.published to cat_published
// Join to check for category published state in parent categories up the tree
$query->select('c.published as cat_published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published');
$subquery =
'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
$subquery .=
'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
$subquery .=
'WHERE parent.extension = ' .
$db->quote('com_contact');
// Find any up-path categories that are not published
// If all categories are published, badcats.id will be null, and we just use the contact state
$subquery .=
' AND parent.published != 1 GROUP BY cat.id ';
// Select state to unpublished if up-path category is unpublished
$publishedWhere =
'CASE WHEN badcats.id is null THEN a.published ELSE 0 END';
$query->join('LEFT OUTER', '(' .
$subquery .
') AS badcats ON badcats.id = c.id');
$state =
$this->getState('filter.published');
$query->where('a.published = ' . (int)
$state);
// Filter by start and end dates.
$nullDate =
$db->quote($db->getNullDate());
$nowDate =
$db->quote($date->toSql());
$query->where('(a.publish_up = ' .
$nullDate .
' OR a.publish_up <= ' .
$nowDate .
')')
->where('(a.publish_down = ' .
$nullDate .
' OR a.publish_down >= ' .
$nowDate .
')')
->where($publishedWhere .
' = ' . (int)
$state);
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) .
',' .
$db->quote('*') .
')');
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering', 'a.ordering')) .
' ' .
$db->escape($this->getState('list.direction', 'ASC')));
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
protected function populateState($ordering =
null, $direction =
null)
// List state information
$limit =
$app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
$limitstart =
$app->input->get('limitstart', 0, 'uint');
$this->setState('list.start', $limitstart);
$orderCol =
$app->input->get('filter_order', 'ordering');
$this->setState('list.ordering', $orderCol);
$listOrder =
$app->input->get('filter_order_Dir', 'ASC');
$this->setState('list.direction', $listOrder);
if ((!$user->authorise('core.edit.state', 'com_contact')) &&
(!$user->authorise('core.edit', 'com_contact')))
// Limit to published for people who can't edit or edit.state.
// Filter by start and end dates.
$this->setState('filter.publish_date', true);
Documentation generated on Tue, 19 Nov 2013 15:02:54 +0100 by phpDocumentor 1.4.3