Exemple #1
0
 public function afterAvatarChange(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = $params['userId'];
     $avatar = $this->avatarService->findByUserId($userId);
     $uAvatar = new UAVATARS_BOL_Avatar();
     $uAvatar->avatarId = $avatar->id;
     $uAvatar->userId = $userId;
     $avatarPath = $this->avatarService->getAvatarPath($userId, 3);
     $tmpPath = OW::getPluginManager()->getPlugin("uavatars")->getPluginFilesDir() . uniqid("tmp-") . '.jpg';
     if (!OW::getStorage()->copyFileToLocalFS($avatarPath, $tmpPath)) {
         return;
     }
     $photoStatus = $avatar->status == "active" ? "approved" : "approval";
     $photoId = $this->photoBridge->addPhoto($userId, $tmpPath, "", null, false, $photoStatus);
     @unlink($tmpPath);
     if (empty($photoId)) {
         return;
     }
     $uAvatar->photoId = $photoId;
     $uAvatar->timeStamp = time();
     $avatarPreview = $this->avatarService->getAvatarPath($userId, 2);
     $fileName = $this->uAvatarsService->storeAvatarImage($avatarPreview);
     if (empty($fileName)) {
         return;
     }
     if (!empty($uAvatar->fileName)) {
         $userfilesDir = OW::getPluginManager()->getPlugin('uavatars')->getUserFilesDir();
         OW::getStorage()->removeFile($userfilesDir . $uAvatar->fileName);
     }
     $uAvatar->fileName = $fileName;
     $this->uAvatarsService->saveAvatar($uAvatar);
 }
Exemple #2
0
 public function afterAvatarChange(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = $params['userId'];
     $avatar = $this->avatarService->findByUserId($userId);
     if ($params['upload']) {
         $uAvatar = new UAVATARS_BOL_Avatar();
         $uAvatar->avatarId = $avatar->id;
         $uAvatar->userId = $userId;
         $avatarPath = $this->avatarService->getAvatarPath($userId, 3);
         $photoId = $this->photoBridge->addPhoto($userId, $avatarPath);
         if (empty($photoId)) {
             return;
         }
         $uAvatar->photoId = $photoId;
         $uAvatar->timeStamp = time();
     } else {
         $uAvatar = $this->uAvatarsService->findLastByUserId($userId);
     }
     $avatarPreview = $this->avatarService->getAvatarPath($userId, 2);
     $fileName = $this->uAvatarsService->storeAvatarImage($avatarPreview);
     if (empty($fileName)) {
         return;
     }
     if (!empty($uAvatar->fileName)) {
         $userfilesDir = OW::getPluginManager()->getPlugin('uavatars')->getUserFilesDir();
         OW::getStorage()->removeFile($userfilesDir . $uAvatar->fileName);
     }
     $uAvatar->fileName = $fileName;
     $this->uAvatarsService->saveAvatar($uAvatar);
 }
Exemple #3
0
 private function importAvatars($avatarUrl)
 {
     $avatarUrl = trim($avatarUrl);
     if (substr($avatarUrl, -1) === '/') {
         $avatarUrl = substr($avatarUrl, 0, -1);
     }
     $avatarDir = BOL_AvatarService::getInstance()->getAvatarsDir();
     $first = 0;
     $count = 150;
     while (true) {
         $list = BOL_UserService::getInstance()->findList($first, $count, true);
         $first += $count;
         if (empty($list)) {
             break;
         }
         foreach ($list as $user) {
             for ($size = 1; $size < 4; $size++) {
                 $path = BOL_AvatarService::getInstance()->getAvatarPath($user->id, $size);
                 $avatarName = str_replace($avatarDir, '', $path);
                 $content = file_get_contents($avatarUrl . '/' . $avatarName);
                 if (!empty($content)) {
                     OW::getStorage()->fileSetContent($path, $content);
                 }
             }
         }
     }
 }
