Example #1
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 #2
0
 public function __construct($listType, $count, $exclude = null, $albumId = null)
 {
     parent::__construct();
     $this->photoService = PHOTO_BOL_PhotoService::getInstance();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $checkPrivacy = !OW::getUser()->isAuthorized('photo');
     if ($albumId) {
         $photos = $this->photoService->getAlbumPhotos($albumId, 1, $count, $exclude);
     } else {
         $photos = $this->photoService->findPhotoList($listType, 1, $count, $checkPrivacy, $exclude);
     }
     $this->assign('photos', $photos);
     foreach ($photos as $photo) {
         array_push($exclude, $photo['id']);
     }
     if ($albumId) {
         $loadMore = $this->photoAlbumService->countAlbumPhotos($albumId, $exclude);
     } else {
         $loadMore = $this->photoService->countPhotos($listType, $checkPrivacy, $exclude);
     }
     if (!$loadMore) {
         $script = "OWM.trigger('photo.hide_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
Example #3
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $questionNames = array();
     if ($this->previewMode) {
         $questions = BOL_QuestionService::getInstance()->findViewQuestionsForAccountType($this->user->accountType);
         foreach ($questions as $question) {
             if ($question["name"] == OW::getConfig()->getValue('base', 'display_name_question')) {
                 continue;
             }
             $questionNames[$question['sectionName']][] = $question["name"];
         }
     }
     $questions = BASE_CMP_UserViewWidget::getUserViewQuestions($this->user->id, OW::getUser()->isAdmin(), reset($questionNames));
     $data = array();
     foreach ($questions['data'][$this->user->id] as $key => $value) {
         $data[$key] = $value;
         if (is_array($value)) {
             $data[$key] = implode(', ', $value);
         }
     }
     $this->assign("displaySections", !$this->previewMode);
     $this->assign('questionArray', $questions['questions']);
     $this->assign('questionData', $data);
     $this->assign('questionLabelList', $questions['labels']);
 }
Example #4
0
 public function __construct($params)
 {
     parent::__construct();
     $this->visiblePhotoCount = !empty($params['photoCount']) ? (int) $params['photoCount'] : 8;
     $checkAuth = isset($params['checkAuth']) ? (bool) $params['checkAuth'] : true;
     $wrap = isset($params['wrapBox']) ? (bool) $params['wrapBox'] : true;
     $boxType = isset($params['boxType']) ? $params['boxType'] : '';
     $showTitle = isset($params['showTitle']) ? (bool) $params['showTitle'] : true;
     $uniqId = isset($params['uniqId']) ? $params['uniqId'] : uniqid();
     if ($checkAuth && !OW::getUser()->isAuthorized('photo', 'view')) {
         $this->setVisible(false);
         return;
     }
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $latest = $photoService->findPhotoList('latest', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
     $this->assign('latest', $latest);
     $featured = $photoService->findPhotoList('featured', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
     $this->assign('featured', $featured);
     $toprated = $photoService->findPhotoList('toprated', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
     $this->assign('toprated', $toprated);
     $items = array('latest', 'toprated');
     if ($featured) {
         $items[] = 'featured';
     }
     $menuItems = $this->getMenuItems($items, $uniqId);
     $this->assign('items', $menuItems);
     $this->assign('wrapBox', $wrap);
     $this->assign('boxType', $boxType);
     $this->assign('showTitle', $showTitle);
     $this->assign('url', OW::getEventManager()->call('photo.getAddPhotoURL', array('')));
     $this->assign('uniqId', $uniqId);
     $this->setTemplate(OW::getPluginManager()->getPlugin('photo')->getMobileCmpViewDir() . 'index_photo_list.html');
 }
Example #5
0
 public function __construct(BASE_CommentsParams $params, $id, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $textArea->setHasInvitation(true);
     $textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text'));
     $form->addElement($textArea);
     $hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1);
     foreach ($hiddenEls as $name => $value) {
         $el = new HiddenField($name);
         $el->setValue($value);
         $form->addElement($el);
     }
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
     //        $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}");
     //        $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}");
     $this->addForm($form);
     OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');");
     $this->assign('form', true);
     $this->assign('id', $id);
 }
Example #6
0
 /**
  * Class constructor
  * 
  * @param array $params
  *      string linkText
  */
 public function __construct(array $params = array())
 {
     parent::__construct();
     // add a form
     $form = new InsertVideoForm();
     $this->addForm($form);
 }
Example #7
0
 /**
  * Class constructor
  * 
  * @param array $params
  *      string linkText
  */
 public function __construct(array $params = array())
 {
     parent::__construct();
     $title = !empty($params['linkText']) ? trim(strip_tags($params['linkText'])) : null;
     // add a form
     $form = new InsertLinkForm();
     $form->setValues(array('title' => $title));
     $this->addForm($form);
 }
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $limit = MBOL_ConsoleService::SECTION_ITEMS_LIMIT;
     $this->addComponent('itemsCmp', new BASE_MCMP_ConsoleInvitations($limit));
     $this->assign('loadMore', $this->service->findInvitationCount(OW::getUser()->getId()) > $limit);
     $params = array('cmdUrl' => OW::getRouter()->urlFor('BASE_MCTRL_Invitations', 'command'));
     $script = 'var invitationsConsole = new OWM_InvitationsConsole(' . json_encode($params) . ');';
     OW::getDocument()->addOnloadScript($script);
 }
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $sections = MBOL_ConsoleService::getInstance()->getPageSections('notifications');
     $tplSections = array();
     foreach ($sections as $section) {
         $tplSections[] = $section['item'];
     }
     $this->assign('items', $tplSections);
 }
Example #10
0
 public function __construct(array $params)
 {
     parent::__construct();
     $this->videoService = IVIDEO_BOL_Service::getInstance();
     $listType = isset($params['type']) ? $params['type'] : '';
     $count = isset($params['count']) ? $params['count'] : 5;
     $tag = isset($params['tag']) ? $params['tag'] : '';
     $userId = isset($params['userId']) ? $params['userId'] : null;
     $category = isset($params['category']) ? $params['category'] : null;
     $page = isset($_GET['page']) && (int) $_GET['page'] ? (int) $_GET['page'] : 1;
     $videosPerPage = (int) OW::getConfig()->getValue('ivideo', 'resultsPerPage');
     if ($userId) {
         $videos = $this->videoService->findUserVideosList($userId, $page, $videosPerPage);
         $records = $this->videoService->findUserVideosCount($userId);
     } else {
         if (strlen($tag)) {
             $videos = $this->videoService->findTaggedVideosList($tag, $page, $videosPerPage);
             $records = $this->videoService->findTaggedVideosCount($tag);
         } else {
             if (strlen($category)) {
                 $videos = $this->videoService->findCategoryVideosList($category, $page, $videosPerPage);
                 $records = $this->videoService->findCategoryVideosCount($category);
             } else {
                 $videos = $this->videoService->findVideosList($listType, $page, $videosPerPage);
                 $records = $this->videoService->findVideosCount($listType);
             }
         }
     }
     $this->assign('listType', $listType);
     if ($videos) {
         $this->assign('no_content', null);
         $this->assign('videos', $videos);
         $userIds = array();
         foreach ($videos as $video) {
             if (!in_array($video['owner'], $userIds)) {
                 array_push($userIds, $video['owner']);
             }
         }
         $names = BOL_UserService::getInstance()->getDisplayNamesForList($userIds);
         $this->assign('displayNames', $names);
         $usernames = BOL_UserService::getInstance()->getUserNamesForList($userIds);
         $this->assign('usernames', $usernames);
         $pages = (int) ceil($records / $videosPerPage);
         $paging = new BASE_CMP_Paging($page, $pages, 10);
         $this->assign('paging', $paging->render());
         $this->assign('count', $count);
     } else {
         $this->assign('no_content', OW::getLanguage()->text('ivideo', 'no_video_found'));
     }
     $this->assign('getUserFilesUrl', OW::getPluginManager()->getPlugin('ivideo')->getUserFilesUrl());
     $this->assign('videoPreviewWidth', OW::getConfig()->getValue('ivideo', 'videoPreviewWidth'));
     $this->assign('videoPreviewHeight', OW::getConfig()->getValue('ivideo', 'videoPreviewHeight'));
     $this->assign('posterImage', OW::getPluginManager()->getPlugin('ivideo')->getStaticUrl() . 'poster.jpg');
     $this->assign('defaultThumb', OW::getPluginManager()->getPlugin('ivideo')->getStaticUrl() . 'video.png');
 }
Example #11
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $limit = self::SECTION_ITEMS_LIMIT;
     $this->addComponent('itemsCmp', new NOTIFICATIONS_MCMP_ConsoleItems($limit));
     $this->assign('loadMore', $this->service->findNotificationCount(OW::getUser()->getId()) > $limit);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('notifications')->getStaticUrl() . 'mobile.js');
     $params = array('limit' => $limit);
     $script = 'var notificationsConsole = new OWM_NotificationsConsole(' . json_encode($params) . ');';
     OW::getDocument()->addOnloadScript($script);
 }
