<?php
 namespace Engine\Form\Input; class Time extends \Engine\Form\Input\Text { protected $class = "time"; private $shortTimeFormat = ""; private $longTimeFormat = ""; public function __construct($label=null, $name=null, $value=null) { parent::__construct($label, $name, $value); $this->longTimeFormat = \dateHelper::appLongDatetimeFormat('time'); $this->shortTimeFormat = \dateHelper::appShortDatetimeFormat('time'); $this->defaultStyle['width'] = 115; } public function setValue($value) { $this->value = $value; return $this; } protected function getTemplateParams($templateClass = null, $parentElement = null) { $params = parent::getTemplateParams($templateClass, null); $params['shortTimeFormat'] = $this->shortTimeFormat; $params['longTimeFormat'] = $this->longTimeFormat; $time = ''; if($params['value']){ $ts = strtotime(TODAY_ISO." ".$params['value']); $time = date($this->shortTimeFormat, $ts); } $params['displayValue'] = $time; return $params; } } 