Example #1
0
 public function getList(array $params)
 {
     OW::getDocument()->setHeading(OW::getLanguage()->text('bookmarks', 'list_headint_title'));
     $this->setTemplate(OW::getPluginManager()->getPlugin('bookmarks')->getCtrlViewDir() . 'list.html');
     $userId = OW::getUser()->getId();
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $userOnPage = (int) OW::getConfig()->getValue('base', 'users_on_page');
     $first = ($page - 1) * $userOnPage;
     $list = $this->service->findBookmarksUserIdList($userId, $first, $userOnPage, $params['category']);
     $count = $this->service->findBookmarksCount($userId, $params['category']);
     $sexValue = array();
     $userDataList = array();
     $questionService = BOL_QuestionService::getInstance();
     $data = $questionService->getQuestionData($list, array('sex', 'googlemap_location', 'birthdate'));
     foreach (BOL_QuestionValueDao::getInstance()->findQuestionValues('sex') as $sexDto) {
         $sexValue[$sexDto->value] = $questionService->getQuestionValueLang('sex', $sexDto->value);
     }
     foreach ($data as $userId => $user) {
         if (isset($user['birthdate'])) {
             $date = UTIL_DateTime::parseDate($user['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
             $age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
         } else {
             $age = '';
         }
         $userDataList[$userId] = array('info_gender' => !empty($user['sex']) && !empty($sexValue[$user['sex']]) ? $sexValue[$user['sex']] : '' . ' ' . $age, 'location' => !empty($user['googlemap_location']) ? $user['googlemap_location']['address'] : '');
     }
     $this->addComponent('list', OW::getClassInstance('BASE_CMP_Users', $userDataList, array(), $count));
 }
Example #2
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $avatarData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($this->user->id));
     $avatarDto = BOL_AvatarService::getInstance()->findByUserId($this->user->id);
     $owner = false;
     if (OW::getUser()->getId() == $this->user->getId()) {
         $owner = true;
     }
     $isModerator = OW::getUser()->isAuthorized('base') || OW::getUser()->isAdmin();
     $avatarData[$this->user->id]['src'] = BOL_AvatarService::getInstance()->getAvatarUrl($this->user->getId(), 1, null, true, !($owner || $isModerator));
     $default_avatar['src'] = BOL_AvatarService::getInstance()->getDefaultAvatarUrl(1);
     $user = array();
     $user["avatar"] = !empty($avatarData[$this->user->id]['src']) ? $avatarData[$this->user->id] : $default_avatar;
     $user["displayName"] = $avatarData[$this->user->id]["title"];
     $this->assign("user", $user);
     $this->addComponent('toolbar', OW::getClassInstance("BASE_MCMP_ProfileActionToolbar", $this->user->id));
     $eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerIdList' => array($this->user->id), 'viewerId' => OW::getUser()->getId());
     $permissions = OW::getEventManager()->getInstance()->call('privacy_check_permission_for_user_list', $eventParams);
     $showPresence = !(isset($permissions[$this->user->id]['blocked']) && $permissions[$this->user->id]['blocked'] == true);
     $this->assign("showPresence", $showPresence);
     $isOnline = null;
     $activityStamp = null;
     if ($showPresence) {
         $onlineInfo = BOL_UserService::getInstance()->findOnlineStatusForUserList(array($this->user->id));
         $isOnline = $onlineInfo[$this->user->id];
         $activityStamp = $this->user->activityStamp;
     }
     $this->assign("isOnline", $isOnline);
     $this->assign("avatarDto", $avatarDto);
     $this->assign("activityStamp", $activityStamp);
     $this->assign('owner', $owner);
     $this->assign('isModerator', $isModerator);
 }
Example #3
0
 public function index(array $params)
 {
     if (!($userId = OW::getUser()->getId())) {
         throw new AuthenticateException();
     }
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $lang = OW::getLanguage();
     $perPage = (int) OW::getConfig()->getValue('base', OW::getPluginManager()->isPluginActive('skadate') ? 'users_on_page' : 'users_count_on_page');
     $guests = OCSGUESTS_BOL_Service::getInstance()->findGuestsForUser($userId, $page, $perPage);
     $guestList = array();
     if ($guests) {
         foreach ($guests as $guest) {
             $guestList[$guest->guestId] = array('last_visit' => $lang->text('ocsguests', 'visited') . ' ' . '<span class="ow_remark">' . $guest->visitTimestamp . '</span>');
         }
         $itemCount = OCSGUESTS_BOL_Service::getInstance()->countGuestsForUser($userId);
         if (OW::getPluginManager()->isPluginActive('skadate')) {
             $cmp = OW::getClassInstance('BASE_CMP_Users', $guestList, array(), $itemCount);
         } else {
             $guestsUsers = OCSGUESTS_BOL_Service::getInstance()->findGuestUsers($userId, $page, $perPage);
             $cmp = new OCSGUESTS_CMP_Users($guestsUsers, $itemCount, $perPage, true, $guestList);
         }
         $this->addComponent('guests', $cmp);
     } else {
         $this->assign('guests', null);
     }
     $this->setPageHeading($lang->text('ocsguests', 'viewed_profile'));
     $this->setPageTitle($lang->text('ocsguests', 'viewed_profile'));
     OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'base', 'dashboard');
 }
 public function __construct()
 {
     parent::__construct();
     $form = OW::getClassInstance('FEMALEREGONLYMEN_CLASS_QuickSearchForm', $this);
     $this->addForm($form);
     $this->assign('form', $form);
     $this->assign('advancedUrl', OW::getRouter()->urlForRoute('users-search'));
     $this->assign('questions', USEARCH_BOL_Service::getInstance()->getQuickSerchQuestionNames());
 }
