From d116e23de0efcd528226acf6dbe4c7cbc5c5698b Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 9 May 2021 15:42:58 +0200 Subject: Include info from venue in concerts. This makes the concert a full object containing all relevant info, while we can still segment the data in the db. Instead of this: $concert = GiglogAdmin_Concert::get($concert_id); $venue = GiglogAdmin_Venue::get($concert->venue()); echo "{$concert->name()} @ {$venue->name()} : {$concert->cdate()}" You can now do: $concert = GiglogAdmin_Concert::get($concert_id); echo "{$concert->name()} @ {$concert->venue()->name()} : {$concert->cdate()}" And yeah, renamed Concert::find_cid() to Concert::get() and changed it's semantics somewhat. It now either returns the given concert if it exists, or NULL if it does not. Simpler function; simpler to use. --- includes/admin/views/giglog_admin_page.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'includes/admin') diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index b78b4db..2971a22 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -36,13 +36,17 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { echo(GiglogAdmin_AdminPage::editforms()); //not sure why it doesn't show without the echo? } - static function get_allvenues( ?int $invenue ): string + static function get_allvenues( ?GiglogAdmin_Venue $invenue ): string { $select = ''; @@ -131,7 +135,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $editing = filter_input(INPUT_POST, "edit") == "EDIT"; if ($editing && !empty($cid)) //A bit overdoing with the checks if concert ID is empty both here and in find_cid. But based on that, things are NULL or not. Better ideas? - $c = GiglogAdmin_Concert::find_cid($cid); + $c = GiglogAdmin_Concert::get($cid); else $c = new GiglogAdmin_Concert(); @@ -140,7 +144,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { .'
CONCERT DETAILS

' .'' .'
' - .''.GiglogAdmin_AdminPage::get_allvenues($c->venue()).'
' + .'' . GiglogAdmin_AdminPage::get_allvenues($c->venue()) . '
' .'
' .'
' .'
' -- cgit v1.2.3