diff --git a/app/Helpers/DateHelper.php b/app/Helpers/DateHelper.php index ca04f6ac..3578154e 100644 --- a/app/Helpers/DateHelper.php +++ b/app/Helpers/DateHelper.php @@ -13,184 +13,184 @@ use \Carbon\Carbon; class DateHelper { - static function toCal($timestamp, $addHours = 0) - { - $timestamp = strtotime($timestamp); - // Sommerzeit berücksichtigen - if(date("I", $timestamp)) - { - $timestamp = $timestamp - 1 * 3600; - } - - // Zeittone berücksichtigen GMT +1 - $timestamp = $timestamp - 1 * 3600; - - $timestamp = Carbon::createFromTimestamp($timestamp); - if($addHours > 0) - { - $timestamp->addHours($addHours); - } - - return $timestamp->format('Ymd\THis\Z'); - } - - static function toHumanDate($timestamp) - { - $timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp); - - return $timestamp->format('d.m.Y'); - } - - static function toHumanTime($timestamp) - { - $timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp); - - return $timestamp->format('H:i'); - } - - static function toHumanDateTime($timestamp) - { - $timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp); - - return $timestamp->format('d.m.Y H:i:s'); - } - - static function daysToPublicationString($date) - { - $days = DateHelper::diffInDaysToNow($date); - - if($days < 0) - { - return __("general.immediately"); - } - else if($days == 0) - { - return __("general.today"); - } - else if($days == 1) - { - return __("general.tomorrow"); - } - else - { - return __("general.in :days days on :date", [ - 'days' => $days, - 'date' => DateHelper::toHumanDate($date)] - ); - } - } - - static function daysSincePublicationString($date) - { - $days = DateHelper::diffInDaysToNow($date); - - if($days < -1) - { $days *= -1; - return "vor $days Tagen, am ".DateHelper::toHumanDate($date); - } - else if($days == -1) - { - return __("general.yesterday"); - } - else if($days == 0) - { - return __("general.today"); - } - else - { - return ___("admin.not published yet"); - } - } - - static function diffInDaysString($date) - { - if(empty($date)) - { - return "nie"; - } - $days = DateHelper::diffInDaysToNow($date); - - if($days < -1) - { - return "vor ".(-1 * $days)." Tagen, am ".DateHelper::toHumanDate($date); - } - else if($days == -1) - { - return __("general.yesterday"); - } - else if($days == 0) - { - return __("general.today"); - } - else if($days == 1) - { - return __("general.tomorrow"); - } - else - { - return __("general.in :days days on :date", [ - 'days' => $days, - 'date' => DateHelper::toHumanDate($date)] - ); - } - } - - static function diffInDaysAndTimeString($date) - { - if(empty($date)) - { - return "nie"; - } - $days = DateHelper::diffInDaysToNow($date); - - $daystring = ""; - $timestring = __("general.at :time", [ - 'time' => DateHelper::toHumanTime($date) - ]); - - if($days < -1) - { - $daystring = __("general.:days days ago on :date", [ - 'days' => (-1 * $days), - 'date' => DateHelper::toHumanDate($date) - ]); - } - else if($days == -1) - { - $daystring = __("general.yesterday"); - } - else if($days == 0) - { - $daystring = __("general.today"); - } - else if($days == 1) - { - $daystring = __("general.tomorrow"); - } - else - { - $daystring = __("general.in :days days on :date", [ - 'days' => $days, - 'date' => DateHelper::toHumanDate($date)] - ); - } - - return $daystring." ".$timestring; - } - - static public function diffInDaysToNow($date) - { - $now = Carbon::now()->endOfDay(); - $days = $now->diffInDays($date); - if($now > $date) - { - $days *= -1; - } - else - { - $days++; - } - - return $days; - } + static function toCal($timestamp, $addHours = 0) + { + $timestamp = strtotime($timestamp); + // Sommerzeit berücksichtigen + if(date("I", $timestamp)) + { + $timestamp = $timestamp - 1 * 3600; + } + + // Zeittone berücksichtigen GMT +1 + $timestamp = $timestamp - 1 * 3600; + + $timestamp = Carbon::createFromTimestamp($timestamp); + if($addHours > 0) + { + $timestamp->addHours($addHours); + } + + return $timestamp->format('Ymd\THis\Z'); + } + + static function toHumanDate($timestamp) + { + $timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp); + + return $timestamp->format('d.m.Y'); + } + + static function toHumanTime($timestamp) + { + $timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp); + + return $timestamp->format('H:i'); + } + + static function toHumanDateTime($timestamp) + { + $timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp); + + return $timestamp->format('d.m.Y H:i:s'); + } + + static function daysToPublicationString($date) + { + $days = DateHelper::diffInDaysToNow($date); + + if($days < 0) + { + return __("general.immediately"); + } + else if($days == 0) + { + return __("general.today"); + } + else if($days == 1) + { + return __("general.tomorrow"); + } + else + { + return __("general.in :days days on :date", [ + 'days' => $days, + 'date' => DateHelper::toHumanDate($date)] + ); + } + } + + static function daysSincePublicationString($date) + { + $days = DateHelper::diffInDaysToNow($date); + + if($days < -1) + { $days *= -1; + return "vor $days Tagen, am ".DateHelper::toHumanDate($date); + } + else if($days == -1) + { + return __("general.yesterday"); + } + else if($days == 0) + { + return __("general.today"); + } + else + { + return ___("admin.not published yet"); + } + } + + static function diffInDaysString($date) + { + if(empty($date)) + { + return "nie"; + } + $days = DateHelper::diffInDaysToNow($date); + + if($days < -1) + { + return "vor ".(-1 * $days)." Tagen, am ".DateHelper::toHumanDate($date); + } + else if($days == -1) + { + return __("general.yesterday"); + } + else if($days == 0) + { + return __("general.today"); + } + else if($days == 1) + { + return __("general.tomorrow"); + } + else + { + return __("general.in :days days on :date", [ + 'days' => $days, + 'date' => DateHelper::toHumanDate($date)] + ); + } + } + + static function diffInDaysAndTimeString($date) + { + if(empty($date)) + { + return "nie"; + } + $days = DateHelper::diffInDaysToNow($date); + + $daystring = ""; + $timestring = __("general.at :time", [ + 'time' => DateHelper::toHumanTime($date) + ]); + + if($days < -1) + { + $daystring = __("general.:days days ago on :date", [ + 'days' => (-1 * $days), + 'date' => DateHelper::toHumanDate($date) + ]); + } + else if($days == -1) + { + $daystring = __("general.yesterday"); + } + else if($days == 0) + { + $daystring = __("general.today"); + } + else if($days == 1) + { + $daystring = __("general.tomorrow"); + } + else + { + $daystring = __("general.in :days days on :date", [ + 'days' => $days, + 'date' => DateHelper::toHumanDate($date)] + ); + } + + return $daystring." ".$timestring; + } + + static public function diffInDaysToNow($date) + { + $now = Carbon::now()->endOfDay(); + $days = $now->diffInDays($date); + if($now > $date) + { + $days *= -1; + } + else + { + $days++; + } + + return $days; + } } \ No newline at end of file diff --git a/app/Helpers/DesignHelper.php b/app/Helpers/DesignHelper.php new file mode 100644 index 00000000..2388a630 --- /dev/null +++ b/app/Helpers/DesignHelper.php @@ -0,0 +1,18 @@ + App\Helpers\StringHelper::class, 'StringHelper' => App\Helpers\StringHelper::class, 'BreakingNews' => App\Helpers\BreakingNewsHelper::class, + 'Design' => App\Helpers\DesignHelper::class, ], ]; diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 79f8626c..913efc23 100755 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -137,7 +137,20 @@ { img = $('#content_container img:first').attr('src'); } - $('#bg-image').css('background-image', 'url('+img+')'); + @if(Design::hasMourningPile()) + $('#bg-image').css('background-image', 'linear-gradient(black, black), url('+img+')'); + $('#bg-image').css('background-blend-mode', 'saturation'); + @else + $('#bg-image').css('background-image', 'url('+img+')'); + @endif + + // Wenn Trauerfloor verwendet werden soll werden alle Bilder in Grautönen angezeigt + @if(Design::hasMourningPile()) + $('img').css('-webkit-filter', 'grayscale(100%)') + .css('filter', 'grayscale(100%)'); + @endif + + $('#info_card_close_button').on('click',function() { $(this).closest('#info_card').fadeOut(); })