Add bookmark item search (#15)
- Implement form styling throughout - Modify header links for narrower views - Clean up CSS
This commit is contained in:
@@ -11,13 +11,35 @@ include '../start.php';
|
||||
$db = Data::getConnection();
|
||||
Security::verifyUser($db);
|
||||
|
||||
if (key_exists('search', $_GET)) {
|
||||
$list = ItemList::matchingSearch($_GET['search'], $db);
|
||||
$search = $_GET['search'] ?? '';
|
||||
$items = $_GET['items'] ?? 'all';
|
||||
|
||||
if ($search != '') {
|
||||
$list = ItemList::matchingSearch($search, $items == 'bookmarked', $db);
|
||||
}
|
||||
|
||||
page_head('Item Search'); ?>
|
||||
<h1>Item Search</h1>
|
||||
// TODO: search form <?php
|
||||
if (isset($list)) $list->render();
|
||||
<article>
|
||||
<form method=GET action=/search>
|
||||
<label>
|
||||
Search Criteria
|
||||
<input type=text name=search required autofocus value="<?=htmlspecialchars($search)?>">
|
||||
</label>
|
||||
<label>
|
||||
Items to Search
|
||||
<select name=items>
|
||||
<option value=all <?=$items == 'all' ? ' selected' : ''?>>All</option>
|
||||
<option value=bookmarked <?=$items == 'bookmarked' ? ' selected' : ''?>>Bookmarked</option>
|
||||
</select>
|
||||
</label>
|
||||
<span class=break></span>
|
||||
<button type=submit>Search</button>
|
||||
</form><?php
|
||||
if (isset($list)) { ?>
|
||||
<hr><?php
|
||||
$list->render();
|
||||
} ?>
|
||||
</article><?php
|
||||
page_foot();
|
||||
$db->close();
|
||||
|
||||
Reference in New Issue
Block a user