Anpassung für EinsatzApp

Der Kalenderfeed (iCal) jeder Abteilung läuft jetzt endlos. Umlaute werden angepasst und der Ort tauch jetzt im Beschreibungstext auf
This commit is contained in:
Marco Glietsch 2023-01-21 21:54:53 +01:00
parent ad35dab0e7
commit 8d87112492
4 changed files with 40 additions and 10 deletions

View File

@ -16,4 +16,28 @@ class StringHelper
$string = str_replace(' ', '-', $string); $string = str_replace(' ', '-', $string);
return $string; return $string;
} }
static function normalize($string)
{
$string = strip_tags($string);
$string = str_replace(" ", " ", $string);
$string = str_replace("\r\n", " ", $string);
$string = str_replace("ü", "ü", $string);
$string = str_replace("ä", "ä", $string);
$string = str_replace("ö", "ö", $string);
$string = str_replace("ä", "ä", $string);
$string = str_replace("Ä", "Ä", $string);
$string = str_replace("ö", "ö", $string);
$string = str_replace("Ö", "Ö", $string);
$string = str_replace("ü", "ü", $string);
$string = str_replace("Ü", "Ü", $string);
$string = str_replace("ß", "ß", $string);
$string = str_replace("</p>", "", $string);
$string = str_replace(">", "", $string);
$string = str_replace("<;", "", $string);
return $string;
}
} }

View File

@ -287,15 +287,21 @@ class ServiceController extends PostController
public function showService(Request $request, $year, $department, $instance, $type = 'html') public function showService(Request $request, $year, $department, $instance, $type = 'html')
{ {
$type = strtolower($type);
$this->prepareModelData('SHOW'); $this->prepareModelData('SHOW');
$model = $this->newModel() $model = $this->newModel()
->select('posts.*', 'tags3.name as serviceType', 'posts.type') ->select('posts.*', 'tags3.name as serviceType', 'posts.type')
->isPublished() ->isPublished()
->where('posts.type', $this->modelType); ->where('posts.type', $this->modelType);
if(strtolower($year) != "app")
{ if($type != 'dienstplan.ical')
$model = $model->where(DB::raw('year(datetime)'), $year); {
} if(strtolower($year) != "app")
{
$model = $model->where(DB::raw('year(datetime)'), $year);
}
}
$model = $model->join('post_tag as post_tag1', function($join){ $model = $model->join('post_tag as post_tag1', function($join){
$join->on('posts.id', 'post_tag1.post_id'); $join->on('posts.id', 'post_tag1.post_id');
}) })
@ -341,7 +347,6 @@ class ServiceController extends PostController
$model->isMainPost = true; $model->isMainPost = true;
$viewFile = ''; $viewFile = '';
$type = strtolower($type);
switch($type) switch($type)
{ {
case 'html': case 'html':
@ -362,8 +367,8 @@ class ServiceController extends PostController
{ {
case 'dienstplan.ical': case 'dienstplan.ical':
$response = Response::make($view, 200); $response = Response::make($view, 200);
$response->header("Content-Disposition", "attachment; filename=Dienstplan-$year-$department-$instance.ics"); $response->header("Content-Disposition", "attachment; filename=Dienstplan-$department-$instance.ics");
$response->header("Content-Type", "text/calendar; charset=utf-8"); $response->header("Content-Type", "text/calendar; charset=ISO-885915");
return $response; return $response;
break; break;

View File

@ -247,7 +247,8 @@ return [
'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class, 'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class,
'Wizard' => App\Helpers\WizardHelper::class, 'Wizard' => App\Helpers\WizardHelper::class,
'String' => App\Helpers\StringHelper::class, 'String' => App\Helpers\StringHelper::class,
'BreakingNews' => App\Helpers\BreakingNewsHelper::class, 'StringHelper' => App\Helpers\StringHelper::class,
'BreakingNews' => App\Helpers\BreakingNewsHelper::class,
], ],
]; ];

View File

@ -10,8 +10,8 @@ DTSTART:{{ Date::toCal($post->datetime) }}
DTEND:{{ Date::toCal($post->datetime, +2) }} DTEND:{{ Date::toCal($post->datetime, +2) }}
UID:{{ $post->id }} UID:{{ $post->id }}
SUMMARY:{{ $post->serviceType }} SUMMARY:{{ $post->serviceType }}
DESCRIPTION:{{ $post->beschreibung }} DESCRIPTION:{{ StringHelper::normalize($post->beschreibung) }}\nOrt: {{ $post->ort }}
LOCATION:{{ $post->ort }} LOCATION:
DTSTAMP:{{ Date::toCal($post->created_at) }} DTSTAMP:{{ Date::toCal($post->created_at) }}
BEGIN:VALARM BEGIN:VALARM
ACTION:DISPLAY ACTION:DISPLAY