Example #5
0
 protected function getUserList($data)
 {
     $userList = OW::getClassInstance("BASE_CMP_MiniAvatarUserList", $data["ids"]);
     $userList->setEmptyListNoRender(true);
     if (!empty($data["viewAllUrl"])) {
         $userList->setViewMoreUrl($this->getUrl($data["viewAllUrl"]));
     }
     return array("label" => $this->getLocalizedText($data['label']), "list" => $userList->render());
 }
Example #6
0
/**
 * Smarty component function.
 *
 * @author Sardar Madumarov <*****@*****.**>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_function_component($params, $smarty)
{
    if (!isset($params['class']) || !mb_strstr($params['class'], '_')) {
        throw new InvalidArgumentException('Ivalid class name provided `' . $params['class'] . '`');
    }
    $class = trim($params['class']);
    unset($params['class']);
    $cmp = OW::getClassInstance($class, $params);
    return $cmp->render();
}
Example #7
0
 public function forApproval()
 {
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'user_list_index.html');
     $language = OW::getLanguage();
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     list($list, $itemCount) = $this->getData('waiting-for-approval', ($page - 1) * $this->usersPerPage, $this->usersPerPage);
     //$cmp = new BASE_Members($list, $itemCount, $this->usersPerPage, false, 'waiting-for-approval');
     $cmp = OW::getClassInstance("BASE_Members", $list, $itemCount, $this->usersPerPage, false, 'waiting-for-approval');
     $this->addComponent('cmp', $cmp);
     $this->assign('listType', 'waiting-for-approval');
 }
Example #8
0
 /**
  * Returns class instance
  * @param $includeCache bool
  * @return BOL_LanguageService
  */
 public static function getInstance($includeCache = true)
 {
     if (!isset(self::$classInstance)) {
         try {
             self::$classInstance = OW::getClassInstance(self::class, $includeCache);
         } catch (ReflectionException $ex) {
             self::$classInstance = new self($includeCache);
         }
     }
     return self::$classInstance;
 }
Example #9
0
 public function __construct()
 {
     parent::__construct();
     $form = OW::getClassInstance("MAILBOX_CLASS_NewMessageForm", $this);
     /* @var $user MAILBOX_CLASS_NewMessageForm */
     $this->addForm($form);
     $this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
     $this->assign('displayCaptcha', false);
     $configs = OW::getConfig()->getValues('mailbox');
     $this->assign('enableAttachments', !empty($configs['enable_attachments']));
 }
Example #10
0
 public function newMessage()
 {
     $form = OW::getClassInstance("MAILBOX_CLASS_NewMessageForm");
     /* @var $user MAILBOX_CLASS_NewMessageForm */
     if ($form->isValid($_POST)) {
         $result = $form->process();
         exit(json_encode($result));
     } else {
         exit(json_encode(array($form->getErrors())));
     }
 }
Example #11
0
 public static function getInstance()
 {
     if (static::$instance == null) {
         try {
             static::$instance = OW::getClassInstance(static::class);
         } catch (ReflectionException $ex) {
             static::$instance = new static();
         }
     }
     return static::$instance;
 }
Example #12
0
 public function index()
 {
     $this->assign('staticUrl', OW::getPluginManager()->getPlugin('spvideolite')->getStaticUrl());
     $this->assign('embedForm', $this->embedForm);
     $this->addComponent('dragDropCmp', OW::getClassInstance('SPVIDEOLITE_CMP_AjaxUpload'));
     // call selected module upload template
     $module = SPVIDEOLITE_BOL_Configs::getInstance()->get('processor');
     $func = 'add';
     if (SPVIDEOLITE_BOL_Configs::getInstance()->get('features.upload_video')) {
         $viewPath = SPVIDEOLITE_BOL_Service::callProcessorFunction($module, 'getViewPath', $this);
         $view = $func . '.html';
         $this->assign('uploadFormTpl', $viewPath . DS . $view);
         SPVIDEOLITE_BOL_Service::callProcessorFunction($module, $func, $this);
     }
 }
