diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-05-25 16:43:05 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-05-25 16:49:57 +0200 |
commit | 44ad0a77496b120eede51e60698e1caff093352c (patch) | |
tree | 6d9e38721100fe3e9ede6f87d2d3fcb5b7b73a07 /includes/admin/views/giglog_admin_page.php | |
parent | 543bddc03fbf9dc90429d4d77dd11affaea4f356 (diff) | |
download | gigologadmin-44ad0a77496b120eede51e60698e1caff093352c.tar.gz gigologadmin-44ad0a77496b120eede51e60698e1caff093352c.tar.bz2 gigologadmin-44ad0a77496b120eede51e60698e1caff093352c.zip |
Use select_field in adminactions form.
Also add a `get_status` method to the Concertlogs class, returning the
press status for a given concert_id.
Diffstat (limited to 'includes/admin/views/giglog_admin_page.php')
-rw-r--r-- | includes/admin/views/giglog_admin_page.php | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 8ae30c3..f84b497 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -152,22 +152,16 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $query = "SELECT id,wpgs_name from wpg_pressstatus" ; $statuses = $wpdb->get_results($query); - $select = + return '<form method="POST" action="">' . '<input type="hidden" name="cid" value="' . $concert_id . '" />' - . '<select name="selectstatus">'; - - foreach ( $statuses AS $sts ) { - $select .= '<option value="' . $sts->id . '">' . $sts->wpgs_name . '</option>'; - } - - $select .= - '</select>' + . \EternalTerror\ViewHelpers\select_field( + 'selectstatus', + array_map(fn($status) => [ $status->id, $status->wpgs_name ], $statuses), + GiglogAdmin_Concertlogs::get_status($concert_id)) . '<input type="submit" value="SetStatus">' . '<input type="submit" name ="edit" value="EDIT">' . '</form>'; - - return $select; } //function to calculate if the concert has been added in the past 10 days or before that and show a green NEW for the newest rows |