From 2769f684179f84861f95f729a2226aa096aac1f3 Mon Sep 17 00:00:00 2001 From: alexcaussades Date: Wed, 17 Apr 2024 00:06:23 +0200 Subject: [PATCH] Maj version Event (#157) * resolve pilots ivao * feedback * new version --- app/Http/Controllers/EventIvaoController.php | 38 ++++++------ resources/views/event_fr.blade.php | 33 +++++++++++ resources/views/event_world.blade.php | 21 +++++++ resources/views/welcome.blade.php | 61 +++----------------- routes/web.php | 8 ++- 5 files changed, 85 insertions(+), 76 deletions(-) create mode 100644 resources/views/event_fr.blade.php create mode 100644 resources/views/event_world.blade.php diff --git a/app/Http/Controllers/EventIvaoController.php b/app/Http/Controllers/EventIvaoController.php index 1fc2915..efdc273 100644 --- a/app/Http/Controllers/EventIvaoController.php +++ b/app/Http/Controllers/EventIvaoController.php @@ -23,14 +23,14 @@ public function __construct() public function get_event_ivao_world(){ $eventIvaoWorld = []; for ($i=0; $i < count($this->event) ; $i++) { - $eventIvaoWorld[$i]['startDate'] = date('Y-m-d H:i:s', strtotime($this->event[$i]['startDate'])); - $eventIvaoWorld[$i]['endDate'] = date('Y-m-d H:i:s', strtotime($this->event[$i]['endDate'])); - $eventIvaoWorld[$i]['title'] = $this->event[$i]['title']; - $eventIvaoWorld[$i]['imageUrl'] = $this->event[$i]['imageUrl']; - $eventIvaoWorld[$i]['description'] = $this->event[$i]['description']; - $eventIvaoWorld[$i]['infoUrl'] = $this->event[$i]['infoUrl']; - $eventIvaoWorld[$i]['divisions'] = $this->event[$i]['divisions']; - $eventIvaoWorld[$i]['airports'] = $this->event[$i]['airports']; + $eventIvaoWorld[$i]['startDate'] = date('Y-m-d H:i:s', strtotime($this->event[$i]['startDate'])) ?? NULL; + $eventIvaoWorld[$i]['endDate'] = date('Y-m-d H:i:s', strtotime($this->event[$i]['endDate'])) ?? NULL; + $eventIvaoWorld[$i]['title'] = $this->event[$i]['title'] ?? NULL; + $eventIvaoWorld[$i]['imageUrl'] = $this->event[$i]['imageUrl'] ?? NULL; + $eventIvaoWorld[$i]['description'] = $this->event[$i]['description'] ?? NULL; + $eventIvaoWorld[$i]['infoUrl'] = $this->event[$i]['infoUrl'] ?? NULL; + $eventIvaoWorld[$i]['divisions'] = $this->event[$i]['divisions'] ?? NULL; + $eventIvaoWorld[$i]['airports'] = $this->event[$i]['airports'] ?? NULL; } @@ -45,14 +45,14 @@ public function get_event_ivao_RFE_RFO(){ $rfe_rfo = []; for ($i=0; $i < count($rfe) ; $i++) { if(preg_match($regexpr, $rfe[$i]['title'])){ - $rfe_rfo[$i]['startDate'] = $rfe[$i]['startDate']; - $rfe_rfo[$i]['endDate'] = $rfe[$i]['endDate']; - $rfe_rfo[$i]['title'] = $rfe[$i]['title']; - $rfe_rfo[$i]['imageUrl'] = $rfe[$i]['imageUrl']; - $rfe_rfo[$i]['description'] = $rfe[$i]['description']; - $rfe_rfo[$i]['infoUrl'] = $rfe[$i]['infoUrl']; - $rfe_rfo[$i]['divisions'] = $rfe[$i]['divisions']; - $rfe_rfo[$i]['airports'] = $rfe[$i]['airports']; + $rfe_rfo[$i]['startDate'] = $rfe[$i]['startDate'] ?? NULL; + $rfe_rfo[$i]['endDate'] = $rfe[$i]['endDate'] ?? NULL; + $rfe_rfo[$i]['title'] = $rfe[$i]['title'] ?? NULL; + $rfe_rfo[$i]['imageUrl'] = $rfe[$i]['imageUrl'] ?? NULL; + $rfe_rfo[$i]['description'] = $rfe[$i]['description'] ?? NULL; + $rfe_rfo[$i]['infoUrl'] = $rfe[$i]['infoUrl'] ?? NULL; + $rfe_rfo[$i]['divisions'] = $rfe[$i]['divisions'] ?? NULL; + $rfe_rfo[$i]['airports'] = $rfe[$i]['airports'] ?? NULL; } } $newrfe_rfo = array_values($rfe_rfo); @@ -80,7 +80,7 @@ public function get_event_ivao_FR_days(){ array_push($event_day, $envent_day); } } catch (\Throwable $th) { - $event_day = []; + $event_day = NULL; } return $event_day; } @@ -116,8 +116,8 @@ public function get_event_ivao_FR_tomorrow(){ public function get_event_ivao_FR(){ $eventIvaoFR = []; $eventIvaoFR = [ - 'today' => $this->get_event_ivao_FR_days(), - 'tomorrow' => $this->get_event_ivao_FR_tomorrow(), + 'today' => $this->get_event_ivao_FR_days() ?? NULL, + 'tomorrow' => $this->get_event_ivao_FR_tomorrow() ?? NULL, ]; return $eventIvaoFR; } diff --git a/resources/views/event_fr.blade.php b/resources/views/event_fr.blade.php new file mode 100644 index 0000000..05afef1 --- /dev/null +++ b/resources/views/event_fr.blade.php @@ -0,0 +1,33 @@ +
IVAO Event FR
+ +
+ @foreach($event_fr as $events) + @if (isset($events[0]["type"]) == "training" || isset($events[0]["type"]) == "exam") +
+
+
+ @if ($events[0]["type"] == "training") + @if (ENV('APP_ENV') == 'local') + + @else + + @endif + @endif + @if ($events[0]["type"] == "exam") + @if (ENV('APP_ENV') == 'local') + + @else + + @endif + @endif +

{{$events[0]["name"]}}

+

{{$events[0]["description"]}}

+

+
+
+
+ @endif + @endforeach +
+ +
\ No newline at end of file diff --git a/resources/views/event_world.blade.php b/resources/views/event_world.blade.php new file mode 100644 index 0000000..2f9741e --- /dev/null +++ b/resources/views/event_world.blade.php @@ -0,0 +1,21 @@ +
+
IVAO Event World
+
+ @foreach($event_worl as $eventss) +
+
+
+ +
{{$eventss["title"]}} / {{$eventss["airports"][0]}}
+
+ @for ($i = 0 ; $i < count($eventss["divisions"]) ; $i++ ) + {{$eventss["divisions"][$i]}} + @endfor +
+

{{$eventss["description"]}}

+ +
+
+
+ @endforeach +
diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 7dbf167..e163076 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -162,60 +162,13 @@
-
IVAO Event FR
- -
- @foreach($event_fr as $events) - @if (isset($events[0]["type"]) == "training" || isset($events[0]["type"]) == "exam") -
-
-
- @if ($events[0]["type"] == "training") - @if (ENV('APP_ENV') == 'local') - - @else - - @endif - @endif - @if ($events[0]["type"] == "exam") - @if (ENV('APP_ENV') == 'local') - - @else - - @endif - @endif -

{{$events[0]["name"]}}

-

{{$events[0]["description"]}}

-

-
-
-
- @endif - @endforeach -
-
+ @if (isset($event_fr) == null ) + @include('event_fr') + @endif + + @if (isset($event_en) == null ) + @include('event_world') + @endif -
-
-
IVAO Event World
-
- @foreach($event_worl as $events) -
-
-
- -
{{$events["title"]}} / {{$events["airports"][0]}}
-
- @for ($i = 0 ; $i < count($events["divisions"]) ; $i++ ) - {{$events["divisions"][$i]}} - @endfor -
-

{{$events["description"]}}

- -
-
-
- @endforeach -
@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index d17ccc9..fb7e085 100644 --- a/routes/web.php +++ b/routes/web.php @@ -675,7 +675,9 @@ Route::get("crypt", function (Request $request) { $encrypted = Crypt::encryptString('la vie de devs est cool.'); - $decrypted = Crypt::decryptString("eyJpdiI6Ik94UDRsMlR4NGRSWHVjazljTXJhQVE9PSIsInZhbHVlIjoiWlZWdGNNdXZabDFlTGQrLzRTVytwejFtV25MRGVibk1IUXB2bDZwVEF2ST0iLCJtYWMiOiJkZmVkOTNhZWM2NmY2MTEyNjhjYjYyMDZiN2FjM2I3MmMwZjY3ZGNiNTJjOTVmOGZiMjRlM2Q3ODE3NTU2ZDQ1IiwidGFnIjoiIn0="); - dd($decrypted); - })->name("crypto"); + $decrypted = Crypt::decryptString($encrypted); + dd($encrypted, $decrypted); + })->name("crypto"); + }); +