Exemplo n.º 1
0
 /**
  * this API is to get hotel menu
  * return type- 
  * created on - 16th Oct 2015;
  * updated on - 
  * update 	  -
  * created by - Akshay Patil;
  */
 function gethotelmenu()
 {
     header('Access-Control-Allow-Origin: *');
     $sb_hotel_id = $this->input->post('sb_hotel_id');
     if ($sb_hotel_id == '') {
         response_fail("Please Insert All data correctly");
     } else {
         $result = $this->Hotelmenu_model->gethotelmenu($sb_hotel_id);
         response_ok($result);
     }
 }
Exemplo n.º 2
0
 /**
  * API to retrieve 
  * return type- 
  * created on - 09Th Sept 2015;
  * updated on - 
  * update 	  -
  * created by - Akshay Patil;
  */
 function get_forum()
 {
     $sb_hotel_guest_booking_id = $this->input->post('sb_hotel_guest_booking_id');
     if ($sb_hotel_guest_booking_id == '') {
         response_fail("Please Insert All data correctly");
     } else {
         $data = $this->Forum_model->get_forum($sb_hotel_guest_booking_id);
         $result = array('result' => $data);
         response_ok($result);
     }
 }
Exemplo n.º 3
0
 public function insert_feedback()
 {
     // print_r($this->input->post());
     $rate_stay = $this->input->post('rate_stay');
     $improve_feedback = $this->input->post('improve_feedback');
     $service_feedback = $this->input->post('service_feedback');
     $special_info = $this->input->post('special_info');
     $sb_hotel_id = $this->input->post('sb_hotel_id');
     $guest_booking_id = $this->input->post('sb_hotel_guest_booking_id');
     if ($sb_hotel_id == '' || $guest_booking_id == '') {
         response_fail("Hotel id or Guest Booking ID is missing");
     } else {
         $insert_arr = array("rate_stay" => $rate_stay, "improve_feedback" => $improve_feedback, "service_feedback" => $service_feedback, "special_info" => $special_info, "sb_hotel_id" => $sb_hotel_id, "guest_booking_id" => $guest_booking_id);
         // print_r($insert_arr); die();
         $result = $this->Feedback_model->insert_feedbck($insert_arr);
         if ($result == 0) {
             response_fail("Some error occoured.. Please try again");
         } else {
             response_ok();
         }
     }
 }
Exemplo n.º 4
0
 /**
  * This function will change password
  * return type- 
  * created on - 22th July 2015;
  * updated on - 
  * created by - Akshay Patil;
  */
 public function change_password()
 {
     $sb_hotel_user_id = $this->input->post('sb_hotel_user_id');
     $sb_hotel_userpasswd = $this->input->post('old_password');
     $newpassword = $this->input->post('new_password');
     if ($sb_hotel_user_id == '' || $sb_hotel_userpasswd == '' || $newpassword == '') {
         response_fail("Input may be empty");
     } else {
         $arr = array();
         $arr['sb_hotel_user_id'] = $sb_hotel_user_id;
         $password = $this->User_model->check_user($arr);
         if (count($password) <= 0) {
             response_fail("Email is wrong");
         } else {
             if (verifyPasswordHash($sb_hotel_userpasswd, $password[0]['sb_hotel_userpasswd']) == TRUE) {
                 $arr1['sb_hotel_userpasswd'] = createHashAndSalt($newpassword);
                 $user_info1 = $this->User_model->update_user($arr1, $arr);
                 response_ok();
             } else {
                 response_fail("Something is wrong");
             }
         }
     }
 }
