| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Joomla.Platform 4 * @subpackage HTML 5 * 6 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 7 * @license GNU General Public License version 2 or later; see LICENSE 8 */ 9 10 defined('JPATH_PLATFORM') or die; 11 12 /** 13 * Utility class working with content language select lists 14 * 15 * @package Joomla.Platform 16 * @subpackage HTML 17 * @since 11.1 18 */ 19 abstract class JHtmlContentLanguage 20 { 21 /** 22 * Cached array of the content language items. 23 * 24 * @var array 25 * @since 11.1 26 */ 27 protected static $items = null; 28 29 /** 30 * Get a list of the available content language items. 31 * 32 * @param boolean $all True to include All (*) 33 * @param boolean $translate True to translate All 34 * 35 * @return string 36 * 37 * @since 11.1 38 * 39 * @see JFormFieldContentLanguage 40 */ 41 public static function existing($all = false, $translate = false) 42 { 43 if (empty(self::$items)) 44 { 45 // Get the database object and a new query object. 46 $db = JFactory::getDBO(); 47 $query = $db->getQuery(true); 48 49 // Build the query. 50 $query->select('a.lang_code AS value, a.title AS text, a.title_native'); 51 $query->from('#__languages AS a'); 52 $query->where('a.published >= 0'); 53 $query->order('a.title'); 54 55 // Set the query and load the options. 56 $db->setQuery($query); 57 self::$items = $db->loadObjectList(); 58 if ($all) 59 { 60 array_unshift(self::$items, new JObject(array('value' => '*', 'text' => $translate ? JText::alt('JALL', 'language') : 'JALL_LANGUAGE'))); 61 } 62 63 // Detect errors 64 if ($db->getErrorNum()) 65 { 66 JError::raiseWarning(500, $db->getErrorMsg()); 67 } 68 } 69 return self::$items; 70 } 71 }
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 |