Go to the documentation of this file.00001 <?php
00010 abstract class form_range_abstract extends form_abstract {
00011
00012 public function toHtml() {
00013 return str_replace('[name]', $this->name, sprintf($this->cfg->template,
00014 utils::htmlTag($this->htmlTagName,
00015 array_merge($this->html, array(
00016 'name'=>$this->name.'[0]',
00017 'id'=>$this->makeId($this->name.'[0]'),
00018 'value'=>$this->getValue('min', 'input'),
00019 ))),
00020 utils::htmlTag($this->htmlTagName,
00021 array_merge($this->html, array(
00022 'name'=>$this->name.'[1]',
00023 'id'=>$this->makeId($this->name.'[1]'),
00024 'value'=>$this->getValue('max', 'input'),
00025 )))
00026 ));
00027 }
00028
00036 public function setValue($value, $refill=false, $key=null) {
00037 $value = utils::htmlOut($value);
00038 if (is_array($value)) {
00039 $min = array_key_exists('min', $value)? $value['min'] : (array_key_exists(0, $value)? $value[0] : null);
00040 $max = array_key_exists('max', $value)? $value['max'] : (array_key_exists(1, $value)? $value[1] : null);
00041 $this->cfg->setInArray('rangeValue', 'min', $min);
00042 $this->cfg->setInArray('rangeValue', 'max', $max);
00043 $this->cfg->value = $value;
00044 } else if (!is_null($key)) {
00045 $this->cfg->setInArray('rangeValue', $key, $value);
00046 $this->cfg->setInArray('value', $key, $value);
00047 }
00048 }
00049
00057 public function getValue($key=null, $mode='raw') {
00058 if (!is_null($key))
00059 $ret = $this->cfg->getInArray('rangeValue', $key);
00060 else
00061 $ret = $this->rangeValue;
00062 return utils::htmlDeOut($ret);
00063 }
00064
00065 }