Exemplo n.º 5
0
 public function hotel_customer()
 {
     // print_r($_POST); die();
     $sb_guest_firstName = $this->input->post('sb_guest_firstName');
     $sb_guest_lastName = $this->input->post('sb_guest_lastName');
     $sb_guest_email = $this->input->post('sb_guest_email');
     $sb_hotel_id = $this->input->post('sb_hotel_id');
     if ($sb_hotel_id == '' || $sb_guest_email == '') {
         response_fail("Please insert all the fields");
     }
     $cdt_token = $this->input->post('cdt_token');
     $cdt_deviceType = $this->input->post('cdt_deviceType');
     $cdt_macid = $this->input->post('cdt_macid');
     $check_reservation = $this->User_model->check_reservation($sb_guest_email, $sb_hotel_id);
     if (count($check_reservation) > 0) {
         $sb_guest_reservation_code = $check_reservation[0]['sb_guest_reservation_code'];
         $this->login($sb_guest_reservation_code, $cdt_token, $cdt_deviceType, $cdt_macid);
     } else {
         $date = date_create();
         $sb_guest_reservation_code = $sb_hotel_id . date_timestamp_get($date) . rand();
         $insert_arr = array("sb_guest_firstName" => $sb_guest_firstName, "sb_guest_lastName" => $sb_guest_lastName, "sb_guest_email" => $sb_guest_email, "sb_hotel_id" => $sb_hotel_id, "sb_guest_reservation_code" => $sb_guest_reservation_code);
         $sb_hotel_guest_booking_id = $this->User_model->register_visitor($insert_arr);
         if ($sb_hotel_guest_booking_id != 0) {
             $data = $this->login($sb_guest_reservation_code, $cdt_token, $cdt_deviceType, $cdt_macid);
             response_ok($data);
         } else {
             response_fail("ErrorCode#2,Something Went Wrong");
         }
     }
 }
Exemplo n.º 6
0
 /**
  *deactivate account by userid
  *@post
  */
 public function deactivateAccount_post()
 {
     $this->form_validation->set_rules('userId', 'User Id', 'required');
     if ($this->form_validation->run() == TRUE) {
         $data = $this->user_model->deactivateAccount();
         if ($data) {
             $this->response(response_success("Account Deactivated", "SUCCESS", ""));
         } else {
             $this->response(response_fail('FAILED', "Something went wrong!"));
         }
     } else {
         $this->response(response_fail('FAILED', strip_tags(validation_errors())));
     }
 }
Exemplo n.º 7
0
 /**
  * This API allow staff to reject item order
  * return type- 
  * created on - 20th AUG 2015;
  * updated on - 
  * created by - Akshay Patil;
  */
 public function reject_order_item()
 {
     $order_placed_id = $this->input->post('order_placed_id');
     if ($order_placed_id == '') {
         response_fail("Please Insert All data correctly");
     } else {
         $res = $this->Tasks_model->check_order_item($order_placed_id);
         if ($res === 1) {
             response_fail("This item is already rejected");
         } elseif ($res === 0) {
             $val = $this->Tasks_model->reject_order_item($order_placed_id);
             response_ok();
         } else {
             response_fail("Please try after some time");
         }
     }
 }