Example #12
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $limit = MBOL_ConsoleService::SECTION_ITEMS_LIMIT;
     $this->addComponent('itemsCmp', new FRIENDS_MCMP_ConsoleItems($limit));
     $this->assign('loadMore', $this->service->count(null, OW::getUser()->getId(), FRIENDS_BOL_Service::STATUS_PENDING) > $limit);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('friends')->getStaticJsUrl() . 'mobile.js');
     $params = array('acceptUrl' => OW::getRouter()->urlFor('FRIENDS_MCTRL_Action', 'accept'), 'ignoreUrl' => OW::getRouter()->urlFor('FRIENDS_MCTRL_Action', 'ignore'));
     $script = 'var friendsConsole = new OWM_FriendsConsole(' . json_encode($params) . ');';
     OW::getDocument()->addOnloadScript($script);
 }
Example #13
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $content = $this->getAboutMeContent();
     if ($content === null) {
         $this->setVisible(false);
         return;
     }
     $this->assign('aboutMe', $content);
     $this->assign('aboutUrl', OW::getRouter()->urlForRoute('base_about_profile', array('username' => $this->user->username)));
     $this->assign("previewMode", !empty($this->length));
 }
Example #14
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $event = new BASE_CLASS_EventCollector(self::EVENT_NAME, array('userId' => $this->user->id));
     OW::getEventManager()->trigger($event);
     $addedData = $event->getData();
     if (empty($addedData)) {
         $this->setVisible(false);
         return;
     }
     $this->initMenu($addedData);
 }
