'en', 'format' => 'MdY', 'minYear' => 2001, 'maxYear' => 2010, 'addEmptyOption' => false, 'emptyOptionValue' => '', 'emptyOptionText' => ' ', 'optionIncrement' => array('i' => 1, 's' => 1) ); function HTML_QuickForm_calendar($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { parent::HTML_QuickForm_date($elementName, $elementLabel, $options, $attributes); if(!isset($options['maxYear'])) $this->_options['maxYear'] = (int)date("Y") + 2; } function setValue($dateTime) { if (is_null($dateTime)) { return null; } if ( !is_array($dateTime) && intval($dateTime) < 70000 ){ list($date, $time) = explode(' ', $dateTime); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $sec) = explode(':', $time); // vdie($hour , $minute, $sec, $month, $day, $year); $dateTime = mktime((int)$hour , (int)$minute, (int)$sec, (int)$month, (int)$day, (int)$year); // $dateTime = array( // 'd' => $day, // 'M' => $month, // 'F' => $month, // 'm' => $month, // 'Y' => $year, // 'y' => $year, // // ); // calendar_setSelValue(name+"[D]", DateObj.getDay() ); // calendar_setSelValue(name+"[l]", DateObj.getDay() ); // calendar_setSelValue(name+"[d]", DateObj.getDate() ); // calendar_setSelValue(name+"[M]", DateObj.getMonth()+1 ); // calendar_setSelValue(name+"[F]", DateObj.getMonth()+1 ); // calendar_setSelValue(name+"[m]", DateObj.getMonth()+1 ); // // calendar_setSelValue(name+"[Y]", year ); // calendar_setSelValue(name+"[y]", year ); } return parent::setValue($dateTime); } function toHtml() { static $jsShown; $suffix = '______'; $valName = $this->getName().$suffix; $html = parent::toHtml(); if (!$this->_flagFrozen) { $html .= ''; $valArr = $this->getValue(); $val = Form::createElement('hidden', $valName); $val->setValue( $valArr['M'].'/'.$valArr['d'].'/'.$valArr['Y']); $html .= $val->toHtml(); if (!isset($jsShown)){ $html .= ' '; } } $jsShown = true; return $html; } } ?>