Example #13
0
 public function index()
 {
     OW::getDocument()->setDescription(OW::getLanguage()->text('base', 'users_list_user_search_meta_description'));
     $this->addComponent('menu', BASE_CTRL_UserList::getMenu('search'));
     if (!OW::getUser()->isAuthorized('base', 'search_users')) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
         $this->assign('authMessage', $status['msg']);
         return;
     }
     $mainSearchForm = OW::getClassInstance('MainSearchForm', $this);
     $mainSearchForm->process($_POST);
     $this->addForm($mainSearchForm);
     $displayNameSearchForm = new DisplayNameSearchForm($this);
     $displayNameSearchForm->process($_POST);
     $this->addForm($displayNameSearchForm);
 }
Example #14
0
 public function collectItems(BASE_CLASS_ConsoleItemCollector $event)
 {
     $language = OW::getLanguage();
     $router = OW::getRouter();
     if (OW::getUser()->isAuthenticated()) {
         // Admin menu
         if (OW::getUser()->isAdmin()) {
             $item = new BASE_CMP_ConsoleDropdownMenu($language->text('admin', 'main_menu_admin'));
             $item->setUrl($router->urlForRoute('admin_default'));
             $item->addItem('head', array('label' => $language->text('admin', 'console_item_admin_dashboard'), 'url' => $router->urlForRoute('admin_default')));
             $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_theme'), 'url' => $router->urlForRoute('admin_themes_edit')));
             $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_users'), 'url' => $router->urlForRoute('admin_users_browse')));
             $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_pages'), 'url' => $router->urlForRoute('admin_pages_main')));
             $item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_plugins'), 'url' => $router->urlForRoute('admin_plugins_installed')));
             $event->addItem($item, 1);
         }
         /**
          * My Profile Menu
          *
          * @var $item BASE_CMP_MyProfileConsoleItem
          */
         $item = OW::getClassInstance("BASE_CMP_MyProfileConsoleItem");
         $event->addItem($item, 2);
     } else {
         $buttonListEvent = new BASE_CLASS_EventCollector(BASE_CMP_ConnectButtonList::HOOK_REMOTE_AUTH_BUTTON_LIST);
         OW::getEventManager()->trigger($buttonListEvent);
         $buttonList = $buttonListEvent->getData();
         $iconListMarkup = '';
         foreach ($buttonList as $button) {
             $iconListMarkup .= '<span class="ow_ico_signin ' . $button['iconClass'] . '"></span>';
         }
         $cmp = new BASE_CMP_SignIn(true);
         $signInMarkup = '<div style="display:none"><div id="base_cmp_floatbox_ajax_signin">' . $cmp->render() . '</div></div>';
         $item = new BASE_CMP_ConsoleItem();
         $item->setControl($signInMarkup . '<span class="ow_signin_label' . (empty($buttonList) ? '' : ' ow_signin_delimiter') . '">' . $language->text('base', 'sign_in_submit_label') . '</span>' . $iconListMarkup);
         $event->addItem($item, 2);
         OW::getDocument()->addOnloadScript("\n                \$('#" . $item->getUniqId() . "').click(function(){new OW_FloatBox({ \$contents: \$('#base_cmp_floatbox_ajax_signin')});});\n            ");
         $item = new BASE_CMP_ConsoleButton($language->text('base', 'console_item_sign_up_label'), OW::getRouter()->urlForRoute('base_join'));
         $event->addItem($item, 1);
     }
     $item = new BASE_CMP_ConsoleSwitchLanguage();
     $event->addItem($item, 0);
 }
