Beispiel #1
0
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_SearchService
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Beispiel #2
0
 public function quickSearch()
 {
     if (!OW::getRequest()->isAjax()) {
         exit(json_encode(array('result' => false)));
     }
     $lang = OW::getLanguage();
     $form = OW::getClassInstance('USEARCH_CLASS_QuickSearchForm', $this);
     $isValid = $form->isValid($_POST);
     $data = $form->getValues();
     if (!empty($data['match_sex'])) {
         $data['match_sex'] = $data['match_sex'];
         OW::getSession()->set(USEARCH_CLASS_QuickSearchForm::FORM_SESSEION_VAR, $data);
     }
     if ($isValid) {
         if (!OW::getUser()->isAuthorized('base', 'search_users')) {
             $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
             OW::getFeedback()->warning($status['msg']);
             exit(json_encode(array('result' => false, 'error' => $status['msg'])));
         }
         //            if ( $credits === false )
         //            {
         //                exit(json_encode(
         //                    array('result' => false, 'error' => OW::getEventManager()->call('usercredits.error_message', $eventParams))
         //                ));
         //            }
         $addParams = array('join' => '', 'where' => '');
         if ($data['online']) {
             $addParams['join'] .= " INNER JOIN `" . BOL_UserOnlineDao::getInstance()->getTableName() . "` `online` ON (`online`.`userId` = `user`.`id`) ";
         }
         if ($data['with_photo']) {
             $addParams['join'] .= " INNER JOIN `" . OW_DB_PREFIX . "base_avatar` avatar ON (`avatar`.`userId` = `user`.`id`) ";
             //$addParams['join'] .= " INNER JOIN `".OW_DB_PREFIX . "photo_album` album ON (`album`.`userId` = `user`.`id`)
             //        INNER JOIN `". OW_DB_PREFIX . "photo` `photo` ON (`album`.`id` = `photo`.`albumId`) ";
         }
         $data = USEARCH_BOL_Service::getInstance()->updateSearchData($data);
         $data = USEARCH_BOL_Service::getInstance()->updateQuickSearchData($data);
         $userIdList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($data, 0, BOL_SearchService::USER_LIST_SIZE, false, $addParams);
         $listId = 0;
         if (count($userIdList) > 0) {
             $listId = BOL_SearchService::getInstance()->saveSearchResult($userIdList);
         }
         OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE, $listId);
         OW::getSession()->set('usearch_search_data', $data);
         BOL_AuthorizationService::getInstance()->trackAction('base', 'search_users');
         exit(json_encode(array('result' => true, 'url' => OW::getRouter()->urlForRoute("users-search-result", array()))));
     }
     exit(json_encode(array('result' => true, 'url' => OW::getRouter()->urlForRoute("users-search"))));
 }
 public function process($data)
 {
     if (OW::getRequest()->isPost() && isset($data[self::SUBMIT_NAME]) && $this->isValid($data) && !$this->isAjax()) {
         if (!OW::getUser()->isAuthorized('base', 'search_users')) {
             $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
             OW::getFeedback()->warning($status['msg']);
             $this->controller->redirect();
         }
         $userIdList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($data, 0, BOL_SearchService::USER_LIST_SIZE);
         $listId = 0;
         if (count($userIdList) > 0) {
             $listId = BOL_SearchService::getInstance()->saveSearchResult($userIdList);
         }
         OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE, $listId);
         BOL_AuthorizationService::getInstance()->trackAction('base', 'search_users');
         $this->controller->redirect(OW::getRouter()->urlForRoute("users-search-result", array()));
     }
 }
Beispiel #4
0
$ow_user = OW::getUser();
$OW_Auth_inst = OW_Auth::getInstance();
$Userservice = BOL_UserService::getInstance();
$EmailVerifyService = BOL_EmailVerifyService::getInstance();
$BOL_AvatarService_inst = BOL_AvatarService::getInstance();
$SKAPI_BOL_Service_inst = SKAPI_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService_inst = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
$PHOTO_BOL_PhotoTemporaryService = PHOTO_BOL_PhotoTemporaryService::getInstance();
$UserResetPassword = BOL_UserResetPasswordDao::getInstance();
$QuestionService = BOL_QuestionService::getInstance();
$AccountTypeToGenderService = SKADATE_BOL_AccountTypeToGenderService::getInstance();
$BOL_AuthorizationService = BOL_AuthorizationService::getInstance();
$BOL_UserOnlineDao = BOL_UserOnlineDao::getInstance();
$USEARCH_BOL_Service = USEARCH_BOL_Service::getInstance();
$BOL_SearchService = BOL_SearchService::getInstance();
$getPluginManager = OW::getPluginManager();
$CONTACTUS_BOL_Service = CONTACTUS_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumCoverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance();
$PHOTO_BOL_PhotoDao = PHOTO_BOL_PhotoDao::getInstance();
$getRouter = OW::getRouter();
$language = OW::getLanguage();
$getMailer = OW::getMailer();
$getConfig = OW::getConfig();
$getFeedback = OW::getFeedback();
$getEventManager = OW::getEventManager();
$getMailer = OW::getMailer();
$ow = OW_DB_PREFIX;
$LanguageService = BOL_LanguageService::getInstance();
$OW_Language = OW_Language::getInstance();
Beispiel #5
0
 public function expireSearchResultList()
 {
     BOL_SearchService::getInstance()->deleteExpireSearchResult();
 }
