Moodle  2.2.1
http://www.collinsharper.com
HTML_QuickForm_Renderer_Array Class Reference
Inheritance diagram for HTML_QuickForm_Renderer_Array:
Collaboration diagram for HTML_QuickForm_Renderer_Array:

Public Member Functions

 HTML_QuickForm_Renderer_Array ($collectHidden=false, $staticLabels=false)
 toArray ()
 startForm (&$form)
 renderHeader (&$header)
 renderElement (&$element, $required, $error)
 renderHidden (&$element)
 startGroup (&$group, $required, $error)
 finishGroup (&$group)
 _elementToArray (&$element, $required, $error)
 _storeArray ($elAry)
 setElementStyle ($elementName, $styleName=null)

Data Fields

 $_ary
 $_sectionCount
 $_currentSection
 $_currentGroup = null
 $_elementStyles = array()
 $_collectHidden = false
 $staticLabels = false

Detailed Description

A concrete renderer for HTML_QuickForm, makes an array of form contents

Based on old toArray() code.

The form array structure is the following: array( 'frozen' => 'whether the form is frozen', 'javascript' => 'javascript for client-side validation', 'attributes' => 'attributes for <form> tag', 'requirednote => 'note about the required elements', // if we set the option to collect hidden elements 'hidden' => 'collected html of all hidden elements', // if there were some validation errors: 'errors' => array( '1st element name' => 'Error for the 1st element', ... 'nth element name' => 'Error for the nth element' ), // if there are no headers in the form: 'elements' => array( element_1, ... element_N ) // if there are headers in the form: 'sections' => array( array( 'header' => 'Header text for the first header', 'name' => 'Header name for the first header', 'elements' => array( element_1, ... element_K1 ) ), ... array( 'header' => 'Header text for the Mth header', 'name' => 'Header name for the Mth header', 'elements' => array( element_1, ... element_KM ) ) ) );

where element_i is an array of the form: array( 'name' => 'element name', 'value' => 'element value', 'type' => 'type of the element', 'frozen' => 'whether element is frozen', 'label' => 'label for the element', 'required' => 'whether element is required', 'error' => 'error associated with the element', 'style' => 'some information about element style (e.g. for Smarty)', // if element is not a group 'html' => 'HTML for the element' // if element is a group 'separator' => 'separator for group elements', 'elements' => array( element_1, ... element_N ) );

public

Definition at line 98 of file Array.php.


Member Function Documentation

_elementToArray ( &$  element,
required,
error 
)

Creates an array representing an element

private

Parameters:
objectAn HTML_QuickForm_element object
boolWhether an element is required
stringError associated with the element
Returns:
array

Definition at line 243 of file Array.php.

Here is the caller graph for this function:

_storeArray ( elAry)

Stores an array representation of an element in the form array

private

Parameters:
arrayArray representation of an element
Returns:
void

Definition at line 289 of file Array.php.

Here is the caller graph for this function:

finishGroup ( &$  group)

Called when visiting a group, after processing all group elements

Parameters:
objectAn HTML_QuickForm_group object being visited public
Returns:
void

Reimplemented from HTML_QuickForm_Renderer.

Definition at line 227 of file Array.php.

Here is the call graph for this function:

HTML_QuickForm_Renderer_Array ( collectHidden = false,
staticLabels = false 
)

Constructor

Parameters:
booltrue: collect all hidden elements into string; false: process them as usual form elements
booltrue: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key" public

Definition at line 150 of file Array.php.

Here is the call graph for this function:

renderElement ( &$  element,
required,
error 
)

Called when visiting an element

Parameters:
objectAn HTML_QuickForm_element object being visited
boolWhether an element is required
stringAn error message associated with an element public
Returns:
void

Reimplemented from HTML_QuickForm_Renderer.

Definition at line 198 of file Array.php.

Here is the call graph for this function:

Here is the caller graph for this function:

renderHeader ( &$  header)

Called when visiting a header element

Parameters:
objectAn HTML_QuickForm_header element being visited public
Returns:
void

Reimplemented from HTML_QuickForm_Renderer.

Definition at line 188 of file Array.php.

renderHidden ( &$  element)

Called when visiting a hidden element

Parameters:
objectAn HTML_QuickForm_hidden object being visited public
Returns:
void

Reimplemented from HTML_QuickForm_Renderer.

Definition at line 208 of file Array.php.

Here is the call graph for this function:

setElementStyle ( elementName,
styleName = null 
)

Sets a style to use for element rendering

Parameters:
mixedelement name or array ('element name' => 'style name')
stringstyle name if $elementName is not an array public
Returns:
void

Definition at line 310 of file Array.php.

startForm ( &$  form)

Called when visiting a form, before processing any form elements

Parameters:
objectAn HTML_QuickForm object being visited public
Returns:
void

Reimplemented from HTML_QuickForm_Renderer.

Definition at line 170 of file Array.php.

startGroup ( &$  group,
required,
error 
)

Called when visiting a group, before processing any group elements

Parameters:
objectAn HTML_QuickForm_group object being visited
boolWhether a group is required
stringAn error message associated with a group public
Returns:
void

Reimplemented from HTML_QuickForm_Renderer.

Definition at line 218 of file Array.php.

Here is the call graph for this function:

toArray ( )

Returns the resultant array

public

Returns:
array

Definition at line 164 of file Array.php.


Field Documentation

$_ary

Definition at line 104 of file Array.php.

$_collectHidden = false

Definition at line 134 of file Array.php.

$_currentGroup = null

Definition at line 122 of file Array.php.

$_currentSection

Definition at line 116 of file Array.php.

$_elementStyles = array()

Definition at line 128 of file Array.php.

$_sectionCount

Definition at line 110 of file Array.php.

$staticLabels = false

Definition at line 141 of file Array.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations