imars.com - Stéphane Lavergne's web site
Go to site navigation

Wizard

Useful superclass for creating multiple step wizards.

Summary

Introduction

Legal

Copyright (C) 2006 Stephane Lavergne http://www.imars.com/

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Description

To use it, create a subclass and define steps and optionally titles in its constructor. Then, have your program instantiate your class and call Display() on it.

TODO

Make use of altgettext. Right now, we're hard-coded in English.

Requires

$_REQUEST, $PHP_SELF

Properties

steps

Array of methods to call in sequence. The first method name is invoked at step 1, the second at step 2, etc. You may display any form fields you wish at each step, but remember that the form block itself is opened before your method gets called, and closed afterwards. Multiple forms are not possible.

titles

Array of titles for each step. If defined, its contents is used to display a title besides the “Step X of Y” heading.

Methods

Wizard

function Wizard()

In your own constructor, be sure to define the steps array, and optionally the titles array.

Display

function Display()

Actually perform a step basd on $_REQUEST parameters.

Post a comment:

(not displayed, optional)

(optional)

Don't write in these two boxes:

(URLs will become hyperlinks, please omit "http://".)

Site navigation