Exemple #4
0
 public function userSearch($query)
 {
     $kw = $query['kw'];
     $data = $query['data'];
     $friendMode = $data['friendsMode'];
     $idList = array();
     $userIds = array();
     if ($friendMode) {
         if (OW::getUser()->isAuthenticated()) {
             $userId = OW::getUser()->getId();
             $userIds = EQUESTIONS_BOL_Service::getInstance()->findFriends($kw, $userId);
         }
     } else {
         $userIds = EQUESTIONS_BOL_Service::getInstance()->findUsers($kw);
     }
     foreach ($userIds as $u) {
         if ($u != OW::getUser()->getId()) {
             $idList[] = $u;
         }
     }
     $allList = empty($idList) ? array() : BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false, true, false);
     $cachelist = array();
     foreach ($allList as $uid => $info) {
         $info['userId'] = $uid;
         $info['kw'] = strtolower($info['title']);
         $cachelist[$uid] = $info;
     }
     return $cachelist;
 }
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     //echo "call";
     $avatarService = BOL_AvatarService::getInstance();
     $userId = OW::getUser()->getId();
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId), true, true, true, true, 2);
     // $avatars = BOL_AvatarService::getInstance()->getAvatarsUrlList(array($userId), 2);
     //        echo '<pre>';
     //        print_r($avatars);
     //        echo '</pre>';
     $this->assign('avatar', $avatars[$userId]);
     $event = new BASE_CLASS_EventCollector('base.on_avatar_toolbar_collect', array('userId' => $userId));
     OW::getEventManager()->trigger($event);
     $toolbarItems = $event->getData();
     //        echo '<pre>';
     //        print_r($toolbarItems);
     //        echo '</pre>';
     $tplToolbarItems = array();
     foreach ($toolbarItems as $item) {
         if (empty($item['title']) || empty($item['url']) || empty($item['iconClass'])) {
             continue;
         }
         $order = empty($item['order']) ? count($tplToolbarItems) + 1 : (int) $item['order'];
         if (!empty($tplToolbarItems[$order])) {
             $order = count($tplToolbarItems) + 1;
         }
         $tplToolbarItems[$order] = $item;
     }
     ksort($tplToolbarItems);
     $this->assign('toolbarItems', array_values($tplToolbarItems));
 }
 protected function buildData($userIds, $group = null, $ignoreUserIds = array())
 {
     if (empty($userIds)) {
         return array();
     }
     $avatarData = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIds, true, true, true, false);
     $infoList = $this->getInfoList($userIds);
     $onlineList = BOL_UserService::getInstance()->findOnlineStatusForUserList($userIds);
     $out = array();
     foreach ($userIds as $userId) {
         if (in_array($userId, $ignoreUserIds)) {
             continue;
         }
         $data = array();
         $data['id'] = $userId;
         $data['url'] = $avatarData[$userId]['url'];
         $data['avatar'] = $avatarData[$userId]['src'];
         $data['text'] = $avatarData[$userId]['title'];
         $data['info'] = '<span class="ow_live_on"></span>' . implode(' ', $infoList[$userId]);
         $data['online'] = $onlineList[$userId];
         $itemCmp = new MCOMPOSE_CMP_UserItem($data);
         $item = array();
         $item["id"] = self::ID_PREFIX . "_" . $userId;
         $item["text"] = $data['text'];
         $item['html'] = $itemCmp->render();
         $item['url'] = $data['url'];
         $item['count'] = null;
         if (!empty($group)) {
             $item['group'] = $group;
         }
         $out[self::ID_PREFIX . '_' . $userId] = $item;
     }
     return $out;
 }
Exemple #7
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $displayCount = 60;
     $list = $this->getList();
     $idList = empty($list['idList']) ? array() : $list['idList'];
     $allList = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false, true, false);
     $allList = empty($allList) ? array() : $allList;
     $cachelist = array();
     foreach ($allList as $uid => $info) {
         $info['userId'] = $uid;
         $info['kw'] = strtolower($info['title']);
         $cachelist[$uid] = $info;
     }
     $tplList = array_slice($cachelist, 0, $displayCount);
     $this->initJs($cachelist, $list['count']);
     $this->assign('list', $tplList);
     $this->assign('friendsMode', $this->friendsMode);
     $this->assign('uniqId', $this->uniqId);
     $language = OW::getLanguage();
     $this->assign('langs', array('ask' => $language->text('equestions', 'user_select_button_ask')));
     $this->assign('fakeAvatar', array('src' => '-', 'title' => '-'));
     $moderator = OW::getUser()->isAuthorized('equestions');
     $this->assign('moderator', $moderator);
 }
Exemple #8
0
 public function __construct($userId)
 {
     parent::__construct();
     $cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId($userId);
     if (empty($cover)) {
         $this->assign('error', OW::getLanguage()->text('uheader', 'cover_not_found'));
         return;
     }
     $src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover);
     $settings = $cover->getSettings();
     $height = $settings['dimensions']['height'];
     $width = $settings['dimensions']['width'];
     $top = 0;
     if ($height < self::MIN_HEIGHT) {
         $top = (self::MIN_HEIGHT - $height) / 2;
     }
     $avatarsData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId));
     $this->assign('user', $avatarsData[$userId]);
     $this->assign('src', $src);
     $this->assign('top', $top);
     $this->assign('dimensions', $settings['dimensions']);
     $cmtParams = new BASE_CommentsParams('uheader', UHEADER_CLASS_CommentsBridge::ENTITY_TYPE);
     $cmtParams->setWrapInBox(false);
     $cmtParams->setEntityId($cover->id);
     $cmtParams->setOwnerId($userId);
     $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_TOP_FORM_WITH_PAGING);
     $photoCmts = new BASE_CMP_Comments($cmtParams);
     $this->addComponent('comments', $photoCmts);
 }