Example #15
0
 /**
  * Default action. Rules tab
  */
 public function index($params)
 {
     $userId = OW::getUser()->getId();
     if (OW::getRequest()->isAjax()) {
         exit;
     }
     if (!OW::getUser()->isAuthenticated() || $userId === null) {
         throw new AuthenticateException();
     }
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('base', 'users_browse_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_chat');
     $this->setPageTitle($language->text('matchmaking', 'matches_index'));
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $perPage = (int) OW::getConfig()->getValue('base', 'users_on_page');
     $first = ($page - 1) * $perPage;
     $count = $perPage;
     $dtoList = $this->service->findMatchList($userId, $first, $count, $params['sortOrder']);
     $listCount = $this->service->findMatchCount($userId);
     $userService = BOL_UserService::getInstance();
     $idList = array();
     $compatibilityList = array();
     foreach ($dtoList as $id => $item) {
         $idList[] = (int) $item['id'];
         $compatibilityList[$item['id']] = $this->service->getCompatibilityByValue($item['compatibility']);
     }
     $userDataList = array();
     $fields = $this->service->getFieldsForMatchList($idList);
     foreach ($idList as $userId) {
         $userDataList[$userId] = array('info_gender' => !empty($fields[$userId]) ? $fields[$userId] : '', 'compatibility' => !empty($compatibilityList[$userId]) ? OW::getLanguage()->text('matchmaking', 'compatibility') . ': <span class="ow_txt_value">' . $compatibilityList[$userId] . '%</span>' : '');
     }
     $listCmp = OW::getClassInstance('BASE_CMP_Users', $userDataList, array(), $listCount);
     $listCmp->setDisplayActivity(false);
     $this->addComponent('listCmp', $listCmp);
     $sortControl = new BASE_CMP_SortControl();
     $sortControl->addItem('newest', OW::getLanguage()->text('matchmaking', 'newest_first'), OW::getRouter()->urlForRoute('matchmaking_members_page_sorted', array('sortOrder' => 'newest')));
     $sortControl->addItem('compatible', OW::getLanguage()->text('matchmaking', 'most_compatible_first'), OW::getRouter()->urlForRoute('matchmaking_members_page_sorted', array('sortOrder' => 'compatible')));
     $sortControl->setActive($params['sortOrder']);
     $this->addComponent('sortControl', $sortControl);
     $this->addComponent('paging', new BASE_CMP_Paging($page, ceil($listCount / $perPage), 5));
 }
Example #16
0
 public function __construct($albumId = null, $albumName = null, $albumDescription = null, $url = null, $data = null)
 {
     parent::__construct();
     if (!OW::getUser()->isAuthorized('photo', 'upload')) {
         $this->setVisible(false);
         return;
     }
     $userId = OW::getUser()->getId();
     $document = OW::getDocument();
     PHOTO_BOL_PhotoTemporaryService::getInstance()->deleteUserTemporaryPhotos($userId);
     $plugin = OW::getPluginManager()->getPlugin('photo');
     $document->addStyleSheet($plugin->getStaticCssUrl() . 'photo_upload.css');
     $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'upload.js');
     $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxPhotoUploadParams = Object.freeze({$params});', array('params' => array('actionUrl' => OW::getRouter()->urlForRoute('photo.ajax_upload'), 'maxFileSize' => PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize(), 'deleteAction' => OW::getRouter()->urlForRoute('photo.ajax_upload_delete')))));
     $document->addOnloadScript(';window.ajaxPhotoUploader.init();');
     $form = new PHOTO_CLASS_AjaxUploadForm('user', $userId, $albumId, $albumName, $albumDescription, $url, $data);
     $this->addForm($form);
     $this->assign('extendInputs', $form->getExtendedElements());
     $this->assign('albumId', $albumId);
     $this->assign('userId', $userId);
     $newsfeedAlbum = PHOTO_BOL_PhotoAlbumService::getInstance()->getNewsfeedAlbum($userId);
     $exclude = !empty($newsfeedAlbum) ? array($newsfeedAlbum->id) : array();
     $this->addComponent('albumNames', OW::getClassInstance('PHOTO_CMP_AlbumNameList', $userId, $exclude));
     $language = OW::getLanguage();
     $language->addKeyForJs('photo', 'not_all_photos_uploaded');
     $language->addKeyForJs('photo', 'size_limit');
     $language->addKeyForJs('photo', 'type_error');
     $language->addKeyForJs('photo', 'dnd_support');
     $language->addKeyForJs('photo', 'dnd_not_support');
     $language->addKeyForJs('photo', 'drop_here');
     $language->addKeyForJs('photo', 'please_wait');
     $language->addKeyForJs('photo', 'create_album');
     $language->addKeyForJs('photo', 'album_name');
     $language->addKeyForJs('photo', 'album_desc');
     $language->addKeyForJs('photo', 'describe_photo');
     $language->addKeyForJs('photo', 'photo_upload_error');
 }
Example #17
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $avatarData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($this->user->id));
     $user = array();
     $user["avatar"] = $avatarData[$this->user->id];
     $user["displayName"] = $avatarData[$this->user->id]["title"];
     $this->assign("user", $user);
     $this->addComponent('toolbar', OW::getClassInstance("BASE_MCMP_ProfileActionToolbar", $this->user->id));
     $eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerIdList' => array($this->user->id), 'viewerId' => OW::getUser()->getId());
     $permissions = OW::getEventManager()->getInstance()->call('privacy_check_permission_for_user_list', $eventParams);
     $showPresence = !(isset($permissions[$this->user->id]['blocked']) && $permissions[$this->user->id]['blocked'] == true);
     $this->assign("showPresence", $showPresence);
     $isOnline = null;
     $activityStamp = null;
     if ($showPresence) {
         $onlineInfo = BOL_UserService::getInstance()->findOnlineStatusForUserList(array($this->user->id));
         $isOnline = $onlineInfo[$this->user->id];
         $activityStamp = $this->user->activityStamp;
     }
     $this->assign("isOnline", $isOnline);
     $this->assign("activityStamp", $activityStamp);
 }
