diff --git a/CHANGELOG.md b/CHANGELOG.md index 434bab6..eee65dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file. - Added session persistence and cookies - Added config page with configuration details - Added conferences page with listing of conferences from the jilo database +- Added search filter for conferences with time, ID and name ### Changed diff --git a/public_html/pages/conferences.php b/public_html/pages/conferences.php index ca6a376..1d650dc 100644 --- a/public_html/pages/conferences.php +++ b/public_html/pages/conferences.php @@ -3,20 +3,29 @@ require_once 'classes/database.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 -$time_range_specified = true; +$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; +} +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) -// either id or name, id has precedence +// either id OR name, id has precedence // we use $_REQUEST, so that both links and forms work -if (isset($_REQUEST['id'])) { +if (isset($_REQUEST['id']) && $_REQUEST['id'] != '') { $conference_id = $_REQUEST['id']; + unset($_REQUEST['name']); unset($conference_name); -} elseif (isset($_REQUEST['name'])) { +} elseif (isset($_REQUEST['name']) && $_REQUEST['name'] != '') { unset($conference_id); $conference_name = $_REQUEST['name']; } else { @@ -77,12 +86,20 @@ if (isset($conference_id)) { } // display the result - echo "
\n"; - echo "Conferences with ID matching \"$conference_id\""; + echo "
\n"; + echo "
Conferences with ID matching \"$conference_id\""; if ($time_range_specified) { - echo " for the time period $from_time - $until_time"; + echo "
for the time period $from_time - $until_time"; } - echo "\n\n"; + echo "
\n\n"; + + // filters - time selection and sorting dropdowns + include 'templates/results-filter.php'; + + echo "
\n\n"; + + // results table + echo "
\n"; if (!empty($conferences['records'])) { @@ -157,12 +174,20 @@ if (isset($conference_id)) { } // display the result - echo "
\n"; - echo "Conferences with name matching \"$conference_name\""; + echo "
\n"; + echo "
Conferences with name matching \"$conference_name\""; if ($time_range_specified) { - echo " for the time period $from_time - $until_time"; + echo "
for the time period $from_time - $until_time"; } - echo "\n\n"; + echo "
\n\n"; + + // filters - time selection and sorting dropdowns + include 'templates/results-filter.php'; + + echo "
\n\n"; + + // results table + echo "
\n"; if (!empty($conferences['records'])) { @@ -236,12 +261,20 @@ if (isset($conference_id)) { } // display the result - echo "
\n"; - echo "All conferences"; + echo "
\n"; + echo "
All conferences"; if ($time_range_specified) { - echo " for the time period $from_time - $until_time"; + echo "
for the time period $from_time - $until_time"; } - echo "\n\n"; + echo "
\n\n"; + + // filters - time selection and sorting dropdowns + include 'templates/results-filter.php'; + + echo "
\n\n"; + + // results table + echo "
\n"; if (!empty($conferences['records'])) { diff --git a/public_html/static/all.css b/public_html/static/all.css index 0123570..ab4ac61 100644 --- a/public_html/static/all.css +++ b/public_html/static/all.css @@ -97,3 +97,17 @@ .results th { background-color: #f2f2f2; } + + +.results-header { + display: flex; +} + +.results-message, .results-filter { + width: 50%; + padding: 20px; +} + +.results-filter { + text-align: right; +} diff --git a/public_html/templates/results-filter.php b/public_html/templates/results-filter.php new file mode 100644 index 0000000..2deebab --- /dev/null +++ b/public_html/templates/results-filter.php @@ -0,0 +1,20 @@ + +
+ +
+ + + /> + + + /> + + /> + + /> + + + +
+ +