Files
ritzenbergen-backend/bulitipp/buli-punkte.php
2025-06-16 21:42:22 +02:00

141 lines
4.7 KiB
PHP
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BuLi-Punkte</title>
<link rel="stylesheet" href="bulitipp2.css">
</head>
<body>
<style>
h1{
text-align: center;
}
</style>
<?php
include("../../mysqlverbinden.php");
include("../rowforeach.php");
$ansichten=["spiel","user","user-preview"];
if(!isset($_GET["spieltag"])) die("GET spieltag fehlt");
$spieltag=$_GET["spieltag"];
if(!isset($_GET["paarung"])) die("GET paarung fehlt");
$paarungid=$_GET["paarung"];
if(!isset($_GET["detail"])) die("GET detail fehlt");
$detail=$_GET["detail"];
if(!isset($_GET["name"])) die("GET name fehlt");
$name=$_GET["name"];
if(!in_array($detail,$ansichten)) die("Ungültige Ansicht");
include("./inc.php");
$paarungsql=srowforeach("SELECT heim, gast from `buli-paarungen` where `id`=?;",[$paarungid]);
if(count($paarungsql)==0) $paarung=null;
else $paarung=$paarungsql[0];
if($detail=="spiel") $results=srowforeach("SELECT score1,score2 from `buli-results` where `paarung`=? AND `spieltag`=?;",[$paarungid,$spieltag])[0];
if($detail=="spiel"){
?>
<h1 class="detailansichtSchriftart">Detailansicht, <?php echo $spieltag; ?>. Spieltag</h1>
<h2 class="detailansichtSchriftart"><?php echo $paarung[0]; ?> - <?php echo $paarung[1]; ?></h2>
<h1><?php echo $results[0]; ?> - <?php echo $results[1]; ?></h1>
<table class="detailansichtSchriftart">
<tr>
<td>Name</td>
<td>Tipp</td>
<td>Punkte</td>
<td>Gesamtpunkte</td>
</tr>
<?php
foreach (rowforeach("SELECT `username` from `buli-user`;") as $key => $value) {
$name=$value[0];
$punkte=ps($name,$spieltag,$paarungid);
$gesamtpunkte=gs($name,$spieltag);
$tipp=getTipp($name,$spieltag,$paarungid);
$tippstr=($tipp==null)?"-":$tipp[0]." - ".$tipp[1];
?>
<tr>
<td><?php echo $name; ?></td>
<td><?php echo $tippstr; ?></td>
<td><?php echo $punkte; ?></td>
<td><?php echo $gesamtpunkte; ?></td>
</tr>
<?php
}
?>
</table>
<?php
}else if($detail=="user"){
?>
<h1 class="detailansichtSchriftart">Detailansicht für <?php echo $name; ?>, <?php echo $spieltag; ?>. Spieltag</h1>
<table class="detailansichtSchriftart">
<tr>
<td>Tipp von <?php echo $name; ?></td>
<td>Ergebnis</td>
<td>Tipp</td>
<td>Punkte</td>
</tr>
<?php
foreach(srowforeach("SELECT paarung, score1, score2 from `buli-results` where spieltag=?;",[$spieltag]) as $key=>$value){
$id=$value[0];
$score1=$value[1];
$score2=$value[2];
$tipp=getTipp($name,$spieltag,$id);
$paarungQuery=srowforeach("SELECT heim, gast from `buli-paarungen` where id=?;",[$id])[0];
$heim=$paarungQuery[0];
$gast=$paarungQuery[1];
$punkte=ps($name,$spieltag,$id);
$tippstr=($tipp==null)?"-":$tipp[0]." - ".$tipp[1];
?>
<tr>
<td><?php echo $heim; ?> - <?php echo $gast; ?></td>
<td><?php echo $score1; ?> - <?php echo $score2; ?></td>
<td><?php echo $tippstr; ?></td>
<td><?php echo $punkte; ?></td>
</tr>
<?php
}
?>
</table>
<?php
}else if($detail=="user-preview"){
?>
<h1 class="detailansichtSchriftart">Detailansicht für <?php echo $name; ?>, <?php echo $spieltag; ?>. Spieltag</h1>
<table class="detailansichtSchriftart">
<tr>
<td>Paarung</td>
<td>Tipp von <?php echo $name; ?></td>
</tr>
<?php
foreach(srowforeach("SELECT `id`,`heim`,`gast` from `buli-paarungen` where spieltag=?;",[$spieltag]) as $key=>$value){
$id=$value[0];
$tipp=getTipp($name,$spieltag,$id);
$heim=$value[1];
$gast=$value[2];
$tippstr=($tipp==null)?"-":$tipp[0]." - ".$tipp[1];
?>
<tr>
<td><?php echo $heim; ?> - <?php echo $gast; ?></td>
<td><?php echo $tippstr; ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</body>
</html>