Select box with additional functions for category and article selection

package CONTENIDO Frontend
subpackage Input Helper

 Methods

Constructor.

__construct(string $sName, int $iWidth, string $sID, string $bDisabled, int $iTabIndex, $sAccessKey) : \none

Creates an HTML select field (aka "DropDown").

Parameters

$sName

string

Name of the element

$iWidth

int

Width of the select element

$sID

string

ID of the element

$bDisabled

string

Item disabled flag (non-empty to set disabled)

$iTabIndex

int

Tab index for form elements

$sAccessKey

Returns

\none

Direct call of object as string will return it's generated markup.

__toString() : string
Inherited
inherited_from \cHTML::__toString()
inherited_from \cHTMLFormElement::__toString()
inherited_from \cHTMLSelectElement::__toString()

Returns

stringGenerated markup

Function addArticles.

addArticles(int $iIDCat, bool $bColored, bool $bArtOnline, string $sSpaces) : int

Adds articles to select box values.

Parameters

$iIDCat

int

idcat of the category to be listed

$bColored

bool

Add color information to option elements

$bArtOnline

bool

If true, only online articles will be added

$sSpaces

string

Just some "" to show data hierarchically (used in conjunction with addCategories)

Returns

intNumber of items added

Function addCategories.

addCategories(int $iMaxLevel, bool $bColored, bool $bCatVisible, bool $bCatPublic, bool $bWithArt, bool $bArtOnline) : int

Adds category elements (optionally including articles) to select box values. Note: Using "with articles" adds the articles also - but the categories will get a negative value! There is no way to distinguish between a category id and an article id...

Parameters

$iMaxLevel

int

Max. level shown (to be exact: except this level)

$bColored

bool

Add color information to option elements

$bCatVisible

bool

If true, only add idcat as value, if cat is visible

$bCatPublic

bool

If true, only add idcat as value, if cat is public

$bWithArt

bool

Add also articles per category

$bArtOnline

bool

If true, show only online articles

Returns

intNumber of items added

Adds an cHTMLOptionElement to the number of choices at the specified position.

addOptionElement(string $index, \cHTMLOptionElement $element) : \cHTMLSelectElement
Inherited
inherited_from \cHTMLSelectElement::addOptionElement()

Parameters

$index

string

Index of the element

$element

\cHTMLOptionElement

Filled cHTMLOptionElement to add

Returns

Adds a required script to the current element.

addRequiredScript(string $script) : \cHTML
Inherited

Anyway, scripts are not included twice.

inherited_from \cHTML::addRequiredScript()
inherited_from \cHTMLFormElement::addRequiredScript()
inherited_from \cHTMLSelectElement::addRequiredScript()

Parameters

$script

string

the script to include

Returns

\cHTML$this

Function addTypesFromArt.

addTypesFromArt(int $iIDCatArt, string $sTypeRange) : int

Adds types and type ids which are available for the specified article

Parameters

$iIDCatArt

int

Article id

$sTypeRange

string

Komma separated list of CONTENIDO type ids which may be in the resulting list (e.g. '1','17','28')

Returns

intNumber of items added

Advances to the next ID available in the system.

advanceID() : \cHTML
Inherited

This function is useful if you need to use HTML elements in a loop, but don't want to re-create new objects each time.

inherited_from \cHTML::advanceID()
inherited_from \cHTMLFormElement::advanceID()
inherited_from \cHTMLSelectElement::advanceID()

Returns

\cHTML$this

Appends a cHTMLOptionElement to the number of choices.

appendOptionElement(\cHTMLOptionElement $element) : \cHTMLSelectElement
Inherited
inherited_from \cHTMLSelectElement::appendOptionElement()

Parameters

$element

\cHTMLOptionElement

Filled cHTMLOptionElement to add

Returns

Appends the given style definition to the HTML element.

appendStyleDefinition(string $property, string $value) : \cHTML
Inherited

Example usage: $element->appendStyleDefinition('margin', '5px');

inherited_from \cHTML::appendStyleDefinition()
inherited_from \cHTMLFormElement::appendStyleDefinition()
inherited_from \cHTMLSelectElement::appendStyleDefinition()

Parameters

$property

string

the property name, e.g. 'margin'

$value

string

the value of the property, e.g. '5px'

Returns

\cHTML$this

Appends the given style definitions to the HTML element.

appendStyleDefinitions(array $styles) : \cHTML
Inherited

Example usage: $element->appendStyleDefinitions(array( 'margin' => '5px', 'padding' => '0' ));

