Source for file DM.php
Documentation is available at DM.php
// +----------------------------------------------------------------------+
// | PEAR :: HTML :: Progress |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Laurent Laville <pear@laurent-laville.org> |
// +----------------------------------------------------------------------+
// $Id: DM.php,v 1.4 2004/07/03 14:48:14 farell Exp $
* The HTML_Progress_DM class handles any mathematical issues
* arising from assigning faulty values.
* @author Laurent Laville <pear@laurent-laville.org>
* @subpackage Progress_DM
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* The progress bar's minimum value.
* @see getMinimum(), setMinimum()
* The progress bar's maximum value.
* @see getMaximum(), setMaximum()
* The progress bar's increment value.
* @see getIncrement(), setIncrement()
* The progress bar's current value.
* @see getValue(), setvalue(), incValue()
* Package name used by PEAR_ErrorStack functions
* The data model class constructor
* o Creates a progress mathematical model with a minimum value set to 0,
* a maximum value set to 100, and a increment value set to +1.
* By default, the value is initialized to be equal to the minimum value.
* $html = new HTML_Progress_DM();
* o Creates a progress mathematical model with minimum and maximum set to
* specified values, and a increment value set to +1.
* By default, the value is initialized to be equal to the minimum value.
* $html = new HTML_Progress_DM($min, $max);
* o Creates a progress mathematical model with minimum, maximum and increment
* set to specified values.
* By default, the value is initialized to be equal to the minimum value.
* $html = new HTML_Progress_DM($min, $max, $inc);
* @throws HTML_PROGRESS_ERROR_INVALID_INPUT
$this->_package = 'HTML_Progress';
} elseif ($args[0 ] < 0 ) {
'expected' => 'positive',
} elseif ($args[0 ] > $args[1 ]) {
'expected' => 'less than $max = '. $args[1 ],
$this->_minimum = $args[0 ];
} elseif ($args[1 ] < 0 ) {
'expected' => 'positive',
$this->_maximum = $args[1 ];
/* int min, int max, int inc */
} elseif ($args[0 ] < 0 ) {
'expected' => 'positive',
} elseif ($args[0 ] > $args[1 ]) {
'expected' => 'less than $max = '. $args[1 ],
$this->_minimum = $args[0 ];
} elseif ($args[1 ] < 0 ) {
'expected' => 'positive',
$this->_maximum = $args[1 ];
} elseif ($args[2 ] < 1 ) {
'expected' => 'greater than zero',
$this->_increment = $args[2 ];
$this->_value = $this->_minimum;
* Returns the progress bar's minimum value. The default value is 0.
* @tutorial dm.getminimum.pkg
* Sets the progress bar's minimum value.
* @param integer $min progress bar's minimal value
* @throws HTML_PROGRESS_ERROR_INVALID_INPUT
* @tutorial dm.setminimum.pkg
'expected' => 'positive',
'expected' => 'less than $max = '. $this->getMaximum(),
/* set current value to minimum if less than minimum */
* Returns the progress bar's maximum value. The default value is 100.
* @tutorial dm.getmaximum.pkg
* Sets the progress bar's maximum value.
* @param integer $max progress bar's maximal value
* @throws HTML_PROGRESS_ERROR_INVALID_INPUT
* @tutorial dm.setmaximum.pkg
'expected' => 'positive',
'expected' => 'greater than $min = '. $this->getMinimum(),
/* set current value to maximum if greater to maximum */
* Returns the progress bar's increment value. The default value is +1.
* @tutorial dm.getincrement.pkg
return $this->_increment;
* Sets the progress bar's increment value.
* @param integer $inc progress bar's increment value
* @throws HTML_PROGRESS_ERROR_INVALID_INPUT
* @tutorial dm.setincrement.pkg
'expected' => 'not equal zero',
$this->_increment = $inc;
* Returns the progress bar's current value. The value is always between
* the minimum and maximum values, inclusive.
* By default, the value is initialized with the minimum value.
* @tutorial dm.getvalue.pkg
* Sets the progress bar's current value.
* If the new value is different from previous value, all change listeners
* @param integer $val progress bar's current value
* @throws HTML_PROGRESS_ERROR_INVALID_INPUT
* @tutorial dm.setvalue.pkg
'expected' => 'greater than $min = '. $this->getMinimum(),
'expected' => 'less than $max = '. $this->getMaximum(),
* Updates the progress bar's current value by adding increment value.
* @see getValue(), setValue()
* @tutorial dm.incvalue.pkg
* Returns the percent complete for the progress bar. Note that this number is
* @see getValue(), getMaximum()
* @tutorial dm.getpercentcomplete.pkg
return floatval($percent); // use for PHP 4.2+
return (float) $percent; // use for PHP 4.1.x
Documentation generated on Mon, 11 Mar 2019 13:52:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|