summaryrefslogtreecommitdiffstats
path: root/includes/admin/views/giglog_admin_page.php
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-25 19:44:01 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-25 19:44:01 +0200
commit19c28b2d51c68d51802b4a653d289a88a00b5d87 (patch)
tree09d5e4fd53a9674f4f02dd649216b3cd72c54d2a /includes/admin/views/giglog_admin_page.php
parent97eedd793237dc45d44409013e45696bcb772721 (diff)
downloadgigologadmin-19c28b2d51c68d51802b4a653d289a88a00b5d87.tar.gz
gigologadmin-19c28b2d51c68d51802b4a653d289a88a00b5d87.tar.bz2
gigologadmin-19c28b2d51c68d51802b4a653d289a88a00b5d87.zip
removed older icons. Added new ones created by me
Modified returnuser function to not allow a user to assign multiple slots to themselves
Diffstat (limited to 'includes/admin/views/giglog_admin_page.php')
-rw-r--r--includes/admin/views/giglog_admin_page.php29
1 files changed, 13 insertions, 16 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php
index 3336fbd..72a34eb 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/giglog_admin_page.php
@@ -422,22 +422,19 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
if (!empty($c))
{
-
- $vquery0 = "select wpgcl_".$p1." as assigneduser from wpg_concertlogs where wpgcl_concertid=".$c ;
- $results = $wpdb->get_results($vquery0);
-
- foreach ( $results AS $row ) {
- $x= $row -> assigneduser;
- if ($x !='' and $x!=$hf_username) return ('<span class="takenby">Taken</span><div class="takenby">Taken by '.$x.'</div>');
- else
- if ($x==$hf_username) //if current user
- return ('<form class="unassignit" method="POST" action=""> <input type="hidden" name="cid" value="' . $c. '" /><input type="hidden" name="pid" value="' . $p1. '" /><input type="submit" name="unassignitem" value=""/>
- </form>');
- else //not taken by anyone
- return ('<form method="POST" action=""> <input type="hidden" name="cid" value="' . $c. '" /><input type="hidden" name="pid" value="' . $p1. '" /><input type="submit" name="assignitem" value=""/>
- </form>');
-
- }
+ $sql = "select * from wpg_concertlogs where wpgcl_concertid=".$c;
+ $crow = $wpdb->get_results($sql);
+ $array = array('photo1' => $crow[0]->wpgcl_photo1, 'photo2'=> $crow[0]->wpgcl_photo2, 'rev1' => $crow[0]->wpgcl_rev1, 'rev2'=> $crow[0]->wpgcl_rev2);
+
+ //first check if current slot is taken by current user
+ if ($array[$p1] == $hf_username) return ('<form class="unassignit" method="POST" action=""> <input type="hidden" name="cid" value="' . $c. '" /><input type="hidden" name="pid" value="' . $p1. '" /><input type="submit" name="unassignitem" value="Your"/></form>');
+ else //check if slot is taken by another user
+ if (!empty($array[$p1])) return ('<span class="takenby">Taken</span><div class="takenby">Taken by '.$array[$p1].'</div>');
+ else //check if other slots for this concert are taken by user
+ if (in_array($hf_username,$array)) return ('<span class="taken_by_self">-</span>');
+ else //not taken by anyone
+ return ('<form method="POST" action=""> <input type="hidden" name="cid" value="' . $c. '" /><input type="hidden" name="pid" value="' . $p1. '" /><input type="submit" name="assignitem" value=""/>
+ </form>');
}
else return ('no concert selected');