Source for file associations.php
Documentation is available at associations.php
* @package Joomla.Libraries
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Utitlity class for associations in multilang
* @package Joomla.Libraries
* @param string $extension The name of the component.
* @param string $tablename The name of the table.
* @param string $context The context
* @param integer $id The primary key value.
* @param string $pk The name of the primary key in the given $table.
* @param string $aliasField If the table has an alias field set it here. Null to not use it
* @param string $catField If the table has a catid field set it here. Null to not use it
* @return array The associated items
public static function getAssociations($extension, $tablename, $context, $id, $pk =
'id', $aliasField =
'alias', $catField =
'catid')
$query =
$db->getQuery(true)
->select($db->quoteName('c2.language'))
->from($db->quoteName($tablename, 'c'))
->join('INNER', $db->quoteName('#__associations', 'a') .
' ON a.id = c.id AND a.context=' .
$db->quote($context))
->join('INNER', $db->quoteName('#__associations', 'a2') .
' ON a.key = a2.key')
->join('INNER', $db->quoteName($tablename, 'c2') .
' ON a2.id = c2.' .
$db->quoteName($pk));
$db->quoteName('c2.' .
$pk),
$db->quoteName('c2.' .
$aliasField)
) .
' AS ' .
$db->quoteName($pk)
$query->select($db->quoteName('c2.' .
$pk));
$query->join('INNER', $db->quoteName('#__categories', 'ca') .
' ON ' .
$db->quoteName('c2.' .
$catField) .
' = ca.id AND ca.extension = ' .
$db->quote($extension))
array('ca.id', 'ca.alias'),
) .
' AS ' .
$db->quoteName($catField)
$query->where('c.' .
$pk .
' = ' . (int)
$id);
$items =
$db->loadObjectList('language');
catch
(RuntimeException $e)
throw
new Exception($e->getMessage(), 500);
foreach ($items as $tag =>
$item)
// Do not return itself as result
if ((int)
$item->{$pk} !=
$id)
$associations[$tag] =
$item;
* Method to determine if the language filter Items Associations parameter is enabled.
* This works for both site and administrator.
* @return boolean True if the parameter is implemented; false otherwise.
// Flag to avoid doing multiple database queries.
// Status of language filter parameter.
if (JLanguageMultilang::isEnabled())
// If already tested, don't test again.
$params =
new JRegistry(JPluginHelper::getPlugin('system', 'languagefilter')->params);
$enabled = (boolean)
$params->get('item_associations', true);
Documentation generated on Tue, 19 Nov 2013 14:54:08 +0100 by phpDocumentor 1.4.3