[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/libraries/joomla/html/parameter/element/ -> templatestyle.php (source)

   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   * Renders a list of template styles.
  14   *
  15   * @package     Joomla.Platform
  16   * @subpackage  Parameter
  17   * @since       11.1
  18   * @deprecated  12.1  Use JFormFieldTemplateStyle instead
  19   */
  20  class JElementTemplateStyle extends JElement
  21  {
  22      /**
  23       * Element name
  24       *
  25       * @var    string
  26       */
  27      protected $_name = 'TemplateStyle';
  28  
  29      /**
  30       * Fetch the template style element
  31       *
  32       * @param   string       $name          Element name
  33       * @param   string       $value         Element value
  34       * @param   JXMLElement  &$node         JXMLElement node object containing the settings for the element
  35       * @param   string       $control_name  Control name
  36       *
  37       * @return  string
  38       *
  39       * @deprecated  12.1  Use JFormFieldTemplateStyle::getGroups  Instead
  40       * @since   11.1
  41       */
  42  	public function fetchElement($name, $value, &$node, $control_name)
  43      {
  44          // Deprecation warning.
  45          JLog::add('JElementTemplateStyle::_fetchElement() is deprecated.', JLog::WARNING, 'deprecated');
  46  
  47          $db = JFactory::getDBO();
  48  
  49          $query = 'SELECT * FROM #__template_styles ' . 'WHERE client_id = 0 ' . 'AND home = 0';
  50          $db->setQuery($query);
  51          $data = $db->loadObjectList();
  52  
  53          $default = JHtml::_('select.option', 0, JText::_('JOPTION_USE_DEFAULT'), 'id', 'description');
  54          array_unshift($data, $default);
  55  
  56          $selected = $this->_getSelected();
  57          $html = JHTML::_('select.genericlist', $data, $control_name . '[' . $name . ']', 'class="inputbox" size="6"', 'id', 'description', $selected);
  58  
  59          return $html;
  60      }
  61  
  62      /**
  63       * Get the selected template style.
  64       *
  65       * @return  integer  The template style id.
  66       *
  67       * @since   11.1
  68       * @deprecated    12.1  Use jFormFieldTemplateStyle instead.
  69       */
  70  	protected function _getSelected()
  71      {
  72          // Deprecation warning.
  73          JLog::add('JElementTemplateStyle::_getSelected() is deprecated.', JLog::WARNING, 'deprecated');
  74  
  75          $id = JRequest::getVar('cid', 0);
  76          $db = JFactory::getDBO();
  77          $query = $db->getQuery(true);
  78          $query->select($query->qn('template_style_id'))->from($query->qn('#__menu'))->where($query->qn('id') . ' = ' . (int) $id[0]);
  79          $db->setQuery($query);
  80          $result = $db->loadResult();
  81          return $result;
  82      }
  83  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1