Exemple #9
0
 public function __construct($users, $size, $layout)
 {
     parent::__construct();
     $questionService = BOL_QuestionService::getInstance();
     $userService = BOL_UserService::getInstance();
     $this->uniqId = uniqid('ucl_');
     $idList = $this->fetchIdList($users);
     $qList = $questionService->getQuestionData($idList, array('sex', 'birthdate'));
     $displayNames = $userService->getDisplayNamesForList($idList);
     $urls = $userService->getUserUrlsForList($idList);
     $tplData = array();
     foreach ($idList as $userId) {
         $tplData[$userId] = array();
         $tplData[$userId]['displayName'] = empty($displayNames[$userId]) ? null : $displayNames[$userId];
         $tplData[$userId]['url'] = empty($urls[$userId]) ? null : $urls[$userId];
         $tplData[$userId]['sex'] = empty($qList[$userId]['sex']) || in_array($layout, array(3, 4)) ? null : strtolower(BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $qList[$userId]['sex']));
         $tplData[$userId]['birthdate'] = null;
         if (!empty($qList[$userId]['birthdate']) && in_array($layout, array(1, 3))) {
             $date = UTIL_DateTime::parseDate($qList[$userId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
             $age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
             $tplData[$userId]['birthdate'] = $age;
         }
         $avatar = BOL_AvatarService::getInstance()->getAvatarUrl($userId, 2);
         $tplData[$userId]['thumb'] = $avatar ? $avatar : BOL_AvatarService::getInstance()->getDefaultAvatarUrl(2);
     }
     $sizes = array('small' => 100, 'medium' => 150, 'big' => OW::getConfig()->getValue('base', 'avatar_big_size'));
     $this->assign('list', $tplData);
     $avatarSize = $sizes[$size];
     $this->assign('size', $size);
     $this->assign('uniqId', $this->uniqId);
     OW::getDocument()->addStyleDeclaration('.uc-avatar-size { width: ' . $avatarSize . 'px; height: ' . ($avatarSize + $avatarSize / 10) . 'px; }');
     OW::getDocument()->addStyleDeclaration('.uc-carousel-size { height: ' . ($avatarSize + 50) . 'px; }');
     OW::getDocument()->addStyleDeclaration('.uc-shape-waterWheel .uc-carousel { width: ' . ($avatarSize + 20) . 'px; }');
 }
 public function __construct($conversationData)
 {
     parent::__construct();
     $this->consoleItem = new BASE_CMP_ConsoleListItem();
     $this->convId = $conversationData['conversationId'];
     $userId = OW::getUser()->getId();
     $conversationService = MAILBOX_BOL_ConversationService::getInstance();
     $this->opponentId = $conversationData['opponentId'];
     $avatarUrl = BOL_AvatarService::getInstance()->getAvatarUrl($this->opponentId);
     $this->avatarUrl = $avatarUrl ? $avatarUrl : BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     $this->profileUrl = BOL_UserService::getInstance()->getUserUrl($this->opponentId);
     $this->displayName = BOL_UserService::getInstance()->getDisplayName($this->opponentId);
     $this->mode = $conversationData['mode'];
     $this->text = $conversationData['previewText'];
     $this->dateLabel = $conversationData['dateLabel'];
     $this->unreadMessageCount = $conversationService->countUnreadMessagesForConversation($this->convId, $userId);
     if ($this->mode == 'mail') {
         $this->url = $conversationService->getConversationUrl($this->convId);
         $this->addClass('ow_mailbox_request_item ow_cursor_default');
     }
     if ($this->mode == 'chat') {
         $this->url = 'javascript://';
         $this->addClass('ow_chat_request_item ow_cursor_default');
         $js = "\$('.consoleChatItem#mailboxConsoleMessageItem{$this->convId}').bind('click', function(){\n        var convId = \$(this).data('convid');\n        var opponentId = \$(this).data('opponentid');\n        OW.trigger('mailbox.open_dialog', {convId: convId, opponentId: opponentId, mode: 'chat', isSelected: true});\n        OW.Console.getItem('mailbox').hideContent();\n    });";
         OW::getDocument()->addOnloadScript($js);
     }
     if ($conversationData['conversationRead'] == 0) {
         $this->addClass('ow_console_new_message');
     }
 }
Exemple #11
0
 public function getList($params)
 {
     $service = SKADATEIOS_ABOL_Service::getInstance();
     $auth = array('photo.view' => $service->getAuthorizationActionStatus('photo', 'view'), 'base.search_users' => $service->getAuthorizationActionStatus('base', 'search_users'));
     $this->assign('auth', $auth);
     if ($auth["base.search_users"]["status"] != BOL_AuthorizationService::STATUS_AVAILABLE) {
         $this->assign("list", array());
         $this->assign("total", 0);
         return;
     }
     $_criteriaList = array_filter($params["criteriaList"]);
     $userId = OW::getUser()->getId();
     $userInfo = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array("sex"));
     $_criteriaList["sex"] = !empty($userInfo[$userId]["sex"]) ? $userInfo[$userId]["sex"] : null;
     $questionList = BOL_QuestionService::getInstance()->findQuestionByNameList(array_keys($_criteriaList));
     $criteriaList = array();
     foreach ($_criteriaList as $questionName => $questionValue) {
         if (empty($questionList[$questionName])) {
             continue;
         }
         $criteriaList[$questionName] = $this->convertQuestionValue($questionList[$questionName]->presentation, $questionValue);
     }
     $idList = OW::getEventManager()->call("usearch.get_user_id_list", array("criterias" => $criteriaList, "limit" => array($params["first"], $params["count"])));
     $idList = empty($idList) ? array() : $idList;
     //$idList = BOL_UserService::getInstance()->findUserIdListByQuestionValues($criteriaList, $params["first"], $params["count"]);
     $total = BOL_UserService::getInstance()->countUsersByQuestionValues($params["criteriaList"]);
     $userData = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, false, false, true, true);
     $questionsData = BOL_QuestionService::getInstance()->getQuestionData($idList, array("googlemap_location", "birthdate"));
     foreach ($questionsData as $userId => $data) {
         $date = UTIL_DateTime::parseDate($data['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
         $userData[$userId]["ages"] = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
         $userData[$userId]["location"] = empty($data["googlemap_location"]["address"]) ? null : $data["googlemap_location"]["address"];
     }
     $photoList = array();
     $avatarList = array();
     foreach ($idList as $userId) {
         $bigAvatar = SKADATE_BOL_Service::getInstance()->findAvatarByUserId($userId);
         $avatarList[$userId] = $bigAvatar ? SKADATE_BOL_Service::getInstance()->getAvatarUrl($userId, $bigAvatar->hash) : BOL_AvatarService::getInstance()->getAvatarUrl($userId, 2);
         $event = new OW_Event('photo.getMainAlbum', array('userId' => $userId));
         OW::getEventManager()->trigger($event);
         $album = $event->getData();
         $photos = !empty($album['photoList']) ? $album['photoList'] : array();
         foreach ($photos as $photo) {
             $photoList[$userId][] = array("src" => $photo["url"]["main"]);
         }
     }
     $bookmarksList = OW::getEventManager()->call("bookmarks.get_mark_list", array("userId" => OW::getUser()->getId(), "idList" => $idList));
     $bookmarksList = empty($bookmarksList) ? array() : $bookmarksList;
     $list = array();
     foreach ($idList as $userId) {
         $list[] = array("userId" => $userId, "photos" => empty($photoList[$userId]) ? array() : $photoList[$userId], "avatar" => $avatarList[$userId], "name" => empty($userData[$userId]["title"]) ? "" : $userData[$userId]["title"], "label" => $userData[$userId]["label"], "labelColor" => $userData[$userId]["labelColor"], "location" => empty($userData[$userId]["location"]) ? "" : $userData[$userId]["location"], "ages" => $userData[$userId]["ages"], "bookmarked" => !empty($bookmarksList[$userId]));
     }
     $this->assign("list", $list);
     $this->assign("total", $total);
     $allowSendMessage = OW::getPluginManager()->isPluginActive('mailbox');
     $this->assign("actions", array("bookmark" => OW::getPluginManager()->isPluginActive('bookmarks'), "message" => $allowSendMessage, "wink" => OW::getPluginManager()->isPluginActive('winks')));
     BOL_AuthorizationService::getInstance()->trackAction("base", "search_users");
     $mailboxModes = OW::getEventManager()->call('mailbox.get_active_mode_list');
     $this->assign("mailboxModes", empty($mailboxModes) ? array() : $mailboxModes);
 }
Exemple #12
0
 public function onConsolePagesCollect(BASE_CLASS_EventCollector $event)
 {
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'underscore-min.js', 'text/javascript', 3000);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'backbone-min.js', 'text/javascript', 3000);
     //        OW::getDocument()->addScript( OW::getPluginManager()->getPlugin('base')->getStaticJsUrl().'backbone.js', 'text/javascript', 3000 );
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'mobile_mailbox.js', 'text/javascript', 3000);
     $userListUrl = OW::getRouter()->urlForRoute('mailbox_user_list');
     $convListUrl = OW::getRouter()->urlForRoute('mailbox_conv_list');
     $authorizationResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'authorization');
     $pingResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'ping');
     $getHistoryResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'getHistory');
     $userId = OW::getUser()->getId();
     $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
     $avatarUrl = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     if (empty($avatarUrl)) {
         $avatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $profileUrl = BOL_UserService::getInstance()->getUserUrl($userId);
     $lastSentMessage = MAILBOX_BOL_ConversationService::getInstance()->getLastSentMessage($userId);
     $lastMessageTimestamp = (int) ($lastSentMessage ? $lastSentMessage->timeStamp : 0);
     $params = array('getHistoryResponderUrl' => $getHistoryResponderUrl, 'pingResponderUrl' => $pingResponderUrl, 'authorizationResponderUrl' => $authorizationResponderUrl, 'userListUrl' => $userListUrl, 'convListUrl' => $convListUrl, 'pingInterval' => 5000, 'lastMessageTimestamp' => $lastMessageTimestamp, 'user' => array('userId' => $userId, 'displayName' => $displayName, 'profileUrl' => $profileUrl, 'avatarUrl' => $avatarUrl));
     $js = UTIL_JsGenerator::composeJsString('OWM.Mailbox = new MAILBOX_Mobile({$params});', array('params' => $params));
     OW::getDocument()->addOnloadScript($js, 'text/javascript', 3000);
     $event->add(array('key' => 'convers', 'cmpClass' => 'MAILBOX_MCMP_ConsoleConversationsPage', 'order' => 2));
 }
