LDAP Account Manager

htmlSelect extends htmlElement
in package

Represents a select box.

Table of Contents

ALIGN_BOTTOM  = 3
align to bottom
ALIGN_CENTER  = 4
align to center
ALIGN_LEFT  = 1
align to left
ALIGN_RIGHT  = 2
align to right
ALIGN_TOP  = 0
align to top
$alignment  : mixed
alignment when inside a table
$colspan  : mixed
colspan if inside a table
$rowspan  : mixed
rowspan if inside a table
$cssClasses  : mixed
CSS classes
$name  : mixed
name of select field
$tableCellCssClasses  : mixed
table cell CSS classes
$tableRowsToHide  : mixed
list of enclosing table rows to hide when checked
$tableRowsToShow  : mixed
list of enclosing table rows to show when checked
$accessibilityLabel  : string|null
accessibility label
$containsOptgroups  : mixed
contains optgroups
$dataAttributes  : mixed
data attributes
$dynamicScrolling  : mixed
dynamic scrolling
$elements  : mixed
elements
$hasDescriptiveElements  : mixed
descriptive elements
$isEnabled  : mixed
enabled or disabled
$multiSelect  : mixed
allows multi-selection
$onchangeEvent  : mixed
onchange event
$optionCssClasses  : mixed
CSS classes for values
$rightToLeftTextDirection  : mixed
right to left text direction
$selectedElements  : mixed
selected elements
$size  : mixed
size
$sortElements  : mixed
sorting enabled
$transformSingleSelect  : mixed
transform select boxes with one element to text
$transient  : mixed
indicates that this field should not automatically be saved in the self service or server profile
$width  : mixed
width of input element
__construct()  : mixed
Constructor.
addDataAttribute()  : mixed
Adds a data attribute.
enableDynamicScrolling()  : mixed
Enable dynamic scrolling. This limits the number of select options to 10000 by dynamically adding/removing options.
generateHTML()  : array<string|int, mixed>
Prints the HTML code for this element.
getAccessibilityMarkup()  : string
Returns the markup for the accessibility data.
getAlignmentString()  : string
Returns the HTML attributes for the alignment.
getColspanString()  : string
Returns the HTML attribute for the colspan.
getCSSClasses()  : array<string|int, mixed>
Returns the CSS classes of this element.
getRowspanString()  : string
Returns the HTML attribute for the rowspan.
getTableCellCSSClasses()  : array<string|int, mixed>
Returns the CSS classes of the surrounding table cell for this element.
setAccessibilityLabel()  : void
Sets the accessibility label.
setContainsOptgroups()  : mixed
Specifies if the elements are divided into optgroups.
setCSSClasses()  : mixed
Adds CSS classes to this element.
setHasDescriptiveElements()  : mixed
Specifies if the elements are just a simple list or an associative array (default: simple list).
setIsEnabled()  : mixed
Specifies if this component is enabled and accepts user modification.
setMultiSelect()  : mixed
Specifies if multi-selection is enabled (default: disabled).
setOnchangeEvent()  : mixed
Sets the JavaScript code for the onchange event.
setOptionCssClasses()  : void
Sets CSS classes for option values.
setRightToLeftTextDirection()  : mixed
Specifies if the text direction should be set to right to left.
setSortElements()  : mixed
Specifies if the elements should be sorted (default: sort).
setTableCellCSSClasses()  : mixed
Adds CSS classes to the surrounding table cell for this element.
setTableRowsToHide()  : mixed
This will hide the given table rows when the select is changed to the specified value.
setTableRowsToShow()  : mixed
This will show the given table rows when the select is changed to the specified value.
setTransformSingleSelect()  : mixed
Specifies if select boxes that contain only a single element should be transformed to a simple text field.
setTransient()  : mixed
Specifies that the value should not be automatically saved when used in self service or server profile (default: false).
setWidth()  : mixed
Specifies the width of this selection box.
getDataAttributesAsString()  : string
Returns the data attributes as rendered string.
getShowHideSelector()  : string
Returns the selector to use to find the show/hide elements.
printCodeForShowHideTableRows()  : mixed
Creates the JavaScript code to hide/show table rows based on the select value.
printOptionsHTML()  : mixed
Prints the HTML code of the option tags.

Constants

ALIGN_BOTTOM

align to bottom

public mixed ALIGN_BOTTOM = 3

ALIGN_CENTER

align to center

public mixed ALIGN_CENTER = 4

ALIGN_LEFT

align to left

public mixed ALIGN_LEFT = 1

ALIGN_RIGHT

align to right

public mixed ALIGN_RIGHT = 2

ALIGN_TOP

align to top

public mixed ALIGN_TOP = 0

Properties

$alignment

alignment when inside a table

public mixed $alignment

$colspan

colspan if inside a table

public mixed $colspan

$rowspan

rowspan if inside a table

