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 +
{{$events[0]["name"]}}
+{{$events[0]["description"]}}
+{{$events[0]["started_at"]}}
+