/** * ----------------------------------------------------------------------------- * @package smartVISU * @author Martin Gleiß and others * @copyright 2012 - 2022 * @license GPL [http://www.gnu.de] * ----------------------------------------------------------------------------- */ /** * Displays a countdown * * @param {id=} unique id for this widget (optional) * @param {item(bool,num)} an item being switched * @param {item(num)} an item containing the start time of the countdown (timestamp) * @param {item(str)} an item containing the duration of the countdown (h,i,s format) * @param {duration=10s} the countdown interval in seconds, e.g. '60s' (default: '10s') * @param {text(item,zero)=item} the mode of stopping the timer 'item' (default): countdown runs until item is changed; 'zero' = countdown stops at 00:00:00 * @param {text='--:--:--'} the text displayed when countdown is inactive (default '--:--:--') * * @author Wolfram v. Hülsen */ {% macro countdown(id, item, starttime, duration, interval, stopmode, idletxt ) %} {% if interval is empty %} {% set interval = "10s" %} {% endif %} {% if stopmode != "zero" %} {% set stopmode = "item" %} {% endif %} {% if idletxt is empty %} {% set idletxt = "--:--:--" %} {% endif %} {{ idletxt }} {% endmacro %} /** * Displays a digital clock * * @param {id} unique id for this widget * @param {text=} location for weather data (optional, no weather shown if omitted) * @param {duration=15i} the refresh interval for weather data (using relative time format), default 15i (15 minutes) * * @info based on jDigiClock by Radoslav Dimov */ {% macro digiclock(id, location, repeat) %} {% set uid = uid(page, id) %} /** stopitem will be set to "true" when new page is loaded in order to stop the clock from loading digits till eternity ;) */ /** use data-item="" in order to trigger update when page is loaded from cache or by page refresh */
{% if not location is empty %} {% endif %} {% endmacro %} /** * Displays a clock in icon style * * @param {id} unique id for this widget */ {% macro iconclock(id) %} {% import "icon.html" as icon %} {{ icon.clock(id) }} {% endmacro %} /** * Displays a mini text-based clock * * @param {id=} unique id for this widget (optional) * @param {text=} a PHP like date/time format string (optional) */ {% macro miniclock(id, format) %} {{ "now"|date('H:i') }} {% endmacro %}