nyroFwk  0.2
form/range/abstract.class.php
Go to the documentation of this file.
1 <?php
10 abstract class form_range_abstract extends form_abstract {
11 
12  public function toHtml() {
13  return str_replace('[name]', $this->name, sprintf($this->cfg->template,
14  utils::htmlTag($this->htmlTagName,
15  array_merge($this->html, array(
16  'name'=>$this->name.'[0]',
17  'id'=>$this->makeId($this->name.'[0]'),
18  'value'=>$this->getValue('min', 'input'),
19  ))),
20  utils::htmlTag($this->htmlTagName,
21  array_merge($this->html, array(
22  'name'=>$this->name.'[1]',
23  'id'=>$this->makeId($this->name.'[1]'),
24  'value'=>$this->getValue('max', 'input'),
25  )))
26  ));
27  }
28 
36  public function setValue($value, $refill=false, $key=null) {
37  $value = utils::htmlOut($value);
38  if (is_array($value)) {
39  $min = array_key_exists('min', $value)? $value['min'] : (array_key_exists(0, $value)? $value[0] : null);
40  $max = array_key_exists('max', $value)? $value['max'] : (array_key_exists(1, $value)? $value[1] : null);
41  $this->cfg->setInArray('rangeValue', 'min', $min);
42  $this->cfg->setInArray('rangeValue', 'max', $max);
43  $this->cfg->value = $value;
44  } else if (!is_null($key)) {
45  $this->cfg->setInArray('rangeValue', $key, $value);
46  $this->cfg->setInArray('value', $key, $value);
47  }
48  }
49 
57  public function getValue($key=null, $mode='raw') {
58  if (!is_null($key))
59  $ret = $this->cfg->getInArray('rangeValue', $key);
60  else
61  $ret = $this->rangeValue;
62  return utils::htmlDeOut($ret);
63  }
64 
65 }
static htmlOut($val, $key=false)
static htmlDeOut($val, $key=false)
static htmlTag($tag, array $attributes, $content=null)
Definition: utils.class.php:46
getValue($key=null, $mode='raw')
setValue($value, $refill=false, $key=null)
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13