]> git.laktatnebel.de Git - airlinemanager.git/commitdiff
Erster View fertig
authorOle B. Rosentreter <ole@laktatnebel.de>
Sat, 3 May 2025 16:55:09 +0000 (18:55 +0200)
committerOle B. Rosentreter <ole@laktatnebel.de>
Sat, 3 May 2025 16:55:09 +0000 (18:55 +0200)
19 files changed:
src/airline_glob_vars.php [new file with mode: 0755]
src/sql/airline.sql [new file with mode: 0644]
src/webui/index.php [new file with mode: 0755]
src/webui/js/tickets.js [new file with mode: 0644]
src/webui/lib/database_functions.php [new file with mode: 0644]
src/webui/lib/db/database_functions_delete.php [new file with mode: 0644]
src/webui/lib/db/database_functions_insert.php [new file with mode: 0644]
src/webui/lib/db/database_functions_pgsql.php [new file with mode: 0644]
src/webui/lib/db/database_functions_select.php [new file with mode: 0644]
src/webui/lib/db/database_functions_update.php [new file with mode: 0644]
src/webui/lib/gui/gui_functions_button.php [new file with mode: 0644]
src/webui/lib/gui/gui_functions_checkbox.php [new file with mode: 0644]
src/webui/lib/gui/gui_functions_input.php [new file with mode: 0644]
src/webui/lib/gui/gui_functions_select.php [new file with mode: 0644]
src/webui/lib/gui/gui_functions_textarea.php [new file with mode: 0644]
src/webui/lib/gui_functions.php [new file with mode: 0644]
src/webui/lib/util/util_functions.php [new file with mode: 0644]
src/webui/lib/util_functions.php [new file with mode: 0644]
src/webui/stylesheet/airline_main.css [new file with mode: 0644]

