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
|
||||
{
|
||||
static function toCal($timestamp, $addHours = 0)
|
||||
{
|
||||
$timestamp = strtotime($timestamp);
|
||||
// Sommerzeit berücksichtigen
|
||||
if(date("I", $timestamp))
|
||||
{
|
||||
$timestamp = $timestamp - 1 * 3600;
|
||||
}
|
||||
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;
|
||||
// Zeittone berücksichtigen GMT +1
|
||||
$timestamp = $timestamp - 1 * 3600;
|
||||
|
||||
$timestamp = Carbon::createFromTimestamp($timestamp);
|
||||
if($addHours > 0)
|
||||
{
|
||||
$timestamp->addHours($addHours);
|
||||
}
|
||||
$timestamp = Carbon::createFromTimestamp($timestamp);
|
||||
if($addHours > 0)
|
||||
{
|
||||
$timestamp->addHours($addHours);
|
||||
}
|
||||
|
||||
return $timestamp->format('Ymd\THis\Z');
|
||||
}
|
||||
return $timestamp->format('Ymd\THis\Z');
|
||||
}
|
||||
|
||||
static function toHumanDate($timestamp)
|
||||
{
|
||||
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
||||
static function toHumanDate($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)
|
||||
{
|
||||
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
||||
static function toHumanTime($timestamp)
|
||||
{
|
||||
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
||||
|
||||
return $timestamp->format('H:i');
|
||||
}
|
||||
return $timestamp->format('H:i');
|
||||
}
|
||||
|
||||
static function toHumanDateTime($timestamp)
|
||||
{
|
||||
$timestamp = Carbon::createFromFormat(config('formats.datetime.database'), $timestamp);
|
||||
static function toHumanDateTime($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)
|
||||
{
|
||||
$days = DateHelper::diffInDaysToNow($date);
|
||||
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)]
|
||||
);
|
||||
}
|
||||
}
|
||||
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);
|
||||
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");
|
||||
}
|
||||
}
|
||||
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);
|
||||
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)]
|
||||
);
|
||||
}
|
||||
}
|
||||
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);
|
||||
static function diffInDaysAndTimeString($date)
|
||||
{
|
||||
if(empty($date))
|
||||
{
|
||||
return "nie";
|
||||
}
|
||||
$days = DateHelper::diffInDaysToNow($date);
|
||||
|
||||
$daystring = "";
|
||||
$timestring = __("general.at :time", [
|
||||
'time' => DateHelper::toHumanTime($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)]
|
||||
);
|
||||
}
|
||||
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;
|
||||
}
|
||||
return $daystring." ".$timestring;
|
||||
}
|
||||
|
||||
static public function diffInDaysToNow($date)
|
||||
{
|
||||
$now = Carbon::now()->endOfDay();
|
||||
$days = $now->diffInDays($date);
|
||||
if($now > $date)
|
||||
{
|
||||
$days *= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$days++;
|
||||
}
|
||||
static public function diffInDaysToNow($date)
|
||||
{
|
||||
$now = Carbon::now()->endOfDay();
|
||||
$days = $now->diffInDays($date);
|
||||
if($now > $date)
|
||||
{
|
||||
$days *= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$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,
|
||||
'StringHelper' => App\Helpers\StringHelper::class,
|
||||
'BreakingNews' => App\Helpers\BreakingNewsHelper::class,
|
||||
'Design' => App\Helpers\DesignHelper::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@ -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();
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user