diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-04-10 13:36:28 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-04-10 14:19:50 +0200 |
commit | 029f4d7a5b9aff1f7b35f060d172611ef81a2943 (patch) | |
tree | 9d16309995e120cff7b9488eb06ef45d7aebf108 /includes/admin | |
parent | 410135aca1c07409f5909b44dc144bb2c3644645 (diff) | |
download | gigologadmin-029f4d7a5b9aff1f7b35f060d172611ef81a2943.tar.gz gigologadmin-029f4d7a5b9aff1f7b35f060d172611ef81a2943.tar.bz2 gigologadmin-029f4d7a5b9aff1f7b35f060d172611ef81a2943.zip |
Change venues into proper objects.
This means most static functions now either return a venue object, or an
array of venue objects. The exception is the `all_cities` method, which
still return an array of cities as strings.
The constructor has been made private, as it should not be used directly
from anywhere but the static methods on the Venue class.
Diffstat (limited to 'includes/admin')
-rw-r--r-- | includes/admin/views/giglog_admin_page.php | 10 | ||||
-rw-r--r-- | includes/admin/views/giglog_import_gigs.php | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index b7d8397..5fdcc6b 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -60,7 +60,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { { $select = '<select name="selectvenue">'; foreach ( GiglogAdmin_Venue::all_venues() AS $venue ) { - $select .= '<option value="' . $venue -> id. '">'.$venue->vname; + $select .= '<option value="' . $venue->id() . '">'. $venue->name(); $select .='</option>'; } $select .= '</select>'; @@ -98,7 +98,13 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { if ( $selected_city != "ALL" ) { //second drop down for venue - $venues = array_merge([[0, "ALL"]], GiglogAdmin_Venue::venues_in_city($selected_city)); + $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]; diff --git a/includes/admin/views/giglog_import_gigs.php b/includes/admin/views/giglog_import_gigs.php index 5874ef8..2423c74 100644 --- a/includes/admin/views/giglog_import_gigs.php +++ b/includes/admin/views/giglog_import_gigs.php @@ -85,7 +85,8 @@ if ( !class_exists( 'GiglogAdmin_ImportGigsPage' ) ) { if (is_numeric($venue)) $newconcert[1] = $venue; else { - $newconcert[1] = GiglogAdmin_Venue::find_or_create($venue); + $v = GiglogAdmin_Venue::find_or_create($venue); + $newconcert[1] = $v->id(); } //not sure how to check dates, hopefully manual verification of files will take care of it |