HtmlDropdown
extends TiqBase
in package
Class that can create an html dropdown for choice/value selection
Requires two arrays of the same length, choices which show up in the dropdown and values which correspond to the choices for use in code
To use, create an instance of the class with the two arrays and echo $theClass->dropDownHTML at the end of your phpgrid. To use the values get them from * the public class variables
Table of Contents
Properties
- $array_min : int|null
- $choices : array<string|int, mixed>
- $message : string
- $selectedChoice : mixed
- $selectedValue : mixed
- $values : array<string|int, mixed>
- $html_name : string
- $show_run_button : bool
Methods
- __construct() : mixed
- This will not create a dropdown. Outputting the result of dropDownHTML will
- __get() : mixed
- Base getter hooked into php's magic __get
- __set() : mixed
- Base setter hooked into php's magic __set
- dropDownHTML() : string
- echo's out the html to create a dropdown give a list of choices
- terminate() : mixed
- Logs an error and throws and exception
- getValue() : void
- gets the data out of the POST variable, also preserves the users selection
- lengthMin() : int
- Find min array length out of a set of arrays
Properties
$array_min
public
int|null
$array_min
= null
$choices
public
array<string|int, mixed>
$choices
$message
public
string
$message
$selectedChoice
public
mixed
$selectedChoice
= null
$selectedValue
public
mixed
$selectedValue
= null
$values
public
array<string|int, mixed>
$values
$html_name
private
string
$html_name
$show_run_button
private
bool
$show_run_button
= false
Methods
__construct()
This will not create a dropdown. Outputting the result of dropDownHTML will
public
__construct(array<string|int, mixed> $choices, array<string|int, mixed> $values[, string $message = 'Select: ' ][, string $html_name = 'selected_value' ][, bool $show_run_button = false ]) : mixed
Parameters
- $choices : array<string|int, mixed>
-
- List of choices seen in the dropdown
- $values : array<string|int, mixed>
-
- Values corresponding to the choices
- $message : string = 'Select: '
-
- The text that will appear next to the dropdown
- $html_name : string = 'selected_value'
- $show_run_button : bool = false
__get()
Base getter hooked into php's magic __get
public
__get(string $name) : mixed
Allows the retrieval of properties from a class. Requires the implementation of a get method in the concrete class
Parameters
- $name : string
-
- name of the property
__set()
Base setter hooked into php's magic __set
public
__set(string $name, mixed $value) : mixed
Allows the settings of properties on a class safely. Requires the implementation of a set method in the concrete class
Parameters
- $name : string
-
- name of property to be set
- $value : mixed
-
- value to which the property will be set
dropDownHTML()
echo's out the html to create a dropdown give a list of choices
public
dropDownHTML() : string
Return values
stringterminate()
Logs an error and throws and exception
protected
terminate([string $message = '' ]) : mixed
Parameters
- $message : string = ''
-
- Reason for termination
Tags
getValue()
gets the data out of the POST variable, also preserves the users selection
private
getValue() : void
lengthMin()
Find min array length out of a set of arrays
private
lengthMin(array<string|int, mixed> $arrays) : int
Parameters
- $arrays : array<string|int, mixed>