diff --git a/app/Http/Controllers/eventController.php b/app/Http/Controllers/eventController.php index b2ffaa8..4359a56 100644 --- a/app/Http/Controllers/eventController.php +++ b/app/Http/Controllers/eventController.php @@ -46,10 +46,15 @@ public function get_last_arrival($route) public function aircrafts($icao_code){ $whazzup = new whazzupController(); $aircrafts = $whazzup->get_aircrafts($icao_code); - //dd($aircrafts); return $aircrafts["wakeTurbulence"]; } + public function aircrafts_model($icao_code){ + $whazzup = new whazzupController(); + $aircrafts = $whazzup->get_aircrafts($icao_code); + return $aircrafts["model"]; + } + public function ETA($distance_arrival, $speed) { $distance_arrival = explode(".", $distance_arrival); @@ -130,4 +135,74 @@ public function Star($route){ break; } } + + public function Departure(){ + $q = $this->get_arrival(); + $r = $q["outbound"]; + $sr = []; + // filter la liste avec les parametres dans la liste [lastTrack][altitude] avec [lastTrack][onGround] + for ($i = 0; $i < count($r); $i++) { + if ($r[$i]["lastTrack"]["onGround"] == true) { + $sr[$i]["callsign"] = $r[$i]["callsign"]; + $sr[$i]["model"] = $this->aircrafts_model($r[$i]["flightPlan"]["aircraftId"]); + $sr[$i]["wakeTurbulence"] = $this->aircrafts($r[$i]["flightPlan"]["aircraftId"]); + $sr[$i]["arrival"] = $r[$i]["flightPlan"]["arrivalId"]; + $sr[$i]["fp"] = $this->get_fp($r[$i]["id"]); + $sr[$i]["departureTime"] = $this->get_fp($r[$i]["id"])[0]["departureTime"]; + $sr[$i]["departureTime"] = Carbon::parse($sr[$i]["departureTime"])->format('H:i'); + $sr[$i]["peopleOnBoard"] = $this->get_fp($r[$i]["id"])[0]["peopleOnBoard"]; + $sr[$i]["rule"] = $this->get_fp($r[$i]["id"])[0]["flightRules"]; + $sr[$i]["fp"] = null; + } + } + $sr = array_values($sr); + $query = [ + "count" => count($sr), + "data" => $sr + ]; + return $query; + } + + public function get_atc_online(){ + $whazzup = new whazzupController(); + $atc = $whazzup->position_search($this->icao); + $sy = []; + for ($i = 0; $i < count($atc); $i++) { + $sy[$i] = $atc[$i]; + } + $sy = collect($sy)->toArray(); + $r = new whazzupController(); + $r = $r->atc_tracking(); + $sr = []; + for ($i = 0; $i < count($r); $i++) { + if ($r[$i]["callsign"]) { + $sr[$i]["callsign"] = $r[$i]["callsign"]; + $sr[$i]["time"] = Carbon::parse($r[$i]["time"])->format('H:i'); + $sr[$i]["frequency"] = $r[$i]["atcSession"]["frequency"]; + $sr[$i]["id"] = $r[$i]["id"]; + } + } + $sr = collect($sr)->toArray(); + // rechercher dans la liste sr les callsigns qui sont dans la liste sy et les mettre dans une liste + $online = []; + foreach ($sr as $key => $value) { + if (in_array($value["callsign"], $sy)) { + array_push($online, $value); + } + } + return $online; + } + + public function get_arrival_departure(){ + + $arrival = $this->get_general(); + $departure = $this->Departure(); + $atc = $this->get_atc_online(); + $query = [ + "arrival" => $arrival, + "departure" => $departure, + "atc" => $atc + ]; + return $query; + } } diff --git a/app/Http/Controllers/myOnlineServeurController.php b/app/Http/Controllers/myOnlineServeurController.php index 51c0651..2d8ed58 100644 --- a/app/Http/Controllers/myOnlineServeurController.php +++ b/app/Http/Controllers/myOnlineServeurController.php @@ -157,8 +157,8 @@ public function getVerrifOnlineServeur() $metar_arr = $whazzupp->Get_metar($fp_session["arrivalId"]); $taf_dep = $whazzupp->Get_taf($fp_session["departureId"]); $taf_arr = $whazzupp->Get_taf($fp_session["arrivalId"]); - $airac_ARR = $airac->get_approach($fp_session["arrivalId"]); - $airac_DEP = $airac->get_departure($fp_session["departureId"]); + //$airac_ARR = $airac->get_approach($fp_session["arrivalId"]); + //$airac_DEP = $airac->get_departure($fp_session["departureId"]); $airac_ils = $airac->get_ils_information($fp_session["arrivalId"]); if ($speed <= 0) { $speed = 1; @@ -222,15 +222,15 @@ public function getVerrifOnlineServeur() "IFR" => $chartController->chartIFR($p["flightPlan"]["departureId"]), "VFR" => $chartController->chartVFR($p["flightPlan"]["departureId"]), "airac" => [ - "departure" => $airac_DEP, + "departure" => $airac_DEP ?? null, ], ], "arrival" => [ "IFR" => $chartController->chartIFR($p["flightPlan"]["arrivalId"]), "VFR" => $chartController->chartVFR($p["flightPlan"]["arrivalId"]), "airac" => [ - "arrival" => $airac_ARR, - "ils" => $airac_ils + "arrival" => $airac_ARR ?? null, + "ils" => $airac_ils ?? null, ], ] ]; diff --git a/app/Http/Controllers/whazzupController.php b/app/Http/Controllers/whazzupController.php index ca1d458..ee3c7b2 100644 --- a/app/Http/Controllers/whazzupController.php +++ b/app/Http/Controllers/whazzupController.php @@ -654,4 +654,19 @@ public function event_ivao() $event = $event->json(); return $event; } + + public function atc_tracking() + { + $atc = $this->API_request("v2/tracker/now/atc"); + $atc = $atc->json(); + return $atc; + } + + public function session_atc($id_session) + { + $atc = $this->API_request("v2/tracker/sessions/" . $id_session . "/atc"); + $atc = $atc->json(); + return $atc; + } + } diff --git a/resources/views/myoline/atc.blade.php b/resources/views/myoline/atc.blade.php index 6418f7b..a61b4bf 100644 --- a/resources/views/myoline/atc.blade.php +++ b/resources/views/myoline/atc.blade.php @@ -70,44 +70,6 @@ @endif @endforeach
SID | -
---|
{{ $airrac_departure }} | -
STAR | -
---|
{{ $approch }} | -
SID | -
---|
{{ $airrac_departure }} | -
SID | -
---|
{{ $airrac_departure }} | -
+
+
+
+
+
Flight number | +Time of departure : | +Arrivals | +Type Aircraft | +Rules | +
---|---|---|---|---|
{{$departures["callsign"]}} | +{{$departures["departureTime"]}} | +{{$departures["arrival"]}} | +{{$departures["model"]}} | +{{$departures["rule"]}} | +
Flight number | +Time of arrival : | +Type Aircraft | +
---|---|---|
{{$arrivals["callsign"]}} | +{{$arrivals["eta"]}} | +{{$arrivals["wakeTurbulence"]}} | +