From da50ad5bdb20aa8300ae5ad13b5ce9dc72383bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sun, 16 Feb 2014 14:15:09 +0100 Subject: [PATCH] FML Update --- application/core/FML/Script/Script.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/application/core/FML/Script/Script.php b/application/core/FML/Script/Script.php index 9c5d8188..b460945f 100644 --- a/application/core/FML/Script/Script.php +++ b/application/core/FML/Script/Script.php @@ -35,6 +35,7 @@ class Script { const OPTION_TOGGLE_SHOW = 'FML_Show_Toggle'; const OPTION_TOGGLE_HIDE = 'FML_Hide_Toggle'; const OPTION_PROFILE_OWN = 'FML_Own_Profile'; + const OPTION_TIME_HIDESECONDS = 'FML_HideSeconds_Time'; const OPTION_TIME_FULLDATE = 'FML_FullDate_Time'; const LABEL_ONINIT = 'OnInit'; const LABEL_LOOP = 'Loop'; @@ -396,12 +397,16 @@ class Script { * Add a Label showing the current Time * * @param Label $timeLabel The Label showing the current Time - * @param bool $showFullDate Whether to show the full Date Text + * @param bool $hideSeconds Whether the seconds should be hidden + * @param bool $showDate Whether to show the full Date Text * @return \FML\Script\Script */ - public function addTimeLabel(Label $timeLabel, $showFullDate = false) { + public function addTimeLabel(Label $timeLabel, $hideSeconds = false, $showDate = false) { $timeLabel->addClass(self::CLASS_TIME); - if ($showFullDate) { + if ($hideSeconds) { + $timeLabel->addClass(self::OPTION_TIME_HIDESECONDS); + } + if ($showDate) { $timeLabel->addClass(self::OPTION_TIME_FULLDATE); } $this->times = true; @@ -932,12 +937,16 @@ if (Event.Control.HasClass(\"" . self::CLASS_PAGEACTION . "\")) { Page.GetClassChildren(\"" . self::CLASS_TIME . "\", Page.MainFrame, True); foreach (TimeLabelControl in Page.GetClassChildren_Result) { declare TimeLabel = (TimeLabelControl as CMlLabel); - declare ShowFullDate = TimeLabel.HasClass(\"" . self::OPTION_TIME_FULLDATE . "\"); - if (ShowFullDate) { - TimeLabel.Value = CurrentLocalDateText; - } else { - TimeLabel.Value = TextLib::SubText(CurrentLocalDateText, 11, 8); + declare HideSeconds = TimeLabel.HasClass(\"" . self::OPTION_TIME_HIDESECONDS . "\"); + declare ShowDate = TimeLabel.HasClass(\"" . self::OPTION_TIME_FULLDATE . "\"); + declare TimeText = CurrentLocalDateText; + if (HideSeconds) { + TimeText = TextLib::SubText(TimeText, 0, 16); } + if (!ShowDate) { + TimeText = TextLib::SubText(TimeText, 11, 9); + } + TimeLabel.Value = TimeText; }"; $timesScript = Builder::getLabelImplementationBlock(self::LABEL_TICK, $timesScript); return $timesScript;