Beispiel #1
0
 /**
  * Constructor (ZE2) Summary
  *
  * o Creates a standard progress bar generator wizard.
  *   <code>
  *   $generator = new HTML_Progress2_Generator();
  *   </code>
  *
  * o Creates a progress bar generator wizard with
  *   customized actions: progress bar preview, form rendering, buttons manager
  *   <code>
  *   $controllerName = 'myPrivateGenerator';
  *   $attributes = array(
  *        'preview' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionPreview', see 'HTML/Progress2/Generator/Preview.php')
  *        'display' => name of a HTML_QuickForm_Action_Display instance
  *                     (default 'ActionDisplay', see 'HTML/Progress2/Generator/Default.php')
  *        'process' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionProcess', see 'HTML/Progress2/Generator/Process.php')
  *   );
  *   $generator = new HTML_Progress2_Generator($controllerName, $attributes);
  *   </code>
  *
  * @param      string    $controllerName(optional) Name of generator wizard (QuickForm)
  * @param      array     $attributes    (optional) List of renderer options
  * @param      array     $errorPrefs    (optional) Hash of params to configure error handler
  *
  * @since      2.0.0
  * @access     protected
  * @throws     HTML_PROGRESS2_ERROR_INVALID_INPUT
  */
 function __construct($controllerName = 'ProgressGenerator', $attributes = array(), $errorPrefs = array())
 {
     $this->_progress = new HTML_Progress2($errorPrefs, HTML_PROGRESS2_BAR_HORIZONTAL, 0, 100);
     if (!is_string($controllerName)) {
         return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT, 'exception', array('var' => '$controllerName', 'was' => gettype($controllerName), 'expected' => 'string', 'paramnum' => 1));
     } elseif (!is_array($attributes)) {
         return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array', 'paramnum' => 2));
     }
     // build a new modal controller
     parent::HTML_QuickForm_Controller($controllerName, true);
     // add all wizard default pages
     $this->addPages();
     // add all wizard default actions
     $this->addActions($attributes);
     // set ProgressBar default values on first run
     $sess =& $this->container();
     if (count($sess['defaults']) == 0) {
         $this->setDefaults(array('shape' => HTML_PROGRESS2_BAR_HORIZONTAL, 'way' => 'natural', 'autosize' => true, 'progresssize' => array('left' => 10, 'top' => 25, 'position' => 'relative', 'bgcolor' => '#FFFFFF'), 'rAnimSpeed' => 100, 'borderpainted' => false, 'borderclass' => 'progressBorder%s', 'borderstyle' => array('style' => 'solid', 'width' => 0, 'color' => '#000000'), 'cellid' => 'pcel%01s', 'cellclass' => 'cell%s', 'cellvalue' => array('min' => 0, 'max' => 100, 'inc' => 1), 'cellsize' => array('width' => 15, 'height' => 20, 'spacing' => 2, 'count' => 10), 'cellcolor' => array('active' => '#006600', 'inactive' => '#CCCCCC', 'bgcolor' => '#FFFFFF'), 'cellfont' => array('family' => 'Courier, Verdana', 'size' => 8, 'color' => '#000000'), 'stringpainted' => false, 'stringid' => 'txt1', 'stringclass' => 'progressTextLabel%s', 'stringvalue' => 'something to display', 'stringsize' => array('left' => 5, 'top' => 5), 'stringvalign' => 'top', 'stringalign' => 'left', 'stringfont' => array('family' => 'Verdana, Tahoma, Arial', 'size' => 11, 'color' => '#000000'), 'stringweight' => 'normal', 'phpcss' => array('P' => true)));
     }
 }
