[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_weblinks/models/fields/ -> ordering.php (source)

   1  <?php
   2  /**
   3   * @package        Joomla.Administrator
   4   * @subpackage    com_weblinks
   5   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   6   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   7   */
   8  
   9  defined('JPATH_BASE') or die;
  10  
  11  /**
  12   * Supports an HTML select list of categories
  13   *
  14   * @package        Joomla.Administrator
  15   * @subpackage    com_weblinks
  16   * @since        1.6
  17   */
  18  class JFormFieldOrdering extends JFormField
  19  {
  20      /**
  21       * The form field type.
  22       *
  23       * @var        string
  24       * @since    1.6
  25       */
  26      protected $type = 'Ordering';
  27  
  28      /**
  29       * Method to get the field input markup.
  30       *
  31       * @return    string    The field input markup.
  32       * @since    1.6
  33       */
  34  	protected function getInput()
  35      {
  36          // Initialize variables.
  37          $html = array();
  38          $attr = '';
  39  
  40          // Initialize some field attributes.
  41          $attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
  42          $attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
  43          $attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
  44  
  45          // Initialize JavaScript field attributes.
  46          $attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
  47  
  48          // Get some field values from the form.
  49          $weblinkId    = (int) $this->form->getValue('id');
  50          $categoryId    = (int) $this->form->getValue('catid');
  51  
  52          // Build the query for the ordering list.
  53          $query = 'SELECT ordering AS value, title AS text' .
  54                  ' FROM #__weblinks' .
  55                  ' WHERE catid = ' . (int) $categoryId .
  56                  ' ORDER BY ordering';
  57  
  58          // Create a read-only list (no name) with a hidden input to store the value.
  59          if ((string) $this->element['readonly'] == 'true') {
  60              $html[] = JHtml::_('list.ordering', '', $query, trim($attr), $this->value, $weblinkId ? 0 : 1);
  61              $html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
  62          }
  63          // Create a regular list.
  64          else {
  65              $html[] = JHtml::_('list.ordering', $this->name, $query, trim($attr), $this->value, $weblinkId ? 0 : 1);
  66          }
  67  
  68          return implode($html);
  69      }
  70  }


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