HTML_QuickForm_advmultiselect
[ class tree: HTML_QuickForm_advmultiselect ] [ index: HTML_QuickForm_advmultiselect ] [ all elements ]

Class: HTML_QuickForm_advmultiselect

Source Location: /main/inc/lib/pear/HTML/QuickForm/advmultiselect.php

Class Overview

HTML_Common
   |
   --HTML_QuickForm_element
      |
      --HTML_QuickForm_select
         |
         --HTML_QuickForm_advmultiselect

Element for HTML_QuickForm that emulate a multi-select.


Author(s):

Version:

  • Release: 0.5.1

Copyright:

  • 1997-2005 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm_select

HTML_QuickForm_select::HTML_QuickForm_select()
Class constructor
HTML_QuickForm_select::addOption()
Adds a new OPTION to the SELECT
HTML_QuickForm_select::apiVersion()
Returns the current API version
HTML_QuickForm_select::exportValue()
We check the options and return only the values that _could_ have been
HTML_QuickForm_select::getFrozenHtml()
Returns the value of field without HTML tags
HTML_QuickForm_select::getMultiple()
Returns the select mutiple attribute
HTML_QuickForm_select::getName()
Returns the element name
HTML_QuickForm_select::getPrivateName()
Returns the element name (possibly with brackets appended)
HTML_QuickForm_select::getSelected()
Returns an array of the selected values
HTML_QuickForm_select::getSize()
Returns the select field size
HTML_QuickForm_select::getValue()
Returns an array of the selected values
HTML_QuickForm_select::load()
Loads options from different types of data sources
HTML_QuickForm_select::loadArray()
Loads the options from an associative array
HTML_QuickForm_select::loadDbResult()
Loads the options from DB_result object
HTML_QuickForm_select::loadQuery()
Queries a database and loads the options from the results
HTML_QuickForm_select::onQuickFormEvent()
HTML_QuickForm_select::setMultiple()
Sets the select mutiple attribute
HTML_QuickForm_select::setName()
Sets the input field name
HTML_QuickForm_select::setSelected()
Sets the default values of the select box
HTML_QuickForm_select::setSize()
Sets the select field size, only applies to 'multiple' selects
HTML_QuickForm_select::setValue()
Sets the value of the form element
HTML_QuickForm_select::toHtml()
Returns the SELECT in HTML

Class: HTML_QuickForm_element

HTML_QuickForm_element::HTML_QuickForm_element()
Class constructor
HTML_QuickForm_element::accept()
Accepts a renderer
HTML_QuickForm_element::apiVersion()
Returns the current API version
HTML_QuickForm_element::exportValue()
Returns a 'safe' element's value
HTML_QuickForm_element::freeze()
Freeze the element so that only its value is returned
HTML_QuickForm_element::getFrozenHtml()
Returns the value of field without HTML tags
HTML_QuickForm_element::getLabel()
Returns display text for the element
HTML_QuickForm_element::getName()
Returns the element name
HTML_QuickForm_element::getType()
Returns element type
HTML_QuickForm_element::getValue()
Returns the value of the form element
HTML_QuickForm_element::isFrozen()
Returns whether or not the element is frozen
HTML_QuickForm_element::onQuickFormEvent()
Called by HTML_QuickForm whenever form event is made on this element
HTML_QuickForm_element::setLabel()
Sets display text for the element
HTML_QuickForm_element::setName()
Sets the input field name
HTML_QuickForm_element::setPersistantFreeze()
Sets wether an element value should be kept in an hidden field when the element is frozen or not
HTML_QuickForm_element::setValue()
Sets the value of the form element
HTML_QuickForm_element::unfreeze()
Unfreezes the element so that it becomes editable
HTML_QuickForm_element::_findValue()
Tries to find the element value from the values array
HTML_QuickForm_element::_generateId()
Automatically generates and assigns an 'id' attribute for the element.
HTML_QuickForm_element::_getPersistantData()
Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on
HTML_QuickForm_element::_prepareValue()
Used by exportValue() to prepare the value for returning

Class: HTML_Common