Beispiel #6
0
 public function findSearchResultList($listId, $first, $count)
 {
     $userIdList = BOL_SearchService::getInstance()->getUserIdList($listId, $first, $count);
     if (empty($userIdList)) {
         return array();
     }
     $queryParts = $this->getUserQueryFilter("user", "id", array("method" => "BOL_UserDao::findUserIdListByQuestionValues"));
     $sql = "SELECT `user`.* FROM `" . $this->getTableName() . "` `user`\n            {$queryParts["join"]}\n            WHERE `user`.`id` IN (" . $this->dbo->mergeInClause($userIdList) . ")\n            ORDER BY " . (!empty($queryParts["order"]) ? $queryParts["order"] . ", " : "") . " `user`.`activityStamp` DESC";
     return $this->dbo->queryForObjectList($sql, $this->getDtoClassName());
 }
 public function process($data)
 {
     if (OW::getRequest()->isPost() && !$this->isAjax() && isset($data['form_name']) && $data['form_name'] === $this->getName()) {
         OW::getSession()->set(self::FORM_SESSEION_VAR, $data);
         OW::getSession()->set('usearch_search_data', $data);
         if (isset($data[self::SUBMIT_NAME]) && $this->isValid($data) && !$this->isAjax()) {
             if (!OW::getUser()->isAuthorized('base', 'search_users')) {
                 $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
                 OW::getFeedback()->warning($status['msg']);
                 $this->controller->redirect();
             }
             $data = $this->updateSearchData($data);
             $data = USEARCH_BOL_Service::getInstance()->updateSearchData($data);
             $addParams = array('join' => '', 'where' => '');
             if (!empty($data['online'])) {
                 $addParams['join'] .= " INNER JOIN `" . BOL_UserOnlineDao::getInstance()->getTableName() . "` `online` ON (`online`.`userId` = `user`.`id`) ";
             }
             if (!empty($data['with_photo'])) {
                 $addParams['join'] .= " INNER JOIN `" . OW_DB_PREFIX . "base_avatar` avatar ON (`avatar`.`userId` = `user`.`id`) ";
                 //                    $addParams['join'] .= " INNER JOIN `".OW_DB_PREFIX . "photo_album` album ON (`album`.`userId` = `user`.`id`)
                 //                            INNER JOIN `". OW_DB_PREFIX . "photo` `photo` ON (`album`.`id` = `photo`.`albumId`) ";
             }
             $userIdList = USEARCH_BOL_Service::getInstance()->findUserIdListByQuestionValues($data, 0, BOL_SearchService::USER_LIST_SIZE, false, $addParams);
             $listId = 0;
             if (OW::getUser()->isAuthenticated()) {
                 foreach ($userIdList as $key => $id) {
                     if (OW::getUser()->getId() == $id) {
                         unset($userIdList[$key]);
                     }
                 }
             }
             if (count($userIdList) > 0) {
                 $listId = BOL_SearchService::getInstance()->saveSearchResult($userIdList);
             }
             OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE, $listId);
             BOL_AuthorizationService::getInstance()->trackAction('base', 'search_users');
             $this->controller->redirect(OW::getRouter()->urlForRoute("users-search-result", array()));
         }
         $this->controller->redirect(OW::getRouter()->urlForRoute("users-search"));
     }
 }
