-
<?php
-
require_once 'HTML/Progress2/Generator.php';
-
require_once 'HTML/Progress2/Generator/HTMLPage2.php';
-
require_once 'HTML/Progress2/Generator/Process.php';
-
-
class MyProcessHandler extends ActionProcess
-
{
-
function
perform(&$page, $actionName)
-
{
-
if
($actionName ==
'cancel')
{
-
echo '<h1>Progress2
Generator Demonstration is
Over</h1>';
-
echo '<p>Hope
you\'ve enjoyed. See you
later!</p>';
-
}
else {
-
// Checks whether the pages of the controller are
valid
-
$page->isFormBuilt() or $page->buildForm();
-
$page->controller->isValid();
-
-
// what kind of source code is requested
-
$code = $page->exportValue('phpcss');
-
$pb = $page->controller->createProgressBar();
-
-
$phpCode = (isset($code['P']) === true);
-
$cssCode = (isset($code['C']) === true);
-
-
if ($cssCode &&
!$phpCode) {
-
$strCSS =
$this->sprintCSS($pb);
-
$this->exportOutput($strCSS, 'text/css');
-
}
-
if ($phpCode) {
-
$strPHP =
$this->sprintPHP($pb, $cssCode);
-
$this->exportOutput($strPHP, 'text/php');
-
}
-
-
// reset session data
-
$page->controller->container(true);
-
}
-
}
-
}
-
-
session_start();
-
-
$tabbed =& HTML_Progress2_Generator::singleton();
-
-
$tabbed->addActions(array('dump' =>
'ActionDump', 'process'
=> 'MyProcessHandler'));
-
-
$pear =
'c:\php4';
-
$css = $pear . '\pear\data\HTML_Progress2\smartydynamic.css';
-
$tabbed->addAction('display', new ActionDisplay($css));
-
-
$tabbed->run();
-
?>