/** * Creates a progress bar with options choosen on all wizard tabs. * * @return object * @since 2.0.0 * @access public */ function createProgressBar() { $structure = $this->createProgressStructure(); $this->_progress->setIdent('PB1'); // indeterminate $this->_progress->setBorderPainted($structure['borderpainted']); $this->_progress->setAnimSpeed($structure['animspeed']); $this->_progress->setOrientation($structure['orientation']); $this->_progress->setFillWay($structure['fillway']); $this->_progress->setCellAttributes($structure['cell']); $this->_progress->setCellCount($structure['cellcount']); $this->_progress->setBorderAttributes($structure['border']); // string if ($structure['stringpainted']) { $labelID = $structure['string']['name']; unset($structure['string']['name']); $this->_progress->addLabel(HTML_PROGRESS2_LABEL_TEXT, $labelID); $this->_progress->setLabelAttributes($labelID, $structure['string']); } $this->_progress->setProgressAttributes($structure['progress']); // script $this->_progress->setMinimum($structure['minimum']); $this->_progress->setMaximum($structure['maximum']); $this->_progress->setIncrement($structure['increment']); return $this->_progress; }
/** * Constructor (ZE2) Summary * * o Creates a standard progress bar into a dialog box (QuickForm). * Form name, buttons 'start', 'cancel' labels and style, and * title of dialog box may also be changed. * <code> * $monitor = new HTML_Progress2_Monitor(); * </code> * * o Creates a progress bar into a dialog box, with only a new * form name. * <code> * $monitor = new HTML_Progress2_Monitor($formName); * </code> * * o Creates a progress bar into a dialog box, with a new form name, * new buttons name and style, and also a different title box. * <code> * $monitor = new HTML_Progress2_Monitor($formName, $attributes); * </code> * * @param string $formName (optional) Name of monitor dialog box (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($formName = 'ProgressMonitor', $attributes = array(), $errorPrefs = array()) { $this->_progress = new HTML_Progress2($errorPrefs); if (!is_string($formName)) { return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT, 'exception', array('var' => '$formName', 'was' => gettype($formName), '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)); } $this->_id = md5(microtime()); $this->_observerCount = 0; $this->_form = new HTML_QuickForm($formName); $this->_form->removeAttribute('name'); // XHTML compliance $captionAttr = array('id' => 'monitorStatus', 'valign' => 'bottom', 'left' => 0); $this->windowname = isset($attributes['title']) ? $attributes['title'] : 'In progress ...'; $this->buttonStart = isset($attributes['start']) ? $attributes['start'] : 'Start'; $this->buttonCancel = isset($attributes['cancel']) ? $attributes['cancel'] : 'Cancel'; $buttonAttr = isset($attributes['button']) ? $attributes['button'] : ''; $this->autorun = isset($attributes['autorun']) ? $attributes['autorun'] : false; $this->caption = isset($attributes['caption']) ? $attributes['caption'] : $captionAttr; $this->_progress->addLabel(HTML_PROGRESS2_LABEL_TEXT, $this->caption['id']); $captionAttr = $this->caption; unset($captionAttr['id']); $this->_progress->setLabelAttributes($this->caption['id'], $captionAttr); $this->_progress->setProgressAttributes('top=0 left=0'); $this->_form->addElement('header', 'windowname', $this->windowname); $this->_form->addElement('static', 'progressBar'); if ($this->isStarted()) { $style = array('disabled' => 'true'); } else { $style = null; } $buttons[] =& $this->_form->createElement('submit', 'start', $this->buttonStart, $style); $buttons[] =& $this->_form->createElement('submit', 'cancel', $this->buttonCancel); $buttons[0]->updateAttributes($buttonAttr); $buttons[1]->updateAttributes($buttonAttr); $this->_form->addGroup($buttons, 'buttons', '', ' ', false); // default embedded progress element with look-and-feel $this->setProgressElement($this->_progress); }