- md5
- 37e7b99a69ca4ff729b9893049c04f2d
- sha1
- 83ca64268ea221c27743098d7da4107da0346cb9
- sha256
- 758d2890d6179cd6feddbdbfaf3b2754c509ea70b7177695b473ea05eb2a9a82
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
<?php
/**
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
/**
* @package Joomla.Administrator
* @subpackage com_menus
*/
abstract class MenusHtmlMenus
{
/**
* @param int $itemid The menu item id
*/
static function association($itemid)
{
// Get the associations
$associations = MenusHelper::getAssociations($itemid);
// Get the associated menu items
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('m.*');
$query->select('mt.title as menu_title');
$query->from('#__menu as m');
$query->leftJoin('#__menu_types as mt ON mt.menutype=m.menutype');
$query->where('m.id IN ('.implode(',', array_values($associations)).')');
$query->leftJoin('#__languages as l ON m.language=l.lang_code');
$query->select('l.image');
$query->select('l.title as language_title');
$db->setQuery($query);
$items = $db->loadObjectList('id');
// Check for a database error.
if ($error = $db->getErrorMsg()) {
JError::raiseWarning(500, $error);
return false;
}
// Construct html
$text = array();
foreach ($associations as $tag=>$associated) {
if ($associated != $itemid) {
$text[] = JText::sprintf('COM_MENUS_TIP_ASSOCIATED_LANGUAGE', JHtml::_('image', 'mod_languages/'.$items[$associated]->image.'.gif', $items[$associated]->language_title, array('title'=>$items[$associated]->language_title), true), $items[$associated]->title, $items[$associated]->menu_title);
}
}
return JHtml::_('tooltip', implode('<br />', $text), JText::_('COM_MENUS_TIP_ASSOCIATION'), 'menu/icon-16-links.png');
}
/**
* 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
*
* @see JHtmlJGrid::state
*
* @since 1.7.1
*/
public static function state($value, $i, $enabled = true, $checkbox = 'cb')
{
$states = array(
7 => array(
'unpublish',
'',
'COM_MENUS_HTML_UNPUBLISH_SEPARATOR',
'',
false,
'publish',
'publish'
),
6 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH_SEPARATOR',
'',
false,
'unpublish',
'unpublish'
),
5 => array(
'unpublish',
'',
'COM_MENUS_HTML_UNPUBLISH_ALIAS',
'',
false,
'publish',
'publish'
),
4 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH_ALIAS',
'',
false,
'unpublish',
'unpublish'
),
3 => array(
'unpublish',
'',
'COM_MENUS_HTML_UNPUBLISH_URL',
'',
false,
'publish',
'publish'
),
2 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH_URL',
'',
false,
'unpublish',
'unpublish'
),
1 => array(
'unpublish',
'COM_MENUS_EXTENSION_PUBLISHED_ENABLED',
'COM_MENUS_HTML_UNPUBLISH_ENABLED',
'COM_MENUS_EXTENSION_PUBLISHED_ENABLED',
true,
'publish',
'publish'
),
0 => array(
'publish',
'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED',
'COM_MENUS_HTML_PUBLISH_ENABLED',
'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED',
true,
'unpublish',
'unpublish'
),
-1 => array(
'unpublish',
'COM_MENUS_EXTENSION_PUBLISHED_DISABLED',
'COM_MENUS_HTML_UNPUBLISH_DISABLED',
'COM_MENUS_EXTENSION_PUBLISHED_DISABLED',
true,
'warning',
'warning'
),
-2 => array(
'publish',
'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED',
'COM_MENUS_HTML_PUBLISH_DISABLED',
'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED',
true,
'unpublish',
'unpublish'
),
);
return JHtml::_('jgrid.state', $states, $value, $i, 'items.', $enabled, true, $checkbox);
}
}
The same content is in 11 releases, Joomla 2.5.18 to 2.5.28. See them all, or every version of this file.