Beispiel #2
0
 /**
  * Constructor Summary
  *
  * o Creates a standard progress bar generator wizard.
  *   <code>
  *   $generator = new HTML_Progress_Generator();
  *   </code>
  *
  * o Creates a progress bar generator wizard with
  *   customized actions: progress bar preview, form rendering, buttons manager
  *   <code>
  *   $controllerName = 'myPrivateGenerator';
  *   $attributes = array(
  *        'preview' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionPreview', see 'HTML/Progress/generator/preview.php')
  *        'display' => name of a HTML_QuickForm_Action_Display instance
  *                     (default 'ActionDisplay', see 'HTML/Progress/generator/default.php')
  *        'process' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionProcess', see 'HTML/Progress/generator/process.php')
  *   );
  *   $generator = new HTML_Progress_Generator($controllerName, $attributes);
  *   </code>
  *
  * @param      string    $controllerName(optional) Name of generator wizard (QuickForm)
  * @param      array     $attributes    (optional) List of renderer options
  * @param      array     $errorPrefs    (optional) Hash of params to configure error handler
  *
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  */
 function HTML_Progress_Generator($controllerName = 'ProgressGenerator', $attributes = array(), $errorPrefs = array())
 {
     $this->_progress = new HTML_Progress($errorPrefs);
     if (!is_string($controllerName)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$controllerName', 'was' => gettype($controllerName), 'expected' => 'string', 'paramnum' => 1));
     } elseif (!is_array($attributes)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array', 'paramnum' => 2));
     }
     parent::HTML_QuickForm_Controller($controllerName);
     // Check if Action(s) are customized
     $ActionPreview = isset($attributes['preview']) ? $attributes['preview'] : 'ActionPreview';
     $ActionDisplay = isset($attributes['display']) ? $attributes['display'] : 'ActionDisplay';
     $ActionProcess = isset($attributes['process']) ? $attributes['process'] : 'ActionProcess';
     $this->_tabs = array(0 => array('page1', 'Property1', 'Progress'), 1 => array('page2', 'Property2', 'Cell'), 2 => array('page3', 'Property3', 'Border'), 3 => array('page4', 'Property4', 'String'), 4 => array('page5', 'Preview', 'Preview'), 5 => array('page6', 'Save', 'Save'));
     foreach ($this->_tabs as $tab) {
         list($pageName, $className, $tabName) = $tab;
         // Add each tab of the wizard
         $this->addPage(new $className($pageName));
         // These actions manage going directly to the pages with the same name
         $this->addAction($pageName, new HTML_QuickForm_Action_Direct());
     }
     $preview = $this->getPage('page5');
     // The customized actions
     if (!class_exists($ActionPreview)) {
         include_once 'HTML/Progress/generator/preview.php';
         $ActionPreview = 'ActionPreview';
     }
     if (!class_exists($ActionDisplay)) {
         include_once 'HTML/Progress/generator/default.php';
         $ActionDisplay = 'ActionDisplay';
     }
     if (!class_exists($ActionProcess)) {
         include_once 'HTML/Progress/generator/process.php';
         $ActionProcess = 'ActionProcess';
     }
     $preview->addAction('apply', new $ActionPreview());
     $this->addAction('display', new $ActionDisplay());
     $this->addAction('process', new $ActionProcess());
     $this->addAction('cancel', new $ActionProcess());
     // set ProgressBar default values on first run
     $sess = $this->container();
     $defaults = $sess['defaults'];
     if (count($sess['defaults']) == 0) {
         $this->setDefaults(array('progressclass' => 'progressBar', 'shape' => HTML_PROGRESS_BAR_HORIZONTAL, 'way' => 'natural', 'autosize' => true, 'progresssize' => array('bgcolor' => '#FFFFFF'), 'rAnimSpeed' => 100, 'borderpainted' => false, 'borderclass' => 'progressBarBorder', 'borderstyle' => array('style' => 'solid', 'width' => 0, 'color' => '#000000'), 'cellid' => 'progressCell%01s', 'cellclass' => 'cell', 'cellvalue' => array('min' => 0, 'max' => 100, 'inc' => 1), 'cellsize' => array('width' => 15, 'height' => 20, 'spacing' => 2, 'count' => 10), 'cellcolor' => array('active' => '#006600', 'inactive' => '#CCCCCC'), 'cellfont' => array('family' => 'Courier, Verdana', 'size' => 8, 'color' => '#000000'), 'stringpainted' => false, 'stringid' => 'installationProgress', 'stringsize' => array('width' => 50, 'height' => '', 'bgcolor' => '#FFFFFF'), 'stringvalign' => 'right', 'stringalign' => 'right', 'stringfont' => array('family' => 'Verdana, Arial, Helvetica, sans-serif', 'size' => 12, 'color' => '#000000'), 'strings' => implode(";\n", array(0 => '10,Hello world', 1 => '20,Welcome', 2 => '30,to', 3 => '40,HTML_Progress v1', 4 => '60,by', 5 => '70,Laurent Laville', 6 => '100,Have a nice day !')), 'phpcss' => array('P' => true)));
     }
 }
