Adds search filter for conferences
parent
e499ef083e
commit
5c020a8483
|
@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- Added session persistence and cookies
|
- Added session persistence and cookies
|
||||||
- Added config page with configuration details
|
- Added config page with configuration details
|
||||||
- Added conferences page with listing of conferences from the jilo database
|
- Added conferences page with listing of conferences from the jilo database
|
||||||
|
- Added search filter for conferences with time, ID and name
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -3,20 +3,29 @@
|
||||||
require_once 'classes/database.php';
|
require_once 'classes/database.php';
|
||||||
require 'classes/conference.php';
|
require 'classes/conference.php';
|
||||||
|
|
||||||
// FIXME add dropdown menus for selecting from-until
|
|
||||||
$from_time = '0000-01-01';
|
|
||||||
$until_time = '9999-12-31';
|
|
||||||
|
|
||||||
// FIXME move thi sto a special function
|
// FIXME move thi sto a special function
|
||||||
|
$time_range_specified = false;
|
||||||
|
if (!isset($_REQUEST['from_time']) || (isset($_REQUEST['from_time']) && $_REQUEST['from_time'] == '')) {
|
||||||
|
$from_time = '0000-01-01';
|
||||||
|
} else {
|
||||||
|
$from_time = $_REQUEST['from_time'];
|
||||||
$time_range_specified = true;
|
$time_range_specified = true;
|
||||||
|
}
|
||||||
|
if (!isset($_REQUEST['until_time']) || (isset($_REQUEST['until_time']) && $_REQUEST['until_time'] == '')) {
|
||||||
|
$until_time = '9999-12-31';
|
||||||
|
} else {
|
||||||
|
$until_time = $_REQUEST['until_time'];
|
||||||
|
$time_range_specified = true;
|
||||||
|
}
|
||||||
|
|
||||||
// conference id/name are specified when searching specific conference(s)
|
// conference id/name are specified when searching specific conference(s)
|
||||||
// either id or name, id has precedence
|
// either id OR name, id has precedence
|
||||||
// we use $_REQUEST, so that both links and forms work
|
// we use $_REQUEST, so that both links and forms work
|
||||||
if (isset($_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && $_REQUEST['id'] != '') {
|
||||||
$conference_id = $_REQUEST['id'];
|
$conference_id = $_REQUEST['id'];
|
||||||
|
unset($_REQUEST['name']);
|
||||||
unset($conference_name);
|
unset($conference_name);
|
||||||
} elseif (isset($_REQUEST['name'])) {
|
} elseif (isset($_REQUEST['name']) && $_REQUEST['name'] != '') {
|
||||||
unset($conference_id);
|
unset($conference_id);
|
||||||
$conference_name = $_REQUEST['name'];
|
$conference_name = $_REQUEST['name'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,12 +86,20 @@ if (isset($conference_id)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// display the result
|
// display the result
|
||||||
echo "<div class=\"results\">\n";
|
echo "<div class=\"results-header\">\n";
|
||||||
echo "Conferences with ID matching \"<strong>$conference_id</strong>\"";
|
echo "<div class=\"results-message\">Conferences with ID matching \"<strong>$conference_id</strong>\"";
|
||||||
if ($time_range_specified) {
|
if ($time_range_specified) {
|
||||||
echo " for the time period <strong>$from_time - $until_time</strong>";
|
echo "<br />for the time period <strong>$from_time - $until_time</strong>";
|
||||||
}
|
}
|
||||||
echo "\n\n";
|
echo "</div>\n\n";
|
||||||
|
|
||||||
|
// filters - time selection and sorting dropdowns
|
||||||
|
include 'templates/results-filter.php';
|
||||||
|
|
||||||
|
echo "</div>\n\n";
|
||||||
|
|
||||||
|
// results table
|
||||||
|
echo "<div class=\"results\">\n";
|
||||||
|
|
||||||
if (!empty($conferences['records'])) {
|
if (!empty($conferences['records'])) {
|
||||||
|
|
||||||
|
@ -157,12 +174,20 @@ if (isset($conference_id)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// display the result
|
// display the result
|
||||||
echo "<div class=\"results\">\n";
|
echo "<div class=\"results-header\">\n";
|
||||||
echo "Conferences with name matching \"<strong>$conference_name</strong>\"";
|
echo "<div class=\"results-message\">Conferences with name matching \"<strong>$conference_name</strong>\"";
|
||||||
if ($time_range_specified) {
|
if ($time_range_specified) {
|
||||||
echo " for the time period <strong>$from_time - $until_time</strong>";
|
echo "<br />for the time period <strong>$from_time - $until_time</strong>";
|
||||||
}
|
}
|
||||||
echo "\n\n";
|
echo "</div>\n\n";
|
||||||
|
|
||||||
|
// filters - time selection and sorting dropdowns
|
||||||
|
include 'templates/results-filter.php';
|
||||||
|
|
||||||
|
echo "</div>\n\n";
|
||||||
|
|
||||||
|
// results table
|
||||||
|
echo "<div class=\"results\">\n";
|
||||||
|
|
||||||
if (!empty($conferences['records'])) {
|
if (!empty($conferences['records'])) {
|
||||||
|
|
||||||
|
@ -236,12 +261,20 @@ if (isset($conference_id)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// display the result
|
// display the result
|
||||||
echo "<div class=\"results\">\n";
|
echo "<div class=\"results-header\">\n";
|
||||||
echo "All conferences";
|
echo "<div class=\"results-message\">All conferences";
|
||||||
if ($time_range_specified) {
|
if ($time_range_specified) {
|
||||||
echo " for the time period <strong>$from_time - $until_time</strong>";
|
echo "<br />for the time period <strong>$from_time - $until_time</strong>";
|
||||||
}
|
}
|
||||||
echo "\n\n";
|
echo "</div>\n\n";
|
||||||
|
|
||||||
|
// filters - time selection and sorting dropdowns
|
||||||
|
include 'templates/results-filter.php';
|
||||||
|
|
||||||
|
echo "</div>\n\n";
|
||||||
|
|
||||||
|
// results table
|
||||||
|
echo "<div class=\"results\">\n";
|
||||||
|
|
||||||
if (!empty($conferences['records'])) {
|
if (!empty($conferences['records'])) {
|
||||||
|
|
||||||
|
|
|
@ -97,3 +97,17 @@
|
||||||
.results th {
|
.results th {
|
||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.results-header {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results-message, .results-filter {
|
||||||
|
width: 50%;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results-filter {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
<div class="results-filter">
|
||||||
|
|
||||||
|
<form method="POST" action="?page=<?= $page ?>">
|
||||||
|
|
||||||
|
<label for="from_time">from</label>
|
||||||
|
<input type="date" id="from_time" name="from_time"<?php if (isset($_REQUEST['from_time'])) echo " value=\"" . $_REQUEST['from_time'] . "\"" ?> />
|
||||||
|
|
||||||
|
<label for="until_time">until</label>
|
||||||
|
<input type="date" id="until_time" name="until_time"<?php if (isset($_REQUEST['until_time'])) echo " value=\"" . $_REQUEST['until_time'] . "\"" ?> />
|
||||||
|
|
||||||
|
<input type="text" name="id" placeholder="ID"<?php if (isset($_REQUEST['id'])) echo " value=\"" . $_REQUEST['id'] . "\"" ?> />
|
||||||
|
|
||||||
|
<input type="text" name="name" placeholder="name"<?php if (isset($_REQUEST['name'])) echo " value=\"" . $_REQUEST['name'] . "\"" ?> />
|
||||||
|
|
||||||
|
<input type="submit" value="search" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
Loading…
Reference in New Issue