Exemplo n.º 8
0
 /**
  * This function will will show all the requests placed by the user.
  * return type- 
  * created on -20th August 2015
  * updated on - 
  * created by - Akshay Patil;
  */
 function place_order()
 {
     $sb_hotel_guest_booking_id = $this->input->post('sb_hotel_guest_booking_id');
     $sb_hotel_id = $this->input->post('sb_hotel_id');
     $rooms = $this->Hotel_service_model->get_guest_rooms($sb_hotel_guest_booking_id);
     $inputArray = $this->input->post('order_details');
     $order_details = json_decode($inputArray);
     if ($sb_hotel_id <= 0 || $sb_hotel_id == '' || $sb_hotel_guest_booking_id == '' || $sb_hotel_guest_booking_id <= 0) {
         response_fail("Wrong Input");
     }
     for ($i = 0; $i < count($order_details); $i++) {
         $order = array();
         $order = (array) $order_details[$i];
         $new_order = array();
         for ($j = 0; $j < count($order['order']); $j++) {
             $new_order[$j] = (array) $order['order'][$j];
         }
         $hrs = array();
         $hss = array();
         $user_order = array();
         for ($j = 0; $j < count($new_order); $j++) {
             $index = -1;
             for ($k = 0; $k < count($hrs); $k++) {
                 if ($hrs[$k]['sb_guest_allocated_room_no'] == $new_order[$j]['sb_guest_allocated_room_no']) {
                     $index = $k;
                 }
             }
             if ($index == -1) {
                 $hrs[$j]['sb_parent_service_id'] = $order['sb_parent_service_id'];
                 $hrs[$j]['sb_hotel_id'] = $sb_hotel_id;
                 $hrs[$j]['sb_hotel_guest_booking_id'] = $sb_hotel_guest_booking_id;
                 $hrs[$j]['order_details'] = '1';
                 if ($this->input->post('service_due_date')) {
                     $hss[$j]['sb_hotel_ser_start_date'] = $this->input->post('service_due_date');
                 } else {
                     $hss[$j]['sb_hotel_ser_start_date'] = date("Y-m-d");
                 }
                 if ($this->input->post('service_due_time')) {
                     $hss[$j]['sb_hotel_ser_start_time'] = $this->input->post('service_due_time');
                 } else {
                     $hss[$j]['sb_hotel_ser_start_time'] = date("h:i:s");
                 }
                 $hrs[$j]['sb_guest_allocated_room_no'] = $new_order[$j]['sb_guest_allocated_room_no'];
                 if ($new_order[$j]['quantity'] > 0) {
                     $temp = array("sb_parent_service_id" => $order['sb_parent_service_id'], "sb_child_service_id" => $new_order[$j]['sb_child_service_id'], "sub_child_services_id" => $new_order[$j]['sub_child_services_id'], "quantity" => $new_order[$j]['quantity'], "price" => $new_order[$j]['price'], "sb_customer_order_duedate" => $new_order[$j]['sb_customer_order_duedate'], "sb_customer_order_duetime" => $new_order[$j]['sb_customer_order_duetime'], "sb_customer_order_comment" => $new_order[$j]['sb_customer_order_comment']);
                     $user_order[$j][] = $temp;
                 }
             } else {
                 if ($new_order[$j]['quantity'] > 0) {
                     $temp = array("sb_parent_service_id" => $order['sb_parent_service_id'], "sb_child_service_id" => $new_order[$j]['sb_child_service_id'], "sub_child_services_id" => $new_order[$j]['sub_child_services_id'], "quantity" => $new_order[$j]['quantity'], "price" => $new_order[$j]['price'], "sb_customer_order_duedate" => $new_order[$j]['sb_customer_order_duedate'], "sb_customer_order_duetime" => $new_order[$j]['sb_customer_order_duetime'], "sb_customer_order_comment" => $new_order[$j]['sb_customer_order_comment']);
                     $temp1 = $user_order[$index];
                     array_push($temp1, $temp);
                     $user_order[$index] = $temp1;
                 }
             }
         }
         $wrongRoom = 0;
         for ($l = 0; $l < count($hrs); $l++) {
             if (!in_array($hrs[$l]['sb_guest_allocated_room_no'], $rooms)) {
                 $wrongRoom++;
                 $result = array('sb_guest_allocated_room_no' => $rooms);
                 continue;
             } else {
                 $data = $this->Hotel_service_model->place_service($hrs[$l], $hss[$l]);
                 for ($m = 0; $m < count($user_order[$l]); $m++) {
                     $user_order[$l][$m]['sb_hotel_requst_ser_id'] = $data;
                 }
                 $rply = $this->User_order_model->place_order_details($user_order[$l]);
                 /*PUSH NOTIFICATION*/
                 if ($data != 0) {
                     $token = $sb_hotel_user = $this->Hotel_service_model->get_staff_ids($hrs[$l]['sb_hotel_id'], $hrs[$l]['sb_parent_service_id']);
                     if (count($token) > 0) {
                         $msg = "New service requested from room no : " . $hrs[$l]['sb_guest_allocated_room_no'];
                         $message = array("type" => 'request', "message" => $msg, "title" => 'New Service Request', "id" => $data);
                         $android_token = array();
                         $ios_token = array();
                         for ($i = 0; $i < count($token); $i++) {
                             if ($token[$i]['sdt_deviceType'] == 'android' and $token[$i]['sdt_token'] != NULL and $token[$i]['sdt_token'] != null) {
                                 array_push($android_token, $token[$i]['sdt_token']);
                             } else {
                                 if ($token[$i]['sdt_token'] != "" and $token[$i]['sdt_token'] != NULL and $token[$i]['sdt_token'] != null) {
                                     array_push($ios_token, $token[$i]['sdt_token']);
                                 }
                             }
                         }
                         if (count($ios_token) > 0) {
                             $ipushdata = array('deviceToken' => $ios_token, 'user' => "staff", 'message' => $message);
                             $this->load->library('api/Iospush');
                             $val = $this->iospush->iospush_notification($ipushdata);
                         }
                         // array for android
                         if (count($android_token) > 0) {
                             $pushdata = array('message' => $message, 'deviceTokens' => $android_token, 'user' => "staff");
                             $this->load->library('api/Android_push');
                             $val1 = $this->android_push->push_notification($pushdata);
                         }
                     }
                 }
             }
         }
         if ($wrongRoom > 0) {
             response_fail("Wrong Room Number", $result);
         } else {
             response_ok();
         }
     }
 }
