Source for file plugins.php
Documentation is available at plugins.php
* @package Joomla.Administrator
* @subpackage com_plugins
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Methods supporting a list of plugin records.
* @package Joomla.Administrator
* @subpackage com_plugins
* @param array An optional associative array of configuration settings.
if (empty($config['filter_fields']))
$config['filter_fields'] =
array(
'extension_id', 'a.extension_id',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'client_id', 'a.client_id',
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
protected function populateState($ordering =
null, $direction =
null)
// Load the filter state.
$this->setState('filter.search', $search);
$this->setState('filter.access', $accessId);
$this->setState('filter.enabled', $state);
$this->setState('filter.folder', $folder);
$this->setState('filter.language', $language);
// List state information.
* Method to get a store id based on model configuration state.
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* @param string A prefix for the store id.
* @return string A store id.
$id .=
':' .
$this->getState('filter.search');
$id .=
':' .
$this->getState('filter.access');
$id .=
':' .
$this->getState('filter.state');
$id .=
':' .
$this->getState('filter.folder');
$id .=
':' .
$this->getState('filter.language');
* @param string The query
* @param int The number of records
protected function _getList($query, $limitstart =
0, $limit =
0)
$search =
$this->getState('filter.search');
$ordering =
$this->getState('list.ordering', 'ordering');
if ($ordering ==
'name' ||
(!empty($search) &&
stripos($search, 'id:') !==
0))
$this->_db->setQuery($query);
$result =
$this->_db->loadObjectList();
foreach ($result as $i =>
$item)
$direction =
($this->getState('list.direction') ==
'desc') ? -
1 :
1;
if ($total <
$limitstart)
return array_slice($result, $limitstart, $limit ?
$limit :
null);
if ($ordering ==
'ordering')
$query->order('a.folder ASC');
$ordering =
'a.ordering';
$query->order($this->_db->quoteName($ordering) .
' ' .
$this->getState('list.direction'));
if ($ordering ==
'folder')
$query->order('a.ordering ASC');
$result =
parent::_getList($query, $limitstart, $limit);
* Translate a list of objects
* @param array The array of objects
* @return array The array of translated objects
foreach ($items as &$item)
$source =
JPATH_PLUGINS .
'/' .
$item->folder .
'/' .
$item->element;
$extension =
'plg_' .
$item->folder .
'_' .
$item->element;
||
$lang->load($extension .
'.sys', $source, null, false, true);
$item->name =
JText::_($item->name);
* Build an SQL query to load the list data.
// Create a new query object.
$query =
$db->getQuery(true);
// Select the required fields from the table.
'a.extension_id , a.name, a.element, a.folder, a.checked_out, a.checked_out_time,' .
' a.enabled, a.access, a.ordering'
->from($db->quoteName('#__extensions') .
' AS a')
->where($db->quoteName('type') .
' = ' .
$db->quote('plugin'));
// Join over the users for the checked out user.
$query->select('uc.name AS editor')
->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Join over the asset groups.
$query->select('ag.title AS access_level')
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access =
$this->getState('filter.access'))
$query->where('a.access = ' . (int)
$access);
// Filter by published state
$published =
$this->getState('filter.enabled');
$query->where('a.enabled = ' . (int)
$published);
elseif ($published ===
'')
$query->where('(a.enabled IN (0, 1))');
$query->where('a.state >= 0');
if ($folder =
$this->getState('filter.folder'))
$query->where('a.folder = ' .
$db->quote($folder));
// Filter by search in name or id
$search =
$this->getState('filter.search');
$query->where('a.extension_id = ' . (int)
substr($search, 3));
Documentation generated on Tue, 19 Nov 2013 15:10:51 +0100 by phpDocumentor 1.4.3