9 * @author Christian Weiske <cweiske@cweiske.de>
10 * @copyright 2014 Christian Weiske
11 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
12 * @link http://cweiske.de/bdrem.htm
21 * @author Christian Weiske <cweiske@cweiske.de>
22 * @copyright 2014 Christian Weiske
23 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
24 * @version Release: @package_version@
25 * @link http://cweiske.de/bdrem.htm
27 abstract class Renderer
30 * HTTP content type of output
33 protected $httpContentType = null;
36 * Call the renderer and output the rendering result to shell or browser
38 * @param array $arEvents Event objects to render
42 public function renderAndOutput($arEvents)
44 if (PHP_SAPI != 'cli' && $this->httpContentType !== null) {
45 header('Content-type: ' . $this->httpContentType);
47 echo $this->render($arEvents);
51 * Do something when there are no events to render
55 public function handleStopOnEmpty()
60 * Display the events in some way
62 * @param array $arEvents Events to display
64 * @return string Event representation
66 abstract public function render($arEvents);
69 * Converts the given date string according to the user's locale setting.
71 * @param string $dateStr Date in format YYYY-MM-DD
73 * @return string Formatted date
75 protected function getLocalDate($dateStr)
77 if ($dateStr{0} != '?') {
78 return strftime('%x', strtotime($dateStr));
81 $dateStr = str_replace('????', '1899', $dateStr);
85 strftime('%x', strtotime($dateStr))