summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--includes/admin/register_db_tables.php7
-rw-r--r--includes/admin/views/giglog_admin_page.php35
-rw-r--r--includes/concert.php23
3 files changed, 62 insertions, 3 deletions
diff --git a/includes/admin/register_db_tables.php b/includes/admin/register_db_tables.php
index 1121253..3e26a15 100644
--- a/includes/admin/register_db_tables.php
+++ b/includes/admin/register_db_tables.php
@@ -419,7 +419,12 @@ if ( !function_exists( "giglog_register_db_tables") )
`wpgcl_createddate` date NOT NULL DEFAULT current_timestamp();");
}
- update_option("giglogadmin_db_version", 3);
+ if ($db_version == NULL || $db_version < 4)
+ {
+ $wpdb->query(
+ "INSERT INTO `wpg_countries` (`id`, `wpgc_fullname`, `wpgcountry_name`, `wpgc_iso3`, `wpgc_numcode`) VALUES ('NN', 'UNKNOWN', 'Unknown', 'NNN', '666');");
+ }
+ update_option("giglogadmin_db_version", 4);
}
giglog_register_db_tables();
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php
index b6fe098..9a59289 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/giglog_admin_page.php
@@ -75,6 +75,30 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
return($select);
}
+ static function get_user($cid, $ctype)
+ {
+ $hf_user = wp_get_current_user();
+ $hf_username = $hf_user->user_login;
+ $select = '<select name="'.$ctype.'">';
+ $select .= '<option value="">Please Select..</option>';
+ $users = get_users( array( 'fields' => array( 'user_login' ) ) );
+ foreach ( $users as $user ) {
+ $usr = $user->user_login;
+ $taken = strpos(GiglogAdmin_AdminPage::returnuser($ctype, $cid),$usr);
+ if($taken) $select .= '<option value="' .$usr. '" selected="selected">'.$usr;
+ else
+ {
+ $takenbyself = strpos(GiglogAdmin_AdminPage::returnuser($ctype, $cid),'name="unassignitem"');
+ if($takenbyself && $usr==$hf_username) $select .= '<option value="' .$usr. '" selected="selected">'.$usr;
+ else
+ $select .= '<option value="'.$usr. '">'. $usr;
+ $select .='</option>';
+ }
+ }
+ $select .= '</select>';
+ return($select);
+ }
+
static function get_filters()
{
$cities = array_merge(["ALL"], GiglogAdmin_Venue::all_cities());
@@ -140,7 +164,12 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
.'<label for="venue">Venue:</label>'.GiglogAdmin_AdminPage::get_allvenues($c->venue()).'<br>'
.'<label for="cdate">Date:</label><input type="date" id="cdate" name="cdate" value="'.$c->cdate().'"><br>'
.'<label for="ticket">Tickets:</label><input type="text" id="ticket" name="ticket" value="'.$c->tickets().'"><br>'
- .'<label for="eventurl">Event link:</label><input type="text" id="eventurl" name="eventurl" value="'.$c->eventlink().'"><br>';
+ .'<label for="eventurl">Event link:</label><input type="text" id="eventurl" name="eventurl" value="'.$c->eventlink().'"><br>'
+ .'<label for="photo1">Photo1:</label>'.GiglogAdmin_AdminPage::get_user($c->id(),'photo1').'<br>'
+ .'<label for="photo2">Photo2:</label>'.GiglogAdmin_AdminPage::get_user($c->id(),'photo2').'<br>'
+ .'<label for="rev1">Text1:</label>'.GiglogAdmin_AdminPage::get_user($c->id(),'rev1').'<br>'
+ .'<label for="rev2">Text2:</label>'.GiglogAdmin_AdminPage::get_user($c->id(),'rev2').'<br>'
+ ;
// actions differ if we update or create a concert, hence two buttons needed
if ($editing) {
@@ -357,8 +386,10 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
else
{
GiglogAdmin_Concert::update_concert($_POST['pid'],$_POST['selectband'], $_POST['selectvenueadmin'], $_POST['cdate'], $_POST['ticket'], $_POST['eventurl']);
- echo '<script language="javascript">alert("Yey, concert updated"); </script>';
+ GiglogAdmin_Concert::update_concertlog($_POST['pid'],$_POST['photo1'], $_POST['photo2'], $_POST['rev1'], $_POST['rev2']);
+ echo '<script language="javascript">alert("Yay, concert updated"); </script>';
}
+
}
if(isset($_POST['newband']))
diff --git a/includes/concert.php b/includes/concert.php
index 7afedca..462586d 100644
--- a/includes/concert.php
+++ b/includes/concert.php
@@ -130,6 +130,29 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
return ($wpdb->last_error);
}
+ static function update_concertlog($cid, $ph1, $ph2, $rev1, $rev2)
+ {
+ global $wpdb;
+
+ $res = $wpdb->update('wpg_concertlogs', array(
+ 'wpgcl_photo1' => $ph1,
+ 'wpgcl_photo2' => $ph2,
+ 'wpgcl_rev1' => $rev1,
+ 'wpgcl_rev2' => $rev2
+ ),
+ array('wpgcl_concertid' => $cid)
+ );
+
+ if ( !$res ) {
+ // exit( var_dump( $wpdb->last_query ) ); //for onscreen debugging when needed
+ error_log( __CLASS__ . '::' . __FUNCTION__ . ": {$wpdb->last_error}");
+ die;
+ }
+
+ return ($wpdb->last_error);
+
+ }
+
public static function get($band, $venue, $date)
{
global $wpdb;