CWIS Developer Documentation
|
Convenience class for generating an HTML select/option form element. More...
Public Member Functions | |
__construct ($ResultVar, $Options, $SelectedValue=NULL) | |
Class constructor. More... | |
PrintHtml () | |
Print HTML for list. More... | |
GetHtml () | |
Get HTML for list. More... | |
DisabledOptions ($Options=NULL) | |
Get/set disabled options. More... | |
SelectedValue ($NewValue=NULL) | |
Get/set currently selected value or array of currently selected values. More... | |
Size ($NewValue=NULL) | |
Get/set the list size (number of visible items). More... | |
MultipleAllowed ($NewValue=NULL) | |
Get/set whether multiple items may be selected. More... | |
SubmitOnChange ($NewValue=NULL) | |
Get/set whether to submit the form when the list value is changed. More... | |
OnChangeAction ($NewValue=NULL) | |
Get/set action to take if form is submitted on change. More... | |
PrintIfEmpty ($NewValue=NULL) | |
Get/set whether list should be output even if there are no items. More... | |
Disabled ($NewValue=NULL) | |
Get/set whether the whole option list is editable. More... | |
ClassForList ($NewValue=NULL) | |
Get/set CSS class(es) for the list. More... | |
ClassForOptions ($NewValue=NULL) | |
Get/set CSS class(es) for the options. More... | |
DataForOptions ($NewValue=NULL) | |
Get/set HTML data attributes for the options. More... | |
MaxLabelLength ($NewValue=NULL) | |
Get/set the maximum number of character a label will be displayed. More... | |
Protected Member Functions | |
GetOptionTag ($Value, $Label) | |
Get HTML for one option. More... | |
Protected Attributes | |
$Disabled = FALSE | |
$DisabledOptions = array() | |
$ListClasses = NULL | |
$MaxLabelLength = 0 | |
$MultipleAllowed = FALSE | |
$OnChangeAction = "submit()" | |
$Options | |
$OptionClasses = NULL | |
$OptionData = array() | |
$PrintIfEmpty = TRUE | |
$ResultVar | |
$SelectedValue | |
$Size = 1 | |
$SubmitOnChange = FALSE | |
Convenience class for generating an HTML select/option form element.
Definition at line 13 of file HtmlOptionList.php.
HtmlOptionList::__construct | ( | $ResultVar, | |
$Options, | |||
$SelectedValue = NULL |
|||
) |
Class constructor.
string | $ResultVar | Name of form variable for select element. |
array | $Options | Array of options, with form values for the array index and labels for the array values. For grouping, any of the options may actually be an array of options, with a group label for the index, and the array for the value. |
mixed | $SelectedValue | Currently selected form value or array of currently selected form values. (OPTIONAL) |
Definition at line 28 of file HtmlOptionList.php.
References $Options, $ResultVar, $SelectedValue, and SelectedValue().
HtmlOptionList::ClassForList | ( | $NewValue = NULL | ) |
Get/set CSS class(es) for the list.
string | $NewValue | String with class names, separated by spaces. |
Definition at line 264 of file HtmlOptionList.php.
References $ListClasses.
HtmlOptionList::ClassForOptions | ( | $NewValue = NULL | ) |
Get/set CSS class(es) for the options.
If separate classes per option are supplied as an array, they do not have to be in the same order as the options originally supplied to the constructor, and not all options must be included.
mixed | $NewValue | String with class names, separated by spaces, or array of class name strings, indexed by option value. |
Definition at line 284 of file HtmlOptionList.php.
References $OptionClasses.
HtmlOptionList::DataForOptions | ( | $NewValue = NULL | ) |
Get/set HTML data attributes for the options.
array | $NewValue | Two-dimensional array of data attribute values, first dimension keyed by option value, second keyed by data attribute name (e.g., 'field-id' for a 'data-field-id' attribute). |
Definition at line 301 of file HtmlOptionList.php.
References $OptionData.
HtmlOptionList::Disabled | ( | $NewValue = NULL | ) |
Get/set whether the whole option list is editable.
NOTE: When the list is not editable, values for it are not submitted with the form. This is distinct from whether individual options are disabled.
bool | $NewValue | If TRUE, list is not editable. |
Definition at line 250 of file HtmlOptionList.php.
References $Disabled.
Referenced by GetHtml().
HtmlOptionList::DisabledOptions | ( | $Options = NULL | ) |
Get/set disabled options.
mixed | $Options | Option or array of options to disable. If a single option then it should be the value and will be added to any existing disabled options, and if an array it should have the values for the index and will replace the current list of disabled options. (OPTIONAL) |
Definition at line 116 of file HtmlOptionList.php.
References $DisabledOptions, and $Options.
Referenced by GetOptionTag().
HtmlOptionList::GetHtml | ( | ) |
Get HTML for list.
Definition at line 47 of file HtmlOptionList.php.
References Disabled(), GetOptionTag(), MultipleAllowed(), OnChangeAction(), PrintIfEmpty(), Size(), and SubmitOnChange().
Referenced by PrintHtml().
|
protected |
Get HTML for one option.
string | $Value | Value for option. |
string | $Label | Label for option. |
Definition at line 349 of file HtmlOptionList.php.
References DisabledOptions(), MaxLabelLength(), and SelectedValue().
Referenced by GetHtml().
HtmlOptionList::MaxLabelLength | ( | $NewValue = NULL | ) |
Get/set the maximum number of character a label will be displayed.
If a label exceeds the limit, the extra characters will be taken off.
int | $NewValue | Maximum number of characters a label will be displayed (OPTIONAL, defaults to no limit). If zero is passed in, limit will be reset to none. |
Definition at line 318 of file HtmlOptionList.php.
References $MaxLabelLength.
Referenced by GetOptionTag().
HtmlOptionList::MultipleAllowed | ( | $NewValue = NULL | ) |
Get/set whether multiple items may be selected.
Defaults to FALSE.
bool | $NewValue | If TRUE, users will be able to select multiple items. (OPTIONAL) |
Definition at line 167 of file HtmlOptionList.php.
References $MultipleAllowed.
Referenced by GetHtml().
HtmlOptionList::OnChangeAction | ( | $NewValue = NULL | ) |
Get/set action to take if form is submitted on change.
Defaults to "submit()" (without the quotes). No character escaping or other processing is done to this value before it is added to the HTML, so whatever is passed in must be pre-sanitized if needed, including escaping any double quotation marks. This setting has no effect if SubmitOnChange() is set to FALSE.
string | $NewValue | New action. (OPTIONAL) |
Definition at line 216 of file HtmlOptionList.php.
References $OnChangeAction.
Referenced by GetHtml().
HtmlOptionList::PrintHtml | ( | ) |
HtmlOptionList::PrintIfEmpty | ( | $NewValue = NULL | ) |
Get/set whether list should be output even if there are no items.
If this is set to FALSE and there are no items in the list, GetHtml() will return an empty string and PrintHtml() will print nothing. Defaults to TRUE.
bool | $NewValue | If TRUE, HTML will be returned/printed even if there are no items in the list. (OPTIONAL) |
Definition at line 234 of file HtmlOptionList.php.
References $PrintIfEmpty.
Referenced by GetHtml().
HtmlOptionList::SelectedValue | ( | $NewValue = NULL | ) |
Get/set currently selected value or array of currently selected values.
mixed | $NewValue | Currently selected form value or array of currently selected form values. (OPTIONAL) |
Definition at line 138 of file HtmlOptionList.php.
References $SelectedValue.
Referenced by __construct(), and GetOptionTag().
HtmlOptionList::Size | ( | $NewValue = NULL | ) |
Get/set the list size (number of visible items).
Defaults to 1.
int | $NewValue | Current size. (OPTIONAL) |
Definition at line 152 of file HtmlOptionList.php.
References $Size.
Referenced by GetHtml().
HtmlOptionList::SubmitOnChange | ( | $NewValue = NULL | ) |
Get/set whether to submit the form when the list value is changed.
Defaults to FALSE.
bool | $NewValue | If TRUE, form will be submitted on change. (OPTIONAL) |
Definition at line 196 of file HtmlOptionList.php.
References $SubmitOnChange.
Referenced by GetHtml().
|
protected |
Definition at line 329 of file HtmlOptionList.php.
Referenced by Disabled().
|
protected |
Definition at line 330 of file HtmlOptionList.php.
Referenced by DisabledOptions().
|
protected |
Definition at line 331 of file HtmlOptionList.php.
Referenced by ClassForList().
|
protected |
Definition at line 332 of file HtmlOptionList.php.
Referenced by MaxLabelLength().
|
protected |
Definition at line 333 of file HtmlOptionList.php.
Referenced by MultipleAllowed().
|
protected |
Definition at line 334 of file HtmlOptionList.php.
Referenced by OnChangeAction().
|
protected |
Definition at line 336 of file HtmlOptionList.php.
Referenced by ClassForOptions().
|
protected |
Definition at line 337 of file HtmlOptionList.php.
Referenced by DataForOptions().
|
protected |
Definition at line 335 of file HtmlOptionList.php.
Referenced by __construct(), and DisabledOptions().
|
protected |
Definition at line 338 of file HtmlOptionList.php.
Referenced by PrintIfEmpty().
|
protected |
Definition at line 339 of file HtmlOptionList.php.
Referenced by __construct().
|
protected |
Definition at line 340 of file HtmlOptionList.php.
Referenced by __construct(), and SelectedValue().
|
protected |
Definition at line 341 of file HtmlOptionList.php.
Referenced by Size().
|
protected |
Definition at line 342 of file HtmlOptionList.php.
Referenced by SubmitOnChange().