Exemple #13
0
 public function copyBigAvatar($userId)
 {
     $avatarService = BOL_AvatarService::getInstance();
     $avatar = $avatarService->findByUserId($userId);
     if (!$avatar) {
         return false;
     }
     // remove old
     $this->removeBigAvatar($userId);
     $origAvatarPath = $avatarService->getAvatarPath($userId, 3);
     $tmpPath = $this->getAvatarPluginFilesPath($userId, $avatar->hash);
     if (!is_writable(dirname($tmpPath))) {
         return false;
     }
     $storage = OW::getStorage();
     $storage->copyFileToLocalFS($origAvatarPath, $tmpPath);
     $image = new UTIL_Image($tmpPath);
     $width = $image->getWidth();
     if ($width < self::BIG_AVATAR_WIDTH) {
         @unlink($tmpPath);
         return false;
     }
     // store new
     $newAvatar = new SKADATE_BOL_Avatar();
     $newAvatar->userId = $userId;
     $newAvatar->avatarId = $avatar->id;
     $newAvatar->hash = $avatar->hash;
     SKADATE_BOL_AvatarDao::getInstance()->save($newAvatar);
     $bigAvatarPath = $this->getAvatarPath($userId, $avatar->hash);
     $image->resizeImage(self::BIG_AVATAR_WIDTH, self::BIG_AVATAR_HEIGHT, true)->saveImage($tmpPath);
     $storage->copyFile($tmpPath, $bigAvatarPath);
     @unlink($tmpPath);
     return true;
 }
 public function uploadTmpAvatar($file)
 {
     if (isset($file)) {
         $lang = OW::getLanguage();
         if (!UTIL_File::validateImage($file['name'])) {
             return array('result' => false, 'error' => $lang->text('base', 'not_valid_image'));
         }
         if (!empty($file['error'])) {
             $message = BOL_FileService::getInstance()->getUploadErrorMessage($file['error']);
         }
         if (!empty($message)) {
             return array('result' => false, 'error' => $message);
         }
         $filesize = OW::getConfig()->getValue('base', 'avatar_max_upload_size');
         if (empty($file['size']) || $filesize * 1024 * 1024 < $file['size']) {
             $message = OW::getLanguage()->text('base', 'upload_file_max_upload_filesize_error');
             return array('result' => false, 'error' => $message);
         }
         $avatarService = BOL_AvatarService::getInstance();
         $key = $avatarService->getAvatarChangeSessionKey();
         $uploaded = $avatarService->uploadUserTempAvatar($key, $file['tmp_name']);
         if (!$uploaded) {
             return array('result' => false, 'error' => $lang->text('base', 'upload_avatar_faild'));
         }
         $url = $avatarService->getTempAvatarUrl($key, 3);
         return array('result' => true, 'url' => $url);
     }
     return array('result' => false);
 }
