summaryrefslogtreecommitdiffstats
path: root/includes/band.php
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-11 22:51:03 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-11 22:51:03 +0200
commit50ab799d1789d666dc1bea546701bc0ee8f8bc31 (patch)
tree650dc0494b318a0567b9f16bde22e6298d089907 /includes/band.php
parent029f4d7a5b9aff1f7b35f060d172611ef81a2943 (diff)
downloadgigologadmin-50ab799d1789d666dc1bea546701bc0ee8f8bc31.tar.gz
gigologadmin-50ab799d1789d666dc1bea546701bc0ee8f8bc31.tar.bz2
gigologadmin-50ab799d1789d666dc1bea546701bc0ee8f8bc31.zip
Added small forms to add new venue and band
Made form for concert both functional to edit existing concert or add new concert
Diffstat (limited to 'includes/band.php')
-rw-r--r--includes/band.php24
1 files changed, 17 insertions, 7 deletions
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);
+ }
}
}