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

Class: HTML_QuickForm_select

Source Location: /pear/HTML/QuickForm/select.php

Class Overview

HTML_Common
   |
   --HTML_QuickForm_element
      |
      --HTML_QuickForm_select

Class to dynamically create an HTML SELECT


Author(s):

Version:

  • 1.0

Methods


Child classes:

HTML_QuickForm_hiddenselect
This class takes the same arguments as a select element, but instead

Inherited Methods

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

Class: HTML_Common

HTML_Common::HTML_Common()
Class constructor
HTML_Common::apiVersion()
Returns the current API version
HTML_Common::charset()
Sets the charset to use by htmlspecialchars() function
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::setAttribute()
Sets the value of the 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

Class Details

[line 33]
Class to dynamically create an HTML SELECT



Tags:

author:  Adam Daniel <adaniel1@eesus.jnj.com>
author:  Bertrand Mansion <bmansion@mamasam.com>
version:  1.0
since:  PHP4.04pl1
access:  public


[ Top ]


Class Methods


constructor HTML_QuickForm_select [line 69]

void HTML_QuickForm_select( [string $elementName = null], [mixed $elementLabel = null], [mixed $options = null], [mixed $attributes = null])

Class constructor



Tags:

since:  1.0
access:  public


Parameters:

string   $elementName   Select name attribute
mixed   $elementLabel   Label(s) for the select
mixed   $options   Data to be used to populate options
mixed   $attributes   Either a typical HTML attribute string or an associative array

[ Top ]

method addOption [line 293]

void addOption( string $text, string $value, [mixed $attributes = null])

Adds a new OPTION to the SELECT



Tags:

since:  1.0
access:  public


Parameters:

string   $text   Display text for the OPTION
string   $value   Value for the OPTION
mixed   $attributes   Either a typical HTML attribute string or an associative array

[ Top ]

method apiVersion [line 89]

double apiVersion( )

Returns the current API version



Tags:

since:  1.0
access:  public


Overrides HTML_QuickForm_element::apiVersion() (Returns the current API version)

[ Top ]

method exportValue [line 550]

void exportValue( &$submitValues, [ $assoc = false])

We check the options and return only the values that _could_ have been

selected. We also return a scalar value if select is not "multiple"




