_appendName = true;
}
/**
* HTML code to display this datepicker
* @return string
*/
public function toHtml()
{
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
$id = $this->getAttribute('id');
$value = $this->getValue();
if (!empty($value)) {
$value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
}
return '
' . $this->getElementJS();
}
/**
* @param string $value
*/
public function setValue($value)
{
$value = substr($value, 0, 16);
$this->updateAttributes(
array(
'value'=>$value
)
);
}
/**
* Get the necessary javascript for this datepicker
* @return string
*/
private function getElementJS()
{
$js = null;
$id = $this->getAttribute('id');
//timeFormat: 'hh:mm'
$js .= "";
return $js;
}
/**
* @param string $layout
*
* @return string
*/
public function getTemplate($layout)
{
$size = $this->getColumnsSize();
$id = $this->getAttribute('id');
$value = $this->getValue();
if (empty($size)) {
$sizeTemp = $this->getInputSize();
if (empty($size)) {
$sizeTemp = 8;
}
$size = array(2, $sizeTemp, 2);
} else {
if (is_array($size)) {
if (count($size) != 3) {
$sizeTemp = $this->getInputSize();
if (empty($size)) {
$sizeTemp = 8;
}
$size = array(2, $sizeTemp, 2);
}
// else just keep the $size array as received
} else {
$size = array(2, intval($size), 2);
}
}
if (!empty($value)) {
$value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
}
switch ($layout) {
case FormValidator::LAYOUT_INLINE:
return '
{element}
';
break;
case FormValidator::LAYOUT_HORIZONTAL:
return '
';
break;
case FormValidator::LAYOUT_BOX_NO_LABEL:
return '{element}';
break;
}
}
}