diff --git a/app/public/add_station.php b/app/public/add_station.php
index 7ca9f53..7913a2c 100644
--- a/app/public/add_station.php
+++ b/app/public/add_station.php
@@ -8,7 +8,8 @@
if(isset($_POST['save'])){
$station_name = sanitize_input($_POST['station_name']);
$station_pos = sanitize_input($_POST['station_pos']);
- write_station($con, $station_name, $station_pos);
+ $station_direct_points = sanitize_input($_POST['direkte_punkte']);
+ write_station($con, $station_name, $station_pos, $station_direct_points);
}
header("Location: stationen.php");
die;
@@ -34,6 +35,13 @@
+
+
+
+
Schließen
diff --git a/app/public/edit_station.php b/app/public/edit_station.php
index a53cac5..38eab12 100644
--- a/app/public/edit_station.php
+++ b/app/public/edit_station.php
@@ -16,11 +16,13 @@
$station_name = sanitize_input($_POST['station_name']);
$station_pos = sanitize_input($_POST['station_pos']);
$station_gewertet = sanitize_input($_POST['gewertet']);
+ $station_direct_points = sanitize_input($_POST['direkte_punkte']);
$station = get_station_all($con, $station_id)->fetch();
$s_id = intval($station['s_id']);
$name = strval($station['name']);
$standort = strval($station['standort']);
$gewertet = intval($station['gewertet']);
+ $direct_points = intval($station['direkte_punkte']);
if($name != $station_name) {
update_station_name($con, $s_id, $station_name);
}
@@ -32,6 +34,10 @@
if($gewertet != $station_gewertet) {
update_station_gewertet($con, $s_id, $station_gewertet);
}
+
+ if($direct_points != $station_direct_points) {
+ update_station_direct_points($con, $s_id, $station_direct_points);
+ }
}
header("Location: stationen.php");
die;
@@ -62,6 +68,13 @@
+
+
+
+
/>
diff --git a/app/public/stationen.php b/app/public/stationen.php
index ad826d7..a1288c0 100644
--- a/app/public/stationen.php
+++ b/app/public/stationen.php
@@ -43,6 +43,7 @@
Name |
Standort |
Gewertet |
+ Direkt Punkte eintragen |
diff --git a/app/scripts/database_queries.php b/app/scripts/database_queries.php
index c9bfbc8..6149d38 100644
--- a/app/scripts/database_queries.php
+++ b/app/scripts/database_queries.php
@@ -167,11 +167,12 @@ function write_points($con, $s_id, $m_id, $points, $time) {
}
}
-function write_station($con, $station_name, $station_pos) {
+function write_station($con, $station_name, $station_pos, $station_direct_points) {
try {
- $stmt = $con->prepare("INSERT INTO Station (name, standort) VALUES (?, ?)");
+ $stmt = $con->prepare("INSERT INTO Station (name, standort, direkte_punkte) VALUES (?, ?, ?)");
$stmt->bindParam(1, $station_name, PDO::PARAM_STR);
$stmt->bindParam(2, $station_pos, PDO::PARAM_STR);
+ $stmt->bindParam(3, $station_direct_points, PDO::PARAM_INT);
$stmt->execute();
} catch(PDOException $e) {
handle_pdo_exceptio($e);
@@ -426,6 +427,17 @@ function update_station_gewertet($con, $s_id, $gewertet) {
}
}
+function update_station_direct_points($con, $s_id, $direct_points) {
+ try {
+ $stmt = $con->prepare("UPDATE Station SET direkte_punkte = ? WHERE s_id = ?");
+ $stmt->bindParam(1, $direct_points, PDO::PARAM_INT);
+ $stmt->bindParam(2, $s_id, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch(PDOExeption $e) {
+ handle_pdo_exception($e);
+ }
+}
+
function get_team($con, $m_id) {
try {
$stmt = $con->prepare("SELECT * FROM Mannschaft WHERE m_id = :m_id");
diff --git a/app/scripts/functions.php b/app/scripts/functions.php
index 34e90bf..9bc2dff 100644
--- a/app/scripts/functions.php
+++ b/app/scripts/functions.php
@@ -38,14 +38,20 @@ function load_stations_table($con) {
$stmt = get_stations_all($con);
foreach($stmt->fetchAll() as $row) {
if ($row['gewertet'] == '1') {
- $checked = "ja";
+ $checked = "Ja";
} else {
- $checked = "nein";
+ $checked = "Nein";
+ }
+ if ($row['direkte_punkte'] == '1') {
+ $direkte_punkte = "Ja";
+ } else {
+ $direkte_punkte = "Nein";
}
echo "";
echo "| " . $row['name'] . " | ";
echo "" . $row['standort'] . " | ";
echo "". $checked . " | ";
+ echo "" . $direkte_punkte . " | ";
echo "
";
}
}