Class FormWizard

Description

This is a magic container that allows you to chain together multiple FormContent objects to automatically create a Wizard process.

Located in /form/FormWizard.inc (line 38)

Container
   |
   --FormProcessor
      |
      --FormWizard
Direct descendents
Class Description
MyWizard This is a magic container that allows you to chain together multiple FormContent objects to automatically create a Wizard process.
Variable Summary
Method Summary
FormWizard FormWizard ()
void add_step (string $title, string $desc, string $help, FormContent &$step)
string get_wizard_id ()
value &get_wizard_variable (key $key)
boolean has_confirm ()
void render ([ $indent_level = 0], [ $output_debug = 0])
string render_confirm (int $indent_level, int $output_debug)
void set_button_class ( $class)
void set_confirm ([boolean $flag = TRUE])
void set_last_step_text ( $text)
void set_wizard_variable (key $key, value &$value)
void user_setup ()
void _build_form_tag ()
string _build_js ()
Atag &_build_step_image (string $step_num,  $step_title)
void _build_toolbar ()
void _clean ()
void _current_step ()
void _init ()
void _init_forms ()
void _init_session ()
boolean _is_step_visited (int $step_num)
void _process_form ()
void _session_test ()
void _set_current_step (int $step)
void _set_step ([ $step = null])
void _step_control ( $type,  $step)
void _step_visited (int $step_num, [boolean $visited = TRUE])
void __hidden_fields ()
Variables
mixed $_button_class = '' (line 73)

The CSS class for the buttons

mixed $_has_confirm = FALSE (line 61)

Flag to tell us to enable confirmation or not

mixed $_image_prefix (line 83)

The image path prefix.

If an image lives on the server in /images/foo/blah.jpg then this prefix should be /images/foo

mixed $_last_step_text = 'Finish' (line 68)

Last step text.

By default it is 'Finish'

mixed $_steps = array() (line 45)

This holds the array of

step objects for the wizard

mixed $_vars = array("to_step" => 0,
"num_steps" => 0,
"on_confirm" => FALSE,
WIZARD_ID => NULL )
(line 52)

Holds a bunch of state

variables

Inherited Variables

Inherited from FormProcessor

FormProcessor::$_auto_show_errors
FormProcessor::$_confirmed
FormProcessor::$_confirmed_successful
FormProcessor::$_FormValidation
FormProcessor::$_form_attributes
FormProcessor::$_form_content
FormProcessor::$_form_submit_action
FormProcessor::$_form_success_render
FormProcessor::$_has_errors
Methods
Constructor FormWizard (line 90)

The constructor

FormWizard FormWizard ()
add_step (line 407)

This adds a step to the wizard

void add_step (string $title, string $desc, string $help, FormContent &$step)
  • string $title: - the title for the step
  • string $desc: - the description for the step
  • string $help: - the help url for the step (if any)
  • FormContent &$step: - the form content object that is the step.
get_wizard_id (line 166)

Get the wizard session id

string get_wizard_id ()
get_wizard_variable (line 810)

This gets a saved wizard variable

value &get_wizard_variable (key $key)
  • key $key
has_confirm (line 156)

This gets the value of the confirmation flag.

which tells the caller that this object has/doesn't have a required confirmation page.

boolean has_confirm ()
render (line 192)

This function renders the

FormWizard

void render ([ $indent_level = 0], [ $output_debug = 0])
  • $indent_level
  • $output_debug

Redefinition of:
FormProcessor::render()
This method is called to render the form's html
render_confirm (line 336)

This function renders the confirmation page. This page sits in between the front end form, and the action handler.

This only gets called after a form and its data has been successfully validated.

  • return: - the raw html
string render_confirm (int $indent_level, int $output_debug)
  • int $indent_level: - $indent_level
  • int $output_debug: - $output_debug

Redefinition of:
FormProcessor::render_confirm()
This function renders the confirmation page. This page sits in between the front end form, and the action handler.
setup_validation (line 129)

This function is used to setup the validation object and the form errors object that is to be used by this form.

You can override this method to use a different FormErrors object for localization.

void setup_validation ()

Redefinition of:
FormProcessor::setup_validation()
This function is used to setup the validation object and the form errors object that is to be used by this form.
set_button_class (line 182)

This method sets the button CSS class

void set_button_class ( $class)
  • $class
set_confirm (line 144)

This sets the $this->_has_confirmation

flag. to let the object know it has a required confirmation page, which should get called after the validation is successfull, and before the action is handled on the back-end.

void set_confirm ([boolean $flag = TRUE])
  • boolean $flag: - the flag value TRUE/FALSE
set_last_step_text (line 175)

This method sets the text to be used for the last/final step prior to the action being taken.

void set_last_step_text ( $text)
  • $text
