diff --git a/registrering.php b/registrering.php
index 3628147..c3fd638 100644
--- a/registrering.php
+++ b/registrering.php
@@ -47,7 +47,7 @@
-
+
@@ -90,38 +90,12 @@ function register_runner(id) {
update()
document.getElementById("search").focus()
};
-function filterTable() {
- var input, filter, table, tr, td, i, txtValue;
- input = document.getElementById("search");
- filter = input.value;
- table = document.getElementById("runners").getElementsByTagName("tbody")[0];
- if (!table) {
- setTimeout(filterTable, 100);
- }
- tr = table.getElementsByTagName("tr");
-
- if (filter == "") {
- for (i = 0; i < tr.length; i++) {
- tr[i].style.display = "";
- }
- }
- else {
- for (i = 0; i < tr.length; i++) {
- td = tr[i].getElementsByTagName("td");
- txtValue = td[0].textContent;
- if (txtValue == filter) {
- tr[i].style.display = "";
- } else {
- tr[i].style.display = "none";
- }
- }
-}
-}
function update() {
const table = document.getElementById("runners");
control = get_control();
- let request = new Request(`table.php?registrering,`+control);
+ filter = document.getElementById("search").value;
+ let request = new Request(`table.php?type=registrering&control=`+control+`&filter=`+filter);
fetch(request)
.then((response) => response.text())
.then((text) => {table.innerHTML = text;})
diff --git a/table.php b/table.php
index 45032c4..29ac9d4 100644
--- a/table.php
+++ b/table.php
@@ -1,6 +1,6 @@
course, $b->course);
}
+function filter_runners(Runner $runner, $id) {
+ if ($runner->id == $id) {
+ return True;
+ }
+ else {
+ return False;
+ }
+}
+
$runners = [];
$csv_runners = file_get_contents("db.csv");
@@ -117,11 +126,23 @@ for ($i = 0; $i < count($timings); $i++) {
if (!isset($query)){
- $query = explode(",",$_SERVER['QUERY_STRING']);
+ parse_str($_SERVER['QUERY_STRING'], $query);
}
-if ($query[0] == "registrering"){
- $matpost = $query[1];
+if ($query["type"] == "registrering"){
+ $matpost = $query["control"];
+ $runners_filtered = [];
+ if ($query["filter"]) {
+ for ($i = 0; $i < count($runners); $i++) {
+ if (filter_runners($runners[$i], $query["filter"])) {
+ array_push($runners_filtered, $runners[$i]);
+ }
+ }
+ $runners = $runners_filtered;
+ }
+
+
+
echo("
# |
Navn |
@@ -158,7 +179,7 @@ if ($query[0] == "registrering"){
}
echo("");
}
-elseif ($query[0] == "paameldte") {
+elseif ($query["type"] == "paameldte") {
usort($runners, "cmp_course");
$kadaverløpere = 0;