_format = $format;
}
/**
*
* display a formatted date (w/ live clock component)
*
* @param string $date
* @param null $format
* @return string
*/
public function liveTime($date, $format = null)
{
if ($date === null) {
return 'n/a';
}
if (!is_numeric($date)) {
$date = strtotime($date);
}
if ($format === null) {
$format = $this->_format;
}
$this->_generateJavascript(
date(self::DATE_FORMAT, $date));
$format = str_replace(
array(':', '%H', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X', '%z', '%Z'), '', $format);
return strftime($format, $date)
. ' '
. '';
}
protected function _generateJavascript($dateTime)
{
/** @var \Cube\View\Helper\Script $scriptHelper */
$scriptHelper = $this->getView()->getHelper('script');
$scriptHelper->addBodyCode("");
}
}