set_wizard_variable (line 800)

This is used to save a wizard variable associated with a particular wizard instance

void set_wizard_variable (key $key, value &$value)
  • key $key
  • value &$value
user_setup (line 391)

A subclass can override this function to setup the class variables after the constructor. The constructor automatically calls this function.

void user_setup ()

Redefined in descendants as:
_build_form_tag (line 366)

Override this so that we can place the toolbar first inside the form tag. We also have to make sure the onsubmit stuff is working properly.

void _build_form_tag ()

Redefinition of:
FormProcessor::_build_form_tag()
this function builds the FORMtag object and its attributes.
_build_js (line 527)

This builds the javascript needed for the navigation of the wizard

string _build_js ()
_build_step_image (line 673)

This function builds an image for a step #

  • return: object
Atag &_build_step_image (string $step_num,  $step_title)
  • string $step_num: - the step # to build
  • $step_title
_build_toolbar (line 555)

This renders the toolbar/step table

for the navigation of the wizard

void _build_toolbar ()
_clean (line 776)

This function cleans up the saved Session state for the wizard. This gets called when we have completed the wizard w/o errors.

void _clean ()
_current_step (line 731)

This returns the current step id

from the session

void _current_step ()
_init (line 425)

This function initializes all of the fields we need to keep track of for the internal state of the wizard. It also walks each of the step FormContent objects and initializes them.

We save some of the state of the wizard in the session.

void _init ()
_init_forms (line 447)

This is used to initialize all of the form content

children classes

void _init_forms ()
_init_session (line 712)

This method initializes the session

variable that we use

void _init_session ()
_is_step_visited (line 762)

This tests to see if the step has been visited or not.

  • return: - TRUE = visited
boolean _is_step_visited (int $step_num)
  • int $step_num: - the step to mark
_process_form (line 242)

This method does the logic of

doing the form processing

void _process_form ()

Redefinition of:
FormProcessor::_process_form()
This method does the logic of
_session_test (line 784)

This ensures that we have sessions started

void _session_test ()
_set_current_step (line 740)

This sets the current step id

void _set_current_step (int $step)
  • int $step: - the new step #
_set_step (line 463)

This function sets the _form_content object for the current step we are operating on.

The parent FormProcessor needs this object set in order to process the step correctly.

void _set_step ([ $step = null])
  • $step
_step_control (line 633)
void _step_control ( $type,  $step)
  • $type
  • $step
_step_visited (line 752)

This sets the state variable for the step to let us know it has been visited or not

void _step_visited (int $step_num, [boolean $visited = TRUE])
  • int $step_num: - the step to mark
  • boolean $visited: - TRUE = visited
__hidden_fields (line 488)
void __hidden_fields ()

Redefinition of:
FormProcessor::__hidden_fields()
This method adds the processor specific hidden fields.

Inherited Methods

Inherited From FormProcessor

FormProcessor::FormProcessor()
FormProcessor::can_validate()
FormProcessor::do_validation()
FormProcessor::get_action()
FormProcessor::get_auto_error_display()
FormProcessor::get_error_array()
FormProcessor::get_error_display_object()
FormProcessor::get_form_action()
FormProcessor::get_form_enctype()
FormProcessor::get_form_method()
FormProcessor::get_form_name()
FormProcessor::get_form_target()
FormProcessor::get_onsubmit()
FormProcessor::has_errors()
FormProcessor::is_action_successful()
FormProcessor::render()
FormProcessor::render_confirm()
FormProcessor::render_error()
FormProcessor::render_form()
FormProcessor::setup_validation()
FormProcessor::set_auto_error_display()
FormProcessor::set_form_action()
FormProcessor::set_form_attribute()
FormProcessor::set_form_enctype()
FormProcessor::set_form_method()
FormProcessor::set_form_name()
FormProcessor::set_form_target()
FormProcessor::set_onsubmit()
FormProcessor::set_render_form_after_success()
FormProcessor::_add_confirm_data()
FormProcessor::_add_hidden_fields()
FormProcessor::_build_form_tag()
FormProcessor::_build_javascript()
FormProcessor::_init_form_content()
FormProcessor::_pre_confirm()
FormProcessor::_process_action()
FormProcessor::_process_form()
FormProcessor::_set_action()
FormProcessor::_set_confirmed_success()
FormProcessor::__hidden_fields()

Inherited From Container

Container::Container()
Container::add()
Container::add_reference()
Container::count_content()
Container::get_element()
Container::get_indent_flag()
Container::push()
Container::push_reference()
Container::render()
Container::reset_content()
Container::set_collapse()
Container::set_indent_flag()

Documentation generated on Fri, 28 Jan 2011 08:53:07 -0500 by phpDocumentor 1.4.3