Example #18
0
 public function __construct()
 {
     parent::__construct();
     $form = OW::getClassInstance('SELECTGENDER_CLASS_QuickSearchForm', $this);
     $this->addForm($form);
     $config = OW::getConfig();
     $opositeMatchSexSearch = $config->getValue('selectgender', 'opositeMatchSexSearch');
     $sameMatchSexSearch = $config->getValue('selectgender', 'sameMatchSexSearch');
     $isUserRegister = OW::getUser()->isAuthenticated();
     if (OW::getUser()->isAuthenticated()) {
         $userId = OW::getUser()->getId();
         $userSex = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array('sex'));
         $jsParams = array('isUserRegister' => $isUserRegister, 'opositeMatchSexSearch' => $opositeMatchSexSearch, 'sameMatchSexSearch' => $sameMatchSexSearch, 'userSex' => $userSex[$userId]['sex']);
         $script = ' var quickSearch = new SELECTGENDER_QuickSearch(); quickSearch.init(' . json_encode($jsParams) . '); ';
         OW::getDocument()->addOnloadScript($script);
         OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('selectgender')->getStaticJsUrl() . 'quickSearch.js');
     }
     $this->assign('form', $form);
     $this->assign('advancedUrl', OW::getRouter()->urlForRoute('users-search'));
     $this->assign('questions', USEARCH_BOL_Service::getInstance()->getQuickSerchQuestionNames());
     if (OW::getUser()->isAuthenticated()) {
         $this->assign('userId', OW::getUser()->getId());
     }
 }
Example #19
0
File: user.php Project: ecki/oxwall
 public function about($params)
 {
     $userDto = $this->checkProfilePermissions($params);
     if ($userDto === null) {
         return;
     }
     $displayName = BOL_UserService::getInstance()->getDisplayName($userDto->id);
     $this->setPageTitle(OW::getLanguage()->text('base', 'profile_view_title', array('username' => $displayName)));
     $this->setPageHeading(OW::getLanguage()->text('base', 'profile_view_heading', array('username' => $displayName)));
     $this->setPageHeadingIconClass('ow_ic_user');
     $this->addComponent("header", OW::getClassInstance("BASE_MCMP_ProfileHeader", $userDto));
     //Profile Info
     $this->addComponent("info", OW::getClassInstance("BASE_MCMP_ProfileInfo", $userDto));
     $this->addComponent('about', OW::getClassInstance("BASE_MCMP_ProfileAbout", $userDto));
     $this->assign("userId", $userDto->id);
 }
Example #20
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'));
 }
 protected function getSettingsMarkup($data)
 {
     if (empty($data['componentId'])) {
         return array();
     }
     $componentPlaceUniqName = $data['componentId'];
     $componentId = $this->componentService->findPlaceComponent($componentPlaceUniqName)->componentId;
     $componentClass = $this->componentService->findComponent($componentId)->className;
     $componentSettingList = $this->getComponentSettingList($componentClass, $data);
     $componentStandardSettingValueList = $this->getComponentStandardSettingValueList($componentClass, $data);
     $componentAccess = $this->getComponentAccess($componentClass, $data);
     $entitySettingList = $this->componentService->findSettingList($componentPlaceUniqName);
     $cmpClass = empty($data["settingsCmpClass"]) ? "BASE_CMP_ComponentSettings" : $data["settingsCmpClass"];
     $cmp = OW::getClassInstance($cmpClass, $componentPlaceUniqName, $componentSettingList, $entitySettingList, $componentAccess);
     if ($data['place'] == BOL_ComponentService::PLACE_INDEX) {
         $cmp->markAsHidden('freeze');
     }
     $cmp->setStandardSettingValueList($componentStandardSettingValueList);
     return $this->getSettingFormMarkup($cmp);
 }
