From 2ca81303a9b892e179a790dc9e4ed14c08307610 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Fri, 3 Sep 2021 14:37:37 +0200 Subject: Drop ref to ConcertLogs in AdminPage::get_user method. --- includes/admin/views/giglog_admin_page.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'includes/admin/views/giglog_admin_page.php') diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 7490122..0db72b2 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -68,16 +68,18 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { } - private function get_user( ?int $cid, string $ctype): string + private function get_user( GiglogAdmin_Concert $concert, string $role): string { $users = array_map( fn($usr) => $usr->user_login, get_users( array( 'fields' => array( 'user_login' ) ) ) ); - $current_user = $cid ? GiglogAdmin_Concertlogs::get_assigned_user( $cid, $ctype ) : null; + $roles = $concert->roles(); + + $current_user = array_key_exists($role, $roles) ? $roles[$role] : NULL; return \EternalTerror\ViewHelpers\select_field( - $ctype, + $role, array_map( fn($user) => [ $user, $user ], $users ), $current_user); } @@ -143,11 +145,12 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $content.='

'; $content.=''; + $content.='
ASSIGNMENT DETAILS

' - .''.$this->get_user($c->id(),'photo1').'
' - .''.$this->get_user($c->id(),'photo2').'
' - .''.$this->get_user($c->id(),'rev1').'
' - .''.$this->get_user($c->id(),'rev2').'
'; + .''.$this->get_user($c,'photo1').'
' + .''.$this->get_user($c,'photo2').'
' + .''.$this->get_user($c,'rev1').'
' + .''.$this->get_user($c,'rev2').'
'; $content.='
'; $content.='
VENUE DETAILS

' -- cgit v1.2.3