/** * @return USEARCH_CLASS_EventHandler */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
OW::getRouter()->addRoute(new OW_Route('users-search', '/users/search/', 'USEARCH_CTRL_Search', 'form')); OW::getRouter()->removeRoute('users-search-result'); OW::getRouter()->addRoute(new OW_Route('users-search-result', '/users/search-result/:orderType/', 'USEARCH_CTRL_Search', 'searchResult', array('orderType' => array(OW_Route::PARAM_OPTION_DEFAULT_VALUE => 'latest_activity')))); OW::getRouter()->addRoute(new OW_Route('usearch.details', '/users/search/details/', 'USEARCH_CTRL_Search', 'details')); OW::getRouter()->addRoute(new OW_Route('usearch.map', '/users/search/map/', 'USEARCH_CTRL_Search', 'map')); OW::getRouter()->addRoute(new OW_Route('usearch.follow', '/users/search/ajax/follow/', 'USEARCH_CTRL_Ajax', 'follow')); OW::getRouter()->addRoute(new OW_Route('usearch.unfollow', '/users/search/ajax/unfollow/', 'USEARCH_CTRL_Ajax', 'unfollow')); OW::getRouter()->addRoute(new OW_Route('usearch.addfriend', '/users/search/ajax/addfriend/', 'USEARCH_CTRL_Ajax', 'addfriend')); OW::getRouter()->addRoute(new OW_Route('usearch.removefriend', '/users/search/ajax/removefriend/', 'USEARCH_CTRL_Ajax', 'removefriend')); OW::getRouter()->addRoute(new OW_Route('usearch.block', '/users/search/ajax/block/', 'USEARCH_CTRL_Ajax', 'block')); OW::getRouter()->addRoute(new OW_Route('usearch.unblock', '/users/search/ajax/unblock/', 'USEARCH_CTRL_Ajax', 'unblock')); OW::getRouter()->addRoute(new OW_Route('usearch.quick_search_action', '/usearch/ajax/quick-search', 'USEARCH_CTRL_Ajax', 'quickSearch')); OW::getRouter()->addRoute(new OW_Route('usearch.load_list_action', '/usearch/ajax/load-list', 'USEARCH_CTRL_Ajax', 'loadList')); OW::getRouter()->addRoute(new OW_Route('usearch.admin_quick_search_setting', '/admin/usearch/quick-search-settings', 'USEARCH_CTRL_Admin', 'quickSearchSettings')); OW::getRouter()->addRoute(new OW_Route('usearch.admin_general_setting', '/admin/usearch/general-settings', 'USEARCH_CTRL_Admin', 'generalSettings')); USEARCH_CLASS_EventHandler::getInstance()->init(); function usearch_set_presentation(OW_Event $event) { $params = $event->getParams(); if ($params['type'] != 'search' || !in_array($params['fieldName'], array('sex', 'birthdate'))) { return; } $lang = OW::getLanguage(); $sessionData = OW::getSession()->get(USEARCH_CLASS_QuickSearchForm::FORM_SESSEION_VAR); switch ($params['fieldName']) { case 'sex': $field = new Selectbox('sex'); $field->setLabel($lang->text('usearch', 'search_label_sex')); $field->setHasInvitation(false); if (!empty($sessionData['sex'])) { $field->setValue($sessionData['sex']);
private function process($list) { $service = BOL_UserService::getInstance(); $idList = array(); $userList = array(); foreach ($list as $dto) { $userList[] = array('dto' => $dto); $idList[] = $dto->getId(); } $displayNameList = array(); $questionList = array(); $markList = array(); if (!empty($idList)) { $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, false, true, true, false); $vatarsSrc = BOL_AvatarService::getInstance()->getAvatarsUrlList($idList, 2); foreach ($avatars as $userId => $avatarData) { $avatars[$userId]['src'] = $vatarsSrc[$userId]; $displayNameList[$userId] = isset($avatarData['title']) ? $avatarData['title'] : ''; } $usernameList = $service->getUserNamesForList($idList); $onlineInfo = $service->findOnlineStatusForUserList($idList); $showPresenceList = array(); $ownerIdList = array(); foreach ($onlineInfo as $userId => $isOnline) { $ownerIdList[$userId] = $userId; } $eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerIdList' => $ownerIdList, 'viewerId' => OW::getUser()->getId()); $permissions = OW::getEventManager()->getInstance()->call('privacy_check_permission_for_user_list', $eventParams); foreach ($onlineInfo as $userId => $isOnline) { // Check privacy permissions if (isset($permissions[$userId]['blocked']) && $permissions[$userId]['blocked'] == true) { $showPresenceList[$userId] = false; continue; } $showPresenceList[$userId] = true; } if ($this->actions) { $actions = USEARCH_CLASS_EventHandler::getInstance()->collectUserListActions($idList); $this->assign('actions', $actions); } $this->assign('showPresenceList', $showPresenceList); $this->assign('fields', $this->getFields($idList)); $this->assign('questionList', $questionList); $this->assign('usernameList', $usernameList); $this->assign('avatars', $avatars); $this->assign('displayNameList', $displayNameList); $this->assign('onlineInfo', $onlineInfo); $this->assign('page', $this->page); $activityShowLimit = OW::getConfig()->getValue('usearch', 'hide_user_activity_after'); $this->assign('activityShowLimit', time() - (int) $activityShowLimit * 24 * 60 * 60); if (OW::getPluginManager()->isPluginActive('bookmarks') && OW::getUser()->isAuthenticated()) { $markList = BOOKMARKS_BOL_MarkDao::getInstance()->getMarkedListByUserId(OW::getUser()->getId(), $idList); $this->assign('bookmarkActive', TRUE); $contextActionList = array(); foreach ($idList as $id) { $label = !empty($markList[$id]) ? OW::getLanguage()->text('bookmarks', 'unmark_toolbar_label') : OW::getLanguage()->text('bookmarks', 'mark_toolbar_label'); $contextAction = new BASE_CMP_ContextAction(); $contextParentAction = new BASE_ContextAction(); $contextParentAction->setKey('userlist_menu'); $contextParentAction->setClass('ow_usearch_userlist_menu ow_newsfeed_context '); $contextAction->addAction($contextParentAction); $action = new BASE_ContextAction(); $action->setKey('bookmark'); $action->setLabel($label); $action->addAttribute('data-user-id', $id); $action->setClass('ow_ulist_big_avatar_bookmark usearch_bookmark download'); $action->setUrl('javascript://'); $action->setParentKey($contextParentAction->getKey()); $action->setOrder(1); $contextAction->addAction($action); $contextActionList[$id] = $contextAction->render(); } $this->assign('itemMenu', $contextActionList); } } $this->assign('list', $userList); $this->assign('bookmarkList', $markList); }
<?php /** * Copyright (c) 2014, Skalfa LLC * All rights reserved. * * ATTENTION: This commercial software is intended for exclusive use with SkaDate Dating Software (http://www.skadate.com) and is licensed under SkaDate Exclusive License by Skalfa LLC. * * Full text of this license can be found at http://www.skadate.com/sel.pdf */ USEARCH_CLASS_EventHandler::getInstance()->genericInit();