HTML_Common::HTML_Common()
Class constructor
HTML_Common::apiVersion()
Returns the current API version
HTML_Common::display()
Displays the HTML to the screen
HTML_Common::getAttribute()
Returns the value of the given attribute
HTML_Common::getAttributes()
Returns the assoc array (default) or string of attributes
HTML_Common::getComment()
Returns the HTML comment
HTML_Common::getTabOffset()
Returns the tabOffset
HTML_Common::removeAttribute()
Removes an attribute
HTML_Common::setAttributes()
Sets the HTML attributes
HTML_Common::setComment()
Sets the HTML comment to be displayed at the beginning of the HTML string
HTML_Common::setLineEnd()
Sets the line end style to Windows, Mac, Unix or a custom string.
HTML_Common::setTab()
Sets the string used to indent HTML
HTML_Common::setTabOffset()
Sets the tab offset
HTML_Common::toHtml()
Abstract method. Must be extended to return the objects HTML
HTML_Common::updateAttributes()
Updates the passed attributes without changing the other existing attributes
HTML_Common::_getAttrKey()
Returns the array key for the given non-name-value pair attribute
HTML_Common::_getAttrString()
Returns an HTML formatted attribute string
HTML_Common::_getLineEnd()
Returns the lineEnd
HTML_Common::_getTab()
Returns a string containing the unit for indenting HTML
HTML_Common::_getTabs()
Returns a string containing the offset for the whole HTML code
HTML_Common::_parseAttributes()
Returns a valid atrributes array from either a string or array
HTML_Common::_removeAttr()
Removes the given attribute from the given array
HTML_Common::_updateAttrArray()
Updates the attributes in $attr1 with the values in $attr2 without changing the other existing attributes

Class Details

[line 78]
Element for HTML_QuickForm that emulate a multi-select.

The HTML_QuickForm_advmultiselect package adds an element to the HTML_QuickForm package that is two select boxes next to each other emulating a multi-select.

PHP versions 4 and 5

LICENSE: This source file is subject to version 3.0 of the PHP license that is available through the world-wide-web at the following URI: http://www.php.net/license/3_0.txt. If you did not receive a copy of the PHP License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.




Tags:

author:  Laurent Laville <pear@laurent-laville.org>
version:  Release: 0.5.1
copyright:  1997-2005 The PHP Group
link:  http://pear.php.net/package/HTML_QuickForm_advmultiselect
license:  PHP License 3.0


[ Top ]


Class Variables

$_addButtonAttributes =

[line 114]

Associative array of the add button attributes



Tags:

since:  0.4.0
access:  private

Type:   array


[ Top ]

$_attributesHidden =

[line 181]

Associative array of the internal hidden box attributes



Tags:

since:  0.4.0
access:  private

Type:   array


[ Top ]

$_attributesSelected =

[line 172]

Associative array of the selected item box attributes



Tags:

since:  0.4.0
access:  private

Type:   array


[ Top ]

$_attributesUnselected =

[line 163]

Associative array of the unselected item box attributes



Tags:

since:  0.4.0
access:  private

Type:   array


[ Top ]

$_downButtonAttributes =

[line 141]

Associative array of the move up button attributes



Tags:

since:  0.5.0
access:  private

Type:   array


[ Top ]

$_elementCSS =  '
#{id}amsSelected {
  font: 13.3px sans-serif;
  background-color: #fff;
  overflow: auto;
  height: 14.3em;
  width: 12em;
  border-left:   1px solid #404040;
  border-top:    1px solid #404040;
  border-bottom: 1px solid #d4d0c8;
  border-right:  1px solid #d4d0c8;
}
#{id}amsSelected label {
  padding-right: 3px;
  display: block;
}
'

[line 210]

Default Element stylesheet string



Tags:

since:  0.4.0
access:  private

Type:   string


[ Top ]

$_elementTemplate =  '
{javascript}
<table{class}>
<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 -->
<tr>
  <td valign="top">{unselected}</td>
  <td align="center">{add}{remove}</td>
  <td valign="top">{selected}</td>
</tr>
</table>
'

[line 190]

Default Element template string



Tags:

since:  0.4.0
access:  private

Type:   string


[ Top ]

$_jsPostfix =

[line 96]

Postfix function name in javascript move selections



Tags:

since:  0.4.0
access:  private

Type:   string


[ Top ]

$_jsPrefix =

[line 87]

Prefix function name in javascript move selections



Tags:

since:  0.4.0
access:  private

