diff --git a/app/Http/Controllers/EventIvaoController.php b/app/Http/Controllers/EventIvaoController.php new file mode 100644 index 0000000..6a4f70c --- /dev/null +++ b/app/Http/Controllers/EventIvaoController.php @@ -0,0 +1,122 @@ +event_ivao(); + $this->event = $event; + return $this->event; + } + + 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']; + + } + + return $eventIvaoWorld; + + } + + public function get_event_ivao_RFE_RFO(){ + + $rfe = $this->get_event_ivao_world(); + $regexpr = '/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']; + } + } + $newrfe_rfo = array_values($rfe_rfo); + return $newrfe_rfo; + + + } + + public function get_event_ivao_FR_days(){ + + $date = date("c"); + $mois = date('m'); + $year = date('Y'); + $date_day = date('d/m/Y'); + $event_fr = []; + $envent_fr_search = Http::get("https://www.ivao.fr/fr/api/p/calendar/".$year."-".$mois.".json"); + $event_fr = $envent_fr_search->json(); + $event_day = []; + foreach ($event_fr[$date_day] as $key => $value) { + $envent_day["type"] = $value['type']; + $envent_day["name"] = $value['name']; + $envent_day["started_at"] = date('Y-m-d H:i:s', strtotime($value['started_at'])); + $envent_day["description"] = $value['tooltip_fr'] ?? "Pas de description disponible"; + array_push($event_day, $envent_day); + } + return $event_day; + } + + + public function get_event_ivao_FR_tomorrow(){ + + $date = date("c"); + $mois = date('m'); + $year = date('Y'); + $date_day = date('d/m/Y'); + $event_fr = []; + $envent_fr_search = Http::get("https://www.ivao.fr/fr/api/p/calendar/".$year."-".$mois.".json"); + $event_fr = $envent_fr_search->json(); + $event_tomorrow = []; + $tomorrow = date('d/m/Y', strtotime('+1 day')); + if(!isset($event_fr[$tomorrow])){ + $tomorrow = date('d/m/Y', strtotime('+2 day')); + } + if(!isset($event_fr[$tomorrow])){ + $tomorrow = date('d/m/Y', strtotime('+3 day')); + } + foreach ($event_fr[$tomorrow] as $key => $value) { + $envent_tomorrow["type"] = $value['type']; + $envent_tomorrow["name"] = $value['name']; + $envent_tomorrow["started_at"] = date('Y-m-d H:i:s', strtotime($value['started_at'])); + $envent_tomorrow["description"] = $value['tooltip_fr'] ?? "Pas de description disponible"; + array_push($event_tomorrow, $envent_tomorrow); + } + return $event_tomorrow; + } + + public function get_event_ivao_FR(){ + $eventIvaoFR = []; + $eventIvaoFR = [ + 'today' => $this->get_event_ivao_FR_days(), + 'tomorrow' => $this->get_event_ivao_FR_tomorrow(), + ]; + return $eventIvaoFR; + } + + +} \ No newline at end of file diff --git a/public/asset/img/exam/_1801431f-d691-4f0a-af4e-4ae1ec92fc0f.jpeg b/public/asset/img/exam/_1801431f-d691-4f0a-af4e-4ae1ec92fc0f.jpeg new file mode 100644 index 0000000..f8d1f0d Binary files /dev/null and b/public/asset/img/exam/_1801431f-d691-4f0a-af4e-4ae1ec92fc0f.jpeg differ diff --git a/public/asset/img/exam/_1fafd630-8088-432b-8fc6-51490b37b753.jpeg b/public/asset/img/exam/_1fafd630-8088-432b-8fc6-51490b37b753.jpeg new file mode 100644 index 0000000..481558e Binary files /dev/null and b/public/asset/img/exam/_1fafd630-8088-432b-8fc6-51490b37b753.jpeg differ diff --git a/public/asset/img/exam/_f567805f-e4ee-4953-9012-88e6d4b9b334.jpeg b/public/asset/img/exam/_f567805f-e4ee-4953-9012-88e6d4b9b334.jpeg new file mode 100644 index 0000000..cb43af0 Binary files /dev/null and b/public/asset/img/exam/_f567805f-e4ee-4953-9012-88e6d4b9b334.jpeg differ diff --git a/public/asset/img/exam/_fb6fa386-b096-4a3e-9499-53307a90572f.jpeg b/public/asset/img/exam/_fb6fa386-b096-4a3e-9499-53307a90572f.jpeg new file mode 100644 index 0000000..eef93d4 Binary files /dev/null and b/public/asset/img/exam/_fb6fa386-b096-4a3e-9499-53307a90572f.jpeg differ diff --git a/public/asset/img/exam/logo_exam.jpeg b/public/asset/img/exam/logo_exam.jpeg new file mode 100644 index 0000000..807d241 Binary files /dev/null and b/public/asset/img/exam/logo_exam.jpeg differ diff --git a/public/asset/img/online_day/onlineday.png b/public/asset/img/online_day/onlineday.png new file mode 100644 index 0000000..7c15173 Binary files /dev/null and b/public/asset/img/online_day/onlineday.png differ diff --git a/public/asset/img/training/traning.webp b/public/asset/img/training/traning.webp new file mode 100644 index 0000000..25002d5 Binary files /dev/null and b/public/asset/img/training/traning.webp differ diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index b26fe27..8ab7467 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -157,5 +157,39 @@ @endauth +
+
+
IVAO Event FR
+ +
+ @foreach($event_fr as $events) + +
+
+
+ @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"]}}