Exemple #15
0
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $avatarService = BOL_AvatarService::getInstance();
     $viewerId = OW::getUser()->getId();
     $userId = $paramObj->additionalParamList['entityId'];
     if ($viewerId == $userId) {
         $this->assign('owner', true);
         $this->assign('changeAvatarUrl', OW::getRouter()->urlForRoute('base_avatar_crop'));
     } else {
         $this->assign('owner', false);
     }
     $avatar = $avatarService->getAvatarUrl($userId, 2);
     $this->assign('avatar', $avatar ? $avatar : $avatarService->getDefaultAvatarUrl(2));
     $roles = BOL_AuthorizationService::getInstance()->getRoleListOfUsers(array($userId));
     $this->assign('role', !empty($roles[$userId]) ? $roles[$userId] : null);
     $userService = BOL_UserService::getInstance();
     $showPresence = true;
     // Check privacy permissions
     $eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $e) {
         $showPresence = false;
     }
     $this->assign('isUserOnline', $userService->findOnlineUserById($userId) && $showPresence);
     $this->assign('userId', $userId);
     $this->assign('avatarSize', OW::getConfig()->getValue('base', 'avatar_big_size'));
 }
Exemple #16
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $userList = array();
     $userDtoList = array();
     $userService = BOL_UserService::getInstance();
     $questionService = BOL_QuestionService::getInstance();
     $userIdList = array_keys($this->userList);
     $userDataList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $this->fieldList);
     foreach ($userService->findUserListByIdList($userIdList) as $userDto) {
         $userDtoList[$userDto->id] = $userDto;
     }
     foreach ($this->userList as $userId => $fieldList) {
         $fields = array_diff(array_keys($fieldList), $this->fieldList);
         $fieldsData = $questionService->getQuestionData(array($userId), $fields);
         $userList[$userId]['fields'] = array_merge(!empty($userDataList[$userId]) ? $userDataList[$userId] : array(), !empty($fieldsData[$userId]) ? $fieldsData[$userId] : array(), $fieldList);
         $userList[$userId]['dto'] = $userDtoList[$userId];
     }
     $this->assign('userList', $userList);
     $this->assign('avatars', BOL_AvatarService::getInstance()->getAvatarsUrlList($userIdList, 2));
     $this->assign('onlineList', !empty($userIdList) ? $userService->findOnlineStatusForUserList($userIdList) : array());
     $this->assign('usernameList', $userService->getUserNamesForList($userIdList));
     $this->assign('displaynameList', $userService->getDisplayNamesForList($userIdList));
     $this->assign('displayActivity', $this->displayActivity);
 }
Exemple #17
0
 public function getList($params)
 {
     $data = OW::getEventManager()->call("guests.get_guests_list", array("userId" => OW::getUser()->getId()));
     if (empty($data)) {
         $this->assign("list", array());
         return;
     }
     $idList = array();
     $viewedMap = array();
     $timeMap = array();
     foreach ($data as $item) {
         $idList[] = $item["userId"];
         $viewedMap[$item["userId"]] = $item["viewed"];
         $timeMap[$item["userId"]] = UTIL_DateTime::formatDate($item["timeStamp"]);
     }
     OW::getEventManager()->call("guests.mark_guests_viewed", array("userId" => OW::getUser()->getId(), "guestIds" => $idList));
     $bookmarkList = OW::getEventManager()->call("bookmarks.get_mark_list", array("userId" => OW::getUser()->getId(), "idList" => $idList));
     $bookmarkList = empty($bookmarkList) ? array() : $bookmarkList;
     $avatarList = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false);
     $onlineMap = BOL_UserService::getInstance()->findOnlineStatusForUserList($idList);
     foreach ($avatarList as $userId => $user) {
         $color = array('r' => '100', 'g' => '100', 'b' => '100');
         if (!empty($user['labelColor'])) {
             $_color = explode(', ', trim($user['labelColor'], 'rgba()'));
             $color = array('r' => $_color[0], 'g' => $_color[1], 'b' => $_color[2]);
         }
         $list[] = array("userId" => $userId, "displayName" => $user["title"], "avatarUrl" => $user["src"], "label" => $user["label"], "labelColor" => $color, "viewed" => $viewedMap[$userId], "online" => $onlineMap[$userId], "bookmarked" => !empty($bookmarkList[$userId]), "time" => $timeMap[$userId]);
     }
     $this->assign("list", $list);
 }