Example #15
0
 /**
  * Constructor.
  */
 public function __construct($timestamp)
 {
     parent::__construct();
     $service = BOL_InvitationService::getInstance();
     $userId = OW::getUser()->getId();
     $invitations = $service->findNewInvitationList($userId, $timestamp);
     $items = BASE_MCMP_ConsoleInvitations::prepareData($invitations);
     $this->assign('items', $items);
     // Mark as viewed
     $service->markViewedByUserId($userId);
     $tpl = OW::getPluginManager()->getPlugin('base')->getMobileCmpViewDir() . 'console_invitations.html';
     $this->setTemplate($tpl);
 }
Example #16
0
 /**
  * Constructor.
  */
 public function __construct($timestamp)
 {
     parent::__construct();
     $service = FRIENDS_BOL_Service::getInstance();
     $userId = OW::getUser()->getId();
     $requests = $service->findNewRequestList($userId, $timestamp);
     $items = FRIENDS_MCMP_ConsoleItems::prepareData($requests);
     $this->assign('items', $items);
     // Mark as viewed
     $service->markAllViewedByUserId($userId);
     $tpl = OW::getPluginManager()->getPlugin('friends')->getMobileCmpViewDir() . 'console_items.html';
     $this->setTemplate($tpl);
 }
Example #17
0
 /**
  * Constructor.
  */
 public function __construct($timestamp)
 {
     parent::__construct();
     $service = NOTIFICATIONS_BOL_Service::getInstance();
     $userId = OW::getUser()->getId();
     $notifications = $service->findNewNotificationList($userId, $timestamp);
     $items = NOTIFICATIONS_MCMP_ConsoleItems::prepareData($notifications);
     $this->assign('items', $items);
     // Mark as viewed
     $service->markNotificationsViewedByUserId($userId);
     $tpl = OW::getPluginManager()->getPlugin('notifications')->getMobileCmpViewDir() . 'console_items.html';
     $this->setTemplate($tpl);
 }
