Points are now only counted if it is selected
This commit is contained in:
@@ -14,10 +14,12 @@
|
|||||||
$station_id = sanitize_input($_POST['station_id']);
|
$station_id = sanitize_input($_POST['station_id']);
|
||||||
$station_name = sanitize_input($_POST['station_name']);
|
$station_name = sanitize_input($_POST['station_name']);
|
||||||
$station_pos = sanitize_input($_POST['station_pos']);
|
$station_pos = sanitize_input($_POST['station_pos']);
|
||||||
|
$station_gewertet = sanitize_input($_POST['gewertet']);
|
||||||
$station = get_station_all($con, $station_id)->fetch();
|
$station = get_station_all($con, $station_id)->fetch();
|
||||||
$s_id = intval($station['s_id']);
|
$s_id = intval($station['s_id']);
|
||||||
$name = strval($station['name']);
|
$name = strval($station['name']);
|
||||||
$standort = strval($station['standort']);
|
$standort = strval($station['standort']);
|
||||||
|
$gewertet = intval($station['gewertet']);
|
||||||
if($name != $station_name) {
|
if($name != $station_name) {
|
||||||
update_station_name($con, $s_id, $station_name);
|
update_station_name($con, $s_id, $station_name);
|
||||||
}
|
}
|
||||||
@@ -25,6 +27,10 @@
|
|||||||
if($standort != $station_pos) {
|
if($standort != $station_pos) {
|
||||||
update_station_pos($con, $s_id, $station_pos);
|
update_station_pos($con, $s_id, $station_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($gewertet != $station_gewertet) {
|
||||||
|
update_station_gewertet($con, $s_id, $station_gewertet);
|
||||||
|
}
|
||||||
header("Location: stationen.php");
|
header("Location: stationen.php");
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
@@ -47,6 +53,13 @@
|
|||||||
<span></span>
|
<span></span>
|
||||||
<label for="station_pos">Stations Standort:</label>
|
<label for="station_pos">Stations Standort:</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="dropdown">
|
||||||
|
<label for="gewertet">Wertung:</label>
|
||||||
|
<select name="gewertet" id="gewertet">
|
||||||
|
<option value="1" <?php if($row['gewertet'] == '1'){echo " selected";}?>>Ja</option>
|
||||||
|
<option value="0" <?php if($row['gewertet'] == '0'){echo " selected";}?>>Nein</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<input type="hidden" name="station_id" <?php echo "value=\"" . $row ['s_id'] . "\""?>/>
|
<input type="hidden" name="station_id" <?php echo "value=\"" . $row ['s_id'] . "\""?>/>
|
||||||
<input type="submit" value="Speichern" class="btn-confirm"/>
|
<input type="submit" value="Speichern" class="btn-confirm"/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
<th scope="col">Standort</th>
|
<th scope="col">Standort</th>
|
||||||
|
<th scope="col">Gewertet</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ function get_teams($con) {
|
|||||||
|
|
||||||
function get_total_score($con) {
|
function get_total_score($con) {
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare("SELECT M.name as Mannschaftsname, M.feuerwehr as Feuerwehr, SUM(P.punkte) as Gesamtpunkte FROM Punkte as P, Mannschaft as M WHERE P.m_id = M.m_id GROUP BY M.m_id ORDER BY Gesamtpunkte DESC");
|
$stmt = $con->prepare("SELECT M.name as Mannschaftsname, M.feuerwehr as Feuerwehr, SUM(P.punkte) as Gesamtpunkte FROM Punkte as P, Mannschaft as M, Station as S WHERE P.m_id = M.m_id AND P.s_id = S.s_id AND S.gewertet = \"1\" GROUP BY M.m_id ORDER BY Gesamtpunkte DESC");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
return $stmt;
|
return $stmt;
|
||||||
@@ -393,6 +393,17 @@ function update_station_pos($con, $s_id, $pos) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_station_gewertet($con, $s_id, $gewertet) {
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare("UPDATE Station SET gewertet = ? WHERE s_id = ?");
|
||||||
|
$stmt->bindParam(1, $gewertet, 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) {
|
function get_team($con, $m_id) {
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare("SELECT * FROM Mannschaft WHERE m_id = :m_id");
|
$stmt = $con->prepare("SELECT * FROM Mannschaft WHERE m_id = :m_id");
|
||||||
|
|||||||
@@ -37,9 +37,15 @@ function generate_password_hash($password, $salt) {
|
|||||||
function load_stations_table($con) {
|
function load_stations_table($con) {
|
||||||
$stmt = get_stations_all($con);
|
$stmt = get_stations_all($con);
|
||||||
foreach($stmt->fetchAll() as $row) {
|
foreach($stmt->fetchAll() as $row) {
|
||||||
|
if ($row['gewertet'] == '1') {
|
||||||
|
$checked = "ja";
|
||||||
|
} else {
|
||||||
|
$checked = "nein";
|
||||||
|
}
|
||||||
echo "<tr id=\"" . $row['s_id'] . "\">";
|
echo "<tr id=\"" . $row['s_id'] . "\">";
|
||||||
echo "<td>" . $row['name'] . "</td>";
|
echo "<td>" . $row['name'] . "</td>";
|
||||||
echo "<td>" . $row['standort'] . "</td>";
|
echo "<td>" . $row['standort'] . "</td>";
|
||||||
|
echo "<td>". $checked . "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user