function getUserInfo($userId) { // echo "call->" . $userId; // exit; global $BOL_AvatarService_inst; global $Userservice; global $QuestionService; $user_data = array(); $user_account = $Userservice->findUserById($userId); if (!empty($user_account)) { $account = $user_account->getAccountType(); $filed_array = array(HAMMU_DB_IM_USING_HAMMU_AS_KEY); $check_type_client_escort = getallquestions(array("user_id" => $userId, "fields" => $filed_array)); $type_check = $check_type_client_escort[0]['userSelectedValue']; if ($type_check == "1") { $type = "preferences"; $sex = "client"; } else { $sex = "escort"; $type = "services"; } } //$userInfo = $BOL_AvatarService_inst->getDataForUserAvatars(array($userId)); $filed = array(HAMMU_DB_PREFRENCES_KEY, HAMMU_DB_SERVICES_KEY); $all_services_preferences = getallquestions(array("user_id" => $userId, "fields" => $filed)); // echo "userid-->" . $userId; // 'field_e9795a9d3be797f58aab38b1033265a4' $userinfoData = $QuestionService->getQuestionData(array($userId), array('id', 'username', 'birthdate', 'email', 'googlemap_location', HAMMU_DB_SERVICES_KEY, HAMMU_DB_MOBILE_NUMBER_KEY, HAMMU_DB_PRICE_KEY)); $avatar = $BOL_AvatarService_inst->getDataForUserAvatars(array($userId)); $onlineStatus = $Userservice->findOnlineStatusForUserList(array($userId)); // print_r($onlineStatus); // exit; foreach ($all_services_preferences as $key => $user_services_preferences) { $user[HAMMU_DB_PRICE_KEY] = ""; foreach ($userinfoData as $key => $user) { // print_r($user); $phone_number = ""; if (!empty($user[HAMMU_DB_MOBILE_NUMBER_KEY])) { $phone_number = $user[HAMMU_DB_MOBILE_NUMBER_KEY]; } $dob = date("d-m-Y", strtotime($user["birthdate"])); $age = ageCalculate($dob); $user_data = array("user_id" => $key, "email" => $user["email"], "user_name" => $user["username"], "address" => !empty($user["googlemap_location"]["address"]) ? $user["googlemap_location"]["address"] : "", "phone_number" => $phone_number, "birthdate" => $dob, "age" => "{$age}", "profile_picture" => $avatar[$key]["src"], "price" => !empty($user[HAMMU_DB_PRICE_KEY]) ? $user[HAMMU_DB_PRICE_KEY] : "", "services" => $user_services_preferences['userSelectedLabel'], "available" => !empty($onlineStatus[$key]) ? "Online" : "Offline"); } } // echo "<pre>"; // print_r($user_data); // exit; // $usersInfo['avatars'][$userId] = $userInfo[$userId]['src']; // $usersInfo['urls'][$userId] = $userInfo[$userId]['url']; // $usersInfo['names'][$userId] = $userInfo[$userId]['title']; // $usersInfo['roleLabels'][$userId] = array( // 'label' => $userInfo[$userId]['label'], // 'labelColor' => $userInfo[$userId]['labelColor'] // ); // // $user = array( // 'id' => $userId, // 'avatarUrl' => $usersInfo['avatars'][$userId], // 'name' => $usersInfo['names'][$userId], // ); return $user_data; }
function getUserInfo($userId) { global $BOL_AvatarService_inst; global $Userservice; global $QuestionService; global $PHOTO_BOL_PhotoService_inst; global $language; $user_data = array(); $user_account = $Userservice->findUserById($userId); if (!empty($user_account)) { $account = $user_account->getAccountType(); $filed_array = array(HAMMU_DB_IM_USING_HAMMU_AS_KEY); $check_type_client_escort = getallquestions(array("user_id" => $userId, "fields" => $filed_array)); $type_check = $check_type_client_escort[0]['userSelectedValue']; if ($type_check == "1") { $type = "preferences"; $sex = "client"; } else { $sex = "escort"; $type = "services"; } } $filed = array(HAMMU_DB_PREFRENCES_KEY, HAMMU_DB_SERVICES_KEY); $all_services_preferences = getallquestions(array("user_id" => $userId, "fields" => $filed)); //hardik edit $userinfoData = $QuestionService->getQuestionData(array($userId), array('id', 'username', 'birthdate', 'email', 'googlemap_location', HAMMU_DB_SERVICES_KEY, HAMMU_DB_MOBILE_NUMBER_KEY, HAMMU_DB_PRICE_KEY, HAMMU_HOTEL_SERVICE, HAMMU_HOME_VISIT, HAMMU_AVAILABLE_AT, HAMMU_SECRET_FANTASY, HAMMU_LANGUAGE, HAMMU_COUNTRY)); //print_r($userinfoData); $avatar = $BOL_AvatarService_inst->getDataForUserAvatars(array($userId)); $onlineStatus = $Userservice->findOnlineStatusForUserList(array($userId)); $available = ""; if (count($all_services_preferences) > 0) { foreach ($all_services_preferences as $key => $user_services_preferences) { $user[HAMMU_DB_PRICE_KEY] = ""; if (count($userinfoData) > 0) { foreach ($userinfoData as $key => $user) { $availableUser = checkAvailableOrNot($key); if ($availableUser == "online") { $available = $language->text("hammu", "available"); //"Available"; } else { $available = $language->text("hammu", "unavailable"); //"Unavailable"; } $phone_number = ""; if (!empty($user[HAMMU_DB_MOBILE_NUMBER_KEY])) { $phone_number = $user[HAMMU_DB_MOBILE_NUMBER_KEY]; } //hardik edited if (!empty($user[HAMMU_HOTEL_SERVICE])) { $hotel_service = $user[HAMMU_HOTEL_SERVICE]; } else { $hotel_service = "0"; } if (!empty($user[HAMMU_HOME_VISIT])) { $home_visit = $user[HAMMU_HOME_VISIT]; } else { $home_visit = "0"; } if (!empty($user[HAMMU_AVAILABLE_AT])) { $availabel_at_all = getallquestions(array("user_id" => $userId, "fields" => array(HAMMU_AVAILABLE_AT))); // print_r($availabel_at_all); // die; $HAMMU_AVAILABLE_AT_VALUE = $availabel_at_all[0]["userSelectedValue"]; //$user[HAMMU_AVAILABLE_AT]; $HAMMU_AVAILABLE_AT_label = $availabel_at_all[0]["userSelectedLabel"]; //$user[HAMMU_AVAILABLE_AT]; // $HAMMU_AVAILABLE_AT = $user[HAMMU_AVAILABLE_AT]; } else { $HAMMU_AVAILABLE_AT_VALUE = ""; $HAMMU_AVAILABLE_AT_label = ""; } if (!empty($user[HAMMU_SECRET_FANTASY])) { $secret_fantasy = $user[HAMMU_SECRET_FANTASY]; } else { $secret_fantasy = "0"; } if (!empty($user[HAMMU_LANGUAGE])) { $HAMMU_LANGUAGE = $user[HAMMU_LANGUAGE]; } else { $HAMMU_LANGUAGE = ""; } if (!empty($user[HAMMU_COUNTRY])) { $HAMMU_COUNTRY = $user[HAMMU_COUNTRY]; } else { $HAMMU_COUNTRY = ""; } $dob = date("d-m-Y", strtotime($user["birthdate"])); $age = ageCalculate($dob); $userKeyId = $key; $photos = $PHOTO_BOL_PhotoService_inst->findPhotoListByUserId($userKeyId, 1, 500); $user_data = array("user_id" => $key, "email" => $user["email"], "user_name" => $user["username"], "address" => !empty($user["googlemap_location"]["address"]) ? $user["googlemap_location"]["address"] : "", "phone_number" => $phone_number, "birthdate" => $dob, "age" => "{$age}", "profile_picture" => $avatar[$key]["src"], "prices" => !empty($user[HAMMU_DB_PRICE_KEY]) ? $user[HAMMU_DB_PRICE_KEY] : "", "services" => $user_services_preferences['userSelectedValue'], "services_name" => $user_services_preferences['userSelectedLabel'], "location" => array("latitude" => $user["googlemap_location"]["latitude"], "longitude" => $user["googlemap_location"]["longitude"]), "available" => $available, HAMMU_HOTEL_SERVICE => $hotel_service, HAMMU_HOME_VISIT => $home_visit, HAMMU_AVAILABLE_AT => $HAMMU_AVAILABLE_AT_VALUE, HAMMU_AVAILABLE_AT . "_label" => $HAMMU_AVAILABLE_AT_label, HAMMU_SECRET_FANTASY => $secret_fantasy, HAMMU_LANGUAGE => $HAMMU_LANGUAGE, HAMMU_COUNTRY => $HAMMU_COUNTRY, "image" => $photos); } } } } return $user_data; }
function getUserInfo($userId) { // echo "call->" . $userId; global $BOL_AvatarService_inst; global $Userservice; global $QuestionService; $user_data = array(); $user_account = $Userservice->findUserById($userId); if (!empty($user_account)) { $account = $user_account->getAccountType(); if ($account == "8cc28eaddb382d7c6a94aeea9ec029fb") { $sex = "lady"; $type = "services"; } else { $type = "preferences"; $sex = "gentleman"; } } //$userInfo = $BOL_AvatarService_inst->getDataForUserAvatars(array($userId)); $filed = array('field_f2d8bb949d7d74a70bcb2003abc5b436', 'field_f92bbdb57510b86ba6c506c487be3aa1'); $all_services_preferences = getallquestions(array("user_id" => $userId, "fields" => $filed)); // echo "userid-->" . $userId; $userinfoData = $QuestionService->getQuestionData(array($userId), array('id', 'username', 'birthdate', 'email', 'googlemap_location', 'field_f92bbdb57510b86ba6c506c487be3aa1', 'field_e9795a9d3be797f58aab38b1033265a4', 'field_391797ad0e06d17d5b5cec0e48def7c2', 'field_d3d1470339c8d689ab705fd19a509655')); //print_r($userinfoData); $avatar = $BOL_AvatarService_inst->getDataForUserAvatars(array($userId)); $onlineStatus = $Userservice->findOnlineStatusForUserList(array($userId)); foreach ($all_services_preferences as $key => $user_services_preferences) { $user["field_d3d1470339c8d689ab705fd19a509655"] = NULL; // print_r($userinfoData); foreach ($userinfoData as $key => $user) { // print_r($user); $phone_number = Null; if (!empty($user["field_391797ad0e06d17d5b5cec0e48def7c2"])) { $phone_number = $user["field_391797ad0e06d17d5b5cec0e48def7c2"]; } $dob = date("d-m-Y", strtotime($user["birthdate"])); $age = ageCalculate($dob); $user_data = array("user_id" => $key, "email" => $user["email"], "user_name" => $user["username"], "address" => !empty($user["googlemap_location"]["address"]) ? $user["googlemap_location"]["address"] : "", "phone_number" => $phone_number, "birthdate" => $dob, "age" => "{$age}", "profile_picture" => $avatar[$key]["src"], "price" => !empty($user["field_d3d1470339c8d689ab705fd19a509655"]) ? $user["field_d3d1470339c8d689ab705fd19a509655"] : "", "services" => $user_services_preferences['userSelectedLabel'], "available" => !empty($onlineStatus[$key]) ? "Online" : "Offline"); } } // echo "<pre>"; // print_r($user_data); // exit; // $usersInfo['avatars'][$userId] = $userInfo[$userId]['src']; // $usersInfo['urls'][$userId] = $userInfo[$userId]['url']; // $usersInfo['names'][$userId] = $userInfo[$userId]['title']; // $usersInfo['roleLabels'][$userId] = array( // 'label' => $userInfo[$userId]['label'], // 'labelColor' => $userInfo[$userId]['labelColor'] // ); // // $user = array( // 'id' => $userId, // 'avatarUrl' => $usersInfo['avatars'][$userId], // 'name' => $usersInfo['names'][$userId], // ); return $user_data; }
function getUserInfo($userId) { global $BOL_AvatarService_inst; global $Userservice; global $QuestionService; global $PHOTO_BOL_PhotoService_inst; $user_data = array(); $user_account = $Userservice->findUserById($userId); if (!empty($user_account)) { $account = $user_account->getAccountType(); $filed_array = array(HAMMU_DB_IM_USING_HAMMU_AS_KEY); $check_type_client_escort = getallquestions(array("user_id" => $userId, "fields" => $filed_array)); $type_check = $check_type_client_escort[0]['userSelectedValue']; if ($type_check == "1") { $type = "preferences"; $sex = "client"; } else { $sex = "escort"; $type = "services"; } } $filed = array(HAMMU_DB_PREFRENCES_KEY, HAMMU_DB_SERVICES_KEY); $all_services_preferences = getallquestions(array("user_id" => $userId, "fields" => $filed)); $userinfoData = $QuestionService->getQuestionData(array($userId), array('id', 'username', 'birthdate', 'email', 'googlemap_location', HAMMU_DB_SERVICES_KEY, HAMMU_DB_MOBILE_NUMBER_KEY, HAMMU_DB_PRICE_KEY)); $avatar = $BOL_AvatarService_inst->getDataForUserAvatars(array($userId)); $onlineStatus = $Userservice->findOnlineStatusForUserList(array($userId)); $available = ""; foreach ($all_services_preferences as $key => $user_services_preferences) { $user[HAMMU_DB_PRICE_KEY] = ""; foreach ($userinfoData as $key => $user) { $availableUser = checkAvailableOrNot($key); if ($availableUser == "online") { $available = "Available"; } else { $available = "Unavailable"; } $phone_number = ""; if (!empty($user[HAMMU_DB_MOBILE_NUMBER_KEY])) { $phone_number = $user[HAMMU_DB_MOBILE_NUMBER_KEY]; } $dob = date("d-m-Y", strtotime($user["birthdate"])); $age = ageCalculate($dob); $userKeyId = $key; $photos = $PHOTO_BOL_PhotoService_inst->findPhotoListByUserId($userKeyId, 1, 500); $user_data = array("user_id" => $key, "email" => $user["email"], "user_name" => $user["username"], "address" => !empty($user["googlemap_location"]["address"]) ? $user["googlemap_location"]["address"] : "", "phone_number" => $phone_number, "birthdate" => $dob, "age" => "{$age}", "profile_picture" => $avatar[$key]["src"], "price" => !empty($user[HAMMU_DB_PRICE_KEY]) ? $user[HAMMU_DB_PRICE_KEY] : "", "services" => $user_services_preferences['userSelectedValue'], "services_name" => $user_services_preferences['userSelectedLabel'], "location" => array("latitude" => $user["googlemap_location"]["latitude"], "longitude" => $user["googlemap_location"]["longitude"]), "available" => $available, "image" => $photos); } } return $user_data; }
function getProfiledetails() { global $Userservice; global $QuestionService; global $BOL_AvatarService_inst; $app = \Slim\Slim::getInstance(); $app->response->headers->set('Content-Type', 'application/json'); $app->response->setStatus(200); $user_id = $app->request()->params('user_id'); $user_ids = array($user_id); if (!empty($user_ids)) { $userinfoData = array(); $user = $Userservice->findUserById($user_id); if (!empty($user)) { $account = $user->getAccountType(); if ($account == "8cc28eaddb382d7c6a94aeea9ec029fb") { $sex = "lady"; $type = "services"; } else { $type = "preferences"; $sex = "gentleman"; } $filed = array('field_f2d8bb949d7d74a70bcb2003abc5b436', 'field_f92bbdb57510b86ba6c506c487be3aa1'); $all_services_preferences = getallquestions(array("user_id" => $user_id, "fields" => $filed)); $userinfoData = $QuestionService->getQuestionData($user_ids, array('id', 'username', 'birthdate', 'email', 'googlemap_location', 'field_f92bbdb57510b86ba6c506c487be3aa1', 'field_e9795a9d3be797f58aab38b1033265a4', 'field_391797ad0e06d17d5b5cec0e48def7c2')); $avatar = $BOL_AvatarService_inst->getDataForUserAvatars($user_ids); if (!empty($all_services_preferences)) { foreach ($all_services_preferences as $key => $user_services_preferences) { foreach ($userinfoData as $key => $user) { $phone_number = Null; if (!empty($user["field_391797ad0e06d17d5b5cec0e48def7c2"])) { $phone_number = $user["field_391797ad0e06d17d5b5cec0e48def7c2"]; } $dob = date("d-m-Y", strtotime($user["birthdate"])); $user_data = array("user_id" => $key, "email" => $user["email"], "user_name" => $user["username"], "address" => $user["googlemap_location"]["address"], "phone_number" => $phone_number, "birthdate" => $dob, "profile_picture" => $avatar[$key]["src"], $type => $user_services_preferences['userSelectedLabel']); } } $return_data = array("response_status" => "1", "response_message" => "Successfully", "data" => $user_data); $app->response->setBody(json_encode($return_data)); } else { $return_data = array("response_status" => "0", "response_message" => "Sorry!! Please provide correct data"); $app->response->setBody(json_encode($return_data)); } } else { $return_data = array("response_status" => "0", "response_message" => "Fail to get your location Please try again"); $app->response->setBody(json_encode($return_data)); } } }
function getProfiledetails() { global $Userservice; global $QuestionService; global $BOL_AvatarService_inst; $app = \Slim\Slim::getInstance(); $app->response->headers->set('Content-Type', 'application/json'); $app->response->setStatus(200); $user_id = $app->request()->params('user_id'); $user_ids = array($user_id); if (!empty($user_ids)) { $userinfoData = array(); $user = $Userservice->findUserById($user_id); if (!empty($user)) { $account = $user->getAccountType(); if ($account == "8cc28eaddb382d7c6a94aeea9ec029fb") { $sex = "lady"; $type = "services"; } else { $type = "preferences"; $sex = "gentleman"; } $filed = array('field_b63db9264225396873b5b6e9a02dbc66', 'field_e9795a9d3be797f58aab38b1033265a4'); $all_services_preferences = getallquestions(array("user_id" => $user_id, "fields" => $filed)); $userinfoData = $QuestionService->getQuestionData($user_ids, array('id', 'username', 'birthdate', 'email', 'googlemap_location', 'field_b63db9264225396873b5b6e9a02dbc66', 'field_e9795a9d3be797f58aab38b1033265a4', 'field_8669de45f87c662844ac8cb7bf1803a4')); $avatar = $BOL_AvatarService_inst->getDataForUserAvatars($user_ids); if (!empty($all_services_preferences)) { foreach ($all_services_preferences as $key => $user_services_preferences) { foreach ($userinfoData as $key => $user) { if (!empty($user["field_8669de45f87c662844ac8cb7bf1803a4"])) { $phone_number = $user["field_8669de45f87c662844ac8cb7bf1803a4"]; } else { $phone_number = null; } $dob = date("d-m-Y", strtotime($user["birthdate"])); $user_data = array("user_id" => $key, "email" => $user["email"], "user_name" => $user["username"], "address" => $user["googlemap_location"]["address"], "phone_number" => $phone_number, "birthdate" => $dob, "profile_picture" => $avatar[$key]["src"], $type => $user_services_preferences['userSelectedLabel']); } } $return_data = array("response_status" => "1", "response_message" => "Successfully", "data" => $user_data); $app->response->setBody(json_encode($return_data)); } else { $return_data = array("response_status" => "0", "response_message" => "Sorry!! Please provide correct data"); $app->response->setBody(json_encode($return_data)); } } else { $return_data = array("response_status" => "0", "response_message" => "Fail to get your location Please try again"); $app->response->setBody(json_encode($return_data)); } // $return_data = getallquestions(array("user_id" => $user_id, "fields" => $filed_array)); // // // if (!empty($return_data)) { // $result_data = $return_data; // } else { // $result_data = array("response_status" => "0", "response_message" => "unSuccess"); // } // // $app->response->setBody(json_encode($result_data)); } }
function setProfiledetails() { global $QuestionService; global $Userservice; global $QUESTION_PRESENTATION_RANGE; global $QUESTION_PRESENTATION_BIRTHDATE; global $QUESTION_PRESENTATION_AGE; global $QUESTION_PRESENTATION_DATE; global $QUESTION_PRESENTATION_MULTICHECKBOX; $app = \Slim\Slim::getInstance(); $app->response->headers->set('Content-Type', 'application/json'); $app->response->setStatus(200); $user_id = $app->request()->params('user_id'); $filed_array = array("realname", "sex", "googlemap_location", "relationship", "6341ee69d879c97cb0c47507a557372c", "match_sex", "a69350b819c8dc1d926cba6b58451f5f", "31d5d3d7ff420e340cfe3f17c534eba3", "23036b67a077fe7784c7cf4691a96fe3", "36e39f917cbcf4fb10aa753186ced60d", "aboutme", "2b29f145d9d1128a3f57d3af6798fc85", "18af0f3559b872c87467a5a89edf03e", "match_age", "birthdate", "6ed883b3412cab27014a0b68ea32f269", "field_b63db9264225396873b5b6e9a02dbc66", "field_8669de45f87c662844ac8cb7bf1803a4", "email", "us ername", "field_e9795a9d3be797f58aab38b1033265a4", "avatar"); $data = array(); foreach ($filed_array as $fileds) { $post_val = $app->request()->params($fileds); if (!empty($post_val)) { $data[$fileds] = $app->request()->params($fileds); } } if (empty($user_id)) { $return_data = array("status" => "false", "message" => "unsuccess", "error" => "Please provide user id!"); $app->response->setBody(json_encode($return_data)); } $data_save = array(); $user_id = (int) $user_id; foreach ($data as $key => $value) { if (in_array($key, $filed_array)) { if (!empty($value)) { $question = $QuestionService->findQuestionByName($key); switch ($question->presentation) { case $QUESTION_PRESENTATION_RANGE: case $QUESTION_PRESENTATION_BIRTHDATE: case $QUESTION_PRESENTATION_AGE: case $QUESTION_PRESENTATION_DATE: // $value = date('Y-m-d H:i:s', strtotime('-18 year')); break; case $QUESTION_PRESENTATION_MULTICHECKBOX: //$value = array(); $value = explode(",", $value); break; default: $value = $value; } $data_save[$key] = $value; } } } $updated = $QuestionService->saveQuestionsData(array_filter($data_save), $user_id); if ($updated) { $userService = $Userservice; $reportedUser = $userService->findUserById($user_id); $account_type = $reportedUser->getAccountType(); if ($account_type == "808aa8ca354f51c5a3868dad5298cd72") { $gender = "gentlemen"; } else { $gender = "lady"; } $id = $reportedUser->getId(); $result_data = getallquestions(array("user_id" => $id, "fields" => $filed_array)); // $username = $reportedUser->getUsername(); // $email = $reportedUser->getEmail(); $messages = "Profile updated with success!"; $return_data = array("response_status" => '1', "response_message" => $messages, "data" => $result_data); //$return_data = array("id" => $id, "username" => $username, "message" => "Profile updated with success!", "status" => "true"); } else { $return_data = array("response_status" => "0", "response_message " => "Please provide proper Profile data!"); } $app->response->setBody(json_encode($return_data)); }