diff --git a/src/airline_glob_vars.php b/src/airline_glob_vars.php
new file mode 100755 (executable)
index 0000000..0210ca1
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+define ("DB_TYPE", "pgsql");
+
+
+define ("HOST", "localhost");
+define ("SCHEMA", "airline");
+define ("DB", "postgres");
+define ("USER", "postgres");
+//define ("USER", "oleb");
+define ("PASS", "B9cr--ZvfF@5cMdu");
+//define ("PASS", "wpj_9+L6ukX+SN2-");
+
+
+date_default_timezone_set('Europe/Berlin');
+
+?>
diff --git a/src/sql/airline.sql b/src/sql/airline.sql
new file mode 100644 (file)
index 0000000..92a4a6e
--- /dev/null
@@ -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 (executable)
index 0000000..70ae0ac
--- /dev/null
@@ -0,0 +1,197 @@
+<?php\r
+putenv("PGGSSENCMODE=disable");\r
+putenv("LC_ALL=C");\r
+?>\r
+<?php require_once '../airline_glob_vars.php'; ?>\r
+<?php require_once 'lib/database_functions.php'; ?>\r
+<?php require_once 'lib/gui_functions.php'; ?>\r
+<?php require_once 'lib/util_functions.php'; ?>\r
+<?php
+$page = 'index.php';\r
+\r
+$j=0;\r
+\r
+$connect_dbms_handle = getDBConnection();\r
+\r
+$current_user=1;\r
+\r
+?>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" lang="de">\r
+\r
+<head>\r
+<meta http-equiv="content-type" content="text/html; charset=UTF-8" />\r
+<meta http-equiv="expires" content="0" /> \r
+\r
+<title>Airline</title>\r
+\r
+<link rel="stylesheet" href="stylesheet/airline_main.css" type="text/css" media="screen, projection\" />\r
+</head>\r
+\r
+<body>\r
+<a href="index.php">All Order</a>\r
+<hr />\r
+<?php\r
+/*\r
+var_dump($_POST);\r
+echo "<hr />";\r
+\r
+var_dump ($_GET) ;\r
+echo "<hr />";\r
+*/\r
+\r
+if (isset($_POST) && count(array_keys($_POST)) > 0) {\r
+    handleQuickUpdate($_POST, $connect_dbms_handle, $current_user, $page);\r
+}\r
+\r
+$orderClause = array();\r
+\r
+if (isset($_GET) && count(array_keys($_GET)) > 0) {\r
+    if (isset($_GET['sense']) && $_GET['sense'] != null) {\r
+        array_push($orderClause, $_GET['field']." ".$_GET['sense']);\r
+    }\r
+    \r
+}\r
+\r
+//var_dump ($orderClause) ;\r
+\r
+if ($orderClause != null || count($orderClause) > 0) {\r
+    $selectFromViewModellOrderAll = str_replace (";", "", $selectFromViewModellOrderAll);\r
+    $selectFromViewModellOrderAll .= " ORDER BY ";\r
+    \r
+    //print_r($orderClause);\r
+    $anzOrders = count($orderClause);\r
+    for ($i = 0 ; $i < $anzOrders; $i++) {\r
+        $selectFromViewModellOrderAll .= $orderClause[$i];\r
+        if ($i < $anzOrders-1) {\r
+            $selectFromViewModellOrderAll .= ", ";\r
+        }\r
+    }\r
+}\r
+echo "<hr />";\r
+\r
+echo $selectFromViewModellOrderAll;\r
+\r
+$orders = getData($connect_dbms_handle, $selectFromViewModellOrderAll);\r
+\r
+//$stati_arr = getData($connect_dbms_handle, $selectFromDtStatus);\r
+\r
+?>\r
+<div class="container">\r
+<table>\r
+<tr>\r
+<form name="sort" id="sort" action="<?php echo $page ?>" method="post">\r
+<th>\r
+<?php\r
+$field="von";\r
+echo $field;\r
+?><br />\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=ASC">&uarr;</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=">-</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=DESC">&darr;</a>\r
+</th>\r
+<th><?php\r
+$field="nach";\r
+echo $field;\r
+?><br />\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=ASC">&uarr;</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=">-</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=DESC">&darr;</a>\r
+</th>\r
+<th>Strecke</th>\r
+<th><?php\r
+$field="modell_name";\r
+?>Modell<br />\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=ASC">&uarr;</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=">-</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=DESC">&darr;</a>\r
+</th>\r
+<th><?php\r
+$field="hersteller_name";\r
+?>Hersteller<br />\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=ASC">&uarr;</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=">-</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=DESC">&darr;</a>\r
+</th>\r
+<th>Anzahl</th>\r
+<th>Invest</th>\r
+<th>Economy</th>\r
+<th>Business</th>\r
+<th>1st Class</th>\r
+<th><?php\r
+$field="aktiv";\r
+echo $field;\r
+?><br />\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=ASC">&uarr;</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=">-</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=DESC">&darr;</a>\r
+</th>\r
+<th><?php\r
+$field="in_arbeit";\r
+?>in Arbeit<br />\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=ASC">&uarr;</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=">-</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=DESC">&darr;</a>\r
+</th>\r
+<th><?php\r
+$field="komplett";\r
+echo $field;\r
+?><br />\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=ASC">&uarr;</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=">-</a>\r
+<a href="<?php echo $page ?>?field=<?php echo $field ?>&sense=DESC">&darr;</a>\r
+</th>\r
+</form>\r
+</tr>\r
+\r
+<?php\r
+foreach ($orders as $order) {\r
+    $j++;\r
+    $key=$order[0]."-".$order[1];\r
+    \r
+    echo "<tr>\n";\r
+\r
+    echo "<form name=\"airline_strecke_".$key."\" id=\"airline_".$key."\" action=\"".$page."\" method=\"post\">\n";\r
+    \r
+    for ($i = 0; $i < count($order); $i++) {\r
+        echo "\t<td>";//{".$order[$i]."}";\r
+\r
+        switch ($i) {\r
+            case 6:\r
+                echo number_format($order[$i], 0, ',', '.');\r
+                break;\r
+            case 10:\r
+                make_check($key."#aktiv", true, $key."_aktiv", null, null, $order[$i] == "t" ? true : false , null, null, "document.forms['airline_".$key."'].submit();", null, null, false, false, 0);\r
+                break;\r
+            case 11:\r
+                make_check($key."#in_arbeit", true, $key."_in_arbeit", null, null, $order[$i] == "t" ? true : false , null, null, "document.forms['airline_".$key."'].submit();", null, null, false, false, 0);\r
+                break;\r
+            case 12:\r
+                make_check($key."#komplett", true, $key."_komplett", null, null, $order[$i] == "t" ? true : false , null, null, "document.forms['airline_".$key."'].submit();", null, null, false, false, 0);\r
+                break;\r
+            \r
+            default:\r
+                echo $order[$i];\r
+                \r
+            break;\r
+        }\r
+        \r
+        echo "</td>\n";\r
+    }\r
+//    var_dump($order);\r
+    echo "</form>\n</tr>\n";\r
+    \r
+}\r
+\r
+?>\r
+\r
+\r
+\r
+</table>\r
+</div>\r
+\r
+</body>\r
+</html>\r
+<?php
+closeDBConnection ( $connect_dbms_handle );
+?>
diff --git a/src/webui/js/tickets.js b/src/webui/js/tickets.js
new file mode 100644 (file)
index 0000000..f2f1df2
--- /dev/null
@@ -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 (file)
index 0000000..9deb4f2
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+if (DB_TYPE == "mysql") {
+       require ("db/database_functions_mysql.php");
+} elseif (DB_TYPE == "pgsql") {
+    require ("db/database_functions_pgsql.php");
+}
+
+require ("db/database_functions_insert.php");
+require ("db/database_functions_select.php");
+require ("db/database_functions_update.php");
+require ("db/database_functions_delete.php");
+
+$selectFromViewModellOrderAktivUncomplete = "SELECT * FROM ".SCHEMA.".modell_order_aktiv_uncomplete;";
+
+$selectFromViewModellOrderAll = "SELECT * FROM ".SCHEMA.".modell_order_all;";
+
+
+?>
\ 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 (file)
index 0000000..f12d7d5
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+
+function generateDeleteSchema($schema, $table, $col, $value) {
+       $delete_str = "DELETE FROM ".$schema.".".$table." WHERE (".$col."=".$value.");";
+       //echo debugPrint($delete_str);
+       return $delete_str;
+}
+
+function generateDelete($table, $col, $value) {
+       $delete_str = "DELETE FROM ".$table." WHERE (".$col."=".$value.");";
+       //echo debugPrint($delete_str);
+       return $delete_str;
+}
+
+?>
\ 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 (file)
index 0000000..2dd4fa1
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+
+
+function generateInsertSchema($schema, $table, $values) {
+    $insert_str = "INSERT INTO ".$schema.".".$table." VALUES (";
+    
+    //print_r($values);
+    $anzValues = count($values);
+    for ($i = 0 ; $i < $anzValues; $i++) {
+        $insert_str .= $values[$i];
+        if ($i < ($anzValues-1)) {
+            $insert_str .= ", ";
+        }
+    }
+    
+    $insert_str .= ");";
+    //echo debugPrint($insert_str);
+    return $insert_str;
+}
+
+function generateInsertSchemaReturn($schema, $table, $values, $return) {
+    $insert_str = "INSERT INTO ".$schema.".".$table." VALUES (";
+    
+    //print_r($values);
+    $anzValues = count($values);
+    for ($i = 0 ; $i < $anzValues; $i++) {
+        $insert_str .= $values[$i];
+        if ($i < ($anzValues-1)) {
+            $insert_str .= ", ";
+        }
+    }
+    
+    $insert_str .= ") ".$return.";";
+    //echo debugPrint($insert_str);
+    return $insert_str;
+}
+
+function generateInsert($table, $values) {
+       $insert_str = "INSERT INTO ".$table." VALUES (";
+
+       //print_r($values);
+       $anzValues = count($values);
+       for ($i = 0 ; $i < $anzValues; $i++) {
+               $insert_str .= $values[$i];
+               if ($i < $anzValues-1) {
+                       $insert_str .= ", ";
+               }
+       }
+
+       $insert_str .= ");";
+       //echo debugPrint($insert_str);
+       return $insert_str;
+}
+
+?>
\ 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 (file)
index 0000000..f1646cf
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+
+/**
+ * Mit PostgresSQL verbinden */
+function getDBConnection() {
+
+       $str_connection = "host=".HOST." port=5432 dbname=".DB." user=".USER." password=".PASS." ";
+       //echo $str_connection;
+       // mit DB verbinden
+       //$connect_dbms_handle = new PDO("pgsql:dbname=".DB, USER, PASS);
+       $connect_dbms_handle = @pg_connect($str_connection) or die('Verbindungsaufbau fehlgeschlagen: ' . pg_last_error());
+
+       if ($connect_dbms_handle) {
+               return $connect_dbms_handle;
+       } else {
+               echo "Datenbankabfrage fehlgeschlagen!";
+               echo pg_last_error($connect_dbms_handle);
+               return false;
+       }
+}
+
+/**
+ * PostgresSQL-Verbindung schliessen */
+function closeDBConnection($ref_connection) {
+       @pg_close($ref_connection) or die('Verbindungsclose fehlgeschlagen: ');
+       echo pg_last_error($ref_connection);
+}
+
+
+// SQL an DB absetzen
+// Parameter: Tablle, Feld(er), Wert(e)
+// Rückgabewert: boolean
+function getBooleanData ($dbms_connection, $db_query) {
+       // Variablen
+       $return_bool_value = false ;
+
+       // 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 "<li>".$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<p> SQL:<br>".$ref_str_db_query."</p>";
+    
+    // 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 "<p>".$res_sql_result."</p>";
+        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<p> SQL:<br>".$ref_str_db_query."</p>";
+    
+    // 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 "<p>".$res_sql_result."</p>";
+        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 (file)
index 0000000..fa8e18a
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+function generateSelect ($selectedFields, $table) {
+       $select_str = "SELECT ";
+       
+       if (is_array($selectedFields)) {
+               //print_r($selectedFields);
+       $anzFields = count($selectedFields);
+       for ($i = 0 ; $i < $anzFields; $i++) {
+               $select_str .= $selectedFields[$i];
+               if ($i < $anzFields-1) {
+                       $select_str .= ", ";
+               }
+       }
+       } else {
+           $select_str .= "*";
+       }
+       
+       $select_str .= " FROM ".$table;
+       
+       $select_str .= ";";
+
+       //echo $select_str;
+       return $select_str;
+}
+
+
+function generateSelectWhereOrder ($selectedFields, $table, $whereClause, $orderClause) {
+       $select_str = "SELECT ";
+
+       if (is_array($selectedFields)) {
+           //print_r($selectedFields);
+       $anzFields = count($selectedFields);
+       for ($i = 0 ; $i < $anzFields; $i++) {
+               $select_str .= $selectedFields[$i];
+               if ($i < $anzFields-1) {
+                       $select_str .= ", ";
+               }
+       }
+       } else {
+           $select_str .= "*";
+       }
+
+       $select_str .= " FROM ".$table;
+
+       if ($whereClause != null) {
+               $select_str .= " WHERE ";
+
+               //print_r($whereClause);
+               $anzWheres = count($whereClause);
+               for ($i = 0 ; $i < $anzWheres; $i++) {
+                       $select_str .= $whereClause[$i];
+                       if ($i < $anzWheres-1) {
+                               $select_str .= " AND ";
+                       }
+               }
+       }
+
+       if ($orderClause != null) {
+               $select_str .= " ORDER BY ";
+
+               //print_r($orderClause);
+               $anzOrders = count($orderClause);
+               for ($i = 0 ; $i < $anzOrders; $i++) {
+                       $select_str .= $orderClause[$i];
+                       if ($i < $anzOrders-1) {
+                               $select_str .= ", ";
+                       }
+               }
+       }
+
+       $select_str .= ";";
+
+       //echo $select_str;
+       return $select_str;
+}
+
+
+?>
\ 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 (file)
index 0000000..8f0d2fc
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+function generateUpdateSchema($schema, $table, $values, $whereClause) {
+    $update_str = "UPDATE ".$schema.".".$table." SET ";
+    
+    //print_r($values);
+    $anzValues = count($values);
+    for ($i = 0 ; $i < $anzValues; $i++) {
+        $update_str .= $values[$i][0];
+        $update_str .= " = ";
+        $update_str .= $values[$i][1];
+        if ($i < ($anzValues-1)) {
+            $update_str .= ", ";
+        }
+    }
+    
+    if ($whereClause != null) {
+        $update_str .= " WHERE ";
+        
+        //print_r($whereClause);
+        $anzWheres = count($whereClause);
+        for ($i = 0 ; $i < $anzWheres; $i++) {
+            $update_str .= $whereClause[$i];
+            if ($i < $anzWheres-1) {
+                $update_str .= " AND ";
+            }
+        }
+    }
+    
+    
+    $update_str .= ";";
+    //echo debugPrint($update_str);
+    return $update_str;
+}
+?>
\ 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 (file)
index 0000000..20ae213
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+/** $ref_button_name                Name des <button>
+ *  $ref_value_button               Daten; null möglich
+ *  $ref_html_button                HTML zwischen <button></button>; null möglich
+ *  $ref_id                         Id des <button>
+ *  $ref_class                      Class des <button>; null möglich
+ *  $ref_tabindex                   Tabindex in der <form>
+ *  $ref_type                       <button>-type (submit, reset, button)
+ *  $ref_javascript                 Javascript; null möglich
+ *  $ref_labeltitle                 <label>-Text; null möglich
+ *  $ref_p_flag                     true, wenn alles in <p> soll
+ *  $ref_newline_flag               true, wenn <label> ueber <button> stehen soll
+ *  $ref_intend                     Anz. Tabs einrücken
+ * */
+function makeButton($ref_button_name, $ref_value_button, $ref_html_button, $ref_id, $ref_class, $ref_tabindex, $ref_type, $ref_javascript, $ref_labeltitle, $ref_p_flag, $ref_newline_flag, $ref_intend) {
+
+       $intend = make_intend_str($ref_intend);
+
+       if ($ref_p_flag) {
+               echo $intend;
+               echo "<p>\n";
+       }
+       
+
+       if ($ref_labeltitle != null) {
+               echo $intend."\t";
+               echo "<label for=\"".$ref_button_name."\">".$ref_labeltitle."</label>";
+               if ($ref_newline_flag) {
+                       echo "<br />";
+               }
+               echo "\n";
+       }
+
+       $str_id = $ref_id == null ? " " : " id=\"".$ref_id."\" ";
+       $str_class = $ref_class == null ? " " : " class=\"".$ref_class."\" ";
+       $str_tabindex = $ref_tabindex == null ? " " : " tabindex=\"".$ref_tabindex."\" ";
+       $str_javascript = $ref_javascript == null ? " " : " onchange=\"".$ref_javascript."\" ";
+
+       echo $intend."\t";
+
+       echo "<button ".$str_id.$str_class.$str_tabindex."name=\"".$ref_button_name."\" type=\"".$ref_type."\" ";
+       if ($ref_value_button != null) {
+               echo " value=\"".$ref_value_button."\"";
+       }
+       echo "/>\n";
+
+       echo $intend."\t\t";
+
+       echo $ref_html_button."\n";
+
+       echo $intend."\t";
+       echo "</button>\n";
+
+       if ($ref_p_flag) {
+               echo $intend;
+               echo "</p>\n";
+       }
+}
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/gui/gui_functions_checkbox.php b/src/webui/lib/gui/gui_functions_checkbox.php
new file mode 100644 (file)
index 0000000..924dd6c
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+
+
+
+function make_check($ref_check_name, $ref_value, $ref_id, $ref_tabindex, $ref_class, $ref_checked, $ref_classerrorextension, $ref_error_label, $ref_javascript, $ref_mandantory, $ref_labeltitle, $ref_p_flag, $ref_newline_flag, $ref_intend) {
+    
+    $intend = make_intend_str($ref_intend);
+    
+    if ($ref_p_flag) {
+        echo $intend;
+        echo "<p>\n";
+    }
+    
+    echo $intend."\t";
+    
+    if ($ref_mandantory) {
+        echo "* ";
+    }
+    
+    if ($ref_labeltitle != null) {
+        echo "<label for=\"".$ref_select_name."\">".$ref_labeltitle."</label>";
+        if ($ref_newline_flag) {
+            echo "<br />";
+        }
+        echo "\n";
+    }
+    
+    $str_id = $ref_id == null ? " " : " id=\"".$ref_id."\" ";
+    $str_class = $ref_class == null ? " " : " class=\"".$ref_class."\" ";
+    $str_tabindex = $ref_tabindex == null ? " " : " tabindex=\"".$ref_tabindex."\" ";
+    $str_javascript = $ref_javascript == null ? " " : " onchange=\"".$ref_javascript."\" ";
+    
+    echo $intend."\t";
+
+    echo "<input type=\"checkbox\" ".$str_id.$str_class.$str_tabindex.$str_javascript."name=\"".$ref_check_name."\" value=\"".$ref_value."\" ";
+    
+    if ($ref_error_label == $ref_name) {
+        echo $ref_classerrorextension;
+    }
+    echo "\" ";
+    
+    if ($ref_checked == true) {
+        echo "checked ";
+    }
+    
+    echo "/>";
+    
+    if ($ref_p_flag) {
+        echo $intend;
+        echo "</p>\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 (file)
index 0000000..0777c68
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+
+/** $ref_name                       Name des <input>
+ *  $ref_value_input                Daten; null möglich
+ *  $ref_id                         Id des <input>
+ *  $ref_class                      Class des <input>; null möglich
+ *  $ref_tabindex                   Tabindex in der <form>
+ *  $ref_type                       <input>-type (hidden, password, text ...)
+ *  $ref_size                       Größe des Feldes
+ *  $ref_maxlength                  Max. Größe der Eingabe
+ *  $ref_javascript                 Javascript; null möglich
+ *  $ref_mandantory                 Pflichtfeldmarkierung; null möglich
+ *  $ref_labeltitle                 <label>-Text; null möglich
+ *  $ref_p_flag                     true, wenn alles in <p> soll
+ *  $ref_newline_flag               true, wenn <label> ueber <input> stehen soll
+ *  $ref_intend                     Anz. Tabs einrücken
+ * */
+function makeInput($ref_name, $ref_value_input, $ref_id, $ref_class, $ref_tabindex, $ref_type, $ref_size, $ref_maxlength, $ref_javascript, $ref_mandantory, $ref_labeltitle, $ref_p_flag, $ref_newline_flag, $ref_intend) {
+
+       $intend = make_intend_str($ref_intend);
+
+       if ($ref_p_flag) {
+               echo $intend;
+               echo "<p>\n";
+       }
+       
+       echo $intend."\t";
+
+       if ($ref_mandantory) {
+               echo "* ";
+       }
+       
+       if ($ref_labeltitle != null) {
+               echo "<label for=\"".$ref_name."\">".$ref_labeltitle."</label>";
+               if ($ref_newline_flag) {
+                       echo "<br />";
+               }
+               echo "\n";
+       }
+
+       $str_id = $ref_id == null ? " " : " id=\"".$ref_id."\" ";
+       $str_class = $ref_class == null ? " " : " class=\"".$ref_class."\" ";
+       $str_tabindex = $ref_tabindex == null ? " " : " tabindex=\"".$ref_tabindex."\" ";
+       $str_javascript = $ref_javascript == null ? " " : " onchange=\"".$ref_javascript."\" ";
+
+       echo $intend."\t";
+
+       echo "<input ".$str_id.$str_class.$str_tabindex.$str_javascript."name=\"".$ref_name."\" type=\"".$ref_type."\" size=\"".$ref_size."\" maxlength=\"".$ref_maxlength."\" ";
+
+       if (isset($_POST[$ref_name]) && strlen($_POST[$ref_name]) > 0) {
+           echo " value=\"".$_POST[$ref_name]."\"";
+       } else if ($ref_value_input != null ){
+           echo " value=\"".$ref_value_input."\"";
+       }
+       echo "/>\n";
+
+       if ($ref_p_flag) {
+               echo $intend;
+               echo "</p>\n";
+       }
+}
+
+function make_multi_input($ref_name, $ref_type, $ref_size, $ref_maxlength, $ref_tabindex, $ref_id, $ref_labeltitle, $ref_class, $ref_classerrorextension, $ref_error_label, $ref_mandantory, $ref_intend, $ref_p_flag) {
+
+       if ($ref_p_flag) {
+               echo make_intend($ref_intend)."<p>\n";
+       }
+       echo make_intend($ref_intend)."\t";
+       if ($ref_mandantory) {
+               echo "*";
+       }
+       echo "<label for=\"".$ref_name[0]."\">".$ref_labeltitle."</label><br />\n";
+
+       for ($i=0; $i<count($ref_name); $i++) {
+               echo make_intend($ref_intend)."\t<input class=\"".$ref_class[$i];
+               if ($ref_error_label == $ref_name[$i]) {
+                       echo $ref_classerrorextension;
+               }
+               echo "\" type=\"".$ref_type[$i]."\" name=\"".$ref_name[$i]."\" size=\"".$ref_size[$i]."\" maxlength=\"".$ref_maxlength[$i]."\" tabindex=\"".$ref_tabindex[$i]."\" id=\"".$ref_id[$i]."\" ";
+               if (isset($_POST[$ref_name[$i]]) && strlen($_POST[$ref_name[$i]]) > 0) {
+                       echo " value=\"".$_POST[$ref_name[$i]]."\"";
+               }
+               echo "/>\n";
+       }
+       if ($ref_p_flag) {
+               echo make_intend($ref_intend)."</p>\n";
+       }
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/gui/gui_functions_select.php b/src/webui/lib/gui/gui_functions_select.php
new file mode 100644 (file)
index 0000000..6a6c248
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+
+/** $ref_select_name                Name des <select>
+ *  $ref_value_array                Daten-Array; null möglich
+ *  $ref_id                         Id des <select>
+ *  $ref_class                      Class des <select>; null möglich
+ *  $ref_tabindex                   Tabindex in der <form>
+
+ *  $ref_start                      Start-Index statt Datenarray falls Datenarray null
+ *  $ref_end                        End-Index statt Datenarray falls Datenarray null
+ *  $ref_int_preselect              Index vorausgewähltes Element; default -1
+ *  $ref_multiple                   Mehrfachauswahl <select multiple>; default false
+ *  $ref_int_size                   Für mehrzeilige Mehrfachauswahl > 1;
+ *  $ref_javascript                 Javascript; null möglich
+ *  $ref_mandantory                 Pflichtfeldmarkierung; null möglich
+ *  $ref_labeltitle                 <label>-Text; null möglich
+ *  $ref_p_flag                     true, wenn alles in <p> soll
+ *  $ref_newline_flag               true, wenn <label> ueber <select> stehen soll
+ *  $ref_intend                     Anz. Tabs einrücken
+ * */
+function makeSelect($ref_select_name, $ref_value_array, $ref_id, $ref_class, $ref_tabindex, $ref_start, $ref_end, $ref_int_preselect, $ref_multiple, $ref_int_size, $ref_javascript, $ref_mandantory, $ref_labeltitle, $ref_p_flag, $ref_newline_flag, $ref_intend) {
+
+       $intend = make_intend_str($ref_intend);
+
+    if ($ref_p_flag) {
+        echo $intend;
+        echo "<p>\n";
+    }
+
+       echo $intend."\t";
+
+    if ($ref_mandantory) {
+        echo "* ";
+    }
+    
+       if ($ref_labeltitle != null) {
+               echo "<label for=\"".$ref_select_name."\">".$ref_labeltitle."</label>";
+               if ($ref_newline_flag) {
+                       echo "<br />";
+               }
+               echo "\n";
+       }
+
+       $str_id = $ref_id == null ? " " : " id=\"".$ref_id."\" ";
+       $str_class = $ref_class == null ? " " : " class=\"".$ref_class."\" ";
+       $str_tabindex = $ref_tabindex == null ? " " : " tabindex=\"".$ref_tabindex."\" ";
+       $str_javascript = $ref_javascript == null ? " " : " onchange=\"".$ref_javascript."\" ";
+
+       echo $intend."\t";
+
+       echo "<select ".$str_id.$str_class.$str_tabindex.$str_javascript."name=\"".$ref_select_name."\" size=\"".$ref_int_size."\" "." ";
+       if ($ref_multiple == true) {
+               echo "multiple=\"multiple\" ";
+       }
+       echo ">\n";
+
+       if ($ref_value_array != null) {
+
+               // Flag: True, falls das Datenarray multidimensional ist. Dann wird das Attribut value in <option> mit dem wert aus dem Unterarray gefüllt, ansonsten wird der Schleifenindex verwendet.
+               $multiDimensionalArrayFlag = is_array($ref_value_array[0]);
+
+               for ($i=0; $i<count($ref_value_array); $i++) {
+                       echo $intend;
+                       echo "\t\t<option value=\"".($multiDimensionalArrayFlag ? $ref_value_array[$i][0] : $i)."\"";
+                       if (($multiDimensionalArrayFlag ? $ref_value_array[$i][0] : ($i+1)) == $ref_int_preselect) { // $i-1 deshalb, weil das Array mit dem 0-ten Element beginnt, der Value aber mit 1 anfängt
+                               echo " selected";
+                       }
+                       echo ">".($multiDimensionalArrayFlag ? $ref_value_array[$i][1] : $ref_value_array[$i])."</option>\n";
+               }
+       } else {
+               for ($i=$ref_start; $i<(1+$ref_end); $i++) {
+                       echo $intend;
+                       echo "\t\t<option value=\"".$i."\"";
+                       if ($i == $ref_int_preselect) {
+                               echo " selected";
+                       }
+                       echo ">".$i."</option>\n";
+               }
+       }
+
+       echo $intend."\t";
+       echo "</select>\n";
+
+       if ($ref_p_flag) {
+               echo $intend;
+               echo "</p>\n";
+       }
+}
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/gui/gui_functions_textarea.php b/src/webui/lib/gui/gui_functions_textarea.php
new file mode 100644 (file)
index 0000000..f733cac
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+
+/**
+ *  $ref_name                        Name der <trxtarea>
+ *  $ref_value_input                Daten; null möglich
+ *  $ref_id                         Id des <input>
+ *  $ref_class                      Class des <input>; null möglich
+ *  $ref_tabindex                   Tabindex in der <form>
+ * 
+ * @param unknown $ref_classerrorextension
+ * @param unknown $ref_error_label
+ * @param unknown $ref_cols
+ * @param unknown $ref_rows
+ * 
+ *  $ref_javascript                 Javascript; null möglich
+ * 
+ *  $ref_mandantory                 Pflichtfeldmarkierung; null möglich
+ *  $ref_labeltitle                 <label>-Text; null möglich
+ *  $ref_p_flag                     true, wenn alles in <p> soll
+ *  $ref_newline_flag               true, wenn <label> ueber <input> stehen soll
+ *  $ref_intend                     Anz. Tabs einrücken
+ */
+function makeTextarea($ref_name, $ref_value_input, $ref_id, $ref_class, $ref_tabindex, $ref_classerrorextension, $ref_error_label, $ref_cols, $ref_rows, $ref_javascript, $ref_mandantory, $ref_labeltitle, $ref_p_flag, $ref_newline_flag, $ref_intend) {
+
+       if ($ref_p_flag) {
+               echo make_intend($ref_intend)."<p>\n";
+       }
+       
+       echo make_intend($ref_intend)."\t";
+       
+       if ($ref_mandantory) {
+               echo "*";
+       }
+       
+       if ($ref_labeltitle != null) {
+           echo "<label for=\"".$ref_name."\">".$ref_labeltitle."</label>";
+           if ($ref_newline_flag) {
+               echo "<br />";
+           }
+           echo "\n";
+       }
+       
+       echo make_intend($ref_intend)."\t<textarea ";
+       
+       if ($ref_error_label == $ref_name) {
+               echo $ref_classerrorextension;
+       }
+       
+       $str_id = $ref_id == null ? " " : " id=\"".$ref_id."\" ";
+       $str_class = $ref_class == null ? " " : " class=\"".$ref_class."\" ";
+       $str_tabindex = $ref_tabindex == null ? " " : " tabindex=\"".$ref_tabindex."\" ";
+       
+       echo " ".$str_id.$str_class.$str_tabindex."name=\"".$ref_name."\" cols=\"".$ref_cols."\" rows=\"".$ref_rows."\" >\n";
+       
+       if (isset($_POST[$ref_name]) && strlen($_POST[$ref_name]) > 0) {
+               echo $_POST[$ref_name];
+       } else if ($ref_value_input != null ){
+           echo $ref_value_input;
+       }
+       
+       echo "</textarea>\n";
+       
+       if ($ref_p_flag) {
+               echo make_intend($ref_intend)."</p>\n";
+       }
+}
+
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/gui_functions.php b/src/webui/lib/gui_functions.php
new file mode 100644 (file)
index 0000000..7211d0e
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+require ("gui/gui_functions_button.php");
+require ("gui/gui_functions_checkbox.php");
+require ("gui/gui_functions_input.php");
+require ("gui/gui_functions_select.php");
+require ("gui/gui_functions_textarea.php");
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/util/util_functions.php b/src/webui/lib/util/util_functions.php
new file mode 100644 (file)
index 0000000..c45e5d1
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+
+function debugPrint($param) {
+       echo "<p>";
+       if (is_array($param)) {
+               if ($asList) {
+                   debugPrintAsList($param);
+               } else {
+                       echo "_";
+                       foreach ($param as $p) {
+                               echo $p."_";
+                       }
+               }
+       } else {
+               echo $param;
+       }
+       echo "</p>\n";
+}
+
+function debugPrintAsList($param) {
+       echo "<ol>\n";
+       foreach ($param as $p) {
+               echo "<li>".$p."_</li>\n";
+       }
+       echo "</ol>\n";
+}
+
+function coordinates ($ref_longitude, $ref_latitude) {
+       $return_geo = array("","");
+
+       $return_geo[0] = $ref_longitude[0] + $ref_longitude[1]/60 + $ref_longitude[2]/3600;
+       $return_geo[1] = $ref_latitude[0] + $ref_latitude[1]/60 + $ref_latitude[2]/3600;
+
+       return $return_geo;
+}
+
+function find_pos_in_array($ref_array, $ref_value) {
+       $pos = -1;
+       
+       for ($i=0; $i<count($ref_array); $i++) {
+               if ($ref_array[$i] == $ref_value) {
+                       $pos = $i;
+               }
+       }
+       
+       return $pos;
+}
+
+function make_intend($ref_count) {
+       for ($i=0; $i<$ref_count; $i++) {
+               echo "\t";
+       }
+}
+
+function make_intend_str($ref_count) {
+       $intend = "";
+       for ($i=0; $i<$ref_count; $i++) {
+               $intend .= "\t";
+       }
+       return $intend;
+}
+
+
+function handleQuickUpdate ($ref_POST, $connect_dbms_handle, $current_user, $page) {
+    $update_arr = array();
+    $issue = 0;
+    
+    foreach (array_keys($ref_POST) as $post) {
+        echo $post." => ".$_POST[$post]."\n";
+        
+        $change = explode ("#", $post);
+        var_dump($change);
+        
+        $start_iata = substr($change[0],0,3);
+        $ziel_iata = substr($change[0],4,3);
+        
+        $value=$change[1];
+        
+        array_push($update_arr, array($value,"true"));
+    }
+    
+    $sqlupdate = generateUpdateSchema(SCHEMA, "strecke", array(array("aktiv","false"),array("in_arbeit","false"),array("komplett","false")), array("start_iata='".$start_iata."'", "ziel_iata='".$ziel_iata."'"));
+    echo "<hr />".$sqlupdate;
+    $sqlupdate_result = getBooleanData($connect_dbms_handle, $sqlupdate);
+    
+    $sqlupdate = generateUpdateSchema(SCHEMA, "strecke", $update_arr, array("start_iata='".$start_iata."'", "ziel_iata='".$ziel_iata."'"));
+    echo "<hr />".$sqlupdate;
+    $sqlupdate_result = getBooleanData($connect_dbms_handle, $sqlupdate);
+    
+    return null;
+}
+
+?>
\ No newline at end of file
diff --git a/src/webui/lib/util_functions.php b/src/webui/lib/util_functions.php
new file mode 100644 (file)
index 0000000..63b5bd3
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+
+require ("util/util_functions.php");
+
+
+?>
\ No newline at end of file
diff --git a/src/webui/stylesheet/airline_main.css b/src/webui/stylesheet/airline_main.css
new file mode 100644 (file)
index 0000000..1a51713
--- /dev/null
@@ -0,0 +1,201 @@
+body {
+       font-size: 100.01%;
+       font-family:  sans-serif, Verdana;
+}
+
+.container {
+       display: flex;
+       flex-wrap: wrap;
+}
+
+table, th, td {
+    border-collapse: collapse;
+
+}
+
+table, th, td {
+  border: 1px solid;
+}
+
+th, td {
+  padding: 5px;
+  text-align: right;
+}
+
+       .issuebox {
+  background-color: #f8f8f8;
+  --width: 18em;
+  margin: 10px;
+  border: 1px solid #000000;
+  display: grid;
+  grid-template-columns: auto auto auto;
+  --row-gap: 0.5em;
+  gap: 0.25em;
+}
+
+.singleissue {
+  background-color: #f8f8f8;
+  --width: 18em;
+  margin: 10px;
+  border: 1px solid #000000;
+  display: grid;
+  grid-template-columns: auto auto;
+  --row-gap: 0.5em;
+  gap: 0.25em;
+}
+
+.boxelem {
+    --margin: 0.2em 0.1em;
+    padding: 0.2em 0.1em;
+    --border: 1px dotted #0000ff;
+    background-color: #ffffff;
+}
+
+.col2 {
+    grid-column: 1 / span 2;
+    --background-color: #ffddcc;
+}
+
+.col2ab2 {
+    grid-column: 2 / span 2;
+    --background-color: #ffddcc;
+}
+
+.col3 {
+    grid-column: 1 / span 3;
+    --background-color: #ffddcc;
+}
+
+.col4 {
+    grid-column: 1 / span 4;
+    --background-color: #ffddcc;
+}
+
+.keywords {
+    font-weight: 400;
+       font-size: 75%;
+}
+
+.headline {
+    background-color: #99fdfd;
+    font-weight: 700;
+       font-size: 125%;
+       text-align: center;
+}
+
+.datum {
+       font-size:      66.6%;
+}
+
+.boxelemdescr {
+       font-style: italic;
+       font-size:      85%;
+}
+
+.center {
+       text-align: center;
+}
+
+.right {
+       text-align: right;
+}
+
+.inputbtn {
+  border: 1px solid #000000;
+  background-color: #eeeeee;
+  font-size: inherit;
+  cursor: text;
+  display: inline-block;
+}
+
+.selectbtn {
+  border: 1px solid #000000;
+  background-color: #eeeeee;
+  font-size: inherit;
+  cursor: pointer;
+  display: inline-block;
+}
+
+.btn {
+  border: 1px solid #000000;
+  background-color: #fafada;
+  font-size: inherit;
+  cursor: pointer;
+  display: inline-block;
+}
+
+.link {
+  border: none;
+  text-decoration: none;
+  color:       #000000;
+  background-color: inherit;
+  font-size: inherit;
+  cursor: pointer;
+  display: inline-block;
+}
+
+.link:hover {
+       background: #eeeeee;
+}
+/*
+.linkbtn {
+  border: none;
+  background-color: inherit;
+  font-size: inherit;
+  cursor: pointer;
+  display: inline-block;
+}
+
+.linkbtn:hover {
+       background: #eeeeee;
+}
+*/
+.tooltip {
+  position: relative;
+  display: inline-block;
+  --border-bottom: 1px dotted black;
+}
+
+.tooltip .tooltiptext {
+  visibility: hidden;
+  background-color: #f8f8f8;
+  border: 1px solid #99fdfd;
+       font-size: 75%;
+  text-align: center;
+  border-radius: 0.1em;
+  padding: 0.25em;
+
+  /* Position the tooltip */
+  position: absolute;
+  z-index: 1;
+}
+
+.tooltip:hover .tooltiptext {
+  visibility: visible;
+  
+@media only screen and (min-width: 320px)  {
+                body {
+                  font-size: 200%;
+                }
+                
+               .keywords {
+                       font-size: 150%;
+               }
+               
+               .tooltip .tooltiptext {
+                       font-size: 150%;
+               }
+               
+               .headline {
+                       font-size: 250%;
+               }
+               
+               .datum {
+                       font-size:      133.3%;
+               }
+               
+               .boxelemdescr {
+                       font-size:      170%;
+               }
+       }
+}