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.4/Controller.php

Class Overview


The class representing a Controller of MVC design pattern.


Author(s):

Version:

  • $Revision: 1.10 $

Methods


Inherited Variables

Inherited 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.

  • Author: Alexey Borzov <avb@php.net>
  • Version: $Revision: 1.10 $


[ Top ]


Method Detail

HTML_QuickForm_Controller (Constructor)   [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.

  • Access: public

Parameters:

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

[ Top ]

addAction   [line 143]

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

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

Parameters:

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

[ Top ]

addPage   [line 155]

void addPage( object HTML_QuickForm_Page &$page)

Adds a new page to the form
  • Access: public

Parameters:

object HTML_QuickForm_Page   &$page   — 

[ Top ]

applyDefaults   [line 439]

void applyDefaults( string $pageName)

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

Parameters:

string   $pageName   —  Name of a page

[ Top ]

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.

  • Access: public

Parameters:

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

[ Top ]

exportValue   [line 491]

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 458]

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 304]

string findInvalid( )

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

[ Top ]

getActionName   [line 323]

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 285]

string getNextName( string $pageName)

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

Parameters:

string   $pageName   — 

[ Top ]

getPage   [line 169]

object HTML_QuickForm_Page &getPage( string $pageName)

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

Parameters:

string   $pageName   —  Name of a page

[ Top ]

getPrevName   [line 266]

string getPrevName( string $pageName)

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

Parameters:

string   $pageName   — 

[ Top ]

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.

  • Access: public

Parameters:

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

[ Top ]

isModal   [line 217]

bool isModal( )

Checks whether the form is modal.
  • Access: public

[ Top ]

isValid   [line 230]

bool isValid( [string $pageName = null])

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

Parameters:

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

[ Top ]

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.

  • Access: public

[ Top ]

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

  • Throws: PEAR_Error
  • Access: public

Parameters:

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

[ Top ]

setDefaults   [line 354]

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 Mon, 11 Mar 2019 14:10:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.