<?php
/**
* @package Joomla.Platform
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Form Field class for the Joomla Platform.
* Supports a generic list of options.
*
* @package Joomla.Platform
* @subpackage Form
* @since 11.1
*/
class JFormFieldList extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 11.1
*/
protected $type = 'List';
/**
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
// Initialize variables.
$html = array();
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true')
{
$attr .= ' disabled="disabled"';
}
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
// Get the field options.
$options = (array) $this->getOptions();
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true')
{
$html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
}
// Create a regular list.
else
{
$html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
return implode($html);
}
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
// Initialize variables.
$options = array();
foreach ($this->element->children() as $option)
{
// Only add <option /> elements.
if ($option->getName() != 'option')
{
continue;
}
// Create a new option object based on the <option /> element.
$tmp = JHtml::_(
'select.option', (string) $option['value'],
JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text',
((string) $option['disabled'] == 'true')
);
// Set some option attributes.
$tmp->class = (string) $option['class'];
// Set some JavaScript option attributes.
$tmp->onclick = (string) $option['onclick'];
// Add the option object to the result set.
$options[] = $tmp;
}
reset($options);
return $options;
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| accesslevel.php | 2014-04-14 20:07 | 1.57 KB | 76129f60960:kunden | -xw-x----- | |
| cachehandler.php | 2014-04-14 20:07 | 1.13 KB | 76129f60960:kunden | -xw-x----- | |
| calendar.php | 2014-04-14 20:07 | 2.83 KB | 76129f60960:kunden | -xw-x----- | |
| category.php | 2014-04-14 20:07 | 3.69 KB | 76129f60960:kunden | -xw-x----- | |
| checkbox.php | 2014-04-14 20:07 | 1.66 KB | 76129f60960:kunden | -xw-x----- | |
| checkboxes.php | 2014-04-14 20:07 | 3.2 KB | 76129f60960:kunden | -xw-x----- | |
| color.php | 2014-04-14 20:07 | 1.77 KB | 76129f60960:kunden | -xw-x----- | |
| combo.php | 2014-04-14 20:07 | 1.99 KB | 76129f60960:kunden | -xw-x----- | |
| componentlayout.php | 2014-04-14 20:07 | 7.74 KB | 76129f60960:kunden | -xw-x----- | |
| contentlanguage.php | 2014-04-14 20:07 | 1.02 KB | 76129f60960:kunden | -xw-x----- | |
| databaseconnection.php | 2014-04-14 20:07 | 2.03 KB | 76129f60960:kunden | -xw-x----- | |
| editor.php | 2014-04-14 20:07 | 3.84 KB | 76129f60960:kunden | -xw-x----- | |
| editors.php | 2014-04-14 20:07 | 2.29 KB | 76129f60960:kunden | -xw-x----- | |
| email.php | 2014-04-14 20:07 | 1.76 KB | 76129f60960:kunden | -xw-x----- | |
| file.php | 2014-04-14 20:07 | 1.72 KB | 76129f60960:kunden | -xw-x----- | |
| filelist.php | 2014-04-14 20:07 | 2.64 KB | 76129f60960:kunden | -xw-x----- | |
| folderlist.php | 2014-04-14 20:07 | 2.22 KB | 76129f60960:kunden | -xw-x----- | |
| groupedlist.php | 2014-04-14 20:07 | 4.74 KB | 76129f60960:kunden | -xw-x----- | |
| hidden.php | 2014-04-14 20:07 | 1.37 KB | 76129f60960:kunden | -xw-x----- | |
| imagelist.php | 2014-04-14 20:07 | 1.1 KB | 76129f60960:kunden | -xw-x----- | |
| index.html | 2014-04-14 20:07 | 31 B | 76129f60960:kunden | -xw-x----- | |
| integer.php | 2014-04-14 20:07 | 1.63 KB | 76129f60960:kunden | -xw-x----- | |
| language.php | 2014-04-14 20:07 | 1.27 KB | 76129f60960:kunden | -xw-x----- | |
| list.php | 2014-04-14 20:07 | 3.03 KB | 76129f60960:kunden | -xw-x----- | |
| media.php | 2014-04-14 20:07 | 7.12 KB | 76129f60960:kunden | -xw-x----- | |
| menuitem.php | 2014-04-14 20:07 | 2.34 KB | 76129f60960:kunden | -xw-x----- | |
| modulelayout.php | 2014-04-14 20:07 | 6.28 KB | 76129f60960:kunden | -xw-x----- | |
| password.php | 2014-04-14 20:07 | 2.26 KB | 76129f60960:kunden | -xw-x----- | |
| plugins.php | 2014-04-14 20:07 | 2.15 KB | 76129f60960:kunden | -xw-x----- | |
| radio.php | 2014-04-14 20:07 | 3 KB | 76129f60960:kunden | -xw-x----- | |
| rules.php | 2014-04-14 20:07 | 10.6 KB | 76129f60960:kunden | -xw-x----- | |
| sessionhandler.php | 2014-04-14 20:07 | 1.2 KB | 76129f60960:kunden | -xw-x----- | |
| spacer.php | 2014-04-14 20:07 | 2.68 KB | 76129f60960:kunden | -xw-x----- | |
| sql.php | 2014-04-14 20:07 | 1.94 KB | 76129f60960:kunden | -xw-x----- | |
| tel.php | 2014-04-14 20:07 | 815 B | 76129f60960:kunden | -xw-x----- | |
| text.php | 2014-04-14 20:07 | 1.68 KB | 76129f60960:kunden | -xw-x----- | |
| textarea.php | 2014-04-14 20:07 | 1.65 KB | 76129f60960:kunden | -xw-x----- | |
| timezone.php | 2014-04-14 20:07 | 2.38 KB | 76129f60960:kunden | -xw-x----- | |
| url.php | 2014-04-14 20:07 | 746 B | 76129f60960:kunden | -xw-x----- | |
| usergroup.php | 2014-04-14 20:07 | 2.15 KB | 76129f60960:kunden | -xw-x----- | |