24 protected $set = array(
'min'=>
false,
'max'=>
false);
30 'timestamp'=>$this->
getValue(
'min') ? strtotime($this->
getValue(
'min')) : $this->cfg->defaultDate,
31 'defaultFormat'=>array(
37 'timestamp'=>$this->
getValue(
'max') ? strtotime($this->
getValue(
'max')) : $this->cfg->defaultDate+$this->cfg->defaultRange,
38 'defaultFormat'=>array(
46 public function setValue($value, $refill=
false, $key=null) {
48 if (is_array($value)) {
49 $min = array_key_exists(
'min', $value)? $value[
'min'] : (array_key_exists(0, $value)? $value[0] : null);
50 $max = array_key_exists(
'max', $value)? $value[
'max'] : (array_key_exists(1, $value)? $value[1] : null);
51 $this->
setValue($min, $refill,
'min');
52 $this->
setValue($max, $refill,
'max');
53 }
else if (!is_null($key)) {
55 $this->dates[$key]->set($value,
'formatDate',
'short2');
57 $this->dates[$key]->set($value);
58 $this->cfg->setInArray(
'rangeValue', $key, $this->dates[$key]->format());
59 $this->cfg->setInArray(
'value', $key, $value);
60 $this->
set[$key] =
true;
64 public function getValue($key=null, $mode=
'raw') {
66 if ($mode ==
'input') {
67 $ret = $this->
set[$key]? $this->dates[$key]->format(
'date',
'short2') : null;
69 $ret = $this->cfg->getInArray(
'rangeValue', $key);
71 $ret = $this->rangeValue;
76 if ($this->cfg->useJs) {
77 $this->cfg->setInArray(
'html',
'class', $this->cfg->getInArray(
'html',
'class').
' date');
79 $resp->addJs(
'jqueryui');
81 $resp->addJs(
'i18n_ui.datepicker-'.$lang);
82 $jsPrmMin = $this->cfg->jsPrm;
83 $jsPrmMax = $this->cfg->jsPrm;
85 $minId = $this->
makeId($this->name.
'[0]');
86 $maxId = $this->
makeId($this->name.
'[1]');
88 $minDate = $this->dates[
'min']->getJs(null);
89 $maxDate = $this->dates[
'max']->getJs(null);
91 $jsPrmMin[
'onSelect'] =
'function(dateText) {$("#'.$maxId.
'").datepicker("option", "minDate", $("#'.$minId.
'").datepicker("getDate"));}';
93 $jsPrmMin[
'maxDate'] = $maxDate;
94 $jsPrmMax[
'onSelect'] =
'function(dateText) {$("#'.$minId.
'").datepicker("option", "maxDate", $("#'.$maxId.
'").datepicker("getDate"));}';
96 $jsPrmMax[
'minDate'] = $minDate;
104 return parent::toHtml();
108 return '<textbox type="number" id="'.$this->name.
'" value="'.$this->value.
'" min="'.$this->min.
'" max="'.$this->max.
'" increment="'.$this->step.
'" '.
utils::htmlAttribute($this->more).
'/>';
static htmlOut($val, $key=false)
static htmlDeOut($val, $key=false)
static getHelper($className, array $cfg=array())
static htmlAttribute(array $prm)