Exemple #18
0
 public function render()
 {
     $defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     $this->assign('defaultAvatarUrl', $defaultAvatarUrl);
     $js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();";
     OW::getDocument()->addOnloadScript($js, 3006);
     //TODO check this config
     $enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments');
     $this->assign('enableAttachments', $enableAttachments);
     $replyToMessageActionPromotedText = '';
     $isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message');
     $isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
     if (!$isAuthorizedReplyToMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage);
     $isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
     if (!$isAuthorizedReplyToChatMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage);
     $this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText);
     if ($isAuthorizedReplyToMessage) {
         $text = new WysiwygTextarea('mailbox_message');
         $text->setId('conversationTextarea');
         $this->assign('mailbox_message', $text->renderInput());
     }
     return parent::render();
 }
    public function __construct($data)
    {
        $script = UTIL_JsGenerator::composeJsString('

        OWM.bind("mailbox.ready", function(readyStatus){
            if (readyStatus == 2){
                OWM.conversation = new MAILBOX_Conversation({$params});
                OWM.conversationView = new MAILBOX_MailConversationView({model: OWM.conversation});
            }
        });
        ', array('params' => $data));
        OW::getDocument()->addOnloadScript($script);
        OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation');
        $form = new MAILBOX_MCLASS_NewMailMessageForm($data['conversationId'], $data['opponentId']);
        $this->addForm($form);
        $this->assign('data', $data);
        $this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
        $firstMessage = MAILBOX_BOL_ConversationService::getInstance()->getFirstMessage($data['conversationId']);
        if (empty($firstMessage)) {
            $actionName = 'send_message';
        } else {
            $actionName = 'reply_to_message';
        }
        $isAuthorized = OW::getUser()->isAuthorized('mailbox', $actionName);
        if (!$isAuthorized) {
            $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
            if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
                $this->assign('sendAuthMessage', $status['msg']);
            } elseif ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) {
                $this->assign('sendAuthMessage', OW::getLanguage()->text('mailbox', $actionName . '_permission_denied'));
            }
        }
    }
 /**
  * Singleton instance.
  *
  * @return BOL_AvatarService
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Exemple #21
0
 public function sendWinkEmailNotification($userId, $partnerId, $winkType)
 {
     if (empty($userId) || empty($partnerId) || ($user = BOL_UserService::getInstance()->findUserById($userId)) === null || ($partner = BOL_UserService::getInstance()->findUserById($partnerId)) === null) {
         return false;
     }
     $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId, $partnerId), true, true, true, false);
     switch ($winkType) {
         case self::EMAIL_SEND:
             $subjectKey = 'wink_send_email_subject';
             $subjectArr = array('displayname' => $avatar[$userId]['title']);
             $textContentKey = 'wink_send_email_text_content';
             $htmlContentKey = 'wink_send_email_html_content';
             $contentArr = array('src' => $avatar[$userId]['src'], 'displayname' => $avatar[$userId]['title'], 'url' => $avatar[$userId]['url'], 'home_url' => OW_URL_HOME);
             break;
         case self::EMAIL_BACK:
         default:
             $subjectKey = 'wink_back_email_subject';
             $subjectArr = array('displayname' => $avatar[$userId]['title']);
             $textContentKey = 'wink_back_email_text_content';
             $htmlContentKey = 'wink_back_email_html_content';
             $contentArr = array('src' => $avatar[$userId]['src'], 'displayname' => $avatar[$userId]['title'], 'url' => $avatar[$userId]['url'], 'conversation_url' => OW::getRouter()->urlForRoute('mailbox_messages_default'));
             break;
     }
     $language = OW::getLanguage();
     $mail = OW::getMailer()->createMail();
     $mail->addRecipientEmail($partner->email);
     $mail->setSubject($language->text('winks', $subjectKey, $subjectArr));
     $mail->setTextContent($language->text('winks', $textContentKey, $contentArr));
     $mail->setHtmlContent($language->text('winks', $htmlContentKey, $contentArr));
     OW::getMailer()->send($mail);
 }
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $count = (int) $params->customParamList['count'];
     $service = SKAPI_BOL_Service::getInstance();
     $userId = OW::getUser()->getId();
     $guests = $service->findGuestsForUser($userId, 1, $count);
     if (!$guests) {
         $this->setVisible(false);
         return;
     }
     $userIdList = array();
     foreach ($guests as $guest) {
         array_push($userIdList, $guest->guestId);
     }
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIdList);
     foreach ($avatars as &$item) {
         $item['class'] = 'ow_guest_avatar';
     }
     $event = new OW_Event('bookmarks.is_mark', array(), $avatars);
     OW::getEventManager()->trigger($event);
     if ($event->getData()) {
         $avatars = $event->getData();
     }
     $this->assign('avatars', $avatars);
     $this->assign('guests', $guests);
     $total = $service->countGuestsForUser($userId);
     if ($total > $count) {
         $toolbar = array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('skapi.list'));
         $this->setSettingValue(self::SETTING_TOOLBAR, array($toolbar));
     }
 }
Exemple #23
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);
 }
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $lang = OW::getLanguage();
     $service = OCSTOPUSERS_BOL_Service::getInstance();
     $limit = $params->customParamList['userCount'];
     $list = $service->findList(1, $limit);
     if ($list) {
         $this->assign('list', $list);
         $total = $service->countUsers();
         $this->assign('total', $total);
         $idList = array();
         $scores = array();
         $rates = array();
         foreach ($list as $user) {
             array_push($idList, $user['dto']->id);
             $scores[$user['dto']->id] = $user['score'];
             $rates[$user['dto']->id] = $user['rates'];
         }
         $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList);
         foreach ($avatars as $userId => &$av) {
             $av['title'] .= ' - ' . $lang->text('ocstopusers', 'rate_info', array('rates' => $rates[$userId], 'score' => floatval($scores[$userId])));
         }
         $this->assign('avatars', $avatars);
         $this->assign('scores', $scores);
         if ($total > $limit) {
             $toolbar = array(array('href' => OW::getRouter()->urlForRoute('ocstopusers.list'), 'label' => OW::getLanguage()->text('base', 'view_all')));
             $this->setSettingValue(self::SETTING_TOOLBAR, $toolbar);
         }
     } else {
         $this->assign('list', null);
     }
 }
Exemple #25
0
 public function __construct($userId, $idList)
 {
     parent::__construct();
     if (!empty($userId) && !empty($idList)) {
         $this->user = BOL_UserService::getInstance()->findUserById($userId);
         $userService = BOL_UserService::getInstance();
         $avatars = BOL_AvatarService::getInstance()->getAvatarsUrlList($idList, 2);
         $sexValue = array();
         $list = array();
         foreach (BOL_QuestionValueDao::getInstance()->findQuestionValues('sex') as $sexDto) {
             $sexValue[$sexDto->value] = BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $sexDto->value);
         }
         $userData = BOL_QuestionService::getInstance()->getQuestionData($idList, array('sex', 'birthdate', 'googlemap_location'));
         foreach ($idList as $userId) {
             $list[$userId]['userUrl'] = $userService->getUserUrl($userId);
             $list[$userId]['displayName'] = $userService->getDisplayName($userId);
             $list[$userId]['avatarUrl'] = $avatars[$userId];
             $list[$userId]['activity'] = UTIL_DateTime::formatDate(BOL_UserService::getInstance()->findUserById($userId)->getActivityStamp());
             if (!empty($userData[$userId]['birthdate'])) {
                 $date = UTIL_DateTime::parseDate($userData[$userId]['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
                 $list[$userId]['age'] = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
             }
             if (!empty($userData[$userId]['sex'])) {
                 $list[$userId]['sex'] = $sexValue[$userData[$userId]['sex']];
             }
             if (!empty($userData[$userId]['googlemap_location'])) {
                 $list[$userId]['googlemap_location'] = $userData[$userId]['googlemap_location']['address'];
             }
         }
         $this->assign('userName', BOL_UserService::getInstance()->getDisplayName($this->user->id));
         $this->assign('list', $list);
     } else {
         $this->setVisible(FALSE);
     }
 }
Exemple #26
0
 public function siteInfo(array $params = array())
 {
     $config = OW::getConfig();
     $facebookConfig = OW::getEventManager()->call('fbconnect.get_configuration');
     $this->assign("siteInfo", array("siteName" => $config->getValue('base', 'site_name'), "facebookAppId" => empty($facebookConfig["appId"]) ? null : trim($facebookConfig["appId"]), "userApprove" => (bool) $config->getValue("base", "mandatory_user_approve"), "confirmEmail" => (bool) $config->getValue("base", "confirm_email"), "maintenance" => (bool) $config->getValue("base", "maintenance"), "serverTimezone" => $config->getValue("base", "site_timezone"), "serverTimestamp" => time()));
     $plugins = BOL_PluginService::getInstance()->findActivePlugins();
     $activePluginKeys = array();
     /* @var $plugin BOL_Plugin */
     foreach ($plugins as $plugin) {
         $activePluginKeys[] = $plugin->getKey();
     }
     $this->assign("activePluginList", $activePluginKeys);
     $this->assign("isUserAuthenticated", OW::getUser()->isAuthenticated());
     if (OW::getUser()->isAuthenticated()) {
         $avatarService = BOL_AvatarService::getInstance();
         $userId = OW::getUser()->getId();
         $avatarInfo = $avatarService->findByUserId($userId);
         $this->assign("userInfo", array("userId" => $userId, "displayName" => $this->userService->getDisplayName($userId), "avatarUrl" => $avatarService->getAvatarUrl($userId, 1), "bigAvatarUrl" => $avatarService->getAvatarUrl($userId, 2), "origAvatarUrl" => $avatarService->getAvatarUrl($userId, 3), "isAvatarApproved" => !$avatarInfo ? true : (bool) $avatarInfo->getStatus() == BOL_ContentService::STATUS_ACTIVE, "isSuspended" => $this->userService->isSuspended($userId), "isApproved" => $this->userService->isApproved($userId), "isEmailVerified" => OW::getUser()->getUserObject()->getEmailVerify()));
         $this->assign("menuInfo", $this->service->getMenu(OW::getUser()->getId()));
     }
     if (!empty($params['commands'])) {
         $event = new OW_Event('skandroid.base.ping', $params);
         OW::getEventManager()->trigger($event);
         $this->assign('ping', $event->getData());
     }
 }
