From 02caa8be1541d11a65dc00cdea08d1b0bc932ba5 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Wed, 14 Apr 2021 22:42:38 +0200 Subject: Got rid of find or create for concert and band Refactored band --- includes/admin/views/giglog_admin_page.php | 39 +++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 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 b59ade3..b6fe098 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -62,12 +62,13 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { return($select); } - static function get_countries() + static function get_countries($incountry) { $select = ''; @@ -152,10 +153,18 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $content.=''; $content.='

' - .'
' - .''.GiglogAdmin_AdminPage::get_countries().'
' - .'

' - .'
'; + .'' + .'
' + .''.GiglogAdmin_AdminPage::get_countries(GiglogAdmin_Band::get_band($c->band())[1]).'
'; + + if ($editing) { + $content.='

'; + } + else { + $content.='

'; + } + + $content.=''; $content.='

' .'
' @@ -336,8 +345,9 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { echo ''; else { - GiglogAdmin_Concert::find_or_create($_POST['selectband'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl']); - echo ''; + $ret = GiglogAdmin_Concert::create($_POST['selectband'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl']); + if ($ret!='dup') echo ''; + else echo ''; } } if(isset($_POST['editconcert'])) @@ -346,7 +356,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { echo ''; else { - GiglogAdmin_Concert::updatec($_POST['pid'],$_POST['selectband'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl']); + GiglogAdmin_Concert::update_concert($_POST['pid'],$_POST['selectband'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl']); echo ''; } } @@ -362,6 +372,17 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { } } + if(isset($_POST['editband'])) + { + IF (empty($_POST['bandname'])) //country is not checked as it is set to Norway by default + echo ''; + else + { + GiglogAdmin_Band::update_band($_POST['bid'],$_POST['bandname'],$_POST['selectcountry']); + echo ''; + } + } + if(isset($_POST['newvenue'])) { IF (empty($_POST['venuename']) || empty($_POST['venuecity'])) -- cgit v1.2.3