Example #22
0
 public function initToolbar($items)
 {
     $cmpsMarkup = '';
     $ghroupsCount = 0;
     $tplActions = array();
     foreach ($items as $item) {
         $action =& $tplActions[];
         $action['label'] = $item[self::DATA_KEY_LABEL];
         $action['order'] = count($tplActions);
         $attrs = isset($item[self::DATA_KEY_LINK_ATTRIBUTES]) && is_array($item[self::DATA_KEY_LINK_ATTRIBUTES]) ? $item[self::DATA_KEY_LINK_ATTRIBUTES] : array();
         $attrs['href'] = isset($item[self::DATA_KEY_LINK_HREF]) ? $item[self::DATA_KEY_LINK_HREF] : 'javascript://';
         if (isset($item[self::DATA_KEY_LINK_ID])) {
             $attrs['id'] = $item[self::DATA_KEY_LINK_ID];
         }
         if (isset($item[self::DATA_KEY_LINK_CLASS])) {
             $attrs['class'] = $item[self::DATA_KEY_LINK_CLASS];
         }
         if (isset($item[self::DATA_KEY_LINK_ORDER])) {
             $action['order'] = $item[self::DATA_KEY_LINK_ORDER];
         }
         if (isset($item[self::DATA_KEY_CMP_CLASS])) {
             $cmpClass = trim($item[self::DATA_KEY_CMP_CLASS]);
             $cmp = OW::getClassInstance($cmpClass, array('userId' => $this->userId));
             $cmpsMarkup .= $cmp->render();
         }
         $_attrs = array();
         foreach ($attrs as $name => $value) {
             $_attrs[] = $name . '="' . $value . '"';
         }
         $action['attrs'] = implode(' ', $_attrs);
     }
     $this->assign('toolbar', $tplActions);
     $this->assign('cmpsMarkup', $cmpsMarkup);
 }
Example #23
0
 public function renderView()
 {
     $this->assign('render', true);
     $this->assign('access', $this->getComponentAccess());
     $paramsObject = $this->getComponentParamObject();
     $isCustomizeMode = $paramsObject->customizeMode;
     if (!$this->isComponentAvaliable($paramsObject) && !$isCustomizeMode) {
         $this->setVisible(false);
         return parent::render();
     }
     $className = $this->componentContentClass;
     /* @var $contentComponent BASE_CLASS_Widget */
     $contentComponent = OW::getClassInstance($className, $paramsObject);
     $this->runTimeSettingList = $contentComponent->getRunTimeSettingList();
     if (!$isCustomizeMode) {
         $this->setVisible($contentComponent->isVisible());
     }
     $this->addComponent('content', $contentComponent);
     return $this->render();
 }
Example #24
0
 public function graphics()
 {
     if (!OW::getRequest()->isAjax()) {
         OW::getDocument()->getMasterPage()->getMenu(OW_Navigation::ADMIN_APPEARANCE)->getElement('sidebar_menu_item_themes_customize')->setActive(true);
     }
     $images = $this->themeService->findAllCssImages();
     $assignArray = array();
     /* @var $image BOL_ThemeImage */
     foreach ($images as $image) {
         $assignArray[] = $this->imageObjToArray($image);
     }
     $this->assign('images', $assignArray);
     $form = new UploadGraphicsForm();
     $form->setEnctype(FORM::ENCTYPE_MULTYPART_FORMDATA);
     $this->addForm($form);
     $this->assign('confirmMessage', OW::getLanguage()->text('admin', 'theme_graphics_image_delete_confirm_message'));
     $cmp = OW::getClassInstance('ADMIN_CMP_UploadedFileList');
     $this->initFloatbox(array('layout' => 'floatbox'));
     $this->addComponent('filelist', $cmp);
     if (OW::getRequest()->isPost()) {
         try {
             $this->themeService->addImage($_FILES['file']);
         } catch (Exception $e) {
             OW::getFeedback()->error(OW::getLanguage()->text('admin', 'theme_graphics_upload_form_fail_message'));
             $this->redirect();
         }
         OW::getFeedback()->info(OW::getLanguage()->text('admin', 'theme_graphics_upload_form_success_message'));
         $this->redirect();
     }
 }
