This commit is contained in:
parent
cd65cba8c4
commit
95837394a9
@ -23,9 +23,18 @@ class Smart extends Page {
|
|||||||
$results = [];
|
$results = [];
|
||||||
while($row = $res->fetchArray())
|
while($row = $res->fetchArray())
|
||||||
{
|
{
|
||||||
|
$row['event'] = $db->querySingle("SELECT name FROM events WHERE id = ".$row['event']);
|
||||||
|
$row['date'] = $db->querySingle("SELECT date FROM events WHERE id = ".$row['event']);
|
||||||
|
$row['unixtimestamp'] = strtotime($row['date']);
|
||||||
|
$row['run'] = $db->querySingle("SELECT name FROM runs WHERE id = ".$row['run']);
|
||||||
$results[] = $row;
|
$results[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sort results by date
|
||||||
|
usort($results, function($a, $b) {
|
||||||
|
return $a['unixtimestamp'] <=> $b['unixtimestamp'];
|
||||||
|
});
|
||||||
|
|
||||||
$this->set('results', $results);
|
$this->set('results', $results);
|
||||||
$this->set('query', $query);
|
$this->set('query', $query);
|
||||||
$this->set('template', 'search.html.php');
|
$this->set('template', 'search.html.php');
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
<h2>Dein Name wie der auf Teilnahmelisten zu finden ist</h2>
|
<h2>Dein Name wie der auf Teilnahmelisten zu finden ist</h2>
|
||||||
<input type="text" name="q"
|
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="basic-url" class="form-label">Dein Name wie der auf Teilnahmelisten zu finden ist (Nachname Vorname)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" name="q"
|
||||||
hx-post="/smart/search"
|
hx-post="/smart/search"
|
||||||
hx-trigger="keyup changed delay:500ms"
|
hx-trigger="keyup changed delay:500ms"
|
||||||
hx-target="#search-results"
|
hx-target="#search-results"
|
||||||
placeholder="Suchen..."
|
placeholder="Suchen..."
|
||||||
hx-indicator="#indicator"
|
hx-indicator="#indicator"
|
||||||
>
|
class="form-control" id="basic-url"
|
||||||
|
>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<i id="indicator" class="fad fa-spinner-third fa-spin htmx-indicator"></i>
|
<i id="indicator" class="fad fa-spinner-third fa-spin htmx-indicator"></i>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user