Beispiel #3
0
 /**
  * Constructor (ZE2) Summary
  *
  * o Creates a standard progress bar generator wizard.
  *   <code>
  *   $generator = new HTML_Progress2_Generator();
  *   </code>
  *
  * o Creates a progress bar generator wizard with
  *   customized actions: progress bar preview, form rendering, buttons manager
  *   <code>
  *   $controllerName = 'myPrivateGenerator';
  *   $attributes = array(
  *        'preview' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionPreview', see 'HTML/Progress2/Generator/Preview.php')
  *        'display' => name of a HTML_QuickForm_Action_Display instance
  *                     (default 'ActionDisplay', see 'HTML/Progress2/Generator/Default.php')
  *        'process' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionProcess', see 'HTML/Progress2/Generator/Process.php')
  *   );
  *   $generator = new HTML_Progress2_Generator($controllerName, $attributes);
  *   </code>
  *
  * @param      string    $controllerName(optional) Name of generator wizard (QuickForm)
  * @param      array     $attributes    (optional) List of renderer options
  * @param      array     $errorPrefs    (optional) Hash of params to configure error handler
  *
  * @since      2.0.0
  * @access     protected
  * @throws     HTML_PROGRESS2_ERROR_INVALID_INPUT
  */
 function __construct($controllerName = 'ProgressGenerator', $attributes = array(), $errorPrefs = array())
 {
     $this->_progress = new HTML_Progress2($errorPrefs, HTML_PROGRESS2_BAR_HORIZONTAL, 0, 100);
     if (!is_string($controllerName)) {
         return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT, 'exception', array('var' => '$controllerName', 'was' => gettype($controllerName), 'expected' => 'string', 'paramnum' => 1));
     } elseif (!is_array($attributes)) {
         return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array', 'paramnum' => 2));
     }
     parent::HTML_QuickForm_Controller($controllerName);
     // Check if Action(s) are customized
     $ActionPreview = isset($attributes['preview']) ? $attributes['preview'] : 'ActionPreview';
     $ActionDisplay = isset($attributes['display']) ? $attributes['display'] : 'ActionDisplay';
     $ActionProcess = isset($attributes['process']) ? $attributes['process'] : 'ActionProcess';
     $this->_tabs = array(0 => array('page1', 'Property1', 'Progress'), 1 => array('page2', 'Property2', 'Cell'), 2 => array('page3', 'Property3', 'Border'), 3 => array('page4', 'Property4', 'String'), 4 => array('page5', 'Preview', 'Preview'), 5 => array('page6', 'Save', 'Save'));
     foreach ($this->_tabs as $tab) {
         list($pageName, $className, $tabName) = $tab;
         // Add each tab of the wizard
         $this->addPage(new $className($pageName));
         // These actions manage going directly to the pages with the same name
         $this->addAction($pageName, new HTML_QuickForm_Action_Direct());
     }
     $preview =& $this->getPage('page5');
     // The customized actions
     if (!class_exists($ActionPreview)) {
         include_once 'HTML/Progress2/Generator/Preview.php';
         $ActionPreview = 'ActionPreview';
     }
     if (!class_exists($ActionDisplay)) {
         include_once 'HTML/Progress2/Generator/Default.php';
         $ActionDisplay = 'ActionDisplay';
     }
     if (!class_exists($ActionProcess)) {
         include_once 'HTML/Progress2/Generator/Process.php';
         $ActionProcess = 'ActionProcess';
     }
     $preview->addAction('apply', new $ActionPreview());
     $this->addAction('display', new $ActionDisplay());
     $this->addAction('process', new $ActionProcess());
     $this->addAction('cancel', new $ActionProcess());
     // set ProgressBar default values on first run
     $sess = $this->container();
     $defaults = $sess['defaults'];
     if (count($sess['defaults']) == 0) {
         $this->setDefaults(array('shape' => HTML_PROGRESS2_BAR_HORIZONTAL, 'way' => 'natural', 'autosize' => true, 'progresssize' => array('left' => 10, 'top' => 25, 'position' => 'relative', 'bgcolor' => '#FFFFFF'), 'rAnimSpeed' => 100, 'borderpainted' => false, 'borderclass' => 'progressBorder%s', 'borderstyle' => array('style' => 'solid', 'width' => 0, 'color' => '#000000'), 'cellid' => 'pcel%01s', 'cellclass' => 'cell%s', 'cellvalue' => array('min' => 0, 'max' => 100, 'inc' => 1), 'cellsize' => array('width' => 15, 'height' => 20, 'spacing' => 2, 'count' => 10), 'cellcolor' => array('active' => '#006600', 'inactive' => '#CCCCCC', 'bgcolor' => '#FFFFFF'), 'cellfont' => array('family' => 'Courier, Verdana', 'size' => 8, 'color' => '#000000'), 'stringpainted' => false, 'stringid' => 'txt1', 'stringclass' => 'progressTextLabel%s', 'stringvalue' => 'something to display', 'stringsize' => array('left' => 5, 'top' => 5), 'stringvalign' => 'top', 'stringalign' => 'left', 'stringfont' => array('family' => 'Verdana, Tahoma, Arial', 'size' => 11, 'color' => '#000000'), 'stringweight' => 'normal', 'phpcss' => array('P' => true)));
     }
 }