Example #25
0
 /**
  * Class constructor
  *
  */
 public function __construct(MAILBOX_CMP_NewMessage $component = null)
 {
     $language = OW::getLanguage();
     parent::__construct('mailbox-new-message-form');
     $this->setId('mailbox-new-message-form');
     $this->setAjax(true);
     $this->setAjaxResetOnSuccess(false);
     $this->setAction(OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'newMessage'));
     $this->setEmptyElementsErrorMessage('');
     $this->setEnctype('multipart/form-data');
     $subject = new TextField('subject');
     //        $subject->setHasInvitation(true);
     //        $subject->setInvitation($language->text('mailbox', 'subject'));
     $subject->addAttribute('placeholder', $language->text('mailbox', 'subject'));
     $requiredValidator = new RequiredValidator();
     $requiredValidator->setErrorMessage($language->text('mailbox', 'subject_is_required'));
     $subject->addValidator($requiredValidator);
     $validatorSubject = new StringValidator(1, 2048);
     $validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
     $subject->addValidator($validatorSubject);
     $this->addElement($subject);
     $validator = new StringValidator(1, MAILBOX_BOL_AjaxService::MAX_MESSAGE_TEXT_LENGTH);
     $validator->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => MAILBOX_BOL_AjaxService::MAX_MESSAGE_TEXT_LENGTH)));
     $textarea = OW::getClassInstance("MAILBOX_CLASS_Textarea", "message");
     /* @var $textarea MAILBOX_CLASS_Textarea */
     $textarea->addValidator($validator);
     $textarea->setCustomBodyClass("mailbox");
     //        $textarea->setHasInvitation(true);
     //        $textarea->setInvitation($language->text('mailbox', 'message_invitation'));
     $textarea->addAttribute('placeholder', $language->text('mailbox', 'message_invitation'));
     $requiredValidator = new RequiredValidator();
     $requiredValidator->setErrorMessage($language->text('mailbox', 'chat_message_empty'));
     $textarea->addValidator($requiredValidator);
     $this->addElement($textarea);
     $user = OW::getClassInstance("MAILBOX_CLASS_UserField", "opponentId");
     /* @var $user MAILBOX_CLASS_UserField */
     //        $user->setHasInvitation(true);
     //        $user->setInvitation($language->text('mailbox', 'to'));
     $requiredValidator = new RequiredValidator();
     $requiredValidator->setErrorMessage($language->text('mailbox', 'recipient_is_required'));
     $user->addValidator($requiredValidator);
     $this->addElement($user);
     if (OW::getSession()->isKeySet('mailbox.new_message_form_attachments_uid')) {
         $uidValue = OW::getSession()->get('mailbox.new_message_form_attachments_uid');
     } else {
         $uidValue = UTIL_HtmlTag::generateAutoId('mailbox_new_message');
         OW::getSession()->set('mailbox.new_message_form_attachments_uid', $uidValue);
     }
     $uid = new HiddenField('uid');
     $uid->setValue($uidValue);
     $this->addElement($uid);
     $configs = OW::getConfig()->getValues('mailbox');
     if (!empty($configs['enable_attachments']) && !empty($component)) {
         $attachmentCmp = new BASE_CLASS_FileAttachment('mailbox', $uidValue);
         $attachmentCmp->setInputSelector('#newMessageWindowAttachmentsBtn');
         $component->addComponent('attachments', $attachmentCmp);
     }
     $submit = new Submit("send");
     $submit->setValue($language->text('mailbox', 'send_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $this->initStatic();
     }
 }
 protected function getSettingsMarkup($data)
 {
     $componentPlaceUniqName = $data['componentId'];
     $entity = $data['entity'];
     $componentId = $this->componentService->findComponentPlace($componentPlaceUniqName, $entity)->componentId;
     $componentClass = $this->componentService->findComponent($componentId)->className;
     $componentSettingList = $this->getComponentSettingList($componentClass, $data);
     $componentStandardSettingValueList = $this->getComponentStandardSettingValueList($componentClass, $data);
     $componentAccess = $this->getComponentAccess($componentClass, $data);
     $defaultSettingList = BOL_ComponentAdminService::getInstance()->findSettingList($componentPlaceUniqName);
     $entitySettingList = $this->componentService->findSettingList($componentPlaceUniqName, $entity);
     $cmpClass = empty($data["settingsCmpClass"]) ? "BASE_CMP_ComponentSettings" : $data["settingsCmpClass"];
     $cmp = OW::getClassInstance($cmpClass, $componentPlaceUniqName, $componentSettingList, array_merge($defaultSettingList, $entitySettingList), $componentAccess);
     $cmp->setStandardSettingValueList($componentStandardSettingValueList);
     return $this->getSettingFormMarkup($cmp);
 }
Example #27
0
 protected function getAdapterData($gateways)
 {
     $paymentOptions = array();
     foreach ($gateways as $gateway) {
         /* @var $adapter OW_BillingAdapter */
         if ($adapter = OW::getClassInstance($gateway->adapterClassName)) {
             $paymentOptions[$gateway->gatewayKey]['dto'] = $gateway;
             $paymentOptions[$gateway->gatewayKey]['orderUrl'] = $adapter->getOrderFormUrl(true);
             $paymentOptions[$gateway->gatewayKey]['logoUrl'] = $adapter->getLogoUrl(true);
         }
     }
     return $paymentOptions;
 }
