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 "