Exemplo n.º 9
0
 function insert_chat()
 {
     $type = $this->input->post('type');
     if ($type != 'request' and $type != 'order') {
         response_fail("ErrorCode#1, Somthing went wrong, Please Logout and login again");
     }
     if ($type == 'request' || $type == 'order') {
         $sb_hotel_requst_ser_id = $this->input->post('sb_hotel_requst_ser_id');
         if ($sb_hotel_requst_ser_id == '') {
             response_fail("ErrorCode#2, Somthing went wrong, Please Logout and login again");
         }
         $data = $this->Chat_model->get_request($sb_hotel_requst_ser_id);
         if ($data > 0) {
             $sb_sender_type = $this->input->post('sb_sender_type');
             $sb_chat_message = trim($this->input->post('sb_chat_message'));
             if ($sb_sender_type == '' || $sb_chat_message == '') {
                 response_fail("ErrorCode#4, Somthing went wrong, Please Logout and login again");
             } else {
                 $insert_arr = array('sb_hotel_requst_ser_id' => $sb_hotel_requst_ser_id, 'sb_sender_type' => $sb_sender_type, 'sb_chat_message' => $sb_chat_message);
                 $result = $this->Chat_model->insert_chat($insert_arr);
                 // print_r($result); die()
                 if ($result) {
                     $id = $this->Chat_model->get_ids($sb_hotel_requst_ser_id, $sb_sender_type);
                     if ($id) {
                         $token = $this->Chat_model->get_token($id, $sb_sender_type);
                         //print_r($token); die();
                         if (count($token) > 0) {
                             $user_name = $this->Chat_model->get_name($id, $sb_sender_type);
                             //print_r($user_name); die();
                             $title = "New Message";
                             // from : ".$user_name ;
                             $message = array("type" => 'Message', "message" => $sb_chat_message, "title" => $title, "id" => $sb_hotel_requst_ser_id);
                             $android_token = array();
                             $ios_token = array();
                             for ($i = 0; $i < count($token); $i++) {
                                 if ($token[$i]['sdt_deviceType'] == 'android' and $token[$i]['sdt_token'] != NULL and $token[$i]['sdt_token'] != null) {
                                     array_push($android_token, $token[$i]['sdt_token']);
                                 } else {
                                     if ($token[$i]['sdt_token'] != "" and $token[$i]['sdt_token'] != NULL and $token[$i]['sdt_token'] != null) {
                                         array_push($ios_token, $token[$i]['sdt_token']);
                                     }
                                 }
                             }
                             if ($sb_sender_type == 1) {
                                 $userType = "staff";
                             } else {
                                 $userType = "customer";
                             }
                             if (count($ios_token) > 0) {
                                 $ipushdata = array('deviceToken' => $ios_token, 'user' => $userType, 'message' => $message);
                                 $this->load->library('api/Iospush');
                                 $val = $this->iospush->iospush_notification($ipushdata);
                             }
                             // array for android
                             if (count($android_token) > 0) {
                                 $pushdata = array('message' => $message, 'deviceTokens' => $android_token, 'user' => $userType);
                                 $this->load->library('api/Android_push');
                                 $val1 = $this->android_push->push_notification($pushdata);
                             }
                         }
                         response_ok();
                     } else {
                         response_fail("No such user exists");
                     }
                 } else {
                     response_fail("Notification not inserted.. Please try again");
                 }
             }
         } else {
             response_fail("ErrorCode#3, Somthing went wrong, Please Logout and login again");
         }
     }
 }