Source for file modules.php
Documentation is available at modules.php
* @package Joomla.Administrator
* @subpackage com_modules
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @package Joomla.Administrator
* @subpackage com_modules
* Builds an array of template options
* @param integer $clientId The client id.
* @param string $state The state of the template.
public static function templates($clientId =
0, $state =
'')
foreach ($templates as $template)
$options[] =
JHtml::_('select.option', $template->element, $template->name);
* Builds an array of template type options
public static function types()
$options[] =
JHtml::_('select.option', 'user', 'COM_MODULES_OPTION_POSITION_USER_DEFINED');
$options[] =
JHtml::_('select.option', 'template', 'COM_MODULES_OPTION_POSITION_TEMPLATE_DEFINED');
* Builds an array of template state options
$options[] =
JHtml::_('select.option', '1', 'JENABLED');
$options[] =
JHtml::_('select.option', '0', 'JDISABLED');
* Returns a published state on a grid
* @param integer $value The state value.
* @param integer $i The row index
* @param boolean $enabled An optional setting for access control on the action.
* @param string $checkbox An optional prefix for checkboxes.
* @return string The Html code
public static function state($value, $i, $enabled =
true, $checkbox =
'cb')
'COM_MODULES_EXTENSION_PUBLISHED_ENABLED',
'COM_MODULES_HTML_UNPUBLISH_ENABLED',
'COM_MODULES_EXTENSION_PUBLISHED_ENABLED',
'COM_MODULES_EXTENSION_UNPUBLISHED_ENABLED',
'COM_MODULES_HTML_PUBLISH_ENABLED',
'COM_MODULES_EXTENSION_UNPUBLISHED_ENABLED',
'COM_MODULES_EXTENSION_PUBLISHED_DISABLED',
'COM_MODULES_HTML_UNPUBLISH_DISABLED',
'COM_MODULES_EXTENSION_PUBLISHED_DISABLED',
'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED',
'COM_MODULES_HTML_PUBLISH_DISABLED',
'COM_MODULES_EXTENSION_UNPUBLISHED_DISABLED',
return JHtml::_('jgrid.state', $states, $value, $i, 'modules.', $enabled, true, $checkbox);
* Display a batch widget for the module position selector.
* @param integer $clientId The client ID.
* @param integer $state The state of the module (enabled, unenabled, trashed).
* @param string $selectedPosition The currently selected position for the module.
* @return string The necessary positions for the widget.
public static function positions($clientId, $state =
1, $selectedPosition =
'')
$templateGroups =
array();
// Add an empty value to be able to deselect a module position
// Add positions from templates
$isTemplatePosition =
false;
foreach ($templates as $template)
if (is_array($positions)) foreach ($positions as $position)
if (!$isTemplatePosition &&
$selectedPosition ===
$position)
$isTemplatePosition =
true;
// Add custom position to options
$customGroupText =
JText::_('COM_MODULES_CUSTOM_POSITION');
// Create the copy/move options.
JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')),
JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE'))
echo
JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm');
* Method to get the field options.
* @param integer $clientId The client ID
* @return array The field option objects.
$query =
$db->getQuery(true)
->select('DISTINCT(position) as value')
->select('position as text')
->from($db->quoteName('#__modules'))
->where($db->quoteName('client_id') .
' = ' . (int)
$clientId)
$options =
$db->loadObjectList();
catch
(RuntimeException $e)
// Pop the first item off the array if it's blank
if (strlen($options[0]->text) <
1)
Documentation generated on Tue, 19 Nov 2013 15:08:54 +0100 by phpDocumentor 1.4.3