From 6f729beebdb1e9993d3afb0a492680194c39d342 Mon Sep 17 00:00:00 2001 From: Oldperl <44996956+oldperl@users.noreply.github.com> Date: Wed, 16 Nov 2011 16:45:21 +0000 Subject: [PATCH] final version 1.0 --- output.php | 113 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 105 insertions(+), 8 deletions(-) diff --git a/output.php b/output.php index ef85d08..05e6233 100644 --- a/output.php +++ b/output.php @@ -13,9 +13,8 @@ * $Id$ */ - $cfgMod = array( - 'debug' => false + 'debug' => true ); // init db-object @@ -30,15 +29,113 @@ if (!is_object($oTpl)) { $oTpl->reset(); // init debugger -cInclude('classes', 'Debug/DebuggerFactory.class.php'); -/* @var $oDebug Debug_VisibleAdv */ -$oDebug = DebuggerFactory::getDebugger('visible_adv'); +if ($cfgMod['debug']) { + cInclude('classes', 'Debug/DebuggerFactory.class.php'); + /* @var $oDebug Debug_VisibleAdv */ + $oDebug = DebuggerFactory::getDebugger('visible_adv'); +} +$oToday = new DateTime(); +if ($cfgMod['debug']) { + if(isset($_GET['dateoffset'])) { + $oToday->modify($_GET['dateoffset']." days"); + } +} + +$oXmasDate = new DateTime(date("Y")."-12-24 23:59:59"); +$oXmasMondayDate = clone $oXmasDate; +$oXmasMondayDate->modify("+2 days"); + +$oFirstAdventDate = new DateTime(date("Y")."-11-26"); +$oFirstAdventDate->modify("next sunday"); + +$oSecondAdvent = clone $oFirstAdventDate; +$oSecondAdvent->modify("+7 days"); + +$oThirdAdvent = clone $oSecondAdvent; +$oThirdAdvent->modify("+7 days"); + +$oFourthAdvent = clone $oThirdAdvent; +$oFourthAdvent->modify("+7 days"); + +if($oToday <= $oXmasMondayDate && $oToday >= $oFirstAdventDate) { + $sImgPath = $cfgClient[$client]['images']."adventskranz/Extra/"; + + if($oToday >= $oFirstAdventDate && $oToday < $oSecondAdvent) { + $sImgPath .= "advent1.gif"; + } else if($oToday >= $oSecondAdvent && $oToday < $oThirdAdvent) { + $sImgPath .= "advent2.gif"; + } else if ($oToday >= $oThirdAdvent && $oToday < $oFourthAdvent) { + $sImgPath .= "advent3.gif"; + } else { + $sImgPath .= "advent4.gif"; + } + + echo '
';
+ // countdown till xmas
+ $iDaysTillmas = (int) daysdiff( $oXmasDate->format("Y-m-d"), $oToday->format("Y-m-d"));
+ if($iDaysTillmas > 1) {
+ printf(mi18n("Noch %s Tage bis Weihnachten"), $iDaysTillmas);
+ } else if($iDaysTillmas == 1) {
+ printf(mi18n("Noch %s Tag bis Weihnachten"), $iDaysTillmas);
+ } else if($iDaysTillmas === 0) {
+ echo mi18n("Frohe Weihnacht!
(Heiliger Abend)");
+ } else {
+ echo mi18n("Frohe Weihnacht!");
+ }
+ echo "