public mixed $rowspan

$cssClasses

CSS classes

protected mixed $cssClasses = []

$name

name of select field

protected mixed $name

$tableCellCssClasses

table cell CSS classes

protected mixed $tableCellCssClasses = []

$tableRowsToHide

list of enclosing table rows to hide when checked

protected mixed $tableRowsToHide = []

$tableRowsToShow

list of enclosing table rows to show when checked

protected mixed $tableRowsToShow = []

$accessibilityLabel

accessibility label

private string|null $accessibilityLabel = \null

$containsOptgroups

contains optgroups

private mixed $containsOptgroups = \false

$dataAttributes

data attributes

private mixed $dataAttributes = []

$dynamicScrolling

dynamic scrolling

private mixed $dynamicScrolling = \false

$elements

elements

private mixed $elements

$hasDescriptiveElements

descriptive elements

private mixed $hasDescriptiveElements = \false

$isEnabled

enabled or disabled

private mixed $isEnabled = \true

$multiSelect

allows multi-selection

private mixed $multiSelect = \false

$onchangeEvent

onchange event

private mixed $onchangeEvent

$optionCssClasses

CSS classes for values

private mixed $optionCssClasses = []

$rightToLeftTextDirection

right to left text direction

private mixed $rightToLeftTextDirection = \false

$selectedElements

selected elements

private mixed $selectedElements = []

$size

size

private mixed $size

$sortElements

sorting enabled

private mixed $sortElements = \true

$transformSingleSelect

transform select boxes with one element to text

private mixed $transformSingleSelect = \true

$transient

indicates that this field should not automatically be saved in the self service or server profile

private mixed $transient = \false

$width

width of input element

private mixed $width = ''

Methods

__construct()

Constructor.

public __construct(string $name, array<string|int, mixed> $elements[, array<string|int, mixed> $selectedElements = [] ][, int $size = 1 ]) : mixed


Examples:

$select = new htmlSelect('myName', array('value1', 'value2'), array('value1'));

$select = new htmlSelect('myName', array('label1' => 'value1', 'label2' => 'value2'), array('value1'));
$select->setHasDescriptiveElements(true);

$select = new htmlSelect('myName', array('optgroupLabel' => array('value1', 'value2')), array('value1'));
$select->setHasDescriptiveElements(true);
$select->setContainsOptgroups(true);

Parameters
$name : string

element name

$elements : array<string|int, mixed>

list of elements array(label => value) or array(value1, value2) or array('optgroup' => array(...))

$selectedElements : array<string|int, mixed> = []

list of selected elements (optional, default none)

$size : int = 1

size (optional, default = 1)

Return values
mixed

addDataAttribute()

Adds a data attribute.

public addDataAttribute(string $key, string $value) : mixed
Parameters
$key : string

attribute name (without "data-")

$value : string

attribute value

Return values
mixed

enableDynamicScrolling()

Enable dynamic scrolling. This limits the number of select options to 10000 by dynamically adding/removing options.

public enableDynamicScrolling() : mixed

This will not be enabled when optgroups are used or the option size is less than 10000.

Return values
mixed

generateHTML()

Prints the HTML code for this element.

public generateHTML(string $module, array<string|int, mixed> $input, array<string|int, mixed> $values, bool $restricted, string $scope) : array<string|int, mixed>
Parameters
$module : string

Name of account module

$input : array<string|int, mixed>

List of meta-HTML elements

$values : array<string|int, mixed>

List of values which override the defaults in $input (name => value)

$restricted : bool

If true then no buttons will be displayed

$scope : string

Account type

Return values
array<string|int, mixed>

List of input field names and their type (name => type)

getAccessibilityMarkup()

Returns the markup for the accessibility data.

public getAccessibilityMarkup() : string
Return values
string

markup to be included in HTML tag (starting with space)

getAlignmentString()

Returns the HTML attributes for the alignment.

public getAlignmentString() : string
Return values
string

alignment HTML attributes (e.g. align="right" valign="top")

getColspanString()

Returns the HTML attribute for the colspan.

public getColspanString() : string
Return values
string

colspan HTML attribute (e.g. colspan=3)

getCSSClasses()

Returns the CSS classes of this element.

public getCSSClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

$classes CSS class names

getRowspanString()

Returns the HTML attribute for the rowspan.

public getRowspanString() : string
Return values
string

rowspan HTML attribute (e.g. rowspan=3)

getTableCellCSSClasses()

Returns the CSS classes of the surrounding table cell for this element.

public getTableCellCSSClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

CSS classes

setAccessibilityLabel()

Sets the accessibility label.

public setAccessibilityLabel(string|null $accessibilityLabel) : void
Parameters
$accessibilityLabel : string|null

label

Return values
void

setContainsOptgroups()

Specifies if the elements are divided into optgroups.