+

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

+
+
+
+ @endforeach +
+
+ @endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 1845342..c8d9e11 100644 --- a/routes/web.php +++ b/routes/web.php @@ -7,6 +7,7 @@ use Illuminate\Support\Sleep; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\DB; +use App\Http\Controllers\airac_info; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Http; @@ -31,20 +32,20 @@ use App\Http\Controllers\whazzupController; use App\Http\Controllers\AutAdminController; use App\Http\Controllers\AuthIVAOController; +use App\Http\Controllers\CarteSIAController; use App\Http\Controllers\changelogController; +use App\Http\Controllers\EventIvaoController; use App\Http\Controllers\PilotIvaoController; use App\Http\Controllers\whitelistController; use App\Http\Controllers\ApiGestionController; use App\Http\Controllers\chartIvaoFRcontroller; use App\Http\Controllers\frendly_userController; use App\Http\Controllers\MailRegisterController; +use App\Http\Controllers\my_fav_plateController; use App\Http\Requests\registerValidationRequest; use App\Http\Controllers\myOnlineServeurController; use App\Http\Controllers\CreatAuhUniqueUsersController; use Symfony\Component\HttpKernel\Controller\ErrorController; -use App\Http\Controllers\my_fav_plateController; -use App\Http\Controllers\airac_info; -use App\Http\Controllers\CarteSIAController; /* |-------------------------------------------------------------------------- @@ -72,6 +73,10 @@ $whazzup = $whazzup->connexion(); $w = new changelogController(); $u = $w->info_update(); + $event_world = new EventIvaoController(); + $event_world = $event_world->get_event_ivao_RFE_RFO(); + $event_fr = new EventIvaoController(); + $event_fr = $event_fr->get_event_ivao_FR(); if (Session::get("ivao_tokens") != null) { $date = new DateTime(); $date->setTimezone(new DateTimeZone('UTC')); @@ -85,13 +90,13 @@ $users_me = $whaz->user_me(); //dd($online->json(), $users_me); $online = json_decode($online, true); - return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u]); + return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u, "event_worl" => $event_world, "event_fr" => $event_fr]); } if (env("maintenance_mode") == true) { return view('maintenance'); } $online = null; - return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u]); + return response()->view('welcome', ["whazzup" => $whazzup, "online" => $online, "update" => $u, "event_worl" => $event_world, "event_fr" => $event_fr]); })->where('client', '[0-9]+')->name("home"); Route::get('/logout', function (Request $request) { @@ -658,4 +663,11 @@ return response($req->body(), 200)->header('Content-Type', 'application/pdf'); //return $airac; })->name("vac.icao"); + + Route::get("event", function (Request $request) { + $event_world = new EventIvaoController(); + $event_world = $event_world->get_event_ivao(); + return $event_world; + + })->name("event.index"); });