inherited_from \cHTML::appendStyleDefinitions()
inherited_from \cHTMLFormElement::appendStyleDefinitions()
inherited_from \cHTMLSelectElement::appendStyleDefinitions()

Parameters

$styles

string

the styles to append

Returns

\cHTML$this

Attaches the code for an event

attachEventDefinition(string $name, string $event, string $code) : \cHTML
Inherited

Example to attach an onClick handler: attachEventDefinition('foo', 'onClick', 'alert("foo");');

inherited_from \cHTML::attachEventDefinition()
inherited_from \cHTMLFormElement::attachEventDefinition()
inherited_from \cHTMLSelectElement::attachEventDefinition()

Parameters

$name

string

Defines the name of the event

$event

string

Defines the event (e.g. onClick)

$code

string

Defines the code

Returns

\cHTML$this

Attaches a style definition.

attachStyleDefinition(string $name, string $definition) : \cHTML
Inherited

This function is not restricted to a single style, e.g. you can set multiple style definitions as-is to the handler.

$example->attachStyle('myIdentifier', 'border: 1px solid black; white-space: nowrap'); $example->attachStyle('myIdentifier2', 'padding: 0px');

Results in:

style="border: 1px solid black; white-space: nowrap; padding: 0px;"

inherited_from \cHTML::attachStyleDefinition()
inherited_from \cHTMLFormElement::attachStyleDefinition()
inherited_from \cHTMLSelectElement::attachStyleDefinition()

Parameters

$name

string

Name for a style definition

$definition

string

Definition for the given entity

Returns

\cHTML$this

Automatically creates and fills cHTMLOptionElements

autoFill(array $stuff) : \cHTMLSelectElement
Inherited

Array format: $stuff = array( array('value', 'title'), array('value', 'title') );

or regular key => value arrays: $stuff = array( 'value' => 'title', 'value' => 'title' );

inherited_from \cHTMLSelectElement::autoFill()

Parameters

$stuff

array

Array with all items

Returns

cHTML()

cHTML() 
Inherited
inherited_from \cHTML::cHTML()
inherited_from \cHTMLFormElement::cHTML()
inherited_from \cHTMLSelectElement::cHTML()

cHTMLFormElement()

cHTMLFormElement($name, $id, $disabled, $tabindex, $accesskey, $class) 
Inherited
inherited_from \cHTMLFormElement::cHTMLFormElement()
inherited_from \cHTMLSelectElement::cHTMLFormElement()

Parameters

$name

$id

$disabled

$tabindex

$accesskey

$class

cHTMLInputSelectElement()

cHTMLInputSelectElement($sName, $iWidth, $sID, $bDisabled, $iTabIndex, $sAccessKey) 
deprecated 2012-08-24 Use __construct()

Parameters

$sName

$iWidth

$sID

$bDisabled

$iTabIndex

$sAccessKey

cHTMLSelectElement()

cHTMLSelectElement($name, $width, $id, $disabled, $tabindex, $accesskey) 
Inherited
inherited_from \cHTMLSelectElement::cHTMLSelectElement()

Parameters

$name

$width

$id

$disabled

$tabindex

$accesskey

Outputs the generated markup

display() 
Inherited
inherited_from \cHTML::display()
inherited_from \cHTMLFormElement::display()
inherited_from \cHTMLSelectElement::display()

Fills the close skeleton

fillCloseSkeleton() : string
Inherited
inherited_from \cHTML::fillCloseSkeleton()
inherited_from \cHTMLFormElement::fillCloseSkeleton()
inherited_from \cHTMLSelectElement::fillCloseSkeleton()

Returns

stringfilled SGML closer skeleton

Fills the open SGML tag skeleton

fillSkeleton(string $attributes) : string
Inherited

fillSkeleton fills the SGML opener tag with the specified attributes. Attributes need to be passed in the stringyfied variant.

inherited_from \cHTML::fillSkeleton()
inherited_from \cHTMLFormElement::fillSkeleton()
inherited_from \cHTMLSelectElement::fillSkeleton()

Parameters

$attributes

string

Attributes to set

Returns

stringfilled SGML opener skeleton

Returns the value of the given attribute.

getAttribute(string $attributeName) : string
Inherited
inherited_from \cHTML::getAttribute()
inherited_from \cHTMLFormElement::getAttribute()
inherited_from \cHTMLSelectElement::getAttribute()

Parameters

$attributeName

string

Attribute name

Returns