Type:   string


[ Top ]

$_removeButtonAttributes =

[line 123]

Associative array of the remove button attributes



Tags:

since:  0.4.0
access:  private

Type:   array


[ Top ]

$_sort =

[line 154]

Defines if both list (unselected, selected) will have their elements be arranged from lowest to highest (or reverse) depending on comparaison function.

SORT_ASC is used to sort in ascending order SORT_DESC is used to sort in descending order




Tags:

since:  0.5.0
access:  private

Type:   integer


[ Top ]

$_tableAttributes =

[line 105]

Associative array of the multi select container attributes



Tags:

since:  0.4.0
access:  private

Type:   array


[ Top ]

$_upButtonAttributes =

[line 132]

Associative array of the move up button attributes



Tags:

since:  0.5.0
access:  private

Type:   array


[ Top ]



Class Methods


constructor HTML_QuickForm_advmultiselect [line 243]

void HTML_QuickForm_advmultiselect( [string $elementName = null], [mixed $elementLabel = null], [mixed $options = null], [mixed $attributes = null], [integer $sortOptions = null])

Class constructor



Tags:

since:  0.4.0
access:  public


Parameters:

string   $elementName   Dual Select name attribute
mixed   $elementLabel   Label(s) for the select boxes
mixed   $options   Data to be used to populate options
mixed   $attributes   Either a typical HTML attribute string or an associative array
integer   $sortOptions   Either SORT_ASC for auto ascending arrange, SORT_DESC for auto descending arrange, or NULL for no sort (append at end: default)

[ Top ]

method getElementCss [line 438]

string getElementCss( [boolean $raw = true])

Gets default element stylesheet for a single multi-select shape render

In custom example 4, the template defined lines 80-87 allows a single multi-select checkboxes shape. Useful when javascript is disabled (or when browser is not js compliant). In our example, no need to add javascript code (see lines 170-172), but css is mandatory (see line 142).




Tags:

link:  http://www.laurent-laville.org/img/qfams/screenshot/custom4.png Custom example 4: screenshot
since:  0.4.0
access:  public
example:  example not found


Parameters:

boolean   $raw   (optional) html output with style tags or just raw data

[ Top ]

method getElementJs [line 670]

string getElementJs( [boolean $raw = true])

Returns the javascript code generated to handle this element



Tags:

see:  HTML_QuickForm_advmultiselect::setJsElement()
since:  0.4.0
access:  public


Parameters:

boolean   $raw   (optional) html output with script tags or just raw data

[ Top ]

method setButtonAttributes [line 322]

void setButtonAttributes( string $button, [mixed $attributes = null])

Sets the button attributes

In custom example 1, the add and remove buttons have look set by the css class inputCommand. See especially lines 43-48 and 98-103.

In custom example 2, the basic text add and remove buttons are now replaced by images. See lines 43-44.

In custom example 5, we have ability to sort the selection list (on right side) by :

  - user-end: with Up and Down buttons
    (see lines 65,65,76 and 128-130)
  - programming: with the QF element constructor $sort option
    (see lines 34,36,38 and 59)




Tags:



Parameters:

string   $button   Button identifier, either 'add', 'remove', 'moveup' or 'movedown'
mixed   $attributes   (optional) Either a typical HTML attribute string or an associative array

[ Top ]

method setElementTemplate [line 393]

void setElementTemplate( string $html)

Sets element template



Tags:

since:  0.4.0
access:  public


Parameters:

string   $html   The HTML surrounding select boxes and buttons

[ Top ]

method setJsElement [line 415]

void setJsElement( [string $pref = null], [string $post = 'moveSelections'])

Sets JavaScript function name parts. Maybe usefull to avoid conflict names

In multiple example 1, the javascript function prefix is set to not null (see line 60).




Tags:



Parameters:

string   $pref   (optional) Prefix name
string   $post   (optional) Postfix name

[ Top ]

method toHtml [line 460]

string toHtml( )

Returns the HTML generated for the advanced mutliple select component



Tags:

since:  0.4.0
access:  public


Overrides HTML_QuickForm_select::toHtml() (Returns the SELECT in HTML)

[ Top ]


Documentation generated on Thu, 12 Jun 2008 12:55:12 -0500 by phpDocumentor 1.4.1