Exemple #27
0
 protected function process($list, $showOnline)
 {
     $service = BOL_UserService::getInstance();
     $idList = array();
     $userList = array();
     foreach ($list as $dto) {
         $userList[] = array('dto' => $dto);
         $idList[] = $dto->getId();
     }
     $avatars = array();
     $usernameList = array();
     $displayNameList = array();
     $onlineInfo = array();
     $questionList = array();
     if (!empty($idList)) {
         $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList);
         foreach ($avatars as $userId => $avatarData) {
             $displayNameList[$userId] = isset($avatarData['title']) ? $avatarData['title'] : '';
         }
         $usernameList = $service->getUserNamesForList($idList);
         if ($showOnline) {
             $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;
     }
     $contextMenuList = array();
     foreach ($idList as $uid) {
         $contextMenu = $this->getContextMenu($uid);
         if ($contextMenu) {
             $contextMenuList[$uid] = $contextMenu->render();
         } else {
             $contextMenuList[$uid] = null;
         }
     }
     $fields = array();
     $this->assign('contextMenuList', $contextMenuList);
     $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('showPresenceList', $showPresenceList);
     $this->assign('list', $userList);
 }
Exemple #28
0
 public function __construct(array $params = array())
 {
     parent::__construct();
     $service = HOTLIST_BOL_Service::getInstance();
     $authMsg = '';
     $authorized = OW::getUser()->isAuthorized('hotlist', 'add_to_list');
     $status = BOL_AuthorizationService::getInstance()->getActionStatus('hotlist', 'add_to_list');
     if (!$authorized) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('hotlist', 'add_to_list');
         $authMsg = json_encode($status['msg']);
     }
     $this->assign('authorized', $authorized);
     $this->assign('authMsg', $authMsg);
     if (empty($params)) {
         $this->settingList = array('number_of_users' => 8);
     } else {
         $this->settingList = $params;
     }
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('hotlist')->getStaticJsUrl() . 'jquery.cycle.js');
     $userList = HOTLIST_BOL_Service::getInstance()->getHotList();
     $info = array();
     foreach ($userList as $id => $user) {
         $userDto = BOL_UserService::getInstance()->findUserById($user->userId);
         if (empty($userDto)) {
             continue;
         }
         $info[$id]['userId'] = $user->userId;
         $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($user->userId));
         $event = new OW_Event('bookmarks.is_mark', array(), $avatars);
         OW::getEventManager()->trigger($event);
         if ($event->getData()) {
             $avatars = $event->getData();
         }
         $info[$id]['avatarUrl'] = $avatars[$user->userId]['src'];
         $info[$id]['url'] = $avatars[$user->userId]['url'];
         $info[$id]['username'] = BOL_UserService::getInstance()->getUserName($user->userId);
         $info[$id]['displayName'] = empty($avatars[$user->userId]['title']) ? BOL_UserService::getInstance()->getUserName($user->userId) : $avatars[$user->userId]['title'];
         $fields = $this->getFields($user->userId);
         $info[$id]['sex'] = empty($fields['sex']) ? '' : $fields['sex'];
         $info[$id]['age'] = empty($fields['age']) ? '' : $fields['age'];
         $info[$id]['googlemap_location'] = empty($fields['googlemap_location']) ? '' : $fields['googlemap_location'];
         $info[$id]['avatar'] = $avatars[$user->userId];
         $info[$id]['isMarked'] = !empty($avatars[$user->userId]['isMarked']);
     }
     if (!empty($info)) {
         $this->assign('userList', $info);
     } else {
         $this->assign('userList', null);
     }
     $user = $service->findUserById(OW::getUser()->getId());
     $this->assign('userInList', !empty($user));
     $this->assign('number_of_users', $this->settingList['number_of_users']);
     $this->assign('number_of_rows', 1);
     $this->assign('count', count($info));
     $js = "\n\$(document).ready(function() {\n    \$('.users_slideshow').cycle({\n\t\tfx: 'scrollUp',\n\t\tspeed: 300,\n\t\ttimeout: 4500\n\t});\n});";
     if (count($info) > $this->settingList['number_of_users']) {
         OW::getDocument()->addOnloadScript($js);
     }
 }
