SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class MultiStepFormController

Supports multistep forms

Variables

NameVisibilityDescription
$complete_function
Appendage to route, where user is redirected after save on final step
$page_title
Page title to be displayed on form steps
$route
Route to form, relative to site root
$session_key
Key for partitioning session data associated with this form, i.e. $_SESSION[$this->session_key]
$steps
Steps and functions/views used to implement them
Keys are step numbers, values are function (and matching view) names
e.g. [1 => 'intro', 2 => 'personal_details']
$table
Table into which data will be saved at the final step
$view_dir
Directory in which views are stored, without trailing slash

Functions

NameVisibilityDescription
buildUrlprotectedBuilds a URL to the form at a particular step
checkStepprotectedCheck the user has access to a step
completepublicDisplay the thanks message after the process has been completed
firstStepprotectedGets the number (should be 0 or 1) of first step of the process
formprotectedThe method used to drive the forms at each step
getSessionprotectedInstantiate the session and make sure the session key is useable
saveprotectedDo any final preparation / data massaging; then call saveData and finally redirect.
saveDataprotectedSave the data, e.g. into a database, after successful validation at the
submitprotectedThe method used to drive the form submissions at each step
validateprotected 

protected buildUrl

string $MultiStepFormController->buildUrl ( int $step [, bool $include_first ] );

Builds a URL to the form at a particular step

protected checkStep

void $MultiStepFormController->checkStep ( mixed $session , mixed $step );

Check the user has access to a step

public complete

void $MultiStepFormController->complete ( );

Display the thanks message after the process has been completed

protected firstStep

int $MultiStepFormController->firstStep ( );

Gets the number (should be 0 or 1) of first step of the process

protected form

View $MultiStepFormController->form ( [ int $step ] );

The method used to drive the forms at each step
This should be called by the entry function of the subclass controller

protected getSession

array $MultiStepFormController->getSession ( );

Instantiate the session and make sure the session key is useable

protected save

void $MultiStepFormController->save ( );

Do any final preparation / data massaging; then call saveData and finally redirect.
This should generally be overridden.

protected saveData

null|int $MultiStepFormController->saveData ( string $table , array $sub_tables , array $extra_fields );

Save the data, e.g. into a database, after successful validation at the
final step

protected submit

void $MultiStepFormController->submit ( int $step );

The method used to drive the form submissions at each step
This should be called by the submit function of the subclass controller

protected validate

void $MultiStepFormController->validate ( int &$step , array $reqd , array $rules [, Validator $valid ] );

This function does not have a description