[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/libraries/joomla/html/parameter/element/ -> sql.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 SQL element
  14   *
  15   * @package     Joomla.Platform
  16   * @subpackage  Parameter
  17   * @since       11.1
  18   * @deprecated  12.1    Use JFormFieldSQL Instead.
  19   */
  20  class JElementSQL extends JElement
  21  {
  22      /**
  23       * Element name
  24       *
  25       * @var    string
  26       */
  27      protected $_name = 'SQL';
  28  
  29      /**
  30       * Fetch the sql 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
  40       * @since   11.1
  41       */
  42  	public function fetchElement($name, $value, &$node, $control_name)
  43      {
  44          // Deprecation warning.
  45          JLog::add('JElementSQL::getOptions is deprecated.', JLog::WARNING, 'deprecated');
  46  
  47          $db = JFactory::getDbo();
  48          $db->setQuery($node->attributes('query'));
  49          $key = ($node->attributes('key_field') ? $node->attributes('key_field') : 'value');
  50          $val = ($node->attributes('value_field') ? $node->attributes('value_field') : $name);
  51  
  52          $options = $db->loadObjectlist();
  53  
  54          // Check for an error.
  55          if ($db->getErrorNum())
  56          {
  57              JError::raiseWarning(500, $db->getErrorMsg());
  58              return false;
  59          }
  60  
  61          if (!$options)
  62          {
  63              $options = array();
  64          }
  65  
  66          return JHtml::_(
  67              'select.genericlist',
  68              $options,
  69              $control_name . '[' . $name . ']',
  70              array(
  71                  'id' => $control_name . $name,
  72                  'list.attr' => 'class="inputbox"',
  73                  'list.select' => $value,
  74                  'option.key' => $key,
  75                  'option.text' => $val
  76              )
  77          );
  78      }
  79  }


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