| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 4 * @license GNU General Public License version 2 or later; see LICENSE.txt 5 */ 6 7 // no direct access 8 defined('_JEXEC') or die; 9 10 JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); 11 12 /** 13 * @package Joomla.Administrator 14 * @subpackage com_menus 15 */ 16 abstract class MenusHtmlMenus 17 { 18 /** 19 * @param int $itemid The menu item id 20 */ 21 static function association($itemid) 22 { 23 // Get the associations 24 $associations = MenusHelper::getAssociations($itemid); 25 26 // Get the associated menu items 27 $db = JFactory::getDbo(); 28 $query = $db->getQuery(true); 29 $query->select('m.*'); 30 $query->select('mt.title as menu_title'); 31 $query->from('#__menu as m'); 32 $query->leftJoin('#__menu_types as mt ON mt.menutype=m.menutype'); 33 $query->where('m.id IN ('.implode(',', array_values($associations)).')'); 34 $query->leftJoin('#__languages as l ON m.language=l.lang_code'); 35 $query->select('l.image'); 36 $query->select('l.title as language_title'); 37 $db->setQuery($query); 38 $items = $db->loadObjectList('id'); 39 40 // Check for a database error. 41 if ($error = $db->getErrorMsg()) { 42 JError::raiseWarning(500, $error); 43 return false; 44 } 45 46 // Construct html 47 $text = array(); 48 foreach ($associations as $tag=>$associated) { 49 if ($associated != $itemid) { 50 $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); 51 } 52 } 53 return JHtml::_('tooltip', implode('<br />', $text), JText::_('COM_MENUS_TIP_ASSOCIATION'), 'menu/icon-16-links.png'); 54 } 55 56 /** 57 * Returns a published state on a grid 58 * 59 * @param integer $value The state value. 60 * @param integer $i The row index 61 * @param boolean $enabled An optional setting for access control on the action. 62 * @param string $checkbox An optional prefix for checkboxes. 63 * 64 * @return string The Html code 65 * 66 * @see JHtmlJGrid::state 67 * 68 * @since 1.7.1 69 */ 70 public static function state($value, $i, $enabled = true, $checkbox = 'cb') 71 { 72 $states = array( 73 7 => array( 74 'unpublish', 75 '', 76 'COM_MENUS_HTML_UNPUBLISH_SEPARATOR', 77 '', 78 false, 79 'publish', 80 'publish' 81 ), 82 6 => array( 83 'publish', 84 '', 85 'COM_MENUS_HTML_PUBLISH_SEPARATOR', 86 '', 87 false, 88 'unpublish', 89 'unpublish' 90 ), 91 5 => array( 92 'unpublish', 93 '', 94 'COM_MENUS_HTML_UNPUBLISH_ALIAS', 95 '', 96 false, 97 'publish', 98 'publish' 99 ), 100 4 => array( 101 'publish', 102 '', 103 'COM_MENUS_HTML_PUBLISH_ALIAS', 104 '', 105 false, 106 'unpublish', 107 'unpublish' 108 ), 109 3 => array( 110 'unpublish', 111 '', 112 'COM_MENUS_HTML_UNPUBLISH_URL', 113 '', 114 false, 115 'publish', 116 'publish' 117 ), 118 2 => array( 119 'publish', 120 '', 121 'COM_MENUS_HTML_PUBLISH_URL', 122 '', 123 false, 124 'unpublish', 125 'unpublish' 126 ), 127 1 => array( 128 'unpublish', 129 'COM_MENUS_EXTENSION_PUBLISHED_ENABLED', 130 'COM_MENUS_HTML_UNPUBLISH_ENABLED', 131 'COM_MENUS_EXTENSION_PUBLISHED_ENABLED', 132 true, 133 'publish', 134 'publish' 135 ), 136 0 => array( 137 'publish', 138 'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED', 139 'COM_MENUS_HTML_PUBLISH_ENABLED', 140 'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED', 141 true, 142 'unpublish', 143 'unpublish' 144 ), 145 -1 => array( 146 'unpublish', 147 'COM_MENUS_EXTENSION_PUBLISHED_DISABLED', 148 'COM_MENUS_HTML_UNPUBLISH_DISABLED', 149 'COM_MENUS_EXTENSION_PUBLISHED_DISABLED', 150 true, 151 'warning', 152 'warning' 153 ), 154 -2 => array( 155 'publish', 156 'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED', 157 'COM_MENUS_HTML_PUBLISH_DISABLED', 158 'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED', 159 true, 160 'unpublish', 161 'unpublish' 162 ), 163 ); 164 165 return JHtml::_('jgrid.state', $states, $value, $i, 'items.', $enabled, true, $checkbox); 166 } 167 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Apr 3 11:40:28 2012 | Cross-referenced by PHPXref 0.7.1 |