Html
in package
HTML class
This class is deprecated in favor of using Sigma or \Cx\Core\Html\Model\Entity...
Provides some commonly used HTML elements
Tags
Table of Contents
Constants
- ATTRIBUTE_CHECKED = ' checked="checked"'
- Some basic and often used (and frequently misspelt) HTML attributes
- ATTRIBUTE_DISABLED = ' disabled="disabled"'
- ATTRIBUTE_MULTIPLE = ' multiple="multiple"'
- ATTRIBUTE_READONLY = ' readonly="readonly"'
- ATTRIBUTE_SELECTED = ' selected="selected"'
- CSS_DISPLAY_BLOCK = 'display:block;'
- CSS_DISPLAY_INLINE = 'display:inline;'
- CSS_DISPLAY_NONE = 'display:none;'
- Some basic and frequently used (and often misspelt) CSS properties
- ICON_BLANK = '/core/Core/View/Media/icons/blank.gif'
- Icon used for omitted icons (for aligning/formatting)
- ICON_COMMENT = '/core/Core/View/Media/icons/comment.gif'
- Icon used for Comments (with tooltip containing the text)
- ICON_ELEMENT_ADD = '/core/Core/View/Media/icons/check.gif'
- Icon used on the link for adding an HTML element
- ICON_ELEMENT_REMOVE = '/core/Core/View/Media/icons/delete.gif'
- Icon used on the link for removing an HTML element
- ICON_FUNCTION_BLANK = '/core/Core/View/Media/icons/pixel.gif'
- Icon used for omitted functions
- ICON_FUNCTION_CLEAR_IMAGE = '/core/Core/View/Media/icons/delete.gif'
- Icon used on the link for removing an image
- ICON_FUNCTION_COPY = '/core/Core/View/Media/icons/copy.gif'
- Icon used on the link for copying any entry
- ICON_FUNCTION_DELETE = '/core/Core/View/Media/icons/delete.gif'
- Icon used on the link for deleting any entry
- ICON_FUNCTION_DOWNLOAD_PDF = '/core/Core/View/Media/icons/pdf.gif'
- Icon used on the link for downloading a PDF document
- ICON_FUNCTION_EDIT = '/core/Core/View/Media/icons/edit.gif'
- Icon used on the link for editing any entry
- ICON_FUNCTION_MARK_DELETED = '/core/Core/View/Media/icons/empty.gif'
- Icon used on the link for marking as deleted
- ICON_FUNCTION_MARK_UNDELETED = '/core/Core/View/Media/icons/restore.gif'
- Icon used on the link for marking as not deleted
- ICON_FUNCTION_SPECIAL_OFF = '/core/Core/View/Media/icons/special_off.png'
- Icon used on the link for marking as not special
- ICON_FUNCTION_SPECIAL_ON = '/core/Core/View/Media/icons/special_on.png'
- Icon used on the link for marking as special
- ICON_FUNCTION_VIEW = '/core/Core/View/Media/icons/viewmag.png'
- Icon used on the link for viewing any entry
- ICON_STATUS_CHECKED = '/core/Core/View/Media/icons/check.gif'
- Icon used for the checked status
- ICON_STATUS_GREEN = '/core/Core/View/Media/icons/status_green.gif'
- Icon used for green status
- ICON_STATUS_RED = '/core/Core/View/Media/icons/status_red.gif'
- Icon used for red status
- ICON_STATUS_UNCHECKED = '/core/Core/View/Media/icons/pixel.gif'
- Icon used for the unchecked status
- ICON_STATUS_YELLOW = '/core/Core/View/Media/icons/status_yellow.gif'
- Icon used for yellow status
- STATUS_GREEN = 'green'
- STATUS_RED = 'red'
- Class constants defining the names of various (LED) status
- STATUS_YELLOW = 'yellow'
Properties
- $index_tab : int
- Index counter for all form elements
Methods
- getCheckbox() : string
- Returns HTML code for a checkbox
- getCheckboxGroup() : string
- Returns HTML code for a checkbox group
- getCheckmark() : string
- Returns HTML code for either a checked or unchecked icon for indicating yes/no status
- getDatepicker() : string
- Returns a datepicker element
- getDatetimepicker() : string
- Returns a datetimepicker element
- getForm() : string
- Returns HTML code for a form
- getHidden() : string
- Returns HTML code for a hidden imput field
- getImageByPath() : string
- Returns an image tag for the given Image path
- getInputButton() : string
- Returns HTML code for a button
- getInputFileupload() : string
- Returns HTML code for a file upload input field
- getInputNumber() : string
- Returns HTML code for a number imput field
- getInputPassword() : string
- Returns HTML code for a password text imput field
- getInputRange() : string
- Returns HTML code for a range imput field
- getInputText() : string
- Returns HTML code for a text imput field
- getInputTextGroup() : mixed
- Returns HMTL code for displaying a group of Text fields
- getLabel() : string
- Wraps the content in a label
- getLanguageIcon() : string
- Returns a single language icon
- getLanguageIcons() : string
- Generates code for ContentManager style language state icons
- getLed() : string
- Returns HTML code to represent some status with a colored LED image
- getLink() : string
- Returns HTML code for a link
- getOptions() : string
- Returns HTML code for selection options
- getRadio() : string
- Returns HTML code for a radio button
- getRadioGroup() : string
- Returns HTML code for a radio button group
- getRelativeUri() : string
- Returns the page URI
- getRelativeUri_entities() : string
- Returns the page URI with all special characters substituted by their corresponding HTML entities
- getSelect() : string
- Returns HTML code for a dropdown menu
- getSelectCustom() : string
- Returns HTML code for a custom dropdown menu
- getTextarea() : string
- Returns HTML code for a text area
- getTimepicker() : string
- Generates a timepicker input element.
- getTwinmenu() : mixed
- Returns HMTL code for displaying two adjacent menus
- makeRating() : bool
- Builds a raty element
- replaceUriParameter() : void
- Replaces the URI parameters given in the URI, by reference
- shortenText() : string
- Shortens text and appends an optional link to "more...".
- stripUriParam() : string
- Remove the parameter and its value from the URI string, by reference
- getJavascript_Twinmenu() : string
- Returns the Javascript code required by the Twinmenu
Constants
ATTRIBUTE_CHECKED
Some basic and often used (and frequently misspelt) HTML attributes
public
mixed
ATTRIBUTE_CHECKED
= ' checked="checked"'
Note the leading space that allows you to add the placeholder right after the preceeding attribute without wasting whitespace when it's unused
ATTRIBUTE_DISABLED
public
mixed
ATTRIBUTE_DISABLED
= ' disabled="disabled"'
ATTRIBUTE_MULTIPLE
public
mixed
ATTRIBUTE_MULTIPLE
= ' multiple="multiple"'
ATTRIBUTE_READONLY
public
mixed
ATTRIBUTE_READONLY
= ' readonly="readonly"'
ATTRIBUTE_SELECTED
public
mixed
ATTRIBUTE_SELECTED
= ' selected="selected"'
CSS_DISPLAY_BLOCK
public
mixed
CSS_DISPLAY_BLOCK
= 'display:block;'
CSS_DISPLAY_INLINE
public
mixed
CSS_DISPLAY_INLINE
= 'display:inline;'
CSS_DISPLAY_NONE
Some basic and frequently used (and often misspelt) CSS properties
public
mixed
CSS_DISPLAY_NONE
= 'display:none;'
ICON_BLANK
Icon used for omitted icons (for aligning/formatting)
public
mixed
ICON_BLANK
= '/core/Core/View/Media/icons/blank.gif'
ICON_COMMENT
Icon used for Comments (with tooltip containing the text)
public
mixed
ICON_COMMENT
= '/core/Core/View/Media/icons/comment.gif'
ICON_ELEMENT_ADD
Icon used on the link for adding an HTML element
public
mixed
ICON_ELEMENT_ADD
= '/core/Core/View/Media/icons/check.gif'
Tags
ICON_ELEMENT_REMOVE
Icon used on the link for removing an HTML element
public
mixed
ICON_ELEMENT_REMOVE
= '/core/Core/View/Media/icons/delete.gif'
ICON_FUNCTION_BLANK
Icon used for omitted functions
public
mixed
ICON_FUNCTION_BLANK
= '/core/Core/View/Media/icons/pixel.gif'
ICON_FUNCTION_CLEAR_IMAGE
Icon used on the link for removing an image
public
mixed
ICON_FUNCTION_CLEAR_IMAGE
= '/core/Core/View/Media/icons/delete.gif'
ICON_FUNCTION_COPY
Icon used on the link for copying any entry
public
mixed
ICON_FUNCTION_COPY
= '/core/Core/View/Media/icons/copy.gif'
ICON_FUNCTION_DELETE
Icon used on the link for deleting any entry
public
mixed
ICON_FUNCTION_DELETE
= '/core/Core/View/Media/icons/delete.gif'
ICON_FUNCTION_DOWNLOAD_PDF
Icon used on the link for downloading a PDF document
public
mixed
ICON_FUNCTION_DOWNLOAD_PDF
= '/core/Core/View/Media/icons/pdf.gif'
ICON_FUNCTION_EDIT
Icon used on the link for editing any entry
public
mixed
ICON_FUNCTION_EDIT
= '/core/Core/View/Media/icons/edit.gif'
ICON_FUNCTION_MARK_DELETED
Icon used on the link for marking as deleted
public
mixed
ICON_FUNCTION_MARK_DELETED
= '/core/Core/View/Media/icons/empty.gif'
ICON_FUNCTION_MARK_UNDELETED
Icon used on the link for marking as not deleted
public
mixed
ICON_FUNCTION_MARK_UNDELETED
= '/core/Core/View/Media/icons/restore.gif'
ICON_FUNCTION_SPECIAL_OFF
Icon used on the link for marking as not special
public
mixed
ICON_FUNCTION_SPECIAL_OFF
= '/core/Core/View/Media/icons/special_off.png'
ICON_FUNCTION_SPECIAL_ON
Icon used on the link for marking as special
public
mixed
ICON_FUNCTION_SPECIAL_ON
= '/core/Core/View/Media/icons/special_on.png'
ICON_FUNCTION_VIEW
Icon used on the link for viewing any entry
public
mixed
ICON_FUNCTION_VIEW
= '/core/Core/View/Media/icons/viewmag.png'
ICON_STATUS_CHECKED
Icon used for the checked status
public
mixed
ICON_STATUS_CHECKED
= '/core/Core/View/Media/icons/check.gif'
ICON_STATUS_GREEN
Icon used for green status
public
mixed
ICON_STATUS_GREEN
= '/core/Core/View/Media/icons/status_green.gif'
ICON_STATUS_RED
Icon used for red status
public
mixed
ICON_STATUS_RED
= '/core/Core/View/Media/icons/status_red.gif'
ICON_STATUS_UNCHECKED
Icon used for the unchecked status
public
mixed
ICON_STATUS_UNCHECKED
= '/core/Core/View/Media/icons/pixel.gif'
ICON_STATUS_YELLOW
Icon used for yellow status
public
mixed
ICON_STATUS_YELLOW
= '/core/Core/View/Media/icons/status_yellow.gif'
STATUS_GREEN
public
mixed
STATUS_GREEN
= 'green'
STATUS_RED
Class constants defining the names of various (LED) status
public
mixed
STATUS_RED
= 'red'
See Html::getLed()
STATUS_YELLOW
public
mixed
STATUS_YELLOW
= 'yellow'
Properties
$index_tab
Index counter for all form elements
private
static int
$index_tab
= 0
Incremented and added to the tabindex attribute for each element in the order they are created
Methods
getCheckbox()
Returns HTML code for a checkbox
public
static getCheckbox(string $name[, string $value = 1 ][, string $id = false ][, bool $checked = false ][, string $onchange = '' ][, string $attribute = '' ]) : string
If the name is empty, the empty string is returned. The $value is contrexx_raw2xhtml()d to prevent side effects. If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $value : string = 1
-
The element value, defaults to 1 (one)
- $id : string = false
-
The optional element id
- $checked : bool = false
-
If true, the checkbox is checked
- $onchange : string = ''
-
The optional onchange event script
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getCheckboxGroup()
Returns HTML code for a checkbox group
public
static getCheckboxGroup(string $name, array<string|int, mixed> $arrOptions[, array<string|int, mixed> $arrLabel = null ][, array<string|int, mixed> $arrChecked = null ][, string $id = false ][, string $onchange = '' ][, string $separator = '' ][, mixed $attributeCheckbox = '' ][, string $attributeLabel = '' ]) : string
If the name is empty, the empty string is returned. The $name parameter is both used for the name and id parameter in the element. For the id, a dash and an additional index are appended, like '$name-$index'. That index is increased accordingly on each call to this method. Mind that thus, it MUST be unique on your page. The $arrOptions array must contain the key-value pairs in the order to be added. The keys are used to index the name attribute in the checkboxes, the value is put into the value attribute. The $arrLabel should use the same keys, its values are appended as label text to the respective checkboxes, if present. The $arrChecked array may contain the values to be preselected as array values. It's keys are ignored.
Parameters
- $name : string
-
The element name
- $arrOptions : array<string|int, mixed>
-
The options array
- $arrLabel : array<string|int, mixed> = null
-
The optional label text array
- $arrChecked : array<string|int, mixed> = null
-
The optional preselected option keys
- $id : string = false
-
The optional element id
- $onchange : string = ''
-
The optional onchange event script
- $separator : string = ''
-
The optional separator between checkboxes
- $attributeCheckbox : mixed = ''
- $attributeLabel : string = ''
-
Additional optional attributes for the labels
Tags
Return values
string —The HTML code for the elements
getCheckmark()
Returns HTML code for either a checked or unchecked icon for indicating yes/no status
public
static getCheckmark([bool $status = '' ]) : string
For the time being, the unchecked status is represented by an empty space, aka pixel.gif
Parameters
- $status : bool = ''
-
If true, the checked box is returned, the unchecked otherwise
Tags
Return values
string —The HTML code with the checkbox icon
getDatepicker()
Returns a datepicker element
public
static getDatepicker(string $name[, array<string|int, mixed> $options = null ][, string $attribute = null ][, string &$id = null ]) : string
Uses and activates jQueryUI (see DateTimeTools::addDatepickerJs()). If the $id parameter is empty, uses the $name parameter value to create an id attribute. The ID attribute created for the element is returned in the $id parameter. The options array may contain any keys that are valid datepicker options, and their respective values. See http://jqueryui.com/demos/datepicker/#options for details. As of writing this (20101125), valid options are: altField altFormat appendText autoSize buttonImage buttonImageOnly buttonText calculateWeek changeMonth changeYear closeText constrainInput currentText dateFormat dayNames dayNamesMin dayNamesShort defaultDate disabled duration firstDay gotoCurrent hideIfNoPrevNext isRTL maxDate minDate monthNames monthNamesShort navigationAsDateFormat nextText numberOfMonths prevText selectOtherMonths shortYearCutoff showAnim showButtonPanel showCurrentAtPos showMonthAfterYear showOn showOptions showOtherMonths showWeek stepMonths weekHeader yearRange yearSuffix Note that you MUST specify boolean option values as true or false, NOT as string literals "true" or "false". The latter will not work.
Parameters
- $name : string
-
The element name
- $options : array<string|int, mixed> = null
-
The optional datepicker options, including the value (defaultDate)
- $attribute : string = null
-
The optional attributes
- $id : string = null
-
The optional ID, by reference.
Tags
Return values
string —The datepicker element HTML code
getDatetimepicker()
Returns a datetimepicker element
public
static getDatetimepicker(string $name[, array<string|int, mixed> $options = null ][, string $attribute = null ][, string &$id = null ]) : string
Parameters
- $name : string
-
textbox name for datetimepicker
- $options : array<string|int, mixed> = null
-
datetimepicker options Ex.dateFormat
- $attribute : string = null
- $id : string = null
-
To initialize the datatime picker
Tags
Return values
string —The datetimepicker element HTML code
getForm()
Returns HTML code for a form
public
static getForm(string $name, string $action, string $content[, string $id = false ][, string $method = 'post' ][, string $attribute = '' ]) : string
If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $action : string
-
The action URI
- $content : string
-
The form content
- $id : string = false
-
The optional element id
- $method : string = 'post'
-
The optional request method. Defaults to 'post'
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getHidden()
Returns HTML code for a hidden imput field
public
static getHidden(string $name, string $value[, string $id = false ][, string $attribute = '' ]) : string
If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $value : string
-
The element value
- $id : string = false
-
The element id, if non-empty
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getImageByPath()
Returns an image tag for the given Image path
public
static getImageByPath(mixed $image_path[, string $attribute = '' ]) : string
This adds alt, width, and height attributes with the values returned by ImageManager. If the $attribute parameter contains one of the alt, width, or height attributes (or corresponding style information), these will override the data from the Image object.
Parameters
- $image_path : mixed
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the image tag
getInputButton()
Returns HTML code for a button
public
static getInputButton(string $name, string $value[, string $type = 'submit' ][, string $id = false ][, string $attribute = '' ][, string $label = '' ][, string $label_attribute = '' ]) : string
If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $value : string
-
The element value
- $type : string = 'submit'
-
The button type, defaults to 'submit'
- $id : string = false
-
The element id, if non-empty
- $attribute : string = ''
-
Additional optional attributes
- $label : string = ''
-
The optional label text
- $label_attribute : string = ''
-
The optional label attributes
Tags
Return values
string —The HTML code for the element
getInputFileupload()
Returns HTML code for a file upload input field
public
static getInputFileupload(string $name[, string $id = false ][, string $maxlength = '' ][, string $mimetype = '' ][, string $attribute = '' ][, bool $visible = true ][, string $path = false ]) : string
If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $id : string = false
-
The optional element id. You can only get the target path and delete functionality if this is not false.
- $maxlength : string = ''
-
The optional maximum accepted size
- $mimetype : string = ''
-
The optional accepted MIME type
- $attribute : string = ''
-
Additional optional attributes
- $visible : bool = true
-
If true, the input element is set visible. Defaults to true
- $path : string = false
-
Optional path. If not empty, and the $id is non-empty, the file path is shown on top of the upload element, with a clickable delete icon to the right. Defaults to false
Tags
Return values
string —The HTML code for the element
getInputNumber()
Returns HTML code for a number imput field
public
static getInputNumber(string $name[, string $value = '' ][, string $id = false ][, string $attribute = '' ]) : string
Note: This requires an HTML5 capable browser. If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead. Use the $attribute parameter to specify additional attributes, like min, max, or step.
Parameters
- $name : string
-
The element name
- $value : string = ''
-
The element value, defaults to the empty string
- $id : string = false
-
The optional element id, defaults to false for none
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getInputPassword()
Returns HTML code for a password text imput field
public
static getInputPassword(string $name, string $value[, string $attribute = '' ]) : string
The $name parameter is used for both the element name and id attributes.
Parameters
- $name : string
-
The element name
- $value : string
-
The element value
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getInputRange()
Returns HTML code for a range imput field
public
static getInputRange(string $name[, string $value = '' ][, string $id = false ][, string $attribute = '' ]) : string
Note: This requires an HTML5 capable browser. If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead. Use the $attribute parameter to specify additional attributes, like min, max, or step.
Parameters
- $name : string
-
The element name
- $value : string = ''
-
The element value, defaults to the empty string
- $id : string = false
-
The optional element id, defaults to false for none
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getInputText()
Returns HTML code for a text imput field
public
static getInputText(string $name[, string $value = '' ][, string $id = false ][, string $attribute = '' ]) : string
If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead. If the custom attributes parameter $attribute is empty, and is_numeric($value) evaluates to true, the text is right aligned within the input element.
Parameters
- $name : string
-
The element name
- $value : string = ''
-
The element value, defaults to the empty string
- $id : string = false
-
The optional element id, defaults to false for none
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getInputTextGroup()
Returns HMTL code for displaying a group of Text fields
public
static getInputTextGroup([array<string|int, mixed> &$options = null ]) : mixed
Parameters
- $options : array<string|int, mixed> = null
-
The options array, by reference
getLabel()
Wraps the content in a label
public
static getLabel(string $for, string $text[, string $attribute = '' ]) : string
The $text is contrexx_raw2xhtml()d to prevent side effects. Mind that the $for parameter must match the id attribute of the contained element in $content.
Parameters
- $for : string
-
The for attribute of the label
- $text : string
-
The text of the label
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the label with the text
getLanguageIcon()
Returns a single language icon
public
static getLanguageIcon(int $languageId, string $state, mixed $link[, string $languageLabel = '' ]) : string
Parameters
- $languageId : int
-
Language ID
- $state : string
-
One of active,inactive,inexistent
- $link : mixed
- $languageLabel : string = ''
-
(optional) Label for the icon, default is uppercase language code
Return values
string —The HTML code for the elements
getLanguageIcons()
Generates code for ContentManager style language state icons
public
static getLanguageIcons(array<string|int, mixed> &$languageStates, string $link) : string
For $languageStates you may supply an array in one of these to forms:
$languageStates = array( {language id} => 'active','inactive','inexistent', )
$languageStates = array( {language id} => array( 'active' => {bool}, 'page' => {page id or object}, ), )
The latter will be resolved to the first form. The two forms can be mixed.
For $link, supply a hyperlink, that may contain %1$d and %2$s which will be replaced with the language ID and code.
Parameters
- $languageStates : array<string|int, mixed>
-
Language states to get icons for
- $link : string
-
Hyperlink for language icons
Return values
string —The HTML code for the elements
getLed()
Returns HTML code to represent some status with a colored LED image
public
static getLed([mixed $status = '' ][, string $alt = '' ][, string $action = '' ]) : string
Colors currently available include green, yellow, and red. For unknown colors, the empty string is returned. The $alt parameter value is added as the images' alt attribute value, if non-empty. The $action parameter may include URI parameters to be inserted in the href attribute of a link, which is added if $action is non-empty.
Parameters
- $status : mixed = ''
- $alt : string = ''
-
The optional alt attribute for the image
- $action : string = ''
-
The optional action URI parameters
Return values
string —The LED HTML code on success, the empty string otherwise
getLink()
Returns HTML code for a link
public
static getLink(string $uri, array<string|int, mixed> $text[, string $target = null ][, string $attribute = null ]) : string
If either $uri or $text is empty, returns the empty string.
Parameters
- $uri : string
-
The target address
- $text : array<string|int, mixed>
-
The link text
- $target : string = null
-
The optional target window
- $attribute : string = null
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getOptions()
Returns HTML code for selection options
public
static getOptions(array<string|int, mixed> $arrOptions[, mixed $selected = '' ][, string $attribute = null ]) : string
The optional $selected parameter may be an array, in which case all IDs found in the array keys are selected. The arrays' values are ignored.
Parameters
- $arrOptions : array<string|int, mixed>
-
The options array
- $selected : mixed = ''
-
The optional preselected option key or array of keys
- $attribute : string = null
-
Additional optional attributes
Tags
Return values
string —The menu options HTML code
getRadio()
Returns HTML code for a radio button
public
static getRadio(string $name, array<string|int, mixed> $value[, string $id = false ][, bool $checked = false ][, string $onchange = '' ][, string $attribute = '' ]) : string
If the name is empty, the empty string is returned. If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $value : array<string|int, mixed>
-
The element value
- $id : string = false
-
The optional element id
- $checked : bool = false
-
If true, the radio button is preselected. Defaults to false
- $onchange : string = ''
-
The optional onchange event script
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getRadioGroup()
Returns HTML code for a radio button group
public
static getRadioGroup(string $name, array<string|int, mixed> $arrOptions[, string $checked = '' ][, string $onchange = '' ][, string $attributeRadio = '' ][, string $attributeLabel = '' ]) : string
If the name is empty, the empty string is returned. The $name parameter is both used for the name and id parameter in the element. For the id, a dash and an additional index are appended, like '$name-$index'. That index is increased accordingly on each call to this method. Mind that thus, it MUST be unique on your page. The $arrOptions array must contain the value-text pairs in the order to be added. The values are used in the radio button, and the text for the label appended.
Parameters
- $name : string
-
The element name
- $arrOptions : array<string|int, mixed>
-
The options array
- $checked : string = ''
-
The optional preselected option key
- $onchange : string = ''
-
The optional onchange event script
- $attributeRadio : string = ''
-
Additional optional attributes for the radio button elements
- $attributeLabel : string = ''
-
Additional optional attributes for the labels
Tags
Return values
string —The HTML code for the element
getRelativeUri()
Returns the page URI
public
static getRelativeUri() : string
The URI contains neither the host nor the directory, but only the script file name and query string. //including the current CSRF parameter. This is ready for use with javascript. Apply contrexx_raw2xhtml() before using it in any href or action attribute.
Tags
Return values
string —The URI
getRelativeUri_entities()
Returns the page URI with all special characters substituted by their corresponding HTML entities
public
static getRelativeUri_entities() : string
The URI contains neither the host nor the directory, but only the script file name and query string. //including the current CSRF parameter. This is ready for use in any href or action attribute. Apply html_entity_decode() before using it with javascript.
Tags
Return values
string —The URI with entities
getSelect()
Returns HTML code for a dropdown menu
public
static getSelect(string $name[, array<string|int, mixed> $arrOptions = array() ][, string $selected = '' ][, string $id = false ][, string $onchange = '' ][, string $attribute = '' ]) : string
If the name is empty, the empty string is returned. If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $arrOptions : array<string|int, mixed> = array()
-
The options array
- $selected : string = ''
-
The optional preselected option key
- $id : string = false
-
The optional element id
- $onchange : string = ''
-
The optional onchange event script
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getSelectCustom()
Returns HTML code for a custom dropdown menu
public
static getSelectCustom(string $name[, string $strOptions = '' ][, string $id = false ][, string $onchange = '' ][, string $attribute = '' ]) : string
Similar to getSelect(), but takes a preproduced string for its options instead of an array and selected key. If the name is empty, the empty string is returned. If the $id parameter is false, the id attribute is not set. If it's empty (but not false), the name is used instead.
Parameters
- $name : string
-
The element name
- $strOptions : string = ''
-
The options string
- $id : string = false
-
The optional element id
- $onchange : string = ''
-
The optional onchange event script
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getTextarea()
Returns HTML code for a text area
public
static getTextarea(string $name, string $value[, string $cols = '' ][, string $rows = '' ][, string $attribute = '' ]) : string
The $name parameter is used for both the element name and id attributes.
Parameters
- $name : string
-
The element name
- $value : string
-
The element value
- $cols : string = ''
-
The optional number of columns
- $rows : string = ''
-
The optional number of rows
- $attribute : string = ''
-
Additional optional attributes
Tags
Return values
string —The HTML code for the element
getTimepicker()
Generates a timepicker input element.
public
static getTimepicker(string $name[, array<string|int, mixed> $options = [] ][, string $attribute = '' ][, string &$id = '' ]) : string
Wraps the Html::getDatetimepicker() with the 'timeOnly' option enabled to create a time-only picker.
Parameters
- $name : string
-
The name attribute of the input field.
- $options : array<string|int, mixed> = []
-
Additional options for timepicker initialization.
- $attribute : string = ''
-
Additional attributes for the input field.
- $id : string = ''
-
Optional ID to assign to the input; if not provided, one is generated.
Return values
string —The HTML code for the timepicker input element.
getTwinmenu()
Returns HMTL code for displaying two adjacent menus
public
static getTwinmenu([array<string|int, mixed> &$options = null ]) : mixed
Options can be moved between the menus. The index "onsubmit" is added to the options array; insert this string into the onsubmit attribute of your form in order to have all options selected before submitting the form.
Parameters
- $options : array<string|int, mixed> = null
-
The options array, by reference
makeRating()
Builds a raty element
public
static makeRating(string $selector[, array<string|int, mixed> $options = null ]) : bool
This element lets you display a customizable star rating. Uses and activates jQuery. The selector will be passed to jQuery to select the element(s) to which the rating is applied (some
Parameters
- $selector : string
-
The element selector
- $options : array<string|int, mixed> = null
-
The optional raty options
Tags
Return values
bool —True on success, false otherwise
replaceUriParameter()
Replaces the URI parameters given in the URI, by reference
public
static replaceUriParameter(string &$uri, string $parameter) : void
Parameters whose names are present in the URI already are replaced with the new values from the $parameter string. Parameters from $parameter that are not already present in the URI are appended. The replaced/added parameters are separated by '&'. Note that this expects and produces URIs in the form as returned by getRelativeUri_entities(). It operates on a URI without entities, too, but the result will probably not be correct.
Parameters
- $uri : string
-
The full URI, by reference
- $parameter : string
-
The parameters to be replaced or added
shortenText()
Shortens text and appends an optional link to "more...".
public
static shortenText(string $text[, int $max_length = 30 ][, string $more_uri = null ][, mixed $more_target = null ]) : string
Mind: the returned string is contrexx_raw2xhtml()d for the current charset!
Parameters
- $text : string
-
The text
- $max_length : int = 30
-
The maximum length
- $more_uri : string = null
-
The optional target window
- $more_target : mixed = null
Return values
string —The shortened text, with the optional link appended
stripUriParam()
Remove the parameter and its value from the URI string, by reference
public
static stripUriParam(string &$uri, string $parameter_name) : string
If the parameter cannot be found, the URI is left unchanged. Note that this expects and produces URIs in the form as returned by getRelativeUri_entities(). It operates on a URI without entities, too, but the result will probably not be correct.
Parameters
- $uri : string
-
The URI, by reference
- $parameter_name : string
-
The name of the parameter
Return values
string —The former parameter value, or the empty string
getJavascript_Twinmenu()
Returns the Javascript code required by the Twinmenu
private
static getJavascript_Twinmenu() : string
This method is called by getTwinmenu() and SHOULD NOT be used otherwise.
Tags
Return values
string —The Javascript code