diff --git a/app/Http/Controllers/airac_info.php b/app/Http/Controllers/airac_info.php index 4613fad..ddfb0d8 100644 --- a/app/Http/Controllers/airac_info.php +++ b/app/Http/Controllers/airac_info.php @@ -25,7 +25,7 @@ public function get_approach($icao, $runway = NULL) $approach = $connection->table('approach')->where('airport_ident', $icao)->where("suffix", "A")->pluck("fix_ident")->toArray(); } else if ($runway != NULL) { $approach = $connection->table('approach')->where('airport_ident', $icao)->where("suffix", "A")->where("runway_name", $runway)->pluck("fix_ident")->toArray(); - if(count($approach) == null){ + if (count($approach) == null) { $approach = $connection->table('approach')->where('airport_ident', $icao)->where("suffix", "A")->pluck("fix_ident")->toArray(); } } @@ -39,16 +39,11 @@ public function get_departure($icao, $runway = NULL) if ($runway == NULL) { $departure = $connection->table('approach')->where('airport_ident', $icao)->where("suffix", "D")->pluck("fix_ident")->toArray(); - - - - } else if ($runway != NULL) { $departure = $connection->table('approach')->where('airport_ident', $icao)->where("suffix", "D")->where("runway_name", $runway)->pluck("fix_ident")->toArray(); - if(count($departure) == null){ + if (count($departure) == null) { $departure = $connection->table('approach')->where('airport_ident', $icao)->where("suffix", "D")->pluck("fix_ident")->toArray(); } - } return $departure; @@ -61,11 +56,11 @@ public function get_ils_airport($icao) $ils = $connection->table('ils')->where('loc_airport_ident', $icao)->get(); $LOC = []; $RNAV = []; - if(count($ils) > 0){ + if (count($ils) > 0) { foreach ($ils as $key => $value) { - if($value->name == NULL){ + if ($value->name == NULL) { $LOC[] = $value; - }else if($value->type != NULL){ + } else if ($value->type != NULL) { $RNAV[] = $value; } } @@ -76,7 +71,7 @@ public function get_ils_airport($icao) return $Q; } - Public function get_ils_information($icao, $runway = NULL) + public function get_ils_information($icao, $runway = NULL) { $connection = $this->connectToDatabase(); @@ -84,7 +79,7 @@ public function get_ils_airport($icao) $ils = $connection->table('ils')->where('loc_airport_ident', $icao)->get(); foreach ($ils as $key => $value) { $frequency = $value->frequency; - $reformattedNumber = substr_replace($frequency, ".", 3, 0) . "Mhz"; + $reformattedNumber = substr_replace($frequency, ".", 3, 0) . " Mhz"; $ils[$key]->frequency = $reformattedNumber; } $new_ils = []; @@ -95,25 +90,32 @@ public function get_ils_airport($icao) $new_ils[$i]["loc_runway_name"] = $ils[$i]->loc_runway_name; $new_ils[$i]["loc_heading"] = $ils[$i]->loc_heading; $new_ils[$i]["loc_heading"] = explode(".", $new_ils[$i]["loc_heading"])[0]; - } $ils = collect($new_ils); - } else if ($runway != NULL) { $ils = $connection->table('ils')->where('loc_airport_ident', $icao)->where("loc_runway_name", $runway)->whereNot("type", "T")->get(); $frequency = $ils->pluck("frequency")->toArray(); - if(count($frequency) != null){ - $reformattedNumber = substr_replace($frequency[0], ".", 3, 0) . "Mhz" ?? NULL; - $ils[0]->frequency = $reformattedNumber; - } - $new_ils = []; - + if (count($frequency) != null) { + $reformattedNumber = substr_replace($frequency[0], ".", 3, 0) . " Mhz" ?? NULL; + $ils[0]->frequency = $reformattedNumber; + $new_ils = []; $new_ils["ident"] = $ils[0]->ident; $new_ils["type"] = $ils[0]->type; $new_ils["frequency"] = $ils[0]->frequency; $new_ils["loc_runway_name"] = $ils[0]->loc_runway_name; $new_ils["loc_heading"] = $ils[0]->loc_heading; + }else{ + $new_ils["ident"] = NULL; + $new_ils["type"] = NULL; + $new_ils["frequency"] = NULL; + $new_ils["loc_runway_name"] = NULL; + $new_ils["loc_heading"] = NULL; + $new_ils["runway"] = $runway; + $new_ils["Approch"] = "RNAV"; + } + + $ils = collect($new_ils); } @@ -123,7 +125,6 @@ public function get_ils_airport($icao) public function Get_info_all_airac($icao, $runway = NULL) { - $approach = $this->get_approach($icao, $runway); $departure = $this->get_departure($icao, $runway); $ils = ""; @@ -131,4 +132,31 @@ public function Get_info_all_airac($icao, $runway = NULL) $q = collect(["app" => $approach, "depa" => $departure, "ils" => $ils, "ils_info" => $ils_info]); return $q; } + + public function decode_rwy($value) + { + $sr = explode("/", $value); + + if (count($sr) > 2) { + $arr = "/[0-9]{2}[L|R|C]?/"; + preg_match_all($arr, $sr[0], $matches); + $sr["ARR"] = $matches[0][0]; + $q = [ + "ARR" => $sr["ARR"], + "DEP" => $sr["ARR"] + ]; + } else { + $arr = "/[0-9]{2}[L|R|C]?/"; + preg_match_all($arr, $sr[0], $matches); + $sr["ARR"] = $matches[0][0]; + preg_match_all($arr, $sr[1], $matches); + $sr["DEP"] = $matches[0][0]; + $q = [ + "ARR" => $sr["ARR"], + "DEP" => $sr["DEP"] + ]; + } + + return $q; + } } diff --git a/app/Http/Controllers/myOnlineServeurController.php b/app/Http/Controllers/myOnlineServeurController.php index ac79209..924c18b 100644 --- a/app/Http/Controllers/myOnlineServeurController.php +++ b/app/Http/Controllers/myOnlineServeurController.php @@ -12,6 +12,7 @@ use App\Http\Controllers\whazzupController; use App\Http\Controllers\chartIvaoFRcontroller; use App\Http\Controllers\CarteSIAController; +use App\Http\Controllers\airac_info; @@ -51,6 +52,7 @@ public function getVerrifOnlineServeur() $whazzupp = new whazzupController(); $chartIvaoFRcontroller = new chartIvaoFRcontroller(); $chartController = new CarteSIAController(); + $airac = new airac_info(); if ($q['atc'] != null) { if ($q['atc']['atcSession']['position'] == "CTR") { @@ -102,7 +104,6 @@ public function getVerrifOnlineServeur() $new_icao = $ivao_session_decode['callsign']; $new_icao = explode("_", $new_icao); $new_icao = $new_icao[0]; - $r = $whazzupp->get_rwy($new_icao); $metar = $whazzupp->Get_metar($new_icao); $taf = $whazzupp->Get_taf($new_icao); @@ -113,6 +114,10 @@ public function getVerrifOnlineServeur() $callsign = $q['atc']['callsign']; $callsign = explode("_", $callsign); $callsign = $callsign[0]; + $airac_airport_rwy = $airac->decode_rwy($r); + $airac_airport_approch = $airac->get_approach($callsign, $airac_airport_rwy["ARR"]); + $airac_airport_departure = $airac->get_departure($callsign, $airac_airport_rwy["DEP"]); + $airac_airport_ils = $airac->get_ils_information($callsign, $airac_airport_rwy["ARR"]); $atc = [ "callsign" => $ivao_session_decode['callsign'], "id_session" => $ivao_session_decode['id'], @@ -123,6 +128,12 @@ public function getVerrifOnlineServeur() "atis" => $r, "metar" => $metar['metar'], "taf" => $taf['taf'], + "airac_airport" => [ + "rwy" => $airac_airport_rwy, + "approch" => $airac_airport_approch, + "departure" => $airac_airport_departure, + "ils" => $airac_airport_ils + ] ]; $metarController = new metarController(); $plateform = $atc_online; @@ -159,8 +170,9 @@ 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_ils = $airac->get_ils_information($fp_session["arrivalId"]); if ($speed <= 0) { $speed = 1; } @@ -222,10 +234,17 @@ public function getVerrifOnlineServeur() "departure" => [ "IFR" => $chartController->chartIFR($p["flightPlan"]["departureId"]), "VFR" => $chartController->chartVFR($p["flightPlan"]["departureId"]), + "airac" => [ + "departure" => $airac_DEP, + ], ], "arrival" => [ "IFR" => $chartController->chartIFR($p["flightPlan"]["arrivalId"]), "VFR" => $chartController->chartVFR($p["flightPlan"]["arrivalId"]), + "airac" => [ + "arrival" => $airac_ARR, + "ils" => $airac_ils + ], ] ]; diff --git a/database/changelog.json b/database/changelog.json index 2705905..25a498b 100644 --- a/database/changelog.json +++ b/database/changelog.json @@ -266,5 +266,19 @@ "description": "View FPL" } ] + }, + "11": { + "id": 12, + "name": "2023 / 37", + "date": "2023-12-03", + "version": "26.2.8", + "option": [ + { + "id": 0, + "type": "Feature", + "btn": "success", + "description": "Add Database Airac for page online ATC and online pilot" + } + ] } } diff --git a/resources/views/myoline/atc.blade.php b/resources/views/myoline/atc.blade.php index 3005116..e155a38 100644 --- a/resources/views/myoline/atc.blade.php +++ b/resources/views/myoline/atc.blade.php @@ -40,6 +40,14 @@ {{$atc["atis"]}} @endif +
+ @if ($atc["airac_airport"]["ils"]["ident"] != null) + ILS ({{$atc["airac_airport"]["ils"]["loc_runway_name"]}}) : + CAT : {{$atc["airac_airport"]["ils"]["type"]}} | FRQ : {{$atc["airac_airport"]["ils"]["frequency"]}} | HDG : {{$atc["airac_airport"]["ils"]["loc_heading"]}} + @else + {{$atc["airac_airport"]["ils"]["Approch"]}} : Runway {{$atc["airac_airport"]["ils"]["runway"]}} + @endif +

@@ -50,17 +58,56 @@

Services ATC

@if ($chart_ivao != null) -

- @endif +
+ @endif
@if ($plateform["atc_open"]!= null) - @foreach ($plateform["atc_open"] as $openatc) - @if ($openatc["composePosition"] != $atc["callsign"]) -
  • - @endif - @endforeach + @foreach ($plateform["atc_open"] as $openatc) + @if ($openatc["composePosition"] != $atc["callsign"]) +

    + @endif + @endforeach +
    +
    +
    + + + + + + + + + @foreach ($atc["airac_airport"]["departure"] as $airrac_departure) + + + + @endforeach + + +
    SID
    {{ $airrac_departure }}
    +
    +
    + + + + + + + + + @foreach ($atc["airac_airport"]["approch"] as $approch) + + + + @endforeach + + +
    STAR
    {{ $approch }}
    +
    +
    @endif
    diff --git a/resources/views/myoline/pilot.blade.php b/resources/views/myoline/pilot.blade.php index a6116ef..a86b0dc 100644 --- a/resources/views/myoline/pilot.blade.php +++ b/resources/views/myoline/pilot.blade.php @@ -33,11 +33,11 @@

    - Departure : {{ $pilot["flightPlan"]['departureId'] }} -


    - METAR : {{ $metar["departure"]["metar"] }} -
    - TAF : {{ $metar["departure"]["taf"] }} + Departure : {{ $pilot["flightPlan"]['departureId'] }} +
    + METAR : {{ $metar["departure"]["metar"] }} +
    + TAF : {{ $metar["departure"]["taf"] }}

    @@ -47,11 +47,26 @@

    - Arrival : {{ $pilot["flightPlan"]['arrivalId'] }} -


    - METAR : {{ $metar["arrival"]["metar"] }} -
    - TAF : {{ $metar["arrival"]["taf"] }} + Arrival : {{ $pilot["flightPlan"]['arrivalId'] }} +
    + METAR : {{ $metar["arrival"]["metar"] }} +
    + TAF : {{ $metar["arrival"]["taf"] }} +
    + + + ILS : + @foreach ($chart["arrival"]["airac"]["ils"] as $ils) + @if ($ils["type"] != "T") +
    RWY: {{$ils["loc_runway_name"]}} | CAT: {{$ils["type"]}} | FRQ: {{$ils["frequency"]}} | HDG: {{$ils["loc_heading"]}}
    + @endif + @endforeach + RNAV : + @foreach ($chart["arrival"]["airac"]["ils"] as $ils) + @if ($ils["type"] == "T") +
    RWY: {{$ils["loc_runway_name"]}} | FRQ: {{$ils["frequency"]}} | HDG: {{$ils["loc_heading"]}}
    + @endif + @endforeach

    @@ -66,9 +81,49 @@
    Departure :
    +
    +
    + + + + + + + + + @foreach ($chart["departure"]["airac"]["departure"] as $airrac_departure) + + + + @endforeach + + +
    SID
    {{ $airrac_departure }}
    +
    +
    Arrival :
    +
    +
    + + + + + + + + + @foreach ($chart["arrival"]["airac"]["arrival"] as $airrac_departure) + + + + @endforeach + + +
    SID
    {{ $airrac_departure }}
    +
    +
    @@ -118,82 +173,81 @@
    - -
    -
    - - +
    +
    + + +
    -
    -
    -
    - - +
    +
    + + +
    -
    -
    -
    - - +
    +
    + + +
    -
    -
    -
    -
    - - +
    +
    +
    + + +
    -
    -
    -
    - - +
    +
    + + +
    -
    -
    -
    - - +
    +
    + + +
    -
    -
    -
    - - +
    +
    + + +
    -
    -
    -
    -
    - - +
    +
    +
    + + +
    -
    -
    -
    - - +
    +
    + + +
    -
    -
    +
    +
    -
    -
    -
    - - +
    +
    + + +
    +
    -
    -
    - @if (ENV('APP_ENV') == 'local') - - @else - - @endif \ No newline at end of file + @if (ENV('APP_ENV') == 'local') + + @else + + @endif \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index cd393ac..d35b5d5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -627,7 +627,15 @@ Route::get("/ils", function (Request $request) { $airac = new airac_info(); - $airac = $airac->Get_info_all_airac("LFBO"); - return $airac; + $airport = "LFMT"; + $Rwy = "30R"; + $airac2 = $airac->get_approach($airport ); + $airac1 = $airac->get_departure($airport); + $ils = $airac->get_ils_information($airport, $Rwy); + + $airac3 = collect(["departure" => $airac1, "arrival" => $airac2, "ils" => $ils]); + + return $airac3; + }); });