Trauerflor rudimentär hinzugefügt
Der Trauerflor kann momentan nur über die Helferklasse App\Helpers\Designhelper::isMourningPile aktiviert werden
This commit is contained in:
parent
8d87112492
commit
91d162906c
@ -13,184 +13,184 @@ use \Carbon\Carbon;
|
|||||||
|
|
||||||
class DateHelper
|
class DateHelper
|
||||||
{
|
{
|
||||||
static function toCal($timestamp, $addHours = 0)
|
static function toCal($timestamp, $addHours = 0)
|
||||||
{
|
{
|
||||||
$timestamp = strtotime($timestamp);
|
$timestamp = strtotime($timestamp);
|
||||||
// Sommerzeit berücksichtigen
|
// Sommerzeit berücksichtigen
|
||||||
if(date("I", $timestamp))
|
if(date("I", $timestamp))
|
||||||
{
|
{
|
||||||
$timestamp = $timestamp - 1 * 3600;
|
$timestamp = $timestamp - 1 * 3600;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zeittone berücksichtigen GMT +1
|
// Zeittone berücksichtigen GMT +1
|
||||||
$timestamp = $timestamp - 1 * 3600;
|
$timestamp = $timestamp - 1 * 3600;
|
||||||
|
|
||||||
$timestamp = Carbon::createFromTimestamp($timestamp);
|
$timestamp = Carbon::createFromTimestamp($timestamp);
|
||||||
if($addHours > 0)
|
if($addHours > 0)
|
||||||
{
|
{
|
||||||
$timestamp->addHours($addHours);
|
$timestamp->addHours($addHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $timestamp->format('Ymd\THis\Z');
|
return $timestamp->format('Ymd\THis\Z');
|
||||||
}
|
}
|
||||||
|
|
||||||
static function toHumanDate($timestamp)
|
static function toHumanDate($timestamp)
|
||||||
{
|
{
|
||||||
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
||||||
|
|
||||||
return $timestamp->format('d.m.Y');
|
return $timestamp->format('d.m.Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
static function toHumanTime($timestamp)
|
static function toHumanTime($timestamp)
|
||||||
{
|
{
|
||||||
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
||||||
|
|
||||||
return $timestamp->format('H:i');
|
return $timestamp->format('H:i');
|
||||||
}
|
}
|
||||||
|
|
||||||
static function toHumanDateTime($timestamp)
|
static function toHumanDateTime($timestamp)
|
||||||
{
|
{
|
||||||
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
||||||
|
|
||||||
return $timestamp->format('d.m.Y H:i:s');
|
return $timestamp->format('d.m.Y H:i:s');
|
||||||
}
|
}
|
||||||
|
|
||||||
static function daysToPublicationString($date)
|
static function daysToPublicationString($date)
|
||||||
{
|
{
|
||||||
$days = DateHelper::diffInDaysToNow($date);
|
$days = DateHelper::diffInDaysToNow($date);
|
||||||
|
|
||||||
if($days < 0)
|
if($days < 0)
|
||||||
{
|
{
|
||||||
return __("general.immediately");
|
return __("general.immediately");
|
||||||
}
|
}
|
||||||
else if($days == 0)
|
else if($days == 0)
|
||||||
{
|
{
|
||||||
return __("general.today");
|
return __("general.today");
|
||||||
}
|
}
|
||||||
else if($days == 1)
|
else if($days == 1)
|
||||||
{
|
{
|
||||||
return __("general.tomorrow");
|
return __("general.tomorrow");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return __("general.in :days days on :date", [
|
return __("general.in :days days on :date", [
|
||||||
'days' => $days,
|
'days' => $days,
|
||||||
'date' => DateHelper::toHumanDate($date)]
|
'date' => DateHelper::toHumanDate($date)]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function daysSincePublicationString($date)
|
static function daysSincePublicationString($date)
|
||||||
{
|
{
|
||||||
$days = DateHelper::diffInDaysToNow($date);
|
$days = DateHelper::diffInDaysToNow($date);
|
||||||
|
|
||||||
if($days < -1)
|
if($days < -1)
|
||||||
{ $days *= -1;
|
{ $days *= -1;
|
||||||
return "vor $days Tagen, am ".DateHelper::toHumanDate($date);
|
return "vor $days Tagen, am ".DateHelper::toHumanDate($date);
|
||||||
}
|
}
|
||||||
else if($days == -1)
|
else if($days == -1)
|
||||||
{
|
{
|
||||||
return __("general.yesterday");
|
return __("general.yesterday");
|
||||||
}
|
}
|
||||||
else if($days == 0)
|
else if($days == 0)
|
||||||
{
|
{
|
||||||
return __("general.today");
|
return __("general.today");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ___("admin.not published yet");
|
return ___("admin.not published yet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function diffInDaysString($date)
|
static function diffInDaysString($date)
|
||||||
{
|
{
|
||||||
if(empty($date))
|
if(empty($date))
|
||||||
{
|
{
|
||||||
return "nie";
|
return "nie";
|
||||||
}
|
}
|
||||||
$days = DateHelper::diffInDaysToNow($date);
|
$days = DateHelper::diffInDaysToNow($date);
|
||||||
|
|
||||||
if($days < -1)
|
if($days < -1)
|
||||||
{
|
{
|
||||||
return "vor ".(-1 * $days)." Tagen, am ".DateHelper::toHumanDate($date);
|
return "vor ".(-1 * $days)." Tagen, am ".DateHelper::toHumanDate($date);
|
||||||
}
|
}
|
||||||
else if($days == -1)
|
else if($days == -1)
|
||||||
{
|
{
|
||||||
return __("general.yesterday");
|
return __("general.yesterday");
|
||||||
}
|
}
|
||||||
else if($days == 0)
|
else if($days == 0)
|
||||||
{
|
{
|
||||||
return __("general.today");
|
return __("general.today");
|
||||||
}
|
}
|
||||||
else if($days == 1)
|
else if($days == 1)
|
||||||
{
|
{
|
||||||
return __("general.tomorrow");
|
return __("general.tomorrow");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return __("general.in :days days on :date", [
|
return __("general.in :days days on :date", [
|
||||||
'days' => $days,
|
'days' => $days,
|
||||||
'date' => DateHelper::toHumanDate($date)]
|
'date' => DateHelper::toHumanDate($date)]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function diffInDaysAndTimeString($date)
|
static function diffInDaysAndTimeString($date)
|
||||||
{
|
{
|
||||||
if(empty($date))
|
if(empty($date))
|
||||||
{
|
{
|
||||||
return "nie";
|
return "nie";
|
||||||
}
|
}
|
||||||
$days = DateHelper::diffInDaysToNow($date);
|
$days = DateHelper::diffInDaysToNow($date);
|
||||||
|
|
||||||
$daystring = "";
|
$daystring = "";
|
||||||
$timestring = __("general.at :time", [
|
$timestring = __("general.at :time", [
|
||||||
'time' => DateHelper::toHumanTime($date)
|
'time' => DateHelper::toHumanTime($date)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if($days < -1)
|
if($days < -1)
|
||||||
{
|
{
|
||||||
$daystring = __("general.:days days ago on :date", [
|
$daystring = __("general.:days days ago on :date", [
|
||||||
'days' => (-1 * $days),
|
'days' => (-1 * $days),
|
||||||
'date' => DateHelper::toHumanDate($date)
|
'date' => DateHelper::toHumanDate($date)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
else if($days == -1)
|
else if($days == -1)
|
||||||
{
|
{
|
||||||
$daystring = __("general.yesterday");
|
$daystring = __("general.yesterday");
|
||||||
}
|
}
|
||||||
else if($days == 0)
|
else if($days == 0)
|
||||||
{
|
{
|
||||||
$daystring = __("general.today");
|
$daystring = __("general.today");
|
||||||
}
|
}
|
||||||
else if($days == 1)
|
else if($days == 1)
|
||||||
{
|
{
|
||||||
$daystring = __("general.tomorrow");
|
$daystring = __("general.tomorrow");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$daystring = __("general.in :days days on :date", [
|
$daystring = __("general.in :days days on :date", [
|
||||||
'days' => $days,
|
'days' => $days,
|
||||||
'date' => DateHelper::toHumanDate($date)]
|
'date' => DateHelper::toHumanDate($date)]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $daystring." ".$timestring;
|
return $daystring." ".$timestring;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function diffInDaysToNow($date)
|
static public function diffInDaysToNow($date)
|
||||||
{
|
{
|
||||||
$now = Carbon::now()->endOfDay();
|
$now = Carbon::now()->endOfDay();
|
||||||
$days = $now->diffInDays($date);
|
$days = $now->diffInDays($date);
|
||||||
if($now > $date)
|
if($now > $date)
|
||||||
{
|
{
|
||||||
$days *= -1;
|
$days *= -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$days++;
|
$days++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $days;
|
return $days;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
18
app/Helpers/DesignHelper.php
Normal file
18
app/Helpers/DesignHelper.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Marco Glietsch
|
||||||
|
* Date: 14.05.2018
|
||||||
|
* Time: 16:20
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
|
||||||
|
class DesignHelper
|
||||||
|
{
|
||||||
|
static public function hasMourningPile()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -249,6 +249,7 @@ return [
|
|||||||
'String' => App\Helpers\StringHelper::class,
|
'String' => App\Helpers\StringHelper::class,
|
||||||
'StringHelper' => App\Helpers\StringHelper::class,
|
'StringHelper' => App\Helpers\StringHelper::class,
|
||||||
'BreakingNews' => App\Helpers\BreakingNewsHelper::class,
|
'BreakingNews' => App\Helpers\BreakingNewsHelper::class,
|
||||||
|
'Design' => App\Helpers\DesignHelper::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -137,7 +137,20 @@
|
|||||||
{
|
{
|
||||||
img = $('#content_container img:first').attr('src');
|
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() {
|
$('#info_card_close_button').on('click',function() {
|
||||||
$(this).closest('#info_card').fadeOut();
|
$(this).closest('#info_card').fadeOut();
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user