ktk_mediaserve/modules/Clock.php

25 lines
629 B
PHP

<?php
namespace ktk\MediaServe;
class Clock {
static private $time = "";
static function onInit() {
if (!MediaServe::getData('time_format')) {
MediaServe::storeData('time_format', 'H:i:s');
}
}
static function onProcess() {
self::$time = date(MediaServe::getData('time_format'));
}
static function onRender() {
echo '<div id="ktk_MediaServe_Clock">'.PHP_EOL;
echo self::$time.PHP_EOL;
echo '<a href="?m=Clock&c=changeTime&p=g:i:s a">12-hour</a>'.PHP_EOL;
echo '</div>'.PHP_EOL;
}
static function changeTime($format) {
MediaServe::storeData('time_format', $format);
}
}
?>