Files
PunkteSystem-KSP/app/public/statistik.php
2022-06-09 16:47:35 +02:00

65 lines
1.8 KiB
PHP

<?php
session_start();
include("../scripts/connection.php");
include("../scripts/functions.php");
$user_data = check_login($con);
if(isset($_GET['stationen'])) {
$_SESSION['select-statistics'] = $_GET['stationen'];
}
if(!isset($_SESSION['select-statistics']) || $_SESSION['select-statistics'] == "total-score") {
$session = "total-score";
} else {
$session = $_SESSION['select-statistics'];
}
echo file_get_contents("html/header.html");
?>
<body>
<div class="headline">
<?php
if($session == "total-score") {
echo "<h2>Gesamtpunkte</h2\n";
} else {
echo "<h2>" . get_station_name($con, $session)['name'] . "</h2>\n";
}
?>
</div>
<div>
<form name="switch-statistics" method="get">
<select name="stationen" id="station" onchange="this.form.submit()">
<?php
load_options_stations($con, $session);
?>
</select>
</form>
<?php
if($session != "total-score" && get_teams_no_points($con, $session)->rowCount() > 0) {
echo "<form action=\"add_entry.php\" method=\"get\">
<input type=\"hidden\" name=\"station\" value=\"$session\"/>
<input type=\"submit\" value=\"Ergebniss eintragen\"/>
</form>";
}
?>
</div>
<div class="table-div">
<table>
<?php
if($session == "total-score") {
load_total_score($con);
} else {
load_station_table($con, $session);
}
?>
</table>
</div>
</body>
<?php
echo file_get_contents("html/footer.html");
$con=null;
?>