From: Ole B. Rosentreter
Date: Sat, 3 May 2025 16:55:09 +0000 (+0200)
Subject: Erster View fertig
X-Git-Url: https://git.laktatnebel.de/?a=commitdiff_plain;h=afcad29a0fba72e68875ebfa71b6531e6027fb49;p=airlinemanager.git
Erster View fertig
---
diff --git a/src/airline_glob_vars.php b/src/airline_glob_vars.php
new file mode 100755
index 0000000..0210ca1
--- /dev/null
+++ b/src/airline_glob_vars.php
@@ -0,0 +1,17 @@
+
diff --git a/src/sql/airline.sql b/src/sql/airline.sql
new file mode 100644
index 0000000..92a4a6e
--- /dev/null
+++ b/src/sql/airline.sql
@@ -0,0 +1,194 @@
+
+insert into airline.land values (default, 'Belarus');
+insert into airline.flughafen values ('SJU', 'San Juan', false, 10, (select id from airline.land where land_name = 'Puerto Rico'));
+
+insert into airline.strecke values ('SIN', 'SJU', 17651, 1820, 317, 103, 102, true, false, false);
+insert into airline.strecke values ('FRA', 'SJU', 7513, 2298, 406, 136, 105, true, false, false);
+insert into airline.strecke values ('GIG', 'SJU', 5350, 2351, 255, 70, 84, true, false, false);
+
+
+
+select * from airline.modell_order_aktiv moa
+join airline.strecke s on (moa.von = s.start_iata and moa.von = s.ziel_iata)
+where s.komplett = false;
+
+select * from strecke s where s.aktiv = true;
+select * from strecke s where s.komplett = false and s.aktiv = true order by start_iata , ziel_iata;
+
+
+select count(*) as anz, ziel_iata from airline.strecke s group by ziel_iata order by anz desc, ziel_iata asc;
+select count(*) as anz, ziel_iata from airline.strecke s where s.aktiv=true group by ziel_iata order by anz desc, ziel_iata asc;
+select count(*) as anz, ziel_iata from airline.strecke s where s.aktiv=true and s.komplett=true group by ziel_iata order by anz desc, ziel_iata asc;
+select count(*) as anz, land_name from airline.flughafen_land fl group by land_name order by anz desc, land_name asc;
+
+select ziel_iata from airline.strecke s where start_iata != 'DXB' group by ziel_iata;
+
+DROP VIEW airline.modell_order_aktiv_uncomplete;
+DROP VIEW airline.modell_order_aktiv;
+DROP VIEW airline.modell_order_all;
+DROP VIEW airline.best_invest_strecke_aktiv;
+DROP VIEW airline.best_invest_strecke_all;
+DROP VIEW airline.invest_strecke_aktiv;
+DROP VIEW airline.invest_strecke_all;
+DROP VIEW airline.pax_bestuhlung_strecke_all;
+
+CREATE OR REPLACE VIEW airline.modell_hersteller_usage
+AS SELECT m.modell_name,
+ h.hersteller_name,
+ m.classic,
+ m.reichweite,
+ m.preis,
+ m.pax,
+ m.speed,
+ m.kategorie,
+ m.verbrauch,
+ m.abnutzung
+ FROM airline.modell m
+ JOIN airline.hersteller h ON m.hersteller = h.id
+ where
+ m.classic = true
+ AND h.hersteller_name::text <> ALL (ARRAY['Comac'::character varying::text, 'Ilyushin'::character varying::text, 'Tupolev'::character varying::text, 'Sukhoi'::character varying::text])
+ and (m.verbrauch * m.abnutzung) < 12;
+
+
+CREATE OR REPLACE VIEW airline.pax_bestuhlung_strecke_all
+AS SELECT s.start_iata as von,
+ s.ziel_iata as nach,
+ s.strecke,
+ m.modell_name,
+ (8::numeric + ceil(s.strecke::numeric * 1.0 / m.speed::numeric * 4::numeric * 2::numeric)) / 4::numeric AS flugdauer,
+ floor(7::numeric / ((8::numeric + ceil(s.strecke::numeric * 1.0 / m.speed::numeric * 4::numeric * 2::numeric)) / 4::numeric / 24::numeric)) AS anzahl_fluege_woche,
+ floor(s.pe * m.pax::numeric / s.ps) AS stuehle_economy,
+ ceil(s.pb * m.pax::numeric / s.ps / 1.8) AS stuehle_business,
+ ceil(s.pf * m.pax::numeric / s.ps / 4.2) AS stuehle_first,
+ s.pax_economy,
+ s.pax_business,
+ s.pax_first,
+ s.aktiv,
+ s.in_arbeit,
+ s.komplett
+ FROM ( SELECT ceil(strecke.pax_economy::numeric) + ceil(strecke.pax_business::numeric * 1.8) + ceil(strecke.pax_first::numeric * 4.2) AS ps,
+ ceil(strecke.pax_economy::numeric) AS pe,
+ ceil(strecke.pax_business::numeric * 1.8) AS pb,
+ ceil(strecke.pax_first::numeric * 4.2) AS pf,
+ strecke.start_iata,
+ strecke.ziel_iata,
+ strecke.strecke,
+ strecke.pax_economy,
+ strecke.pax_business,
+ strecke.pax_first,
+ strecke.fracht,
+ strecke.aktiv,
+ strecke.in_arbeit,
+ strecke.komplett
+ FROM airline.strecke) s
+ JOIN airline.modell_hersteller_usage m ON m.reichweite >= s.strecke;
+
+CREATE OR REPLACE VIEW airline.pax_bestuhlung_strecke_aktiv
+AS SELECT * FROM airline.pax_bestuhlung_strecke_all s
+ where s.aktiv = true;
+
+CREATE OR REPLACE VIEW airline.invest_strecke_all
+AS SELECT s.von,
+ s.nach,
+ s.strecke,
+ s.modell_name,
+ m.hersteller_name,
+ s.stuehle_economy * s.anzahl_fluege_woche as pax_kapa_economy,
+ s.stuehle_business * s.anzahl_fluege_woche as pax_kapa_business,
+ s.stuehle_first * s.anzahl_fluege_woche as pax_kapa_first,
+ s.pax_economy::numeric / (s.stuehle_economy * s.anzahl_fluege_woche / 7::numeric * 2::numeric) as economy_aircrafts,
+ s.pax_business::numeric / (s.stuehle_business * s.anzahl_fluege_woche / 7::numeric * 2::numeric) as business_aircrafts,
+ s.pax_first::numeric / (s.stuehle_first * s.anzahl_fluege_woche / 7::numeric * 2::numeric) as first_aircrafts,
+ ceil(GREATEST(s.pax_economy::numeric / (s.stuehle_economy * s.anzahl_fluege_woche / 7::numeric * 2::numeric),
+ s.pax_business::numeric / (s.stuehle_business * s.anzahl_fluege_woche / 7::numeric * 2::numeric),
+ s.pax_first::numeric / (s.stuehle_first * s.anzahl_fluege_woche / 7::numeric * 2::numeric))) AS anzahl,
+ m.preis::numeric * ceil(GREATEST(s.pax_economy::numeric / (s.stuehle_economy * s.anzahl_fluege_woche / 7::numeric * 2::numeric),
+ s.pax_business::numeric / (s.stuehle_business * s.anzahl_fluege_woche / 7::numeric * 2::numeric),
+ s.pax_first::numeric / (s.stuehle_first * s.anzahl_fluege_woche / 7::numeric * 2::numeric))) AS investition,
+ s.aktiv,
+ s.in_arbeit,
+ s.komplett
+ FROM airline.pax_bestuhlung_strecke_all s
+ JOIN airline.modell_hersteller_usage m ON s.modell_name::text = m.modell_name::text
+ WHERE ceil(GREATEST(s.pax_economy::numeric / (s.stuehle_economy * s.anzahl_fluege_woche / 7::numeric * 2::numeric),
+ s.pax_business::numeric / (s.stuehle_business * s.anzahl_fluege_woche / 7::numeric * 2::numeric),
+ s.pax_first::numeric / (s.stuehle_first * s.anzahl_fluege_woche / 7::numeric * 2::numeric))) < 10::numeric;
+
+
+CREATE OR REPLACE VIEW airline.invest_strecke_aktiv
+AS SELECT * FROM airline.invest_strecke_all s
+ where s.aktiv = true;
+
+
+CREATE OR REPLACE VIEW airline.best_invest_strecke_all
+AS SELECT a.v AS von,
+ a.n AS nach,
+ inv.modell_name,
+ inv.hersteller_name,
+ inv.anzahl,
+ inv.investition
+ FROM ( SELECT invest_strecke_all.von AS v,
+ invest_strecke_all.nach AS n,
+ min(invest_strecke_all.investition) AS inv
+ FROM airline.invest_strecke_all
+ GROUP BY invest_strecke_all.von, invest_strecke_all.nach) a
+ JOIN airline.invest_strecke_all inv ON a.v = inv.von AND a.n = inv.nach AND a.inv = inv.investition;
+
+
+CREATE OR REPLACE VIEW airline.best_invest_strecke_aktiv
+AS SELECT a.v AS von,
+ a.n AS nach,
+ inv.modell_name,
+ inv.hersteller_name,
+ inv.anzahl,
+ inv.investition
+ FROM ( SELECT invest_strecke_aktiv.von AS v,
+ invest_strecke_aktiv.nach AS n,
+ min(invest_strecke_aktiv.investition) AS inv
+ FROM airline.invest_strecke_aktiv
+ GROUP BY invest_strecke_aktiv.von, invest_strecke_aktiv.nach) a
+ JOIN airline.invest_strecke_aktiv inv ON a.v = inv.von AND a.n = inv.nach AND a.inv = inv.investition;
+
+
+CREATE OR REPLACE VIEW airline.modell_order_all
+AS SELECT s.von,
+ s.nach,
+ m.strecke,
+ s.modell_name,
+ s.hersteller_name,
+ s.anzahl,
+ s.investition,
+ m.stuehle_economy,
+ m.stuehle_business,
+ m.stuehle_first,
+ m.aktiv,
+ m.in_arbeit,
+ m.komplett
+ FROM airline.best_invest_strecke_all s
+ JOIN airline.pax_bestuhlung_strecke_all m ON (s.modell_name::text = m.modell_name::text and s.von = m.von and s.nach = m.nach );
+
+
+CREATE OR REPLACE VIEW airline.modell_order_aktiv
+AS SELECT * FROM airline.modell_order_all s
+ where s.aktiv = true;
+
+
+CREATE OR REPLACE VIEW airline.modell_order_aktiv_uncomplete
+AS SELECT * FROM airline.modell_order_all s
+ where s.aktiv = true and s.komplett = false;
+
+
+CREATE OR REPLACE VIEW airline.flughafen_land
+AS select
+ f.iata,
+ f.flughafen_name,
+ l.land_name,
+ f.is_hub,
+ f.kategorie
+ FROM airline.flughafen f
+ join airline.land l on (f.land = l.id );
+
+
+
+
diff --git a/src/webui/index.php b/src/webui/index.php
new file mode 100755
index 0000000..70ae0ac
--- /dev/null
+++ b/src/webui/index.php
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+Airline
+
+
+
+
+
+All Order
+
+";
+
+var_dump ($_GET) ;
+echo " ";
+*/
+
+if (isset($_POST) && count(array_keys($_POST)) > 0) {
+ handleQuickUpdate($_POST, $connect_dbms_handle, $current_user, $page);
+}
+
+$orderClause = array();
+
+if (isset($_GET) && count(array_keys($_GET)) > 0) {
+ if (isset($_GET['sense']) && $_GET['sense'] != null) {
+ array_push($orderClause, $_GET['field']." ".$_GET['sense']);
+ }
+
+}
+
+//var_dump ($orderClause) ;
+
+if ($orderClause != null || count($orderClause) > 0) {
+ $selectFromViewModellOrderAll = str_replace (";", "", $selectFromViewModellOrderAll);
+ $selectFromViewModellOrderAll .= " ORDER BY ";
+
+ //print_r($orderClause);
+ $anzOrders = count($orderClause);
+ for ($i = 0 ; $i < $anzOrders; $i++) {
+ $selectFromViewModellOrderAll .= $orderClause[$i];
+ if ($i < $anzOrders-1) {
+ $selectFromViewModellOrderAll .= ", ";
+ }
+ }
+}
+echo " ";
+
+echo $selectFromViewModellOrderAll;
+
+$orders = getData($connect_dbms_handle, $selectFromViewModellOrderAll);
+
+//$stati_arr = getData($connect_dbms_handle, $selectFromDtStatus);
+
+?>
+
+
+
+
+
+
+\n";
+
+ echo "\n\n";
+
+}
+
+?>
+
+
+
+
+
+
+
+
+
diff --git a/src/webui/js/tickets.js b/src/webui/js/tickets.js
new file mode 100644
index 0000000..f2f1df2
--- /dev/null
+++ b/src/webui/js/tickets.js
@@ -0,0 +1,3 @@
+/**
+ *
+ */
\ No newline at end of file
diff --git a/src/webui/lib/database_functions.php b/src/webui/lib/database_functions.php
new file mode 100644
index 0000000..9deb4f2
--- /dev/null
+++ b/src/webui/lib/database_functions.php
@@ -0,0 +1,19 @@
+
\ No newline at end of file
diff --git a/src/webui/lib/db/database_functions_delete.php b/src/webui/lib/db/database_functions_delete.php
new file mode 100644
index 0000000..f12d7d5
--- /dev/null
+++ b/src/webui/lib/db/database_functions_delete.php
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/src/webui/lib/db/database_functions_insert.php b/src/webui/lib/db/database_functions_insert.php
new file mode 100644
index 0000000..2dd4fa1
--- /dev/null
+++ b/src/webui/lib/db/database_functions_insert.php
@@ -0,0 +1,55 @@
+
\ No newline at end of file
diff --git a/src/webui/lib/db/database_functions_pgsql.php b/src/webui/lib/db/database_functions_pgsql.php
new file mode 100644
index 0000000..f1646cf
--- /dev/null
+++ b/src/webui/lib/db/database_functions_pgsql.php
@@ -0,0 +1,104 @@
+".$res_sql_result;
+ $return_bool_value = true;
+ } else {
+ return "Datenbankabfrage fehlgeschlagen!";
+ }
+
+ return $return_bool_value;
+}
+
+
+// SQL an DB absetzen
+// Parameter: Tablle, Feld(er), Wert(e)
+// Rückgabewert: Array
+function getData ($dbms_connection, $db_query) {
+ $return_arr_data = array(); // Rückgabewert als Array
+ //echo "\n SQL: ".$ref_str_db_query."
";
+
+ // DB Abfage starten
+ //echo $db_query;
+ $res_sql_result = pg_query ($dbms_connection, $db_query);
+ // Gültigkeit der DB Abfage testen
+ if ($res_sql_result) {
+ //echo "".$res_sql_result."
";
+ while ($arr_sql_data = pg_fetch_row($res_sql_result)) {
+ //echo debugPrint($arr_sql_data);
+ array_push ($return_arr_data, $arr_sql_data);
+ }
+ //var_dump( $return_arr_data);
+ } else {
+ return "Datenbankabfrage fehlgeschlagen!";
+ }
+
+ return $return_arr_data;
+}
+
+
+// SQL an DB absetzen
+// Parameter: Tablle, Feld(er), Wert(e)
+// Rückgabewert: Array
+function getDataReturnID ($dbms_connection, $db_query) {
+ $return_arr_data = array(); // Rückgabewert als Array
+ //echo "\n SQL: ".$ref_str_db_query."
";
+
+ // DB Abfage starten
+ //echo $db_query;
+ $res_sql_result = pg_query ($dbms_connection, $db_query);
+ // Gültigkeit der DB Abfage testen
+ if ($res_sql_result) {
+ //echo "".$res_sql_result."
";
+ while ($arr_sql_data = pg_fetch_row($res_sql_result)) {
+ //echo debugPrint($arr_sql_data);
+ array_push ($return_arr_data, $arr_sql_data);
+ }
+ //var_dump( $return_arr_data);
+ } else {
+ return "Datenbankabfrage fehlgeschlagen!";
+ }
+
+ return $return_arr_data[0][0];
+}
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/db/database_functions_select.php b/src/webui/lib/db/database_functions_select.php
new file mode 100644
index 0000000..fa8e18a
--- /dev/null
+++ b/src/webui/lib/db/database_functions_select.php
@@ -0,0 +1,78 @@
+
\ No newline at end of file
diff --git a/src/webui/lib/db/database_functions_update.php b/src/webui/lib/db/database_functions_update.php
new file mode 100644
index 0000000..8f0d2fc
--- /dev/null
+++ b/src/webui/lib/db/database_functions_update.php
@@ -0,0 +1,35 @@
+
\ No newline at end of file
diff --git a/src/webui/lib/gui/gui_functions_button.php b/src/webui/lib/gui/gui_functions_button.php
new file mode 100644
index 0000000..20ae213
--- /dev/null
+++ b/src/webui/lib/gui/gui_functions_button.php
@@ -0,0 +1,64 @@
+
+ * $ref_value_button Daten; null möglich
+ * $ref_html_button HTML zwischen ; null möglich
+ * $ref_id Id des
+ * $ref_class Class des ; null möglich
+ * $ref_tabindex Tabindex in der
\n";
+ }
+}
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/gui/gui_functions_input.php b/src/webui/lib/gui/gui_functions_input.php
new file mode 100644
index 0000000..0777c68
--- /dev/null
+++ b/src/webui/lib/gui/gui_functions_input.php
@@ -0,0 +1,95 @@
+
+ * $ref_value_input Daten; null möglich
+ * $ref_id Id des
+ * $ref_class Class des ; null möglich
+ * $ref_tabindex Tabindex in der