From 50ab799d1789d666dc1bea546701bc0ee8f8bc31 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Sun, 11 Apr 2021 22:51:03 +0200 Subject: Added small forms to add new venue and band Made form for concert both functional to edit existing concert or add new concert --- includes/band.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'includes/band.php') diff --git a/includes/band.php b/includes/band.php index 9ed7a53..72af425 100644 --- a/includes/band.php +++ b/includes/band.php @@ -19,26 +19,27 @@ if ( !class_exists('GiglogAdmin_Band') ) { class GiglogAdmin_Band { - static function create($name) + static function create($name, $country) { global $wpdb; - + if (empty($country)) $country = 'NO'; $wpdb->insert('wpg_bands', array( 'id' => '', - 'wpgband_name' => $name + 'wpgband_name' => $name, + 'wpgband_country' => $country )); return $wpdb->insert_id; } - static function find_or_create($name) + static function find_or_create($name, $country) { global $wpdb; - + if(empty($country)) $country = 'NO'; $bandsql = 'SELECT id FROM wpg_bands WHERE upper(wpgband_name)="' . $name . '"'; - $results = $wpdb->get_results($bandsql); + $results = $wpdb->get_results($bandsql); - return $results ? $results[0]->id : GiglogAdmin_Band::create($name); + return $results ? $results[0]->id : GiglogAdmin_Band::create($name, $country); } static function all_bands() @@ -49,6 +50,15 @@ if ( !class_exists('GiglogAdmin_Band') ) { return ($results); } + + static function all_countries() + { + global $wpdb; + + $results = $wpdb->get_results("select id, wpgcountry_name as cname from wpg_countries order by id"); + + return ($results); + } } } -- cgit v1.2.3