Docs For Class FormWizard

## Class FormWizard

Description

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

- author: Walter A. Boring IV <waboring@newsblob.com>
- todo: Finish this. It doesn't work now.

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
mixed $_button_class
mixed $_has_confirm
mixed $_image_prefix
mixed $_last_step_text
mixed $_steps
mixed $_vars
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 (mixed $indent_level, mixed $output_debug)
string render_confirm (int $indent_level, int $output_debug)
void setup_validation ()
void set_button_class (mixed $class)
void set_confirm ([boolean $flag = TRUE])
void set_last_step_text (mixed $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, mixed $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 ([mixed $step = null])
void _step_control (mixed $type, mixed $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 = '/phphtmllib/images/wizard' (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_successfull
> 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 406)

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 165)

Get the wizard session id

string get_wizard_id ()
get_wizard_variable (line 809)

This gets a saved wizard variable

value &get_wizard_variable (key $key)

- key $key

has_confirm (line 155)

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 191)

This function renders the

FormWizard

void render (mixed $indent_level, mixed $output_debug)

Redefinition of:

FormProcessor::render()
  This method is called to render the form's html

render_confirm (line 335)

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 128)

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 181)

This method sets the button CSS class

void set_button_class (mixed $class)
set_confirm (line 143)

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 174)

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

void set_last_step_text (mixed $text)
set_wizard_variable (line 799)

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 390)

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:

- MyWizard::user_setup()

_build_form_tag (line 365)

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 526)

This builds the javascript needed for the navigation of the wizard

string _build_js ()
_build_step_image (line 672)

This function builds an image for a step #

- return: object

Atag &_build_step_image (string $step_num, mixed $step_title)

- string $step_num: - the step # to build

_build_toolbar (line 554)

This renders the toolbar/step table

for the navigation of the wizard

void _build_toolbar ()
_clean (line 775)

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 730)

This returns the current step id

from the session

void _current_step ()
_init (line 424)

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 446)

This is used to initialize all of the form content

children classes

void _init_forms ()
_init_session (line 711)

This method initializes the session

variable that we use

void _init_session ()
_is_step_visited (line 761)

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 241)

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 783)

This ensures that we have sessions started

void _session_test ()
_set_current_step (line 739)

This sets the current step id

void _set_current_step (int $step)

- int $step: - the new step #

_set_step (line 462)

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 ([mixed $step = null])
_step_control (line 632)
void _step_control (mixed $type, mixed $step)
_step_visited (line 751)

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 487)
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_successfull()
> 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 Thu, 1 Sep 2005 17:06:01 -0700 by phpDocumentor 1.3.0RC3