\seekquarry\yioop\views\helpersOptionsHelper

This is a helper class is used to handle draw select options form elements

Helpers are classes used to reduce the coding required in Views. They do some computation with the data they are supplied and output HTML/XML

Summary

Methods
Properties
Constants
__construct()
render()
renderLinkDropDown()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() 

The constructor at this point does nothing

render()

render(string  $id, string  $name, array  $options, string  $selected, mixed  $onchange_action = false, array  $additional_attributes = array()) 

Draws an HTML select tag according to the supplied parameters

Parameters

string $id

the id attribute the select tag should have If empty string id attribute not echo'd

string $name

the name this form element should use If empty string name attribute not echo'd

array $options

an array of key value pairs for the options tags of this select element. The key is used as an option tag's value and the value being used as its contents. If the value is empty in a key value pair then the key is taken as the label of a new optgroup.

string $selected

which option (note singular -- no support for selecting more than one) should be set as selected in the select tag

mixed $onchange_action

if true then submit the parent form if this drop down is changed, if false, normal dropdown, if a callback function, then when change call callback

array $additional_attributes

associative array of attributes => values to add to the open select tag if present

renderLinkDropDown()

renderLinkDropDown(string  $id, array  $options, string  $selected, string  $url_prefix, boolean  $as_list = false) 

Creates a dropdown where selecting an item redirects to a given url.

Parameters

string $id

the id attribute the select tag should have If empty string id attribute not echo'd

array $options

an array of key value pairs for the options tags of this select element. The key is used as an option tag's value and the value being used as its contents. If the value is empty in a key value pair then the key is taken as the label of a new optgroup.

string $selected

which url should be selected in dropdown

string $url_prefix

keys in $options should correspond to urls. if such a key doesn't begin with http, it is assumed to be a url suffix and the value $url_prefix is put before it to get a complete url before the window location is changed.

boolean $as_list

whether to output the result as a dropdown or as an unordered list.