Overrides HTML_QuickForm_element::exportValue() (Returns a 'safe' element's value)

Parameters:

   &$submitValues  
   $assoc  

[ Top ]

method getFrozenHtml [line 509]

string getFrozenHtml( )

Returns the value of field without HTML tags



Tags:

since:  1.0
access:  public


Overrides HTML_QuickForm_element::getFrozenHtml() (Returns the value of field without HTML tags)

[ Top ]

method getMultiple [line 274]

bool getMultiple( )

Returns the select mutiple attribute



Tags:

return:  true if multiple select, false otherwise
since:  1.2
access:  public


[ Top ]

method getName [line 158]

string getName( )

Returns the element name



Tags:

since:  1.0
access:  public


Overrides HTML_QuickForm_element::getName() (Returns the element name)

[ Top ]

method getPrivateName [line 173]

string getPrivateName( )

Returns the element name (possibly with brackets appended)



Tags:

since:  1.0
access:  public


[ Top ]

method getSelected [line 127]

array getSelected( )

Returns an array of the selected values



Tags:

return:  of selected values
since:  1.0
access:  public


[ Top ]

method getSize [line 239]

int getSize( )

Returns the select field size



Tags:

since:  1.0
access:  public


[ Top ]

method getValue [line 208]

array getValue( )

Returns an array of the selected values



Tags:

return:  of selected values
since:  1.0
access:  public


Overrides HTML_QuickForm_element::getValue() (Returns the value of the form element)

[ Top ]

method load [line 440]

PEAR_Error load( &$options, [mixed $param1 = null], [mixed $param2 = null], [mixed $param3 = null], [mixed $param4 = null], mixed $options)

Loads options from different types of data sources

This method is a simulated overloaded method. The arguments, other than the first are optional and only mean something depending on the type of the first argument. If the first argument is an array then all arguments are passed in order to loadArray. If the first argument is a db_result then all arguments are passed in order to loadDbResult. If the first argument is a string or a DB connection then all arguments are passed in order to loadQuery.




Tags:

return:  on error or true
since:  1.1
throws:  PEAR_Error
access:  public


Parameters:

mixed   $options   Options source currently supports assoc array or DB_result
mixed   $param1   (optional) See function detail
mixed   $param2   (optional) See function detail
mixed   $param3   (optional) See function detail
mixed   $param4   (optional) See function detail
   &$options  

[ Top ]

method loadArray [line 326]

PEAR_Error loadArray( array $arr, [mixed $values = null])

Loads the options from an associative array



Tags:

return:  on error or true
since:  1.0
throws:  PEAR_Error
access:  public


Parameters:

array   $arr   Associative array of options
mixed   $values   (optional) Array or comma delimited string of selected values

[ Top ]

method loadDbResult [line 358]

PEAR_Error loadDbResult( &$result, [string $textCol = null], [string $valueCol = null], [mixed $values = null], object $result)

Loads the options from DB_result object

If no column names are specified the first two columns of the result are used as the text and value columns respectively




Tags:

return:  on error or true
since:  1.0
throws:  PEAR_Error
access:  public


Parameters:

object   $result   DB_result object
string   $textCol   (optional) Name of column to display as the OPTION text
string   $valueCol   (optional) Name of column to use as the OPTION value
mixed   $values   (optional) Array or comma delimited string of selected values
   &$result  

[ Top ]

method loadQuery [line 393]

void loadQuery( &$conn, string $sql, [string $textCol = null], [string $valueCol = null], [mixed $values = null], mixed $conn)

Queries a database and loads the options from the results



Tags:

since:  1.1
throws:  PEAR_Error
access:  public


Parameters:

mixed   $conn   Either an existing DB connection or a valid dsn
string   $sql   SQL query string
string   $textCol   (optional) Name of column to display as the OPTION text
string   $valueCol   (optional) Name of column to use as the OPTION value
mixed   $values   (optional) Array or comma delimited string of selected values
   &$conn  

[ Top ]

method onQuickFormEvent [line 581]

void onQuickFormEvent( $event, $arg, &$caller)



Overrides HTML_QuickForm_element::onQuickFormEvent() (Called by HTML_QuickForm whenever form event is made on this element)

Parameters:

   $event  
   $arg  
   &$caller  

[ Top ]

method setMultiple [line 255]

void setMultiple( bool $multiple)

Sets the select mutiple attribute



Tags:

since:  1.2
access:  public


Parameters:

bool   $multiple   Whether the select supports multi-selections

[ Top ]

method setName [line 143]

void setName( string $name)

Sets the input field name



Tags:

since:  1.0
access:  public


Overrides HTML_QuickForm_element::setName() (Sets the input field name)

Parameters:

string   $name   Input field name attribute

[ Top ]

method setSelected [line 105]

void setSelected( mixed $values)

Sets the default values of the select box



Tags:

since:  1.0
access:  public


Parameters:

mixed   $values   Array or comma delimited string of selected values

[ Top ]

method setSize [line 224]

void setSize( int $size)

Sets the select field size, only applies to 'multiple' selects



Tags:

since:  1.0
access:  public


Parameters:

int   $size   Size of select field

[ Top ]

method setValue [line 193]

void setValue( $value, mixed $values)

Sets the value of the form element



Tags:

since:  1.0
access:  public


Overrides HTML_QuickForm_element::setValue() (Sets the value of the form element)

Parameters:

mixed   $values   Array or comma delimited string of selected values
   $value  

[ Top ]

method toHtml [line 465]

string toHtml( )

Returns the SELECT in HTML



Tags:

since:  1.0
access:  public


Overridden in child classes as:

HTML_QuickForm_hiddenselect::toHtml()
Returns the SELECT in HTML

Overrides HTML_Common::toHtml() (Abstract method. Must be extended to return the objects HTML)

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:51:59 +0100 by phpDocumentor 1.4.3