public setContainsOptgroups(bool $containsOptgroups) : mixed

In this case the provided options are an array where the key is the optgroup label and the value is an array containing the options for the optgroup.

Parameters
$containsOptgroups : bool

activates optgroups

Return values
mixed

setCSSClasses()

Adds CSS classes to this element.

public setCSSClasses(array<string|int, mixed> $classes) : mixed
Parameters
$classes : array<string|int, mixed>

CSS class names

Return values
mixed

setHasDescriptiveElements()

Specifies if the elements are just a simple list or an associative array (default: simple list).

public setHasDescriptiveElements(bool $hasDescriptiveElements) : mixed
Parameters
$hasDescriptiveElements : bool

activates descriptive elements

Return values
mixed

setIsEnabled()

Specifies if this component is enabled and accepts user modification.

public setIsEnabled(bool $isEnabled) : mixed
Parameters
$isEnabled : bool

enabled if true

Return values
mixed

setMultiSelect()

Specifies if multi-selection is enabled (default: disabled).

public setMultiSelect(bool $multiSelect) : mixed
Parameters
$multiSelect : bool

allows multi-selection

Return values
mixed

setOnchangeEvent()

Sets the JavaScript code for the onchange event.

public setOnchangeEvent(string $onchangeEvent) : mixed
Parameters
$onchangeEvent : string

onchange event code (e.g. myfunction();)

Return values
mixed

setOptionCssClasses()

Sets CSS classes for option values.

public setOptionCssClasses(array<string|int, mixed> $optionCssClasses) : void
Parameters
$optionCssClasses : array<string|int, mixed>

array('option value' => 'CSS class(es)')

Return values
void

setRightToLeftTextDirection()

Specifies if the text direction should be set to right to left.

public setRightToLeftTextDirection(bool $rightToLeftTextDirection) : mixed
Parameters
$rightToLeftTextDirection : bool

if true use right to left direction

Return values
mixed

setSortElements()

Specifies if the elements should be sorted (default: sort).

public setSortElements(bool $sortElements) : mixed
Parameters
$sortElements : bool

sort elements

Return values
mixed

setTableCellCSSClasses()

Adds CSS classes to the surrounding table cell for this element.

public setTableCellCSSClasses(array<string|int, mixed> $classes) : mixed
Parameters
$classes : array<string|int, mixed>

CSS class names

Return values
mixed

setTableRowsToHide()

This will hide the given table rows when the select is changed to the specified value.

public setTableRowsToHide(array<string|int, mixed> $tableRowsToHide) : mixed

The given IDs can be of any e.g. input element. Starting from this element the first parent "" element will be used to show/hide.


Example:
Using "mycheckbox" will use this "tr" to hide/show.

Example for $tableRowsToHide:
array('yes' => array('option1', 'option2'), 'no' => array('option3'))

Parameters
$tableRowsToHide : array<string|int, mixed>

array of select value => array of IDs of child elements to hide

Return values
mixed

setTableRowsToShow()

This will show the given table rows when the select is changed to the specified value.

public setTableRowsToShow(array<string|int, mixed> $tableRowsToShow) : mixed

The given IDs can be of any e.g. input element. Starting from this element the first parent "" element will be used to show/hide.


Example:
Using "mycheckbox" will use this "tr" to hide/show.

Example for $tableRowsToShow:
array('yes' => array('option1', 'option2'), 'no' => array('option3'))

Parameters
$tableRowsToShow : array<string|int, mixed>

array of select value => array of IDs of child elements to show

Return values
mixed

setTransformSingleSelect()

Specifies if select boxes that contain only a single element should be transformed to a simple text field.

public setTransformSingleSelect(bool $transformSingleSelect) : mixed
Parameters
$transformSingleSelect : bool

transform single options to text

Return values
mixed

setTransient()

Specifies that the value should not be automatically saved when used in self service or server profile (default: false).

public setTransient(bool $transient) : mixed
Parameters
$transient : bool

transient field

Return values
mixed

setWidth()

Specifies the width of this selection box.

public setWidth(string $width) : mixed
Parameters
$width : string

width (e.g. 20em)

Return values
mixed

getDataAttributesAsString()

Returns the data attributes as rendered string.

protected getDataAttributesAsString() : string
Return values
string

data attributes

getShowHideSelector()

Returns the selector to use to find the show/hide elements.

protected getShowHideSelector() : string
Return values
string

selector

printCodeForShowHideTableRows()

Creates the JavaScript code to hide/show table rows based on the select value.

private printCodeForShowHideTableRows(string &$onChange) : mixed
Parameters
$onChange : string

onChange code

Return values
mixed

printOptionsHTML()

Prints the HTML code of the option tags.

private printOptionsHTML(array<string|int, mixed> $elements) : mixed
Parameters
$elements : array<string|int, mixed>

list of options

Return values
mixed

Search results