diff --git a/PHP.Dockerfile b/PHP.Dockerfile
index dea799e..46caafb 100644
--- a/PHP.Dockerfile
+++ b/PHP.Dockerfile
@@ -9,6 +9,5 @@ RUN docker-php-ext-install pdo pdo_mysql
# install xdebug for php
RUN pecl install xdebug && docker-php-ext-enable xdebug
-# install ldap module
-RUN apt install -y libldap2-dev
-RUN docker-php-ext-install ldap
\ No newline at end of file
+# create log folder
+RUN mkdir /logs
\ No newline at end of file
diff --git a/app/public/edit_station.php b/app/public/edit_station.php
index e69de29..6a2805c 100644
--- a/app/public/edit_station.php
+++ b/app/public/edit_station.php
@@ -0,0 +1,48 @@
+fetch();
+ include("header_footer/header.php");
+ }
+
+ if($_SERVER['REQUEST_METHOD'] == "POST") {
+ $station = get_station_all($con, $_POST['station_id'])->fetch();
+ $s_id = intval($station['s_id']);
+ $name = strval($station['name']);
+ $standort = strval($station['standort']);
+ if($name != $_POST['station_name']) {
+ update_station_name($con, $s_id, $_POST['station_name']);
+ }
+
+ if($standort != $_POST['station_pos']) {
+ update_station_pos($con, $s_id, $_POST['station_pos']);
+ }
+ header("Location: stationen.php");
+ die;
+ }
+?>
+
+
+
+
Station bearbeiten
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/public/index.php b/app/public/index.php
index 0e0a75e..3310ce7 100644
--- a/app/public/index.php
+++ b/app/public/index.php
@@ -5,7 +5,7 @@
$user_data = check_login($con);
- include("header_footer/header.php");
+ include("header_footer/header.php");
?>
diff --git a/app/public/js/edit_table.js b/app/public/js/edit_table.js
index 3324258..4cf396f 100644
--- a/app/public/js/edit_table.js
+++ b/app/public/js/edit_table.js
@@ -6,12 +6,13 @@ if (document.readyState == "complete") {
}
function init() {
- if(document.getElementById('table') != null) {
+ if(document.getElementById('table') != null && document.getElementsByClassName('edit')[0] != null) {
highlight_row();
}
user_edit_button();
statistic_edit_button();
+ station_edit_button();
}
var selected = null;
@@ -65,4 +66,15 @@ function statistic_edit_button() {
this.form.submit();
}
}
+}
+
+function station_edit_button() {
+ var button = document.getElementById('edit_station');
+ if(button != null) {
+ button.onclick = function() {
+ var row = document.getElementsByClassName("selected")[0];
+ document.getElementById('s_id').value = row.id;
+ this.form.submit();
+ }
+ }
}
\ No newline at end of file
diff --git a/app/public/stationen.php b/app/public/stationen.php
index 6401289..f010403 100644
--- a/app/public/stationen.php
+++ b/app/public/stationen.php
@@ -5,7 +5,7 @@
include("../scripts/functions.php");
$user_data = check_login($con);
- include("header_footer/header.php");
+ include("header_footer/header.php");
?>
@@ -17,6 +17,12 @@
+
+
+
diff --git a/app/scripts/database_queries.php b/app/scripts/database_queries.php
index 65d14d2..22a2008 100644
--- a/app/scripts/database_queries.php
+++ b/app/scripts/database_queries.php
@@ -358,4 +358,39 @@ function change_time($con, $m_id, $s_id, $time) {
} catch(PDOException $e) {
handle_pdo_exception($e);
}
+}
+
+function get_station_all($con, $s_id) {
+ try {
+ $stmt = $con->prepare("SELECT * FROM Station WHERE s_id = :s_id");
+ $stmt->execute(['s_id' => $s_id]);
+ $stmt->setFetchMode(PDO::FETCH_ASSOC);
+ return $stmt;
+ } catch(PDOException $e) {
+ handle_pdo_exception($e);
+ }
+}
+
+function update_station_name($con, $s_id, $name) {
+ try {
+ echo $s_id . "\n";
+ echo $name . "\n";
+ $stmt = $con->prepare("UPDATE Station SET name = ? WHERE s_id = ?");
+ $stmt->bindParam(1, $name, PDO::PARAM_STR);
+ $stmt->bindParam(2, $s_id, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch(PDOException $e) {
+ handle_pdo_exception($e);
+ }
+}
+
+function update_station_pos($con, $s_id, $pos) {
+ try {
+ $stmt = $con->prepare("UPDATE Station SET standort = ? WHERE s_id = ?");
+ $stmt->bindParam(1, $pos, PDO::PARAM_STR);
+ $stmt->bindParam(2, $s_id, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch(PDOException $e) {
+ handle_pdo_exception($e);
+ }
}
\ No newline at end of file
diff --git a/app/scripts/functions.php b/app/scripts/functions.php
index 5ad2bac..0ac2913 100644
--- a/app/scripts/functions.php
+++ b/app/scripts/functions.php
@@ -35,9 +35,9 @@ function generate_password_hash($password, $salt) {
}
function load_stations_table($con) {
- $stmt = get_stations($con);
+ $stmt = get_stations_all($con);
foreach($stmt->fetchAll() as $row) {
- echo "";
+ echo "
";
echo "| " . $row['name'] . " | ";
echo "" . $row['standort'] . " | ";
echo "
";