* - user-end: with Up and Down buttons
* - programming: with the QF element constructor $sort option
*
*
- * @param string $button Button identifier, either 'add', 'remove',
- * 'all', 'none', 'toggle',
- * 'movetop', 'movebottom'
- * 'moveup' or 'movedown'
- * @param mixed $attributes (optional) Either a typical HTML attribute string
+ * @param string $button Button identifier, either 'add', 'remove',
+ * 'all', 'none', 'toggle',
+ * 'movetop', 'movebottom'
+ * 'moveup' or 'movedown'
+ * @param mixed $attributes (optional) Either a typical HTML attribute string
* or an associative array
- *
- * @return void
- * @throws PEAR_Error $button argument
- * is not a string, or not in range
- * (add, remove, all, none, toggle,
- * movetop, movebottom, moveup, movedown)
+ *
+ * @return void
+ * @throws PEAR_Error $button argument
+ * is not a string, or not in range
+ * (add, remove, all, none, toggle,
+ * movetop, movebottom, moveup, movedown)
* @access public
- * @since version 0.4.0 (2005-06-25)
- *
- * @example examples/qfams_custom_5.php
- * Custom example 5: source code
- * @link http://www.laurent-laville.org/img/qfams/screenshot/custom5.png
- * Custom example 5: screenshot
- *
- * @example examples/qfams_custom_2.php
- * Custom example 2: source code
- * @link http://www.laurent-laville.org/img/qfams/screenshot/custom2.png
- * Custom example 2: screenshot
- *
- * @example examples/qfams_custom_1.php
- * Custom example 1: source code
- * @link http://www.laurent-laville.org/img/qfams/screenshot/custom1.png
- * Custom example 1: screenshot
+ * @since version 0.4.0 (2005-06-25)
+ *
+ * @example examples/qfams_custom_5.php
+ * Custom example 5: source code
+ * @link http://www.laurent-laville.org/img/qfams/screenshot/custom5.png
+ * Custom example 5: screenshot
+ *
+ * @example examples/qfams_custom_2.php
+ * Custom example 2: source code
+ * @link http://www.laurent-laville.org/img/qfams/screenshot/custom2.png
+ * Custom example 2: screenshot
+ *
+ * @example examples/qfams_custom_1.php
+ * Custom example 1: source code
+ * @link http://www.laurent-laville.org/img/qfams/screenshot/custom1.png
+ * Custom example 1: screenshot
*/
function setButtonAttributes($button, $attributes = null)
{
if (!is_string($button)) {
- return PEAR::throwError('Argument 1 of HTML_QuickForm_advmultiselect::' .
- 'setButtonAttributes is not a string',
- HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
- array('level' => 'exception'));
+ return PEAR::throwError('Argument 1 of HTML_QuickForm_advmultiselect::' .
+ 'setButtonAttributes is not a string',
+ HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
+ array('level' => 'exception'));
}
switch ($button) {
- case 'add':
- if (is_null($attributes)) {
- $this->_addButtonAttributes
- = array('name' => 'add',
- 'value' => ' ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_addButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'remove':
- if (is_null($attributes)) {
- $this->_removeButtonAttributes
- = array('name' => 'remove',
- 'value' => ' ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_removeButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'all':
- if (is_null($attributes)) {
- $this->_allButtonAttributes
- = array('name' => 'all',
- 'value' => ' Select All ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_allButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'none':
- if (is_null($attributes)) {
- $this->_noneButtonAttributes
- = array('name' => 'none',
- 'value' => ' Select None ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_noneButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'toggle':
- if (is_null($attributes)) {
- $this->_toggleButtonAttributes
- = array('name' => 'toggle',
- 'value' => ' Toggle Selection ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_toggleButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'moveup':
- if (is_null($attributes)) {
- $this->_upButtonAttributes
- = array('name' => 'up',
- 'value' => ' Up ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_upButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'movedown':
- if (is_null($attributes)) {
- $this->_downButtonAttributes
- = array('name' => 'down',
- 'value' => ' Down ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_downButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'movetop':
- if (is_null($attributes)) {
- $this->_topButtonAttributes
- = array('name' => 'top',
- 'value' => ' Top ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_topButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- case 'movebottom':
- if (is_null($attributes)) {
- $this->_bottomButtonAttributes
- = array('name' => 'bottom',
- 'value' => ' Bottom ',
- 'type' => 'button');
- } else {
- $this->_updateAttrArray($this->_bottomButtonAttributes,
- $this->_parseAttributes($attributes));
- }
- break;
- default;
- return PEAR::throwError('Argument 1 of HTML_QuickForm_advmultiselect::' .
- 'setButtonAttributes has unexpected value',
- HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
- array('level' => 'error'));
+ case 'add':
+ if (is_null($attributes)) {
+ $this->_addButtonAttributes
+ = array('name' => 'add',
+ 'value' => ' ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_addButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'remove':
+ if (is_null($attributes)) {
+ $this->_removeButtonAttributes
+ = array('name' => 'remove',
+ 'value' => ' ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_removeButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'all':
+ if (is_null($attributes)) {
+ $this->_allButtonAttributes
+ = array('name' => 'all',
+ 'value' => ' Select All ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_allButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'none':
+ if (is_null($attributes)) {
+ $this->_noneButtonAttributes
+ = array('name' => 'none',
+ 'value' => ' Select None ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_noneButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'toggle':
+ if (is_null($attributes)) {
+ $this->_toggleButtonAttributes
+ = array('name' => 'toggle',
+ 'value' => ' Toggle Selection ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_toggleButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'moveup':
+ if (is_null($attributes)) {
+ $this->_upButtonAttributes
+ = array('name' => 'up',
+ 'value' => ' Up ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_upButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'movedown':
+ if (is_null($attributes)) {
+ $this->_downButtonAttributes
+ = array('name' => 'down',
+ 'value' => ' Down ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_downButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'movetop':
+ if (is_null($attributes)) {
+ $this->_topButtonAttributes
+ = array('name' => 'top',
+ 'value' => ' Top ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_topButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ case 'movebottom':
+ if (is_null($attributes)) {
+ $this->_bottomButtonAttributes
+ = array('name' => 'bottom',
+ 'value' => ' Bottom ',
+ 'type' => 'button');
+ } else {
+ $this->_updateAttrArray($this->_bottomButtonAttributes,
+ $this->_parseAttributes($attributes));
+ }
+ break;
+ default;
+ return PEAR::throwError('Argument 1 of HTML_QuickForm_advmultiselect::' .
+ 'setButtonAttributes has unexpected value',
+ HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
+ array('level' => 'error'));
}
}
/**
* Sets element template
*
- * @param string $html (optional) The HTML surrounding select boxes and buttons
- * @param string $js (optional) if we need to include qfams javascript handler
+ * @param string $html (optional) The HTML surrounding select boxes and buttons
+ * @param string $js (optional) if we need to include qfams javascript handler
*
* @access public
- * @return string
- * @since version 0.4.0 (2005-06-25)
+ * @return string
+ * @since version 0.4.0 (2005-06-25)
*/
- function setElementTemplate($html = null, $js = true)
+ function setElementTemplate($html = null, $js = true)
{
- $oldTemplate = $this->_elementTemplate;
-
- if (isset($html) && is_string($html)) {
- $this->_elementTemplate = $html;
- } else {
- $this->_elementTemplate = '
-{javascript}
-| {label_2} | -{label_3} | |
|---|---|---|
| {unselected} | -{add}{remove} | -{selected} | -
| {label_2} | +{label_3} | |
|---|---|---|
| {unselected} | +{add}{remove} | +{selected} | +