diff options
author | AndreaChirulescu <andrea.chirulescu@gmail.com> | 2021-05-04 20:14:40 +0200 |
---|---|---|
committer | AndreaChirulescu <andrea.chirulescu@gmail.com> | 2021-05-04 20:14:40 +0200 |
commit | c3a19d2a6b392d9f3ab58c61ed83bdf25d919c9e (patch) | |
tree | fde9d462dd16b45a489c6cf391dd128b2f2609ff /includes/admin | |
parent | ee9bef751805ac3f3c9572d1620f2221092b3094 (diff) | |
download | gigologadmin-c3a19d2a6b392d9f3ab58c61ed83bdf25d919c9e.tar.gz gigologadmin-c3a19d2a6b392d9f3ab58c61ed83bdf25d919c9e.tar.bz2 gigologadmin-c3a19d2a6b392d9f3ab58c61ed83bdf25d919c9e.zip |
Fixed venue by city filter. With a small exception: cna't get it to select in dropdown
Diffstat (limited to 'includes/admin')
-rw-r--r-- | includes/admin/views/giglog_admin_page.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 72a34eb..3482ae2 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -78,6 +78,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { static function get_filters() { $cities = array_merge(["ALL"], GiglogAdmin_Venue::all_cities()); + $cty = filter_input( INPUT_POST, 'selectcity', FILTER_SANITIZE_SPECIAL_CHARS ); $selected_city = filter_input(INPUT_POST, "selectcity", FILTER_SANITIZE_SPECIAL_CHARS) || $cities[0]; @@ -85,34 +86,34 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $select = '<form method="POST" action="">FILTER DATA: <select name="selectcity">'; foreach ( $cities AS $city ) { - $select .= '<option value="' . $city . '"' . selected($city, $selected_city) . '>'; + $select .= '<option value="' . $city . '"' . selected($city,$cty ) . '>'; $select .= $city . '</option>'; } $select .= '</select>'; - if ( $selected_city != "ALL" ) { + + if ( $cty && $cty!= "ALL" ) { //second drop down for venue + $venues = GiglogAdmin_Venue::venues_in_city($cty); - $venues = GiglogAdmin_Venue::venues_in_city($selected_city); $venue_list = array_merge( [0, "ALL"], array_map( function($v) { return [$v->id(), $v->name()]; }, $venues)); - $selected_venue = - filter_input(INPUT_POST, "selectvenue", FILTER_SANITIZE_SPECIAL_CHARS) - || $venues[0]; + $selected_venue = filter_input(INPUT_POST, "selectvenue", FILTER_SANITIZE_SPECIAL_CHARS) + || $venue_list[0]; $select .= '<select name="selectvenue">'; - - foreach ( $venues AS $venue ) { - $select .= '<option value="' . $venue[0] . '"' . selected($venue, $selected_venue) . '>'; + foreach ( $venue_list AS $venue ) { + //below line returns an erorr which I haven't really figured out yet But filtering works. It doesn't keep the venue selected in the dropdown + $select .= '<option value="' . $venue[0] . '"' . selected($venue[0], $selected_venue) . '>'; $select .= $venue[1] . '</option>'; } - $select .= '</select>'; + } //option to select own concerts only $select .= '<input class="ownconc" type="checkbox" value="1"'; |