Beispiel #8
0
 public function searchResult($params)
 {
     //OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE,999);
     $listId = OW::getSession()->get(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE);
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $orderType = $this->getOrderType($params);
     if (!OW::getUser()->isAuthenticated()) {
         if (in_array($orderType, array(USEARCH_BOL_Service::LIST_ORDER_MATCH_COMPATIBILITY, USEARCH_BOL_Service::LIST_ORDER_DISTANCE))) {
             throw new Redirect404Exception();
         }
     }
     $limit = 16;
     $itemCount = BOL_SearchService::getInstance()->countSearchResultItem($listId);
     $list = USEARCH_BOL_Service::getInstance()->getSearchResultList($listId, $orderType, ($page - 1) * $limit, $limit);
     $idList = array();
     foreach ($list as $dto) {
         $idList[] = $dto->id;
     }
     $searchResultMenu = $this->searchResultMenu($orderType);
     if (!empty($searchResultMenu)) {
         $this->addComponent('searchResultMenu', $searchResultMenu);
     }
     $cmp = OW::getClassInstance('USEARCH_CMP_SearchResultList', $list, $page, $orderType);
     $this->addComponent('cmp', $cmp);
     $script = '$(".back_to_search_button").click(function(){
         window.location = ' . json_encode(OW::getRouter()->urlForRoute('users-search')) . ';
     });  ';
     OW::getDocument()->addOnloadScript($script);
     $jsParams = array('excludeList' => $idList, 'respunderUrl' => OW::getRouter()->urlForRoute('usearch.load_list_action'), 'orderType' => $orderType, 'page' => $page, 'listId' => $listId, 'count' => $limit);
     $script = ' USEARCH_ResultList.init(' . json_encode($jsParams) . ', $(".ow_search_results_photo_gallery_container")); ';
     OW::getDocument()->addOnloadScript($script);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('usearch')->getStaticJsUrl() . 'result_list.js');
     $this->addComponent('menu', $this->getMenu());
     $this->assign('itemCount', $itemCount);
     $this->assign('page', $page);
     $this->assign('searchUrl', OW::getRouter()->urlForRoute('users-search'));
     OW::getDocument()->setHeading(OW::getLanguage()->text('usearch', 'search_result'));
     OW::getDocument()->setDescription(OW::getLanguage()->text('base', 'users_list_user_search_meta_description'));
 }
Beispiel #9
0
 public function process($data)
 {
     if (OW::getRequest()->isPost() && isset($data[self::SUBMIT_NAME]) && $this->isValid($data) && !$this->isAjax()) {
         if (!OW::getUser()->isAuthorized('base', 'search_users')) {
             OW::getFeedback()->warning(OW::getLanguage()->text('base', 'user_search_authorization_warning'));
             $this->controller->redirect();
         }
         $eventParams = array('pluginKey' => 'base', 'action' => 'search_users');
         $credits = OW::getEventManager()->call('usercredits.check_balance', $eventParams);
         if ($credits === false) {
             OW::getFeedback()->warning(OW::getEventManager()->call('usercredits.error_message', $eventParams));
             $this->controller->redirect();
         }
         $userIdList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($data, 0, BOL_SearchService::USER_LIST_SIZE);
         $listId = 0;
         if (count($userIdList) > 0) {
             $listId = BOL_SearchService::getInstance()->saveSearchResult($userIdList);
         }
         OW::getSession()->set(BOL_SearchService::SEARCH_RESULT_ID_VARIABLE, $listId);
         if ($credits === true) {
             OW::getEventManager()->call('usercredits.track_action', $eventParams);
         }
         $this->controller->redirect(OW::getRouter()->urlForRoute("users-search-result", array()));
     }
 }
Beispiel #10
0
 protected function searchResult($params, $listId)
 {
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $orderType = $this->getOrderType($params);
     //bhushan changes
     if (!OW::getUser()->isAuthenticated()) {
         if (in_array($orderType, array(USEARCH_BOL_Service::LIST_ORDER_MATCH_COMPATIBILITY, USEARCH_BOL_Service::LIST_ORDER_DISTANCE))) {
             throw new Redirect404Exception();
         }
         //    }
         //end bhushan changes
         $limit = 16;
         $itemCount = BOL_SearchService::getInstance()->countSearchResultItem($listId);
         $list = USEARCH_BOL_Service::getInstance()->getSearchResultList($listId, $orderType, ($page - 1) * $limit, $limit);
         foreach ($list as $key => $list_id) {
             $ids[] = $list_id->id;
         }
         $user_ids = array();
         $user_data = array();
         if (!empty($ids)) {
             $user_ids = array_values($ids);
             $single_id = $user_ids[0];
         }
         $userinfoData = array();
         $userinfoData = BOL_QuestionService::getInstance()->getQuestionData($user_ids, array('id', 'username', 'realname', 'birthdate', 'googlemap_location'));
         $flag = "1";
         $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars($user_ids, true, true, true, true, $flag);
         //$onlineStatus = $Userservice->findOnlineStatusForUserList($user_ids);
         foreach ($userinfoData as $key => $user) {
             $user_data[] = array("user_id" => $key, "user_name" => $user["username"], "realname" => $user["realname"], "profile_picture" => $avatar[$key]["src"]);
         }
         return $user_data;
     }
 }