Beispiel #1
0
function renderFAQ($page)
{
    $markup = "<div class='faq-container'>";
    foreach ($page->faq as $key => $qa) {
        $markup .= renderQuestion($qa);
    }
    $markup .= "</div>";
    return $markup;
}
Beispiel #2
0
function getallquestions($param)
{
    global $QuestionService;
    global $AccountTypeToGenderService;
    global $BOL_AvatarService_inst;
    global $QUESTION_PRESENTATION_RANGE;
    global $QUESTION_PRESENTATION_BIRTHDATE;
    global $QUESTION_PRESENTATION_AGE;
    global $QUESTION_PRESENTATION_DATE;
    global $Userservice;
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    //Lang Call Start
    $hammu_lang_id = $app->request()->params("lang_id");
    if (!empty($hammu_lang_id)) {
        getCurrentLanguages($hammu_lang_id);
    }
    //Lang Call end
    $fields = $param["fields"];
    $user_id = $param["user_id"];
    //    if (empty($user_id)) {
    //        $return_data = array("message" => "Please provide User id!", "status" => "false");
    //        $app->response->setBody(json_encode($return_data));
    //    }
    $user = $Userservice->findUserById($user_id);
    if (!empty($user)) {
        $account = $user->getAccountType();
        $account_type = getValueFromAccountType($account);
        $accountType = $AccountTypeToGenderService->getAccountType($account_type);
        $questionNames = array();
        $questionNames[] = "sex";
        foreach ($QuestionService->findSignUpQuestionsForAccountType($accountType) as $question) {
            $questionNames[] = $question['name'];
        }
        $questionList = $QuestionService->findQuestionByNameList($questionNames);
        $sectionNameList = array();
        foreach ($questionList as $question) {
            if (!in_array($question->sectionName, $sectionNameList)) {
                $sectionNameList[] = $question->sectionName;
            }
        }
        $sectionList = $QuestionService->findSectionBySectionNameList($sectionNameList);
        usort($questionList, function ($a, $b) use($sectionList) {
            $sectionNameA = $a->sectionName;
            $sectionNameB = $b->sectionName;
            if ($sectionNameA === $sectionNameB) {
                return (int) $a->sortOrder < (int) $b->sortOrder ? -1 : 1;
            }
            if (!isset($sectionList[$sectionNameA]) || !isset($sectionList[$sectionNameB])) {
                return 1;
            }
            return (int) $sectionList[$sectionNameA]->sortOrder < (int) $sectionList[$sectionNameB]->sortOrder ? -1 : 1;
        });
        $questionOptions = $QuestionService->findQuestionsValuesByQuestionNameList($questionNames);
        $questions = $category = array();
        //        print_r($questions);
        //        exit;
        foreach ($questionList as $question) {
            if (in_array($question->name, $fields)) {
                $custom = json_decode($question->custom, true);
                $value = null;
                switch ($question->presentation) {
                    case $QUESTION_PRESENTATION_RANGE:
                        $value = '18-33';
                        break;
                    case $QUESTION_PRESENTATION_BIRTHDATE:
                    case $QUESTION_PRESENTATION_AGE:
                    case $QUESTION_PRESENTATION_DATE:
                        $value = date('Y-m-d H:i:s', strtotime('-18 year'));
                        break;
                }
                if (!isset($category[$question->sectionName])) {
                    $category[$question->sectionName] = array('category' => $question->sectionName, 'label' => $QuestionService->getSectionLang($question->sectionName));
                }
                $questions[] = array('name' => $question->name, 'label' => $QuestionService->getQuestionLang($question->name), 'presentation' => $question->name == 'googlemap_location' ? $question->name : $question->presentation, 'options' => formatOptionsForQuestion($question->name, $questionOptions), 'value' => $value, 'userSelectedValue' => renderQuestion($user_id, $question->name), 'userSelectedLabel' => renderQuestion($user_id, $question->name, true), 'required' => $question->required);
            }
        }
        if (in_array('avatar', $fields)) {
            $avatar = $BOL_AvatarService_inst->getAvatarUrl($user_id);
            $questions[] = array('name' => "avatar", 'label' => "Avatar", 'custom' => $custom, 'presentation' => "upload", 'options' => array(), 'value' => null, 'rawValue' => $value, 'userSelectedValue' => $avatar, 'userSelectedLabel' => "Avatar", 'required' => "0");
        }
        return $questions;
    }
}
Beispiel #3
0
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, HAMMU_LANG));
    //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];
                    }
                    if (!empty($user[HAMMU_LANG])) {
                        $language_lable = renderQuestion($key, HAMMU_LANG);
                        $language_value = renderQuestion($key, HAMMU_LANG, true);
                    } else {
                        $language_lable = "";
                        $language_value = "";
                    }
                    //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, "language_lable" => $language_lable, "language_value" => $language_value);
                }
            }
        }
    }
    //    print_r($user_data);
    //    exit;
    return $user_data;
}
function getallquestions($param)
{
    global $QuestionService;
    global $AccountTypeToGenderService;
    global $BOL_AvatarService_inst;
    global $QUESTION_PRESENTATION_RANGE;
    global $QUESTION_PRESENTATION_BIRTHDATE;
    global $QUESTION_PRESENTATION_AGE;
    global $QUESTION_PRESENTATION_DATE;
    global $Userservice;
    $fields = $param["fields"];
    $user_id = $param["user_id"];
    if (empty($user_id)) {
        $return_data = array("message" => "Please provide User id!", "status" => "false");
        $app->response->setBody(json_encode($return_data));
    }
    $user = $Userservice->findUserById($user_id);
    if (!empty($user)) {
        $account = $user->getAccountType();
        if ($account == "8cc28eaddb382d7c6a94aeea9ec029fb") {
            //        $sex = "lady";
            $account_type = 2;
        } else {
            $account_type = 1;
            //$sex = "gentleman";
        }
        $accountType = $AccountTypeToGenderService->getAccountType($account_type);
        $questionNames = array();
        $questionNames[] = "sex";
        foreach ($QuestionService->findSignUpQuestionsForAccountType($accountType) as $question) {
            //        if (in_array($question['name'], $exclideQuestions)) {
            //             continue;
            //        }
            $questionNames[] = $question['name'];
        }
        $questionList = $QuestionService->findQuestionByNameList($questionNames);
        $sectionNameList = array();
        foreach ($questionList as $question) {
            if (!in_array($question->sectionName, $sectionNameList)) {
                $sectionNameList[] = $question->sectionName;
            }
        }
        $sectionList = $QuestionService->findSectionBySectionNameList($sectionNameList);
        usort($questionList, function ($a, $b) use($sectionList) {
            $sectionNameA = $a->sectionName;
            $sectionNameB = $b->sectionName;
            if ($sectionNameA === $sectionNameB) {
                return (int) $a->sortOrder < (int) $b->sortOrder ? -1 : 1;
            }
            if (!isset($sectionList[$sectionNameA]) || !isset($sectionList[$sectionNameB])) {
                return 1;
            }
            return (int) $sectionList[$sectionNameA]->sortOrder < (int) $sectionList[$sectionNameB]->sortOrder ? -1 : 1;
        });
        $questionOptions = $QuestionService->findQuestionsValuesByQuestionNameList($questionNames);
        $questions = $category = array();
        foreach ($questionList as $question) {
            if (in_array($question->name, $fields)) {
                $custom = json_decode($question->custom, true);
                $value = null;
                switch ($question->presentation) {
                    case $QUESTION_PRESENTATION_RANGE:
                        $value = '18-33';
                        break;
                    case $QUESTION_PRESENTATION_BIRTHDATE:
                    case $QUESTION_PRESENTATION_AGE:
                    case $QUESTION_PRESENTATION_DATE:
                        $value = date('Y-m-d H:i:s', strtotime('-18 year'));
                        break;
                }
                if (!isset($category[$question->sectionName])) {
                    $category[$question->sectionName] = array('category' => $question->sectionName, 'label' => $QuestionService->getSectionLang($question->sectionName));
                }
                $questions[] = array('name' => $question->name, 'label' => $QuestionService->getQuestionLang($question->name), 'presentation' => $question->name == 'googlemap_location' ? $question->name : $question->presentation, 'options' => formatOptionsForQuestion($question->name, $questionOptions), 'value' => $value, 'userSelectedValue' => renderQuestion($user_id, $question->name), 'userSelectedLabel' => renderQuestion($user_id, $question->name, true), 'required' => $question->required);
            }
        }
        if (in_array('avatar', $fields)) {
            $avatar = $BOL_AvatarService_inst->getAvatarUrl($user_id);
            // $questions[] = array('name' => "avatar", "userSelectedValue" => $avatar);
            $questions[] = array('name' => "avatar", 'label' => "Avatar", 'presentation' => "upload", 'options' => array(), 'value' => null, 'userSelectedValue' => $avatar, 'userSelectedLabel' => "Avatar", 'required' => "0");
        }
        return $questions;
    }
}