HTML_QuickForm_Controller
[ class tree: HTML_QuickForm_Controller ] [ index: HTML_QuickForm_Controller ] [ all elements ]

Class: HTML_QuickForm_Controller

Source Location: /main/inc/lib/pear/HTML/QuickForm/Controller.php

Class Overview


The class representing a Controller of MVC design pattern.


Author(s):

Version:

  • $Revision: 6184 $

Variables

Methods



Class Details

[line 37]
The class representing a Controller of MVC design pattern.

This class keeps track of pages and (default) action handlers for the form, it manages keeping the form values in session, setting defaults and constants for the form as a whole and getting its submit values.

Generally you don't need to subclass this.




Tags:

author:  Alexey Borzov <avb@php.net>
version:  $Revision: 6184 $


[ Top ]


Class Variables

$_actionName =  null

[line 67]

The action extracted from HTTP request: array('page', 'action')


Type:   array


[ Top ]

$_actions = array()

[line 49]

Contains the mapping of actions to corresponding HTML_QuickForm_Action objects


Type:   array


[ Top ]

$_modal =  true

[line 61]

Whether the form is modal


Type:   bool


[ Top ]

$_name =

[line 55]

Name of the form, used to store the values in session


Type:   string


[ Top ]

$_pages = array()

[line 43]

Contains the pages (HTML_QuickForm_Page objects) of the miultipage form


Type:   array


[ Top ]



Class Methods


constructor HTML_QuickForm_Controller [line 81]

HTML_QuickForm_Controller HTML_QuickForm_Controller( string $name, [bool $modal = true])

Class constructor.

Sets the form name and modal/non-modal behaviuor. Different multipage forms should have different names, as they are used to store form values in session. Modal forms allow passing to the next page only when all of the previous pages are valid.




Tags:

access:  public


Parameters:

string   $name   form name
bool   $modal   whether the form is modal

[ Top ]

method addAction [line 143]

void addAction( string $actionName, object HTML_QuickForm_Action &$action)

Registers a handler for a specific action.



Tags:

access:  public


Parameters:

string   $actionName   name of the action
object HTML_QuickForm_Action   &$action   the handler for the action

[ Top ]

method addPage [line 155]

void addPage( object HTML_QuickForm_Page &$page)

Adds a new page to the form



Tags:

access:  public


Parameters:


[ Top ]

method applyDefaults [line 439]

void applyDefaults( string $pageName)

Sets the default values for the given page



Tags:

access:  public


Parameters:

string   $pageName   Name of a page

[ Top ]

method container [line 99]

array &container( [bool $reset = false])

Returns a reference to a session variable containing the form-page values and pages' validation status.

This is a "low-level" method, use exportValues() if you want just to get the form's values.




Tags:

access:  public


Parameters:

bool   $reset   If true, then reset the container: clear all default, constant and submitted values

[ Top ]

method exportValue [line 491]

mixed exportValue( string $pageName, string $elementName)

Returns the element's value



Tags:

return:  value for the element
access:  public


Parameters:

string   $pageName   name of the page
string   $elementName   name of the element in the page

[ Top ]

method exportValues [line 458]

array exportValues( [string $pageName = null])

Returns the form's values



Tags:

access:  public


Parameters:

string   $pageName   name of the page, if not set then returns values for all pages

[ Top ]

method findInvalid [line 304]

string findInvalid( )

Finds the (first) invalid page



Tags:

return:  Name of an invalid page
access:  public


[ Top ]

method getActionName [line 323]

array getActionName( )

Extracts the names of the current page and the current action from HTTP request data.



Tags:

return:  first element is page name, second is action name
access:  public


[ Top ]

method getNextName [line 285]

string getNextName( string $pageName)

Returns the name of the page after the given.



Tags:

access:  public


Parameters:

string   $pageName  

[ Top ]

method getPage [line 169]

object HTML_QuickForm_Page &getPage( string $pageName)

Returns a page



Tags:

return:  A reference to the page
access:  public


Parameters:

string   $pageName   Name of a page

[ Top ]

method getPrevName [line 266]

string getPrevName( string $pageName)

Returns the name of the page before the given.



Tags:

access:  public


Parameters:

string   $pageName  

[ Top ]

method handle [line 189]

void handle( object HTML_QuickForm_Page &$page, string $actionName)

Handles an action.

This will be called if the page itself does not have a handler to a specific action. The method also loads and uses default handlers for common actions, if specific ones were not added.




Tags:

access:  public


Parameters:

object HTML_QuickForm_Page   &$page   The page that failed to handle the action
string   $actionName   Name of the action

[ Top ]

method isModal [line 217]

bool isModal( )

Checks whether the form is modal.



Tags:

access:  public


[ Top ]

method isValid [line 230]

bool isValid( [string $pageName = null])

Checks whether the pages of the controller are valid



Tags:

access:  public


Parameters:

string   $pageName   If set, check only the pages before (not including) that page

[ Top ]

method run [line 128]

void run( )

Processes the request.

This finds the current page, the current action and passes the action to the page's handle() method.




Tags:

access:  public


[ Top ]

method setConstants [line 372]

void setConstants( [array $constantValues = null], [mixed $filter = null])

Initializes constant form values.

These values won't get overridden by POST or GET vars




Tags:

throws:  PEAR_Error
access:  public


Parameters:

array   $constantValues   constant values
mixed   $filter   filter(s) to apply to constant values

[ Top ]

method setDefaults [line 354]

void setDefaults( [array $defaultValues = null], [mixed $filter = null])

Initializes default form values.



Tags:

throws:  PEAR_Error
access:  public


Parameters:

array   $defaultValues   default values
mixed   $filter   filter(s) to apply to default values

[ Top ]

method _arrayMapRecursive [line 419]

mixed _arrayMapRecursive( mixed $callback, mixed $value)

Recursively applies the callback function to the value



Tags:

return:  Processed values
access:  private


Parameters:

mixed   $callback   Callback function
mixed   $value   Value to process

[ Top ]

method _setDefaultsOrConstants [line 390]

void _setDefaultsOrConstants( array &$values, array $newValues, [mixed $filter = null])

Adds new values to defaults or constants array



Tags:

throws:  PEAR_Error
access:  private


Parameters:

array   &$values   array to add values to (either defaults or constants)
array   $newValues   values to add
mixed   $filter   filters to apply to new values

[ Top ]


Documentation generated on Thu, 12 Jun 2008 13:09:39 -0500 by phpDocumentor 1.4.1