stringnull value or null if the attribute does not exist

Returns the assoc array(default) or string of attributes

getAttributes(bool $returnAsString) : array
Inherited
inherited_from \cHTML::getAttributes()
inherited_from \cHTMLFormElement::getAttributes()
inherited_from \cHTMLSelectElement::getAttributes()

Parameters

$returnAsString

bool

Whether to return the attributes as string

Returns

arraystring

Search for the selected elements

getDefault() : string
Inherited
inherited_from \cHTMLSelectElement::getDefault()

Returns

stringbool "lvalue" or false

Returns the current ID

getID() : string
Inherited
inherited_from \cHTML::getID()
inherited_from \cHTMLFormElement::getID()
inherited_from \cHTMLSelectElement::getID()

Returns

stringcurrent ID

Removes an attribute

removeAttribute(string $attributeName) : \cHTML
Inherited
inherited_from \cHTML::removeAttribute()
inherited_from \cHTMLFormElement::removeAttribute()
inherited_from \cHTMLSelectElement::removeAttribute()

Parameters

$attributeName

string

Attribute name

Returns

\cHTML$this

Alias for toHtml

render() : string
Inherited
inherited_from \cHTML::render()
inherited_from \cHTMLFormElement::render()
inherited_from \cHTMLSelectElement::render()

Returns

stringGenerated markup

Sets the access key for this element.

setAccessKey(string $accesskey) : \cHTMLFormElement
Inherited
inherited_from \cHTMLFormElement::setAccessKey()
inherited_from \cHTMLSelectElement::setAccessKey()

Parameters

$accesskey

string

The length of the access key. May be A-Z and 0-9.

Returns

Sets the alt and title attributes

setAlt(string $alt) : \cHTML
Inherited

Sets the "alt" and "title" tags. Usually, "alt" is used for accessibility and "title" for mouse overs.

To set the text for all browsers for mouse over, set "alt" and "title". IE behaves incorrectly and shows "alt" on mouse over. Mozilla browsers only show "title" as mouse over.

inherited_from \cHTML::setAlt()
inherited_from \cHTMLFormElement::setAlt()
inherited_from \cHTMLSelectElement::setAlt()

Parameters

$alt

string

Text to set as the "alt" and "title" attribute

Returns

\cHTML$this

Sets a specific attribute

setAttribute(string $attributeName, string $value) : \cHTML
Inherited
inherited_from \cHTML::setAttribute()
inherited_from \cHTMLFormElement::setAttribute()
inherited_from \cHTMLSelectElement::setAttribute()

Parameters

$attributeName

string

Name of the attribute

$value

string

Value of the attribute

Returns

\cHTML$this

Sets the HTML attributes

setAttributes(array $attributes) : \cHTML
Inherited
inherited_from \cHTML::setAttributes()
inherited_from \cHTMLFormElement::setAttributes()
inherited_from \cHTMLSelectElement::setAttributes()

Parameters

$attributes

array

Associative array with attributes

Returns

\cHTML$this

Sets the CSS class

setClass(string $class) : \cHTML
Inherited
inherited_from \cHTML::setClass()
inherited_from \cHTMLFormElement::setClass()
inherited_from \cHTMLSelectElement::setClass()

Parameters

$class

string

Text to set as the "class" attribute

Returns

\cHTML$this

Contentless tag setter

setContentlessTag(bool $contentlessTag) : \cHTML
Inherited
inherited_from \cHTML::setContentlessTag()
inherited_from \cHTMLFormElement::setContentlessTag()
inherited_from \cHTMLSelectElement::setContentlessTag()

Parameters

$contentlessTag

bool

Returns

\cHTML$this

Sets a specific cHTMLOptionElement to the selected state.

setDefault(string $lvalue) : \cHTMLSelectElement
Inherited
inherited_from \cHTMLSelectElement::setDefault()

Parameters

$lvalue

string

Specifies the "value" of the cHTMLOptionElement to set

Returns

Sets the "disabled" attribute of an element.

setDisabled(string $disabled) : \cHTMLFormElement
Inherited

User Agents usually are showing the element as "greyed-out".

Example: $obj->setDisabled('disabled'); $obj->setDisabled('');

The first example sets the disabled flag, the second one removes the disabled flag.

inherited_from \cHTMLFormElement::setDisabled()
inherited_from \cHTMLSelectElement::setDisabled()

Parameters

$disabled

string

Sets the disabled-flag if non-empty

Returns

Adds an "on???" javascript event handler

setEvent(string $event, string $action) : \cHTML
Inherited

example: $item->setEvent('change','document.forms[0].submit');

inherited_from \cHTML::setEvent()
inherited_from \cHTMLFormElement::setEvent()
inherited_from \cHTMLSelectElement::setEvent()

Parameters

$event

string

Type of the event, e. g. "change" for "onchange"

$action

string

Function or action to call (JavaScript Code)

Returns

\cHTML$this

Setter for static $_generateXHTML property

setGenerateXHTML(bool $value) 
InheritedStatic
inherited_from \cHTML::setGenerateXHTML()
inherited_from \cHTMLFormElement::setGenerateXHTML()
inherited_from \cHTMLSelectElement::setGenerateXHTML()

Parameters

$value

bool

Sets the ID class

setID(string $id) : \cHTML
Inherited
inherited_from \cHTML::setID()
inherited_from \cHTMLFormElement::setID()
inherited_from \cHTMLSelectElement::setID()

Parameters

$id

string

Text to set as the "id"

Returns

\cHTML$this

Defines that this select element is a multiselect element.

setMultiselect() : \cHTMLSelectElement
Inherited
inherited_from \cHTMLSelectElement::setMultiselect()

Returns

Selects specified elements as selected

setSelected(array $aElements) : \none

Parameters

$aElements

array

Array with "values" of the cHTMLOptionElement to set

Returns

\none

Defines the size of this select element.

setSize($size) : \cHTMLSelectElement
Inherited
inherited_from \cHTMLSelectElement::setSize()

Parameters

$size

Returns

Sets the CSS style

setStyle(string $style) : \cHTML
Inherited
inherited_from \cHTML::setStyle()
inherited_from \cHTMLFormElement::setStyle()
inherited_from \cHTMLSelectElement::setStyle()

Parameters

$style

string

Text to set as the "style" attribute

Returns

\cHTML$this

setStyleDefinition()

setStyleDefinition(string $entity, string $definition) : \cHTML
Inherited
inherited_from \cHTML::setStyleDefinition()
inherited_from \cHTMLFormElement::setStyleDefinition()
inherited_from \cHTMLSelectElement::setStyleDefinition()

Parameters

$entity

string

Entity to define

$definition

string

Definition for the given entity

Returns

\cHTML$this

Sets the tab index for this element.

setTabindex(int $tabindex) : \cHTMLFormElement
Inherited

The tab index needs to be numeric, bigger than 0 and smaller than 32767.

inherited_from \cHTMLFormElement::setTabindex()
inherited_from \cHTMLSelectElement::setTabindex()

Parameters

$tabindex

int

Desired tab index

Returns

Sets the HTML tag to $tag

setTag(string $tag) : \cHTML
Inherited
inherited_from \cHTML::setTag()
inherited_from \cHTMLFormElement::setTag()
inherited_from \cHTMLSelectElement::setTag()

Parameters

$tag

string

The new tag

Returns

\cHTML$this

Generates the markup of the element

toHTML() : string
Inherited
inherited_from \cHTML::toHTML()
inherited_from \cHTMLFormElement::toHTML()
inherited_from \cHTMLSelectElement::toHTML()

Returns

stringGenerated markup

Renders the select box

toHtml() : string
Inherited
inherited_from \cHTMLSelectElement::toHtml()

Returns

stringRendered HTML

Removes an event handler

unsetEvent(string $event) : \cHTML
Inherited

example: $item->unsetEvent('change');

inherited_from \cHTML::unsetEvent()
inherited_from \cHTMLFormElement::unsetEvent()
inherited_from \cHTMLSelectElement::unsetEvent()

Parameters

$event

string

Type of the event

Returns

\cHTML$this

Updates the passed attribute without changing the other existing attributes

updateAttribute(string $name, string $value) : \cHTML
Inherited
inherited_from \cHTML::updateAttribute()
inherited_from \cHTMLFormElement::updateAttribute()
inherited_from \cHTMLSelectElement::updateAttribute()

Parameters

$name

string

the name of the attribute

$value

string

the value of the attribute with the given name

Returns

\cHTML$this

Updates the passed attributes without changing the other existing attributes

updateAttributes(array $attributes) : \cHTML
Inherited
inherited_from \cHTML::updateAttributes()
inherited_from \cHTMLFormElement::updateAttributes()
inherited_from \cHTMLSelectElement::updateAttributes()

Parameters

$attributes

array

Associative array with attributes

Returns

\cHTML$this

Adds the given content to the already existing content of this object.

_appendContent(string | object | array $content) : \cHTML
Inherited
inherited_from \cHTML::_appendContent()
inherited_from \cHTMLFormElement::_appendContent()
inherited_from \cHTMLSelectElement::_appendContent()

Parameters

$content

stringobjectarray

String with the content or an object to render or an array of strings/objects.

Returns

\cHTML$this

Returns an HTML formatted attribute string

_getAttrString(array $attributes) : string
Inherited
inherited_from \cHTML::_getAttrString()
inherited_from \cHTMLFormElement::_getAttrString()
inherited_from \cHTMLSelectElement::_getAttrString()

Parameters

$attributes

array

Associative array with attributes

Returns

stringAttribute string in HTML format

Returns a valid atrributes array.

_parseAttributes(array $attributes) : array
Inherited
inherited_from \cHTML::_parseAttributes()
inherited_from \cHTMLFormElement::_parseAttributes()
inherited_from \cHTMLSelectElement::_parseAttributes()

Parameters

$attributes

array

Associative array with attributes

Returns

arraythe parsed attributes

Sets the content of the object

_setContent(string | object | array $content) : \cHTML
Inherited
inherited_from \cHTML::_setContent()
inherited_from \cHTMLFormElement::_setContent()
inherited_from \cHTMLSelectElement::_setContent()

Parameters

$content

stringobjectarray

String with the content or a cHTML object to render or an array of strings / objects.

Returns

\cHTML$this

 Properties

 

$_attributes : array
Inherited
inherited_from \cHTML::$$_attributes
inherited_from \cHTMLFormElement::$$_attributes
inherited_from \cHTMLSelectElement::$$_attributes
 

$_content : string
Inherited
inherited_from \cHTML::$$_content
inherited_from \cHTMLFormElement::$$_content
inherited_from \cHTMLSelectElement::$$_content
 

$_contentlessTag : bool
Inherited
inherited_from \cHTML::$$_contentlessTag
inherited_from \cHTMLFormElement::$$_contentlessTag
inherited_from \cHTMLSelectElement::$$_contentlessTag
 

$_eventDefinitions : array
Inherited
inherited_from \cHTML::$$_eventDefinitions
inherited_from \cHTMLFormElement::$$_eventDefinitions
inherited_from \cHTMLSelectElement::$$_eventDefinitions
 

$_generateXHTML : bool
Inherited
inherited_from \cHTML::$$_generateXHTML
inherited_from \cHTMLFormElement::$$_generateXHTML
inherited_from \cHTMLSelectElement::$$_generateXHTML
 

$_idCounter : int
Inherited
inherited_from \cHTML::$$_idCounter
inherited_from \cHTMLFormElement::$$_idCounter
inherited_from \cHTMLSelectElement::$$_idCounter
 

$_options : array
Inherited
inherited_from \cHTMLSelectElement::$$_options
 

$_requiredScripts : array
Inherited
inherited_from \cHTML::$$_requiredScripts
inherited_from \cHTMLFormElement::$$_requiredScripts
inherited_from \cHTMLSelectElement::$$_requiredScripts
 

$_skeletonClose : string
Inherited
inherited_from \cHTML::$$_skeletonClose
inherited_from \cHTMLFormElement::$$_skeletonClose
inherited_from \cHTMLSelectElement::$$_skeletonClose
 

$_skeletonOpen : string
Inherited
inherited_from \cHTML::$$_skeletonOpen
inherited_from \cHTMLFormElement::$$_skeletonOpen
inherited_from \cHTMLSelectElement::$$_skeletonOpen
 

$_skeletonSingle : string
Inherited
inherited_from \cHTML::$$_skeletonSingle
inherited_from \cHTMLFormElement::$$_skeletonSingle
inherited_from \cHTMLSelectElement::$$_skeletonSingle
 

$_styleDefinitions : array
Inherited
inherited_from \cHTML::$$_styleDefinitions
inherited_from \cHTMLFormElement::$$_styleDefinitions
inherited_from \cHTMLSelectElement::$$_styleDefinitions
 

$_styleDefs : array
Inherited
inherited_from \cHTML::$$_styleDefs
inherited_from \cHTMLFormElement::$$_styleDefs
inherited_from \cHTMLSelectElement::$$_styleDefs
 

$_tag : string
Inherited
inherited_from \cHTML::$$_tag
inherited_from \cHTMLFormElement::$$_tag
inherited_from \cHTMLSelectElement::$$_tag