$count++; } mysql_free_result($results); return $data; } if ($action == "locationRequest") { $tap_id = isset($_REQUEST['tap_id']) ? $_REQUEST['tap_id'] : ""; $update_query = "update tap set isSendLocation = 1 WHERE tap_id = " . $tap_id; $data1 = mysql_query($update_query); // Send Notification $qry = "select * from tap where tap_id = {$tap_id}"; $tapDetails = selectForJason($qry); $qry = "select user_group.*, user.udid,user.name from user_group left join user on user_group.admin_id = user.user_id where group_id = " . $tapDetails[0]['group_id']; $groupAdminDetails = selectForJason($qry); $members = str_replace("|", ",", $groupAdminDetails[0]['members_id']); $sendNoti = new sendNotification(); foreach ($members as $member) { $qry = "select * from user where user_id = {$member}"; $userDetails = selectForJason($qry); $msg = $groupAdminDetails[0]["name"] . " has request to send your location"; if ($userDetails[0]['udid'] != "") { $sendNoti->sendNotificationByApns($userDetails[0]['udid'], $msg, "locationRequest", $tap_id); } } // end notification if ($data1) { $arr_result = array(RESULT => SUCCESS, MESSAGE => "request sent successfully", DATA => ""); } else { $arr_result = array(RESULT => FAILED, MESSAGE => "something went wrong", DATA => ""); } } elseif ($action == "updateUserLocation") {
} } elseif ($action == "edit" && $tap_id != '') { $select_query = "SELECT * FROM tap WHERE tap_id = '{$tap_id}'"; $data = mysql_query($select_query); if (mysql_num_rows($data) > 0) { $result = mysql_fetch_assoc($data); $update_query = "UPDATE tap SET {$query_set_value} WHERE tap_id = " . $result['tap_id']; $data1 = mysql_query($update_query); $select_query = "SELECT * FROM tap WHERE tap_id = '{$tap_id}'"; $data = mysql_query($select_query); $result = mysql_fetch_assoc($data); // Send notification to all group members $qry = "select user_group.*, user.udid,user.name from user_group left join user on user_group.admin_id = user.user_id where group_id = " . $result['group_id']; $groupAdminDetails = selectForJason($qry); $members = str_replace("|", ",", $groupAdminDetails[0]['members_id']); $sendNoti = new sendNotification(); foreach ($members as $member) { $qry = "select * from user where user_id = {$member}"; $userDetails = selectForJason($qry); $msg = $groupAdminDetails[0]["name"] . " has change the tap information"; if ($userDetails[0]['udid'] != "") { $sendNoti->sendNotificationByApns($userDetails[0]['udid'], $msg, "tapDetailChang", $tap_id); } } // send notification end $arr_result = array(RESULT => SUCCESS, MESSAGE => "Data Update Succesfully ", DATA => $result); } else { $arr_result = array(RESULT => SUCCESS, MESSAGE => "No Record Found", DATA => $result); } } else { $arr_result = array(RESULT => FAILED, MESSAGE => "Plese Provide Data", DATA => "");
$qry = "select * from tap where tap_id = {$tap_id}"; $tapDetails = selectForJason($qry); $qry = "select user_group.*, user.udid,user.name from user_group left join user on user_group.admin_id = user.user_id where group_id = " . $tapDetails[0]['group_id']; $groupAdminDetails = selectForJason($qry); $qry = "select * from user where user_id = {$member_id}"; $userDetails = selectForJason($qry); if ($status == 1) { $msg = $userDetails[0]["name"] . " is running late"; } else { if ($status == 1) { $msg = $userDetails[0]["name"] . " will not coming"; } else { $msg = $userDetails[0]["name"] . " will come"; } } $sendNoti = new sendNotification(); if ($userDetails[0]['udid'] != "") { $sendNoti->sendNotificationByApns($groupAdminDetails[0]['udid'], $msg, "tapTiming", $tap_id); } if ($insert_id > 0) { $select_query = "SELECT * FROM tap_timing WHERE tap_timing_id = {$insert_id}"; $data = mysql_query($select_query); $result = mysql_fetch_assoc($data); $arr_result = array(RESULT => SUCCESS, MESSAGE => "Data Insert Succesfully ", DATA => $result); } else { $arr_result = array(RESULT => FAILED, MESSAGE => "Data Insert not Succesfully ", DATA => ""); } } elseif ($action == "edit" && $tap_id != '' && $member_id != "") { $select_query = "SELECT * FROM tap_timeing WHERE tap_timeing_id = '{$tap_timeing_id}'"; $data = mysql_query($select_query); if (mysql_num_rows($data) > 0) {
} } elseif ($action == "acceptRequest") { $group_id = isset($_REQUEST['group_id']) ? $_REQUEST['group_id'] : ""; $user_id = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : ""; $query = "select * from user_group WHERE group_id = '" . $group_id . "'"; $grpDetail = selectForJason($query); $memIds = $grpDetail[0]["members_id"] . "|" . $user_id; $update_query = "update user_group set members_id = '" . $memIds . "' WHERE group_id = " . $group_id; $data1 = mysql_query($update_query); $update_query = "delete from group_request WHERE group_id = " . $group_id . " and member_id = " . $user_id; $data1 = mysql_query($update_query); // send Notification $qry = "select user_group.*, user.udid,user.name from user_group left join user on user_group.admin_id = user.user_id where group_id = {$group_id}"; $groupAdminDetails = selectForJason($qry); $qry = "select * from user where user_id = {$user_id}"; $userDetails = selectForJason($qry); $msg = $groupAdminDetails[0]["name"] . " has been accepted your group request"; $sendNoti = new sendNotification(); if ($userDetails[0]['udid'] != "") { $sendNoti->sendNotificationByApns($userDetails[0]['udid'], $msg, "groupRequestAccept", $group_id); } if ($data1) { $arr_result = array(RESULT => SUCCESS, MESSAGE => "accept request successfully", DATA => ""); } else { $arr_result = array(RESULT => FAILED, MESSAGE => "something went wrong", DATA => ""); } } echo json_encode($arr_result); ?>