* @copyright 2004 by http://wombat.exit0.net * @package wombatSite * @subpackage formDatasource */ /** * Generate custom ranges to be used in forms * * More preciecely this class is just an interface for the php-function * range (@see range()) * * * @version 0.1 * @package wombatSite * @subpackage formDatasource * @see range() */ class wbFormDatasource_Range extends wbFormDatasource { /** * default values of used attributes * @access private * @var array $_atts */ var $_atts = array( 'low' => 0, 'high' => 9, 'step' => 1, 'format' => '%d' ); /** * implement this method * * @access private * @param integer $id * @return boolean $result true on success * @see */ function getValues() { $range = range( $this->_atts['low'], $this->_atts['high'] ); $values = array(); for( $i = 0; $i < count( $range ); ++$i ) { if( $i % $this->_atts['step'] ) { continue; } array_push( $values, array( 'value' => $range[$i], 'label' => sprintf( $this->_atts['format'], $range[$i] ) ) ); } return $values; } } ?>