Example #28
0
 /**
  * @param array $dispatchAttributes
  */
 public function dispatch()
 {
     // check if controller class contains package pointer with plugin key
     if (empty($this->handlerAttributes[self::ATTRS_KEY_CTRL]) || !mb_strstr($this->handlerAttributes[self::ATTRS_KEY_CTRL], '_')) {
         throw new InvalidArgumentException("Can't dispatch request! Empty or invalid controller class provided!");
     }
     // set uri params in request object
     if (!empty($this->handlerAttributes[self::ATTRS_KEY_VARLIST])) {
         OW::getRequest()->setUriParams($this->handlerAttributes[self::ATTRS_KEY_VARLIST]);
     }
     $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey($this->handlerAttributes[self::ATTRS_KEY_CTRL]));
     $catchAllRequests = $this->processCatchAllRequestsAttrs();
     if ($catchAllRequests !== null) {
         $this->handlerAttributes = $catchAllRequests;
     }
     try {
         $controller = OW::getClassInstance($this->handlerAttributes[self::ATTRS_KEY_CTRL]);
     } catch (ReflectionException $e) {
         throw new Redirect404Exception();
     }
     /* @var $controller OW_ActionController */
     // check if controller exists and is instance of base action controller class
     if ($controller === null || !$controller instanceof OW_ActionController) {
         throw new LogicException("Can't dispatch request! Please provide valid controller class!");
     }
     // redirect to page 404 if plugin is inactive and isn't instance of admin controller class
     if (!$plugin->isActive() && !$controller instanceof ADMIN_CTRL_Abstract) {
         throw new Redirect404Exception();
     }
     // call optional init method
     $controller->init();
     if (empty($this->handlerAttributes[self::ATTRS_KEY_ACTION])) {
         $this->handlerAttributes[self::ATTRS_KEY_ACTION] = $controller->getDefaultAction();
     }
     if (!method_exists($controller, $this->handlerAttributes[self::ATTRS_KEY_ACTION])) {
         throw new Redirect404Exception();
     }
     OW::getEventManager()->trigger(new OW_Event("core.performance_test", array("key" => "controller_call.start", "handlerAttrs" => $this->handlerAttributes)));
     call_user_func_array(array($controller, $this->handlerAttributes[self::ATTRS_KEY_ACTION]), array(self::ATTRS_KEY_VARLIST => empty($this->handlerAttributes[self::ATTRS_KEY_VARLIST]) ? array() : $this->handlerAttributes[self::ATTRS_KEY_VARLIST]));
     OW::getEventManager()->trigger(new OW_Event("core.performance_test", array("key" => "controller_call.end", "handlerAttrs" => $this->handlerAttributes)));
     // set default template for controller action if template wasn't set
     if ($controller->getTemplate() === null) {
         $controller->setTemplate($this->getControllerActionDefaultTemplate($controller));
     }
     OW::getDocument()->setBody($controller->render());
 }
Example #29
0
 protected function addLastStepQuestions($controller)
 {
     $displayPhoto = false;
     $displayPhotoUpload = OW::getConfig()->getValue('base', 'join_display_photo_upload');
     $avatarValidator = OW::getClassInstance("BASE_CLASS_AvatarFieldValidator", false);
     switch ($displayPhotoUpload) {
         case BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD:
             $avatarValidator = OW::getClassInstance("BASE_CLASS_AvatarFieldValidator", true);
         case BOL_UserService::CONFIG_JOIN_DISPLAY_PHOTO_UPLOAD:
             $userPhoto = OW::getClassInstance("BASE_CLASS_JoinUploadPhotoField", 'userPhoto');
             $userPhoto->setLabel(OW::getLanguage()->text('base', 'questions_question_user_photo_label'));
             $userPhoto->addValidator($avatarValidator);
             $this->addElement($userPhoto);
             $displayPhoto = true;
     }
     $displayTermsOfUse = false;
     if (OW::getConfig()->getValue('base', 'join_display_terms_of_use')) {
         $termOfUse = new CheckboxField('termOfUse');
         $termOfUse->setLabel(OW::getLanguage()->text('base', 'questions_question_user_terms_of_use_label'));
         $termOfUse->setRequired();
         $this->addElement($termOfUse);
         $displayTermsOfUse = true;
     }
     $this->setEnctype('multipart/form-data');
     $event = new OW_Event('join.get_captcha_field');
     OW::getEventManager()->trigger($event);
     $captchaField = $event->getData();
     $displayCaptcha = false;
     $enableCaptcha = OW::getConfig()->getValue('base', 'enable_captcha');
     if ($enableCaptcha && !empty($captchaField) && $captchaField instanceof FormElement) {
         $captchaField->setName('captchaField');
         $this->addElement($captchaField);
         $displayCaptcha = true;
     }
     $controller->assign('display_captcha', $displayCaptcha);
     $controller->assign('display_photo', $displayPhoto);
     $controller->assign('display_terms_of_use', $displayTermsOfUse);
     if (OW::getRequest()->isPost()) {
         if (!empty($captchaField) && $captchaField instanceof FormElement) {
             $captchaField->setValue(null);
         }
         if (isset($userPhoto) && isset($_FILES[$userPhoto->getName()]['name'])) {
             $_POST[$userPhoto->getName()] = $_FILES[$userPhoto->getName()]['name'];
         }
     }
 }
Example #30
0
 public function __construct()
 {
     parent::__construct();
     $component = OW::getClassInstance('USEARCH_CMP_QuickSearch', $this);
     $this->addComponent('quickSearch', $component);
 }