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

Class: HTML_QuickForm_Controller

Source Location: /HTML_QuickForm_Controller-1.0.10/Controller.php

Class Overview


The class representing a Controller of MVC design pattern.


Author(s):

Version:

  • Release: 1.0.10

Methods


Inherited Variables

Inherited Methods


Class Details

[line 45]
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.



[ Top ]


Method Detail

HTML_QuickForm_Controller (Constructor)   [line 89]

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.

  • Access: public

Parameters:

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

[ Top ]

addAction   [line 152]

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

Registers a handler for a specific action.
  • Access: public

Parameters:

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

[ Top ]

addPage   [line 164]

void addPage( HTML_QuickForm_Page &$page)

Adds a new page to the form
  • Access: public

Parameters:

HTML_QuickForm_Page   &$page     

[ Top ]

applyDefaults   [line 460]

void applyDefaults( string $pageName)

Sets the default values for the given page
  • Access: public

Parameters:

string   $pageName     Name of a page

[ Top ]

container   [line 107]

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.

  • Access: public

Parameters:

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

[ Top ]

exportValue   [line 512]

mixed exportValue( string $pageName, string $elementName)

Returns the element's value
  • Return: value for the element
  • Access: public

Parameters:

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

[ Top ]

exportValues   [line 479]

array exportValues( [string $pageName = null])

Returns the form's values
  • Access: public

Parameters:

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

[ Top ]

findInvalid   [line 325]

string findInvalid( )

Finds the (first) invalid page
  • Return: Name of an invalid page
  • Access: public

[ Top ]

getActionName   [line 344]

array getActionName( )

Extracts the names of the current page and the current action from HTTP request data.
  • Return: first element is page name, second is action name
  • Access: public

[ Top ]

getNextName   [line 306]

string getNextName( string $pageName)

Returns the name of the page after the given.
  • Access: public

Parameters:

string   $pageName     

[ Top ]

getPage   [line 179]

HTML_QuickForm_Page &getPage( string $pageName)

Returns a page
  • Return: A reference to the page
  • Throws: PEAR_Error
  • Access: public

Parameters:

string   $pageName     Name of a page

[ Top ]

getPrevName   [line 287]

string getPrevName( string $pageName)

Returns the name of the page before the given.
  • Access: public

Parameters:

string   $pageName     

[ Top ]

handle   [line 200]

void handle( 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.

  • Throws: PEAR_Error
  • Access: public

Parameters:

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

[ Top ]

isModal   [line 228]

bool isModal( )

Checks whether the form is modal.
  • Access: public

[ Top ]

isValid   [line 242]

bool isValid( [string $pageName = null])

Checks whether the pages of the controller are valid
  • Throws: PEAR_Error
  • Access: public

Parameters:

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

[ Top ]

run   [line 137]

void run( )

Processes the request.

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

  • Throws: PEAR_Error
  • Access: public

[ Top ]

setConstants   [line 393]

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

Initializes constant form values.

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

  • Throws: PEAR_Error
  • Access: public

Parameters:

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

[ Top ]

setDefaults   [line 375]

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

Initializes default form values.
  • Throws: PEAR_Error
  • Access: public

Parameters:

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

[ Top ]


Documentation generated on Fri, 02 Oct 2009 08:30:03 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.