Side med påmeldinger

This commit is contained in:
Trygve 2024-10-11 18:04:42 +02:00
parent 40f8468cd4
commit 91ada2809d
2 changed files with 57 additions and 4 deletions

View File

@ -8,9 +8,11 @@ class Runner
{ {
public int $id; public int $id;
public string $name; public string $name;
public string $club;
public string $course;
public array $splits; public array $splits;
function __construct($id, $name) function __construct($id, $name, $club, $course)
{ {
//echo($id); //echo($id);
//echo($name); //echo($name);
@ -20,6 +22,8 @@ class Runner
} }
$this->id = $id; $this->id = $id;
$this->name = $name; $this->name = $name;
$this->club = $club;
$this->course = $course;
for ($i = 0; $i < $GLOBALS['number_of_controls']; $i++) { for ($i = 0; $i < $GLOBALS['number_of_controls']; $i++) {
$this->splits[$i] = false; $this->splits[$i] = false;
} }
@ -83,7 +87,7 @@ $csv_runners = str_getcsv($csv_runners, "\n");
//print_r($csv_runners); //print_r($csv_runners);
for ($i = 1; $i < count($csv_runners); $i++) { for ($i = 1; $i < count($csv_runners); $i++) {
$line = str_getcsv($csv_runners[$i]); $line = str_getcsv($csv_runners[$i]);
array_push($runners, new Runner($line[0], $line[1])); array_push($runners, new Runner($line[0], $line[1], $line[2], $line[3]));
} }
@ -107,9 +111,10 @@ for ($i = 0; $i < count($timings); $i++) {
$runner->set_split($line[0]-1, $time); $runner->set_split($line[0]-1, $time);
} }
usort($runners, "cmp");
if (!isset($query)){
$query = explode(",",$_SERVER['QUERY_STRING']); $query = explode(",",$_SERVER['QUERY_STRING']);
}
if ($query[0] == "registrering"){ if ($query[0] == "registrering"){
$matpost = $query[1]; $matpost = $query[1];
@ -153,7 +158,19 @@ if ($query[0] == "registrering"){
echo ("<tr $cssclass><td>". $i+1 .".</td><td>$runner->id</td><td>$runner->name</td><td>$tid_1_mat</td><td>$tid_2_mat</td><td>$tid_maal</td><td>$button</td></tr>\n"); echo ("<tr $cssclass><td>". $i+1 .".</td><td>$runner->id</td><td>$runner->name</td><td>$tid_1_mat</td><td>$tid_2_mat</td><td>$tid_maal</td><td>$button</td></tr>\n");
} }
} }
elseif ($query[0] == "paameldte") {
echo(" <tr>
<th>Navn</th>
<th>Klubb/Forening</th>
<th>Variant</th>
</tr>");
for ($i = 0; $i < count($runners); $i++) {
$runner = $runners[$i];
echo ("<td>$runner->name</td><td>$runner->club</td><td>$runner->course</td></tr>\n");
}
}
else { else {
usort($runners, "cmp");
echo(" <tr> echo(" <tr>
<th>#</th> <th>#</th>
<th>Startnummer</th> <th>Startnummer</th>

36
paameldte.php Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="UTF-8" />
<title>Påmeldte kadaverløpet</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="Elektronisk Kadaver Tidtakningssystem" />
<link rel="stylesheet" href="matcha.css">
<style>
@media (prefers-color-scheme: dark) {
.invert {
filter: invert(1);
}
}
</style>
</head>
<body>
<div class="flex align-center">
<figure><img src="img/kadaver.png" alt="" width="100px" class="invert"></figure>
<h1>Påmeldte kadaverløpet 2024</h1>
</div>
<h2>Oppdatert 11.10.24</h2>
<table>
<tbody>
<?php
$query = ["paameldte"];
include("get_table.php");
?>
</tbody>
<footer>
</table>
<h3>Laget av Trygve. <a href="https://git.willy.club/Trygve/elektronisk-kadaver-tidtakingssystem">Kildekode</a></h3>
<figure><img src="img/NMBUI.webp" alt="" width="200px"></figure>
</footer>
</body>
</html>