Exemple #29
0
 private function exportConfigs(ZipArchive $za, $archiveDir)
 {
     $this->configs['avatarUrl'] = OW::getStorage()->getFileUrl(BOL_AvatarService::getInstance()->getAvatarsDir());
     $tableName = OW::getDbo()->escapeString(str_replace(OW_DB_PREFIX, '%%TBL-PREFIX%%', BOL_ConfigDao::getInstance()->getTableName()));
     $query = " SELECT `key`, `name`, `value`, `description` FROM " . BOL_ConfigDao::getInstance()->getTableName() . " WHERE name NOT IN ( 'maintenance', 'update_soft', 'site_installed', 'soft_build', 'soft_version' )\n                    AND `key` NOT IN ( 'dataimporter', 'dataexporter' ) ";
     $sql = DATAEXPORTER_BOL_ExportService::getInstance()->exportTableToSql(OW_DB_PREFIX . 'base_config', false, false, true, $query);
     $za->addFromString($archiveDir . '/configs.sql', $sql);
 }
 public function getUser()
 {
     $user = array();
     $avatar = BOL_AvatarService::getInstance()->getAvatarUrl($this->userId, 2);
     $user['avatar'] = $avatar ? $avatar : BOL_AvatarService::getInstance()->getDefaultAvatarUrl(2);
     $user['displayName'] = BOL_UserService::getInstance()->getDisplayName($this->userId);
     return $user;
 }