PEAR::HTML::Progress example: Embedded ProgressBar Generator
Author: Laurent Laville

examples

# Embedded ProgressBar Generator

$Date: 2005/07/25 12:52:15 $

- Introduction
- Render options
- Ouput
- PHP source syntax highlight
- Play generator

## Introduction

This example requires :

- PEAR::HTML_Progress_Generator 1.2.0RC3 or better (see source at line 12).

Be aware that:

- HTML_Progress_Generator has dependencies (HTML_QuickForm 3.2.4+, HTML_QuickForm_Controller 1.0.4+)

This example will run a custom ProgressBar Controller Wizard integrated in your own existing pages. As other examples it will help you to create your own progress bar. You may even save the CSS and/or PHP code at end !

This example will show you how to customize all actions (display, preview, process). We will use IT template engine family, but you may use engine such as Smarty or even many others.

At line 12 is included the IT template engine ressource for default class name 'ActionDisplay'.

But we have choosen to include the generator in our own pages (itdynamic_generator.html) set at line 43.

For preview tab, we have to make it ourself. This is done on lines 46 to 57. CSS and Javascript code required for progress bar are merge into html page on lines 49 to 53.

The progress bar generated with all your options at line 47 is finally included into html page on lines 55, 56.

On lines 84 to 208, class MyProcessHandler is defined to replace default 'ActionProcess', that will help you to download the file that contents your progress bar PHP/CSS code (see option 'text/php' at line 172, rather than default 'text/plain').

Don't forget also on lines 88 to 90 code to manage action when user click on Cancel button.

And finally, the generator is create at lines 213 to 216, and run on line 218.

[Top]

## Render options

Uses defaults:

- preview Action = ActionPreview => HTML/Progress/generator/preview.php

and replace :

- Controller name = PBwizard
- display Action = MyDisplayHandler => class on lines 34 to 68
- process Action = MyProcessHandler => class on lines 84 to 208

[Top]

## Output

### Screenshot

[Top]

## PHP source syntax highlight

Open source listing in a new window.

[Top]

## Play generator

Run the script.

[Top]