Public Member Functions | Public Attributes | Protected Attributes

FormContainer Class Reference

Inheritance diagram for FormContainer:

List of all members.

Public Member Functions

 append ()
 insert ()
 checksum ()
 get_values ()
 get_controls ()
 get ($forvalidation=true)
 get_theme ($forvalidation=false, $control=null)
 move ($source, $target, $offset=0)
 move_before ($control, $target)
 move_after ($control, $target)
 move_into ($control, $target)
 replace ($target, $control)
 remove ($target)
 has_user_options ()
 __get ($name)
 __isset ($name)
 pre_out ()
 validate ()
 save ()
 set_theme ($theme)
 errors_out ($format, $wrap= '%s')
 errors_get ($format, $wrap= '%s')

Public Attributes

 $name = ''
 $class = ''
 $caption = ''
 $controls = array()
 $template = 'formcontainer'
 $properties = array()

Protected Attributes

 $theme_obj = null
 $checksum

Detailed Description

FormUI Library - Create interfaces for plugins

FormUI This is the main class, it generates the form itself; FormContainer A form-related class that can contain form elements, derived by FormUI and FormControlFieldset; FormValidators Catalog of validation functions, it can be extended if needed; FormControl Parent class to controls, it contains basic functionalities overrode in each control's class; FormControl* Every control needs a FormControl* class, FormUI literally looks for example, FormControlCheckbox.

Definition at line 17 of file formui.php.


Member Function Documentation

FormContainer::__get ( name  ) 

Magic property getter, returns the specified control

Parameters:
string $name The name of the control
Returns:
FormControl The control object requested

Definition at line 329 of file formui.php.

FormContainer::__isset ( name  ) 

Magic property isset, returns if the specified control exists

Parameters:
string $name The name of the control
Returns:
bool If the control object is set

Definition at line 350 of file formui.php.

FormContainer::append (  ) 

Append a control to the end of this container

Parameters:
string $name The name of the control
string $type A classname, or the postfix of a class starting 'FormControl' that will be used to create the control
Returns:
FormControl An instance of the named FormControl descendant.

Definition at line 40 of file formui.php.

FormContainer::checksum (  ) 

Generate a hash for this container

Returns:
string An md5 hash built using the controls contained within this container

Definition at line 93 of file formui.php.

Referenced by FormUI::salted_name().

FormContainer::errors_get ( format,
wrap = '%s' 
)

Return any validation errors on any controls in this container using the supplied format $this->validate must be called first!

string $format A sprintf()-style format string to format the validation error string $format A sprintf()-style format string to wrap the returned error, only if at least one error exists

Returns:
string The errors in the supplied format

Definition at line 438 of file formui.php.

Referenced by errors_out().

FormContainer::errors_out ( format,
wrap = '%s' 
)

Output any validation errors on any controls in this container using the supplied format $this->validate must be called first!

string $format A sprintf()-style format string to format the validation error string $format A sprintf()-style format string to wrap the returned error, only if at least one error exists

Definition at line 425 of file formui.php.

FormContainer::get ( forvalidation = true  ) 

Produce HTML output for all this fieldset and all contained controls

Parameters:
boolean $forvalidation True if this control should render error information based on validation.
Returns:
string HTML that will render this control in the form

Reimplemented in FormControlTabs.

Definition at line 155 of file formui.php.

FormContainer::get_controls (  ) 

Returns an associative array of controls

Returns:
array An array of FormControls

Definition at line 135 of file formui.php.

Referenced by errors_get().

FormContainer::get_theme ( forvalidation = false,
control = null 
)

Retreive the Theme used to display the form component

Parameters:
boolean $forvalidation If true, perform validation on control and add error messages to output
FormControl $control The control to output using a template
Returns:
Theme The theme object to display the template for the control

Definition at line 179 of file formui.php.

Referenced by FormUI::get(), get(), and FormUI::output_controls().

FormContainer::get_values (  ) 

Returns an associative array of the controls' values

Returns:
array Associative array where key is control's name and value is the control's value

Definition at line 116 of file formui.php.

FormContainer::has_user_options (  ) 

Returns true if any of the controls this container contains should be stored in userinfo

Returns:
boolean True if control data should be sotred in userinfo

Definition at line 313 of file formui.php.

Referenced by FormUI::save().

FormContainer::insert (  ) 

Insert a control into the container

Parameters:
string The name of the control to insert the new control in front of
string The type of the new control
string The name of the new control
Returns:
FormControl The new control instance

Definition at line 75 of file formui.php.

FormContainer::move ( source,
target,
offset = 0 
)

Moves a control to target's position to which we add $int if specified That integer is useful to move before or move after the target

Parameters:
FormControl $control FormControl object to move
FormControl $target FormControl object acting as destination
int $int Integer added to $target's position (index)

Definition at line 220 of file formui.php.

Referenced by move_after(), and move_before().

FormContainer::move_after ( control,
target 
)

Moves a control after the target control

Parameters:
FormControl $control FormControl object to move
FormControl $target FormControl object acting as destination

Definition at line 258 of file formui.php.

Referenced by replace().

FormContainer::move_before ( control,
target 
)

Moves a control before the target control

Parameters:
FormControl $control FormControl object to move
FormControl $target FormControl object acting as destination

Definition at line 247 of file formui.php.

Referenced by insert().

FormContainer::move_into ( control,
target 
)

Move a control into the container

Parameters:
FormControl $control FormControl object to move
FormControl $target FormControl object acting as destination

Definition at line 269 of file formui.php.

FormContainer::pre_out (  ) 

Return the HTML/script required for all contained controls. Do it only once.

Returns:
string The HTML/javascript required for all contained controls.

Definition at line 371 of file formui.php.

FormContainer::remove ( target  ) 

Removes a target control from this group (can be the form or a fieldset)

Parameters:
FormControl $target FormControl to remove

Definition at line 302 of file formui.php.

FormContainer::replace ( target,
control 
)

Replaces a target control by the supplied control

Parameters:
FormControl $target FormControl object to replace
FormControl $control FormControl object to replace $target with

Definition at line 291 of file formui.php.

FormContainer::save (  ) 

Store each contained control's value under the control's specified key.

Parameters:
string $key (optional) The Options table key to store this option in

Reimplemented in FormUI.

Definition at line 401 of file formui.php.

FormContainer::set_theme ( theme  ) 

Explicitly assign the theme object to be used with this container

Parameters:
Theme $theme The theme object to use to output this container

Definition at line 413 of file formui.php.

FormContainer::validate (  ) 

Runs any attached validation functions to check validation of each control contained in this fieldset.

Returns:
array An array of string validation error descriptions or an empty array if no errors were found.

Reimplemented in FormUI.

Definition at line 385 of file formui.php.


The documentation for this class was generated from the following file: