diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-09-01 10:44:01 +0200 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2016-09-01 10:44:01 +0200 |
commit | 2481f29a0f558f2d1b0140b9ab34615d96a4f222 (patch) | |
tree | e46ef3f2b7b03370672c091bec86aab913142ee7 /infra-dashboard/utils/book.php | |
parent | 2a634c9262e7f51a7802b69b9ba51641711f2ad4 (diff) |
Remove first prototype of the Pharos Dashboard
The Dashboard implementation from Max is im progress and
more advanced than the initial one. It doesn't make sense
to maintain both of them.
Change-Id: Iabea63a7e5b6e8d64cb72b8de2264c5c4484eae8
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'infra-dashboard/utils/book.php')
-rw-r--r-- | infra-dashboard/utils/book.php | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/infra-dashboard/utils/book.php b/infra-dashboard/utils/book.php deleted file mode 100644 index 6d4c5b2..0000000 --- a/infra-dashboard/utils/book.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - - include 'database.php'; - - function book() { - $resource_id = $_POST['resource_id']; - $resource_name = $_POST['resource_name']; - $user_id = $_POST['user_id']; - $start = $_POST['start']; - $end = $_POST['end']; - $purpose = $_POST['purpose']; - - $query = "select role.name as rolename from user, role, user_role where user.user_id = ".$user_id." and role.role_id=user_role.role_id and user_role.user_id=user.user_id;"; - $result = mysql_query($query); - - if(mysql_num_rows($result) == 0) { - echo "1"; //return a code instead of a meesage. Display the message later in javascript according to the returned code. - //echo "Booking not possible (your account is not associated with a role). Please contact the administrator."; - exit; - } - $is_only_lab_owner = true; - while ($row = mysql_fetch_array($result)) { - $rolename = $row['rolename']; - if ($rolename != "lab_owner") $is_only_lab_owner = false; - } - if ($is_only_lab_owner) { - $query = "select * from user u inner join user_resource r on r.user_id=u.user_id and u.user_id=".$user_id." and r.resource_id=".$resource_id.";"; - $result = mysql_query($query); - if(mysql_num_rows($result) == 0) { - echo "2"; - //echo "You are not allowed to book this resource. "; - exit; - } - } - $query = "INSERT INTO booking (resource_id, user_id, starttime, endtime, purpose) VALUES (".$resource_id.",".$user_id.",'".$start."','".$end."', '".$purpose."');"; - $result = mysql_query($query); - if(mysql_insert_id()>0){ - echo "Booking successful. The resource '".$resource_name."' is booked from ".$start." to ".$end."."; - } - else{ - echo "Mysql Error : ".mysql_error().". Query = ".$query; - } - - } - - function getBookedDates() { - $resource_id = $_POST['resource_id']; - $query = "SELECT b.booking_id, b.resource_id,u.name as username,u.email,b.starttime,b.endtime,b.creation,b.purpose FROM booking as b,user as u WHERE b.resource_id=".$resource_id." AND b.user_id=u.user_id;"; - $result = mysql_query($query); - - $events = array(); - while ($row = mysql_fetch_array($result)) { - $e = array(); - $e['id'] = $row['booking_id']; - $e['booker_name'] = $row['username']; - $e['booker_email'] = $row['email']; - $e['title'] = $row['purpose']; - $e['start'] = $row['starttime']; - $e['end'] = $row['endtime']; - $e['bookdate'] = $row['creation']; - - // Merge the event array into the return array - array_push($events, $e); - } - - echo json_encode($events); - } - - - - $action = $_POST['action']; - - connectDB(); - if ($action == "book") { - book(); - } elseif ($action == "getBookedDates" ) { - getBookedDates(); - } else { - echo "Invalid POST action."; - } - closeDB(); -?> |