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

Commit

Permalink
2024-02 (#164)
Browse files Browse the repository at this point in the history
* remove event pages

* remove html pages event

* Remouve API

* Close issues #160

* preview 2024-02

* Add fir to ATC pages

* mod des pages

* Change information metar and bug fix

* Correct atc module

* valid correctif page index

* update readme
  • Loading branch information
alexcaussades authored Jul 31, 2024
1 parent 2b28589 commit 933eb47
Show file tree
Hide file tree
Showing 15 changed files with 852 additions and 750 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Biogaz Pers'o
# IVATRAC

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
Expand Down Expand Up @@ -33,13 +33,13 @@ Ce projet a pour but de gérer le suivit du biogaz des sites de production. :hot
- [PHP](https://windows.php.net/download/)
- [Composer](https://getcomposer.org/Composer-Setup.exe)

Vous voulez suivre les étapes d'[installation pas à pas](https://github.com/alexcaussades/Gestion_Biogaz/wiki/%5BTech%5D-Installation)
Vous voulez suivre les étapes d'[installation pas à pas](https://github.com/alexcaussades/Ivatrac/wiki/%5BTech%5D-Installation)

# Installation
Pour installer le projet, il suffit de suivre les étapes suivantes :

```bash
git clone https://github.com/alexcaussades/Gestion_Biogaz.git
git clone https://github.com/alexcaussades/ivatrac.git
cd Gestion_biogaz
composer install
php -r "file_exists('.env') || copy('.env.example', '.env');"
Expand Down
19 changes: 18 additions & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use App\Http\Controllers\CarteSIAController;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\Http;

class Kernel extends ConsoleKernel
{
Expand All @@ -12,7 +14,17 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
$schedule->call(function () {
$airac = new CarteSIAController();
$new_airac = $airac->config_Date();
$dateairac = $airac->checkdate();
$date = date("Y-m-d");
if ($new_airac == $date) {
http::post(env("Webhook_url_Airac_Info"), [
"content" => " :warning: Nouvelle Airac disponible version 2024-".$dateairac." :warning: ",
]);
}
})->dailyAt("12:50")->timezone($this->scheduleTimezone());
}

/**
Expand All @@ -24,4 +36,9 @@ protected function commands(): void

require base_path('routes/console.php');
}

protected function scheduleTimezone(): string
{
return 'Europe/Paris';
}
}
78 changes: 64 additions & 14 deletions app/Http/Controllers/eventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ public function get_last_arrival($route)
return $rr[$m];
}

public function aircrafts($icao_code){
public function aircrafts($icao_code)
{
$whazzup = new whazzupController();
$aircrafts = $whazzup->get_aircrafts($icao_code);
return $aircrafts["wakeTurbulence"];
}

public function aircrafts_model($icao_code){
public function aircrafts_model($icao_code)
{
$whazzup = new whazzupController();
$aircrafts = $whazzup->get_aircrafts($icao_code);
return $aircrafts["model"];
Expand Down Expand Up @@ -81,9 +83,13 @@ public function get_general()
$r = $this->get_fp($q[$i]["id"]);
$r = $r[0];
$sr[$i]["callsign"] = $q[$i]["callsign"];
$sr[$i]["star"] = $this->Star($r["route"]);
$sr[$i]["userId"] = $q[$i]["userId"];
$sr[$i]["pob"] = $r["peopleOnBoard"];
$sr[$i]["rule"] = $r["flightRules"];
$sr[$i]["model"] = $this->aircrafts_model($q[$i]["flightPlan"]["aircraftId"]);
$sr[$i]["eta"] = $this->ETA($q[$i]["lastTrack"]["arrivalDistance"], $q[$i]["lastTrack"]["groundSpeed"]);
$sr[$i]["wakeTurbulence"] = $this->aircrafts($q[$i]["flightPlan"]["aircraftId"]);

}
$sr = array_values($sr);
//tri par ordre eta croissant
Expand All @@ -93,23 +99,23 @@ public function get_general()
"data" => $sr
];
return $query;

}

public function Star($route){
public function Star($route)
{
$star_search = $this->get_last_arrival($route);

switch ($star_search) {
case 'MEN':
$star_search = "MEN 6T";
return $star_search;
break;

case 'BRUSC':
$star_search = "BRUSC 6T";
return $star_search;
break;

case 'KELAM':
$star_search = "KELAM 6T";
return $star_search;
Expand All @@ -124,7 +130,7 @@ public function Star($route){
$star_search = "MARRI 6T";
return $star_search;
break;

case 'NG':
$star_search = "NG 6T";
return $star_search;
Expand All @@ -136,14 +142,16 @@ public function Star($route){
}
}

public function Departure(){
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]
// 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]["userId"] = $r[$i]["userId"];
$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"];
Expand All @@ -163,7 +171,8 @@ public function Departure(){
return $query;
}

public function get_atc_online(){
public function get_atc_online()
{
$whazzup = new whazzupController();
$atc = $whazzup->position_search($this->icao);
$sy = [];
Expand All @@ -190,18 +199,59 @@ public function get_atc_online(){
array_push($online, $value);
}
}
return $online;
return $online;
}

public function get_airport()
{
$whazzup = new whazzupController();
$whazzup = $whazzup->get_airport($this->icao);
return $whazzup["centerId"];
}

public function get_atc_online_fir()
{
$whazzup = new whazzupController();
$atc = $whazzup->position_search($this->get_airport());
$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(){
public function get_arrival_departure()
{

$arrival = $this->get_general();
$departure = $this->Departure();
$atc = $this->get_atc_online();
$fir = $this->get_atc_online_fir();
$query = [
"arrival" => $arrival,
"departure" => $departure,
"atc" => $atc
"atc" => $atc,
"fir" => $fir
];
return $query;
}
Expand Down
74 changes: 50 additions & 24 deletions app/Http/Controllers/metarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers;

use DateTime;
use GuzzleHttp\Psr7\Response;
use Illuminate\Http\Request;
use Illuminate\Support\Env;
use Illuminate\Support\Facades\Http;
Expand Down Expand Up @@ -277,40 +278,65 @@ public function metar($icao)
$whazzup = new whazzupController();
$metar = $whazzup->Get_metar($icao);
$metar = json_decode($metar);
$temp = $this->temp_qnh($metar->metar);
$winds = $this->winds($metar->metar);
$visibility = $this->visibility($metar->metar);
$clouds = $this->clouds($metar->metar) ?? "None";
$station = $this->station($metar->metar);
$times = $this->time($metar->metar);
$tempo = $this->tempo($metar->metar);

$info = $metar->statusCode ?? 200;
if($info == 200 ){
$temp = $this->temp_qnh($metar->metar) ?? "None";
$winds = $this->winds($metar->metar) ?? "None";
$visibility = $this->visibility($metar->metar) ?? "None";
$clouds = $this->clouds($metar->metar) ?? "None";
$station = $this->station($metar->metar) ?? "None";
$times = $this->time($metar->metar) ?? "None";
$tempo = $this->tempo($metar->metar);


$r = [
'metar' => $metar->metar,
'station' => $station,
'visibility' => $visibility ?? "None",
'flight_rules' => "None",
"QNH" => $temp["qnh"] ?? "None",
"tempo" => $tempo ?? null,
"wind" => [
"wind" => $winds["direction"] ?? "None",
"direction" => $winds["direction"] ?? "None",
"wind_variable" => $winds["variable"] ?? "None",
"speed_KT" => $winds["winds"] ?? "None",
"speed_KM" => $winds["winds_KM"],
],
"temperature" => $temp["temp"]["temp"] ?? "None",
"dewpoint" => $temp["temp"]["dewpoint"] ?? "None",
"clouds" => $clouds ?? "None",
"meta_day" => [
"time" => $times. " Z"
],
];
}else{
$r = [
'metar' => $metar->metar,
'station' => $station,
'visibility' => $visibility ?? "None",
'flight_rules' => "None",
"QNH" => $temp["qnh"] ?? "None",
"tempo" => $tempo ?? null,
'metar' => "Not Found",
'station' => "Not Found",
'visibility' => "Not Found",
'flight_rules' => "Not Found",
"QNH" => "Not Found",
"tempo" => null,
"wind" => [
"wind" => $winds["direction"] ?? "None",
"direction" => $winds["direction"] ?? "None",
"wind_variable" => $winds["variable"] ?? "None",
"speed_KT" => $winds["winds"] ?? "None",
"speed_KM" => $winds["winds_KM"],
"wind" => "Not Found",
"direction" => "Not Found",
"wind_variable" => "Not Found",
"speed_KT" => "Not Found",
"speed_KM" => "Not Found",
],
"temperature" => $temp["temp"]["temp"] ?? "None",
"dewpoint" => $temp["temp"]["dewpoint"] ?? "None",
"clouds" => $clouds ?? "None",
"temperature" => "Not Found",
"dewpoint" => "Not Found",
"clouds" => "Not Found",
"meta_day" => [
"time" => $times. " Z"
"time" => "Not Found"
],
];


}
return $r;
}


public function taf($icao)
{
Expand Down
Loading

0 comments on commit 933eb47

Please sign in to comment.