From affb423909d127f5a1e8ec17b135cc66c9890a75 Mon Sep 17 00:00:00 2001 From: AndreaChirulescu Date: Tue, 6 Apr 2021 21:43:31 +0200 Subject: Added drop down menu for admin actions on concert log --- includes/admin/views/giglog_admin_page.php | 95 +++++++++++++++--------------- includes/css/main.css | 7 +++ 2 files changed, 54 insertions(+), 48 deletions(-) diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index bd91299..86398bf 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -83,6 +83,27 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { return $select; } + + static function adminactions() //didn't get this one to work, the point was to create the drop down menu with a function, but it works fine to create it directly in the query + { + global $wpdb; + $query = "SELECT id,wpgs_name from wpg_pressstatus" ; + $statuses = $wpdb->get_results($query); + + $select = '
'; + $select .= '
'; + return $select; + } + + static function get_concerts() { @@ -97,7 +118,10 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $content .= ' CITYBANDVENUEDATE PHOTO1PHOTO2TEXT1TEXT2 - STATUS'; + STATUS'; + if (current_user_can('administrator')) //($hf_username == 'etadmin') + $content .= 'AdminOptions'; + $content .= ''; // Use the submitted "city" if any. Otherwise, use the default/static value. $cty = filter_input( INPUT_POST, 'selectcity', FILTER_SANITIZE_SPECIAL_CHARS ); @@ -146,11 +170,20 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $content .= ''.GiglogAdmin_AdminPage::returnuser('photo2', $row->id ).''; $content .= ''.GiglogAdmin_AdminPage::returnuser('rev1', $row->id ).''; $content .= ''.GiglogAdmin_AdminPage::returnuser('rev2', $row->id ).''; - $content .= ''.$row -> wpgs_name; + $content .= ''.$row -> wpgs_name.''; if (current_user_can('administrator')) //($hf_username == 'etadmin') - $content .= '
-
'; - $content .= ''; + { $content .= ''; + $stquery = "SELECT id,wpgs_name from wpg_pressstatus" ; + $statuses = $wpdb->get_results($stquery); + $content .= '
'; + $content .= '
'; + $content .= ''; + } $content .= ''; $lastType = $row->wpgvenue_city; } @@ -162,7 +195,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { } static function update() - { + { global $wpdb; if ('POST' !== $_SERVER['REQUEST_METHOD']) return; @@ -188,51 +221,17 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { $url3=$_SERVER['REQUEST_URI']; header("Refresh: 1; URL=$url3"); //reload page } - - if(isset($_POST['reqsent'])) - { - GiglogAdmin_AdminPage::assignconcert($_POST['pid'],$_POST['cid']); - $usql = "UPDATE wpg_concertlogs SET wpgcl_status=2 WHERE wpgcl_concertid=".$_POST['cid']; - $uresults = $wpdb->get_results($usql); - $url2=$_SERVER['REQUEST_URI']; - header("Refresh: 1; URL=$url2"); //reload page - } - - if(isset($_POST['phok'])) + + //handling the admin drop down menu + if(isset($_POST['selectstatus'])) { - $usql = "UPDATE wpg_concertlogs SET wpgcl_status=3 WHERE wpgcl_concertid=".$_POST['cid']; - $uresults = $wpdb->get_results($usql); - - $url2=$_SERVER['REQUEST_URI']; - header("Refresh: 1; URL=$url2"); //reload page + $usql = "UPDATE wpg_concertlogs SET wpgcl_status=".$_POST['selectstatus']." WHERE wpgcl_concertid=".$_POST['cid']; + $uresults = $wpdb->get_results($usql); + //$url2=$_SERVER['REQUEST_URI']; //doesn't seem to be needed actually, leaving here just in case + //header("Refresh: 1; URL=$url2"); //reload page } - if(isset($_POST['txtok'])) - { - $usql = "UPDATE wpg_concertlogs SET wpgcl_status=4 WHERE wpgcl_concertid=".$_POST['cid']; - $uresults = $wpdb->get_results($usql); - - $url2=$_SERVER['REQUEST_URI']; - header("Refresh: 1; URL=$url2"); //reload page - } - - if(isset($_POST['allok'])) - { - $usql = "UPDATE wpg_concertlogs SET wpgcl_status=5 WHERE wpgcl_concertid=".$_POST['cid']; - $uresults = $wpdb->get_results($usql); - - $url2=$_SERVER['REQUEST_URI']; - header("Refresh: 1; URL=$url2"); //reload page - } - - if(isset($_POST['rej'])) - { - $usql = "UPDATE wpg_concertlogs SET wpgcl_status=6 WHERE wpgcl_concertid=".$_POST['cid']; - $uresults = $wpdb->get_results($usql); - - $url2=$_SERVER['REQUEST_URI']; - header("Refresh: 1; URL=$url2"); //reload page - } + } static function assignconcert($p1, $c) diff --git a/includes/css/main.css b/includes/css/main.css index c88de60..af50cfd 100644 --- a/includes/css/main.css +++ b/includes/css/main.css @@ -30,6 +30,13 @@ span.takenby vertical-align: center; } +table.assignit + +{ + white-space: nowrap; + overflow: hidden; +} + .unassignit input { background:red; -- cgit v1.2.3