Example #18
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $userId = OW::getUser()->getId();
     $userService = BOL_UserService::getInstance();
     $this->assign('username', $userService->getDisplayName($userId));
     $this->assign('url', $userService->getUserUrl($userId));
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId));
     $this->assign('avatarUrl', $avatars[$userId]['src']);
     $script = '$(".owm_sidebar_profile_logout").click(function(){
         document.location.href = ' . json_encode(OW::getRouter()->urlForRoute('base_sign_out')) . ';
     });';
     OW::getDocument()->addOnloadScript($script);
 }
Example #19
0
 /**
  * Constructor.
  */
 public function __construct($ajax = true)
 {
     parent::__construct();
     if (OW::getUser()->isAuthenticated()) {
         $this->setVisible(false);
     }
     $form = BOL_UserService::getInstance()->getSignInForm('sign-in', false);
     if ($ajax) {
         $form->setAction(OW::getRouter()->urlFor('BASE_MCTRL_User', 'signIn'));
         $form->setAjax();
         $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OWM.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OWM.error(data.message);}}');
     }
     $this->addForm($form);
 }
Example #20
0
 public function __construct($userId, $limit, $exclude)
 {
     parent::__construct();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $user = BOL_UserService::getInstance()->findUserById($userId);
     $this->assign('username', $user->getUsername());
     $albums = $this->photoAlbumService->findUserAlbumList($user->id, 1, $limit, $exclude, true);
     $this->assign('albums', $albums);
     foreach ($albums as $album) {
         array_push($exclude, $album['dto']->id);
     }
     $loadMore = $this->photoAlbumService->countUserAlbums($userId, $exclude);
     if (!$loadMore) {
         $script = "OWM.trigger('photo.hide_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
 /**
  * Constructor.
  */
 public function __construct($limit, $exclude = null)
 {
     parent::__construct();
     $service = NOTIFICATIONS_BOL_Service::getInstance();
     $userId = OW::getUser()->getId();
     $notifications = $service->findNotificationList($userId, time(), $exclude, $limit);
     $items = self::prepareData($notifications);
     $this->assign('items', $items);
     $notificationIdList = array();
     foreach ($items as $id => $item) {
         $notificationIdList[] = $id;
     }
     // Mark as viewed
     $service->markNotificationsViewedByUserId($userId);
     $exclude = is_array($exclude) ? array_merge($exclude, $notificationIdList) : $notificationIdList;
     $loadMore = (bool) $service->findNotificationCount($userId, null, $exclude);
     if (!$loadMore) {
         $script = "OWM.trigger('mobile.console_hide_notifications_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
Example #22
0
 /**
  * Constructor.
  */
 public function __construct($limit, $exclude = null)
 {
     parent::__construct();
     $service = FRIENDS_BOL_Service::getInstance();
     $userId = OW::getUser()->getId();
     $requests = $service->findRequestList($userId, time(), 0, $limit, $exclude);
     $items = self::prepareData($requests);
     $this->assign('items', $items);
     // Mark as viewed
     $service->markAllViewedByUserId($userId);
     $requestIdList = array();
     foreach ($requests as $id => $request) {
         $requestIdList[] = $id;
     }
     $exclude = is_array($exclude) ? array_merge($exclude, $requestIdList) : $requestIdList;
     $loadMore = (bool) $service->count(null, $userId, FRIENDS_BOL_Service::STATUS_PENDING, null, null, $exclude);
     if (!$loadMore) {
         $script = "OWM.trigger('mobile.console_hide_friends_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
Example #23
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 #24
0
 public function __construct($items)
 {
     parent::__construct();
     $this->assign('items', $items);
     OW::getDocument()->addOnloadScript('OWM.initWidgetMenu(' . json_encode($items) . ')');
 }
Example #25
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->process($this->list, $this->showOnline);
 }
Example #26
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $pages = MBOL_ConsoleService::getInstance()->getPages();
     $this->assign('pages', $pages);
 }
Example #27
0
 public function __construct($message)
 {
     parent::__construct();
     $this->assign('message', $message);
 }