[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

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

   1  <?php
   2  /**
   3   * @package        Joomla.Administrator
   4   * @subpackage    com_plugins
   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 plugins
  13   *
  14   * @package        Joomla.Administrator
  15   * @subpackage    com_plugins
  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          $pluginId    = (int) $this->form->getValue('extension_id');
  50          $folder    =  $this->form->getValue('folder');
  51          $db = JFactory::getDbo();
  52  
  53          // Build the query for the ordering list.
  54          $query = 'SELECT ordering AS value, name AS text, type AS type, folder AS folder, extension_id AS extension_id' .
  55                  ' FROM #__extensions' .
  56                  ' WHERE (type =' .$db->Quote('plugin'). 'AND folder='. $db->Quote($folder) . ')'.
  57                  ' ORDER BY ordering';
  58  
  59          // Create a read-only list (no name) with a hidden input to store the value.
  60          if ((string) $this->element['readonly'] == 'true') {
  61              $html[] = JHtml::_('list.ordering', '', $query, trim($attr), $this->value, $pluginId ? 0 : 1);
  62              $html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
  63          }
  64          // Create a regular list.
  65          else {
  66              $html[] = JHtml::_('list.ordering', $this->name, $query, trim($attr), $this->value, $pluginId ? 0 : 1);
  67          }
  68  
  69          return implode($html);
  70      }
  71  }


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