Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'Seach_ILS'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcaussades committed Dec 3, 2023
2 parents 23ee198 + 74af754 commit b80512c
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 104 deletions.
70 changes: 49 additions & 21 deletions app/Http/Controllers/airac_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand All @@ -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;
Expand All @@ -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;
}
}
Expand All @@ -76,15 +71,15 @@ 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();

if ($runway == NULL) {
$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 = [];
Expand All @@ -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);
}
Expand All @@ -123,12 +125,38 @@ 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 = "";
$ils_info = $this->get_ils_information($icao, $runway);
$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;
}
}
25 changes: 22 additions & 3 deletions app/Http/Controllers/myOnlineServeurController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;



Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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);
Expand All @@ -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'],
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
],
]
];

Expand Down
14 changes: 14 additions & 0 deletions database/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
}
61 changes: 54 additions & 7 deletions resources/views/myoline/atc.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
<span class="">{{$atc["atis"]}}</span>
@endif
</div>
<div>
@if ($atc["airac_airport"]["ils"]["ident"] != null)
<span class="text-info">ILS ({{$atc["airac_airport"]["ils"]["loc_runway_name"]}}) :</span>
<span class="text-whyte"> CAT : {{$atc["airac_airport"]["ils"]["type"]}} | FRQ : {{$atc["airac_airport"]["ils"]["frequency"]}} | HDG : {{$atc["airac_airport"]["ils"]["loc_heading"]}}</span>
@else
<span class="text-info">{{$atc["airac_airport"]["ils"]["Approch"]}} :</span> <span class="text-whyte"> Runway {{$atc["airac_airport"]["ils"]["runway"]}}</span>
@endif
</div>
</div>
</p>
</div>
Expand All @@ -50,17 +58,56 @@
<h4 class="card-title">Services ATC</h4>
<p class="card-text">
@if ($chart_ivao != null)
<div class="mt-2"><a href="{{$chart_ivao}}" target="_blank"><button class="btn btn-info btn-sm text-black"><span class=" d-flex d-inline"><span class="material-symbols-outlined">description</span>Memo IVAO</span></button></a></div>
@endif
<div class="mt-2"><a href="{{$chart_ivao}}" target="_blank"><button class="btn btn-info btn-sm text-black"><span class=" d-flex d-inline"><span class="material-symbols-outlined">description</span>Memo IVAO</span></button></a></div>
@endif
<div class="row">
<!-- Information des ATCs sur le depart -->
<div class="col-12 mt-2">
@if ($plateform["atc_open"]!= null)
@foreach ($plateform["atc_open"] as $openatc)
@if ($openatc["composePosition"] != $atc["callsign"])
<li class="mt-2"><button class="btn btn-success btn-sm">{{ $openatc["composePosition"] }} - {{ $openatc["frequency"] }} Mhz</button></li>
@endif
@endforeach
@foreach ($plateform["atc_open"] as $openatc)
@if ($openatc["composePosition"] != $atc["callsign"])
<p class="mt-2"><button class="btn btn-success btn-sm">{{ $openatc["composePosition"] }} - {{ $openatc["frequency"] }} Mhz</button></p>
@endif
@endforeach
<hr>
<div class="row">
<div class="col-6">
<table class="table table-striped table-inverse table-responsive text-info">
<thead class="thead-inverse">
<tr>
<th class="text-center">SID</th>
</tr>
</thead>
<tbody>

@foreach ($atc["airac_airport"]["departure"] as $airrac_departure)
<tr>
<td class="text-white">{{ $airrac_departure }}</td>
</tr>
@endforeach

</tbody>
</table>
</div>
<div class="col-6">
<table class="table table-striped table-inverse table-responsive text-info">
<thead class="thead-inverse">
<tr>
<th class="text-center">STAR</th>
</tr>
</thead>
<tbody>

@foreach ($atc["airac_airport"]["approch"] as $approch)
<tr>
<td class="text-white">{{ $approch }}</td>
</tr>
@endforeach

</tbody>
</table>
</div>
</div>
@endif
</div>
</div>
Expand Down
Loading

0 comments on commit b80512c

Please sign in to comment.