public function run() { $config = OW::getConfig(); // check if uninstall is in progress if (!$config->getValue('groups', 'uninstall_inprogress')) { return; } if (!$config->configExists('groups', 'uninstall_cron_busy')) { $config->addConfig('groups', 'uninstall_cron_busy', 0); } // check if cron queue is not busy if ($config->getValue('groups', 'uninstall_cron_busy')) { return; } $config->saveConfig('groups', 'uninstall_cron_busy', 1); $service = GROUPS_BOL_Service::getInstance(); try { $groups = $service->findLimitedList(self::GROUPS_DELETE_LIMIT); if (empty($groups)) { BOL_PluginService::getInstance()->uninstall('groups'); OW::getApplication()->setMaintenanceMode(false); return; } foreach ($groups as $group) { $service->deleteGroup($group->id); } $config->saveConfig('groups', 'uninstall_cron_busy', 0); } catch (Exception $e) { $config->saveConfig('groups', 'uninstall_cron_busy', 0); throw $e; } }
/** * @return Constructor. */ public function __construct($groupId) { parent::__construct(); $service = GROUPS_BOL_Service::getInstance(); $groupDto = $service->findGroupById($groupId); $group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id); $imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto); OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop'); OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property'); $createDate = UTIL_DateTime::formatDate($groupDto->timeStamp); $adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId); $adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId); $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId))); OW::getDocument()->addOnloadScript($js, 1001); $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl)))); if ($service->isCurrentUserCanEdit($groupDto)) { $toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId))); } if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) { $toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag'); } $event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId)); OW::getEventManager()->trigger($event); foreach ($event->getData() as $item) { $toolbar[] = $item; } $this->assign('toolbar', $toolbar); $this->assign('group', $group); }
/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $paramObj) { parent::__construct(); $service = GROUPS_BOL_Service::getInstance(); $groupId = (int) $paramObj->additionalParamList['entityId']; $this->addComponent('briefInfo', new GROUPS_CMP_BriefInfoContent($groupId)); }
public function __construct($groupId) { parent::__construct(); $cover = GHEADER_BOL_Service::getInstance()->findCoverByGroupId($groupId); if (empty($cover)) { $this->assign('error', OW::getLanguage()->text('gheader', 'cover_not_found')); return; } $group = GROUPS_BOL_Service::getInstance()->findGroupById($cover->groupId); $src = GHEADER_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; } $this->assign('src', $src); $this->assign('top', $top); $this->assign('dimensions', $settings['dimensions']); $userId = OW::getUser()->getId(); $cmtParams = new BASE_CommentsParams('gheader', GHEADER_CLASS_CommentsBridge::ENTITY_TYPE); $cmtParams->setEntityId($cover->id); $cmtParams->setAddComment(GHEADER_BOL_Service::getInstance()->isUserCanInteract($userId, $group->id)); $cmtParams->setOwnerId($group->userId); $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_TOP_FORM_WITH_PAGING); $photoCmts = new BASE_CMP_Comments($cmtParams); $this->addComponent('comments', $photoCmts); }
public function __construct(BASE_CLASS_WidgetParameter $params) { parent::__construct(); $groupId = $params->additionalParamList['entityId']; $userId = OW::getUser()->getId(); $service = GROUPS_BOL_Service::getInstance(); $feedService = GROUPRSS_BOL_FeedService::getInstance(); $whoCanAdd = OW::getConfig()->getValue('grouprss', 'actionMember'); if ($whoCanAdd == 'admin' && !OW::getUser()->isAdmin()) { $this->setVisible(false); return; } $mypaths = explode("/", UTIL_Url::selfUrl()); $groupId = strtolower(end($mypaths)); if ($groupId == 'customize') { $groupId = strtolower(prev($mypaths)); } if ($whoCanAdd == 'creator' && $feedService->getGroupCreater($groupId) !== $userId) { $this->setVisible(false); return; } if ($whoCanAdd == 'both') { if (!OW::getUser()->isAdmin() && $feedService->getGroupCreater($groupId) !== $userId) { $this->setVisible(false); return; } } $this->assign('groupId', (int) $groupId); }
public function import($params) { $importDir = $params['importDir']; $configFile = $importDir . 'config.txt'; $service = GROUPS_BOL_Service::getInstance(); $string = file_get_contents($configFile); $configs = json_decode($string, true); $sourceDirUrl = $configs['dirUrl']; $counter = 0; while (true) { $list = $service->findGroupList(GROUPS_BOL_Service::LIST_ALL, $counter, 100); if (empty($list)) { break; } $counter += 100; foreach ($list as $dto) { $fileName = $service->getGroupImageFileName($dto); if ($fileName === null) { continue; } $sourceFileUrl = $sourceDirUrl . '/' . $fileName; $content = file_get_contents($sourceFileUrl); $distFilePath = $service->getGroupImagePath($dto); if (!empty($content)) { OW::getStorage()->fileSetContent($distFilePath, $content); } } } }
protected function assignList(BASE_CLASS_WidgetParameter $params) { $groupId = $params->additionalParamList['entityId']; $list = GROUPS_BOL_Service::getInstance()->findUserList($groupId, 0, self::MAX_USERS_COUNT); $idlist = array(); foreach ($list as $item) { $idlist[] = $item->id; } return $idlist; }
/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $params) { parent::__construct(); $groupId = $params->additionalParamList['entityId']; $userId = OW::getUser()->getId(); if (!$params->customizeMode && GROUPS_BOL_Service::getInstance()->findUser($groupId, $userId) !== null) { $this->setVisible(false); return; } $actionUrl = OW::getRouter()->urlForRoute('groups-join', array('groupId' => $groupId)); $this->assign('actionUrl', $actionUrl); }
private function assignList($userId, $count) { $service = GROUPS_BOL_Service::getInstance(); $list = $service->findUserGroupList($userId, 0, $count); $tplList = array(); foreach ($list as $item) { /* @var $item GROUPS_BOL_Group */ $tplList[] = array('image' => $service->getGroupImageUrl($item), 'title' => htmlspecialchars($item->title), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $item->id))); } $this->assign("list", $tplList); return !empty($tplList); }
public function __construct($groupId) { parent::__construct(); $this->groupId = $groupId; $urlStatic = OW::getPluginManager()->getPlugin('gheader')->getStaticUrl(); OW::getDocument()->addScript($urlStatic . 'gheader.js'); OW::getDocument()->addStyleSheet($urlStatic . 'gheader.css'); OW::getLanguage()->addKeyForJs('gheader', 'delete_cover_confirmation'); OW::getLanguage()->addKeyForJs('gheader', 'my_photos_title'); $this->service = GHEADER_BOL_Service::getInstance(); $this->groupService = GROUPS_BOL_Service::getInstance(); $this->group = $this->groupService->findGroupById($this->groupId); }
private function assignList($groupId, $count) { $list = GROUPS_BOL_Service::getInstance()->findUserList($groupId, 0, $count); $idlist = array(); foreach ($list as $item) { $idlist[] = $item->id; } $data = array(); if (!empty($idlist)) { $data = BOL_AvatarService::getInstance()->getDataForUserAvatars($idlist); } $this->assign("userIdList", $idlist); $this->assign("data", $data); return !empty($idlist); }
/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $paramObj) { parent::__construct(); $params = $paramObj->customParamList; $commentParams = new BASE_CommentsParams('groups', GROUPS_BOL_Service::ENTITY_TYPE_WAL); $groupId = (int) $paramObj->additionalParamList['entityId']; $commentParams->setEntityId($groupId); if (isset($params['comments_count'])) { $commentParams->setCommentCountOnPage($params['comments_count']); } if (isset($params['display_mode'])) { $commentParams->setDisplayType($params['display_mode']); } $isMember = GROUPS_BOL_Service::getInstance()->findUser($groupId, OW::getUser()->getId()) !== null; $commentParams->setAddComment($isMember); $this->addComponent('comments', new BASE_CMP_Comments($commentParams)); }
public function onInvitationCommand(OW_Event $event) { $params = $event->getParams(); $result = array('result' => false); if (!in_array($params['command'], array('groups.accept', 'groups.ignore'))) { return; } $groupId = $params['data']; $userId = OW::getUser()->getId(); if ($params['command'] == 'groups.accept') { GROUPS_BOL_Service::getInstance()->addUser($groupId, $userId); $result = array('result' => true, 'msg' => OW::getLanguage()->text('groups', 'join_complete_message')); } else { if ($params['command'] == 'groups.ignore') { GROUPS_BOL_Service::getInstance()->deleteInvite($groupId, $userId); } } $event->setData($result); }
public function getService($pluginKey) { switch ($pluginKey) { case 'newsfeed': return NEWSFEED_BOL_Service::getInstance(); case 'blogs': return PostService::getInstance(); case 'groups': return GROUPS_BOL_Service::getInstance(); case 'event': return EVENT_BOL_EventService::getInstance(); case 'links': return LinkService::getInstance(); case 'video': return VIDEO_BOL_ClipService::getInstance(); case 'forum': return FORUM_BOL_ForumService::getInstance(); case 'photo': return PHOTO_BOL_PhotoService::getInstance(); } }
public function collectSnippets(BASE_CLASS_EventCollector $event) { $language = OW::getLanguage(); $params = $event->getParams(); if ($params["entityType"] != SNIPPETS_CLASS_EventHandler::ENTITY_TYPE_USER) { return; } $userId = $params["entityId"]; $preview = $params["preview"]; $snippet = new SNIPPETS_CMP_Snippet(self::WIDGET_NAME, $userId); if ($preview) { $snippet->setLabel($language->text("snippets", "snippet_groups_preview")); $snippet->setIconClass("ow_ic_files"); $event->add($snippet); return; } // Privacy check $eventParams = array('action' => GROUPS_BOL_Service::PRIVACY_ACTION_VIEW_MY_GROUPS, 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId()); try { OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams); } catch (RedirectException $exception) { return; } $service = GROUPS_BOL_Service::getInstance(); $total = $service->findUserGroupListCount($userId); $list = $service->findUserGroupList($userId, 0, 3); if (empty($list)) { return; } $images = array(); foreach ($list as $group) { $images[] = $service->getGroupImageUrl($group); } $url = OW::getRouter()->urlForRoute("groups-user-groups", array("user" => BOL_UserService::getInstance()->getUserName($userId))); $snippet->setImages($images); $snippet->setLabel($language->text("snippets", "snippet_groups", array("count" => '<span class="ow_txt_value">' . $total . '</span>'))); $snippet->setUrl($url); $event->add($snippet); }
public function onBeforeQuestionAdd(OW_Event $event) { $params = $event->getParams(); $data = $event->getData(); if (empty($params['settings']['context']['type']) || $params['settings']['context']['type'] != 'groups') { return; } if (!$this->isActive()) { return; } $context = $params['settings']['context']; $service = GROUPS_BOL_Service::getInstance(); $groupId = (int) $context['id']; $group = $service->findGroupById($groupId); $url = $service->getGroupUrl($group); $title = UTIL_String::truncate(strip_tags($group->title), 100, '...'); $context['label'] = $title; $context['url'] = $url; $data['settings']['context'] = $context; $data['privacy'] = 'groups'; $event->setData($data); }
/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $params) { parent::__construct(); $groupId = $params->additionalParamList['entityId']; $userId = OW::getUser()->getId(); $service = GROUPS_BOL_Service::getInstance(); if (!$params->customizeMode && !$service->isCurrentUserInvite($groupId)) { $this->setVisible(false); return; } $users = null; if (OW::getEventManager()->call('plugin.friends')) { $users = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => $userId, 'count' => 100)); } if ($users === null) { $users = array(); $userDtos = BOL_UserService::getInstance()->findRecentlyActiveList(0, 100); foreach ($userDtos as $u) { if ($u->id != $userId) { $users[] = $u->id; } } } $idList = array(); if (!empty($users)) { $groupUsers = $service->findGroupUserIdList($groupId); $invitedList = $service->findInvitedUserIdList($groupId, $userId); foreach ($users as $uid) { if (in_array($uid, $groupUsers) || in_array($uid, $invitedList)) { continue; } $idList[] = $uid; } } $options = array('groupId' => $groupId, 'userList' => $idList, 'floatBoxTitle' => OW::getLanguage()->text('groups', 'invite_fb_title'), 'inviteResponder' => OW::getRouter()->urlFor('GROUPS_CTRL_Groups', 'invite')); $js = UTIL_JsGenerator::newInstance()->callFunction('GROUPS_InitInviteButton', array($options)); OW::getDocument()->addOnloadScript($js); }
public function countGroups() { return GROUPS_BOL_Service::getInstance()->findGroupListCount(GROUPS_BOL_Service::LIST_LATEST); }
public function __construct() { parent::__construct(); $this->service = GHEADER_BOL_Service::getInstance(); $this->groupService = GROUPS_BOL_Service::getInstance(); }
public function afterContentApprove(OW_Event $event) { $params = $event->getParams(); if ($params["entityType"] != GROUPS_BOL_Service::FEED_ENTITY_TYPE) { return; } if (!$params["isNew"]) { return; } $group = GROUPS_BOL_Service::getInstance()->findGroupById($params["entityId"]); if ($group === null) { return; } BOL_AuthorizationService::getInstance()->trackActionForUser($group->userId, 'groups', 'create'); }
public function isValid($value) { if (!empty($this->exception) && trim($this->exception) == trim($value)) { return true; } $dto = GROUPS_BOL_Service::getInstance()->findByTitle($value); if ($dto === null) { return true; } return false; }
public function onCoverAdd(OW_Event $event) { if (!$this->isActive()) { return; } $params = $event->getParams(); $coverPath = $params['path']; $groupId = $params['groupId']; $saveToPhoto = GHEADER_BOL_Service::getInstance()->getConfig($groupId, 'saveToPhoto'); if (!$saveToPhoto) { return; } $albumName = GHEADER_BOL_Service::getInstance()->getConfig($groupId, 'albumName'); $group = GROUPS_BOL_Service::getInstance()->findGroupById($groupId); if (empty($group)) { return; } $userId = $group->userId; $data = $event->getData(); if (!empty($data['photoId'])) { return; } $photoId = $this->addPhoto($userId, $albumName, $coverPath, null, null, false); if ($photoId === null) { return; } if ($data !== null) { $data['photoId'] = $photoId; } $event->setData($data); }
public function manage($params) { $groupId = (int) $params['groupId']; if (empty($groupId)) { throw new Redirect404Exception(); } $service = GROUPS_BOL_Service::getInstance(); $feedService = GROUPRSS_BOL_FeedService::getInstance(); $language = OW::getLanguage(); $config = OW::getConfig(); $userId = OW::getUser()->getId(); $groupDto = $service->findGroupById($groupId); if ($groupDto === null) { throw new Redirect404Exception(); } $whoCanAdd = $config->getValue('grouprss', 'actionMember'); if ($whoCanAdd == 'admin' && !OW::getUser()->isAdmin()) { throw new Redirect404Exception(); } $mypaths = explode("/", UTIL_Url::selfUrl()); $groupId = strtolower(end($mypaths)); if ($groupId == 'customize') { $groupId = strtolower(prev($mypaths)); } if ($whoCanAdd == 'creator' && $feedService->getGroupCreater($groupId) !== $userId) { throw new Redirect404Exception(); } if ($whoCanAdd == 'both') { if (!OW::getUser()->isAdmin() && $feedService->getGroupCreater($groupId) !== $userId) { throw new Redirect404Exception(); } } $userList = $service->findGroupUserIdList($groupId); $userService = BOL_UserService::getInstance(); $feedService = GROUPRSS_BOL_FeedService::getInstance(); $newForm = new Form('newForm'); $element = new Selectbox('feedUser'); $element->setLabel($language->text('grouprss', 'newsfeed_user')); $element->setRequired(); foreach ($userList as $key => $user) { $element->addOption($user, $userService->getDisplayName($user)); } $newForm->addElement($element); $element = new TextField('feedUrl'); $element->setRequired(true); $validator = new UrlValidator(); $validator->setErrorMessage($language->text('grouprss', 'invalid_feed_url')); $element->addValidator($validator); $element->setLabel($language->text('grouprss', 'new_feed_url')); $newForm->addElement($element); $element = new TextField('feedCount'); $element->setValue("2"); $element->setRequired(); $element->setLabel(OW::getLanguage()->text('grouprss', 'user_feed_count')); $validator = new IntValidator(1, 50); $validator->setErrorMessage(OW::getLanguage()->text('grouprss', 'invalid_feed_count_error')); $element->addValidator($validator); $newForm->addElement($element); $element = new Submit('addFeed'); $element->setValue(OW::getLanguage()->text('grouprss', 'add_new_feed')); $newForm->addElement($element); if (OW::getRequest()->isPost()) { if ($newForm->isValid($_POST)) { $values = $newForm->getValues(); $userId = $values['feedUser']; $feedUrl = $values['feedUrl']; $feedCount = $values['feedCount']; if ($feedService->isDuplicate($groupId, $feedUrl)) { OW::getFeedback()->error($language->text('grouprss', 'add_feed_duplicate_error')); } else { $feedService->addFeed($groupId, $userId, $feedUrl, $feedCount); OW::getFeedback()->info($language->text('grouprss', 'add_feed_success')); GROUPRSS_BOL_FeedService::getInstance()->addAllGroupFeed(); } } } $this->addForm($newForm); $allFeeds = $feedService->findByGroup($groupId); $feedDetails = array(); $deleteFeeds = array(); foreach ($allFeeds as $feed) { $feedDetails[$feed->id]['feedID'] = $feed->id; $feedDetails[$feed->id]['groupID'] = $feed->groupId; $feedDetails[$feed->id]['userID'] = $feed->userId; $feedDetails[$feed->id]['userName'] = $userService->getDisplayName($feed->userId); $feedDetails[$feed->id]['userURL'] = $userService->getUserUrl($feed->userId); $feedDetails[$feed->id]['feedURL'] = $feed->feedUrl; $feedDetails[$feed->id]['feedCount'] = $feed->feedCount; $feedDetails[$feed->id]['timestamp'] = $feed->timestamp; $deleteFeeds[$feed->id] = OW::getRouter()->urlFor(__CLASS__, 'delete', array('id' => $feed->id, 'groupId' => $groupId)); } $this->assign('feedDetails', $feedDetails); $this->assign('deleteFeeds', $deleteFeeds); OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('grouprss')->getStaticCssUrl() . 'style.css'); OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('grouprss')->getStaticJsUrl() . 'jquery.tablesorter.min.js'); $this->setPageHeading(OW::getLanguage()->text('grouprss', 'manage_settings_title')); $this->setPageTitle(OW::getLanguage()->text('grouprss', 'manage_settings_title')); $this->setPageHeadingIconClass('ow_ic_gear_wheel'); }
public function onActionUpdate(OW_Event $event) { $params = $event->getParams(); $data = $event->getData(); if ($params['entityType'] != GHEADER_CLASS_CommentsBridge::ENTITY_TYPE) { return; } $cover = GHEADER_BOL_Service::getInstance()->findCoverById($params['entityId']); if ($cover === null) { return; } $data['params'] = empty($data['params']) ? array() : $data['params']; $group = GROUPS_BOL_Service::getInstance()->findGroupById($cover->groupId); $data['params']['visibility'] = $this->getVisibility($group); $data['params']['postOnUserFeed'] = $this->getPostOnUserFeed($group); $event->setData($data); }
protected function assignList(BASE_CLASS_WidgetParameter $params) { $groupId = $params->additionalParamList['entityId']; $list = GROUPS_BOL_Service::getInstance()->findGroupUserIdList($groupId, 'everybody'); return $list; }
public function onCommand(OW_Event $event) { $params = $event->getParams(); if (!in_array($params['command'], array('groups.accept', 'groups.ignore'))) { return; } $groupId = $params['data']; $userId = OW::getUser()->getId(); $jsResponse = UTIL_JsGenerator::newInstance(); if ($params['command'] == 'groups.accept') { GROUPS_BOL_Service::getInstance()->addUser($groupId, $userId); $jsResponse->callFunction(array('OW', 'info'), array(OW::getLanguage()->text('groups', 'join_complete_message'))); } else { if ($params['command'] == 'groups.ignore') { GROUPS_BOL_Service::getInstance()->deleteInvite($groupId, $userId); } } $event->setData($jsResponse); }
public function additional() { $this->setPageHeading(OW::getLanguage()->text('groups', 'widgets_panel_heading')); $this->setPageHeadingIconClass('ow_ic_dashboard'); $is_forum_connected = OW::getConfig()->getValue('groups', 'is_forum_connected'); if (OW::getPluginManager()->isPluginActive('forum') || $is_forum_connected) { $this->assign('isForumConnected', $is_forum_connected); $this->assign('isForumAvailable', true); } else { $this->assign('isForumAvailable', false); } $menu = $this->getMenu(); $this->addComponent('menu', $menu); if (OW::getConfig()->getValue('groups', 'restore_groups_forum')) { // Add forum section $event = new OW_Event('forum.create_section', array('name' => 'Groups', 'entity' => 'groups', 'isHidden' => true)); OW::getEventManager()->trigger($event); $groupsService = GROUPS_BOL_Service::getInstance(); $groupList = $groupsService->findGroupList(GROUPS_BOL_Service::LIST_ALL); if (!empty($groupList)) { foreach ($groupList as $group) { // Add forum group $event = new OW_Event('forum.create_group', array('entity' => 'groups', 'name' => $group->title, 'description' => $group->description, 'entityId' => $group->getId())); OW::getEventManager()->trigger($event); } } OW::getConfig()->saveConfig('groups', 'restore_groups_forum', 0); } }
public function collectToolbar(BASE_CLASS_EventCollector $event) { $params = $event->getParams(); $groupId = $params["groupId"]; $group = GROUPS_BOL_Service::getInstance()->findGroupById($groupId); if (empty($group) || $group->userId != OW::getUser()->getId()) { return false; } $uniqId = uniqid("mcompose-"); $recipients = array(self::ID_PREFIX . "_" . $groupId); $href = OW::getRouter()->urlForRoute("mcompose-index"); $href = OW::getRequest()->buildUrlQueryString($href, array("recipients" => $recipients, "context" => MCOMPOSE_BOL_Service::CONTEXT_GROUP)); $toolbar = array("label" => OW::getLanguage()->text("mcompose", "groups_send_message"), "href" => $href, "id" => $uniqId); $event->add($toolbar); $js = UTIL_JsGenerator::newInstance(); $js->jQueryEvent("#" . $uniqId, "click", 'OW.ajaxFloatBox(e.data.class, e.data.params); return false;', array("e"), array("class" => "MCOMPOSE_CMP_SendMessage", "params" => array($recipients, MCOMPOSE_BOL_Service::CONTEXT_GROUP))); OW::getDocument()->addOnloadScript($js); }
public function sosialSharingGetGroupInfo(OW_Event $event) { $params = $event->getParams(); $data = $event->getData(); $data['display'] = false; if (empty($params['entityId'])) { return; } if ($params['entityType'] == 'groups') { if (!BOL_AuthorizationService::getInstance()->isActionAuthorizedForUser(0, 'groups', 'view')) { $event->setData($data); return; } $groupDto = GROUPS_BOL_Service::getInstance()->findGroupById($params['entityId']); if (!empty($groupDto)) { $data['display'] = $groupDto->whoCanView !== GROUPS_BOL_Service::WCV_INVITE; } } $event->setData($data); }
private function triggerAction(OW_Event $event, $add) { $params = $event->getParams(); $data = $event->getData(); $coverId = $params['id']; $cover = GHEADER_BOL_Service::getInstance()->findCoverById($coverId); $group = GROUPS_BOL_Service::getInstance()->findGroupById($cover->groupId); if (empty($group)) { return; } $userId = $group->userId; $groupUrl = GROUPS_BOL_Service::getInstance()->getGroupUrl($group); $groupTitle = UTIL_String::truncate($group->title, 100, '...'); $groupImage = GROUPS_BOL_Service::getInstance()->getGroupImageUrl($group); $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId)); $avatar = $avatars[$userId]; $previewImage = array('src' => $groupImage, 'url' => $groupUrl); $notificationParams = array('pluginKey' => $this->plugin->getKey(), 'action' => self::ACTION_ADD, 'entityType' => self::TYPE_ADD, 'entityId' => $cover->groupId, 'userId' => null, 'time' => time()); $groupEmbed = '<a href="' . $groupUrl . '">' . $groupTitle . '</a>'; $notificationData = array('string' => array('key' => $add ? 'gheader+notifications_cover_add' : 'gheader+notifications_cover_change', 'vars' => array('user' => '<a href="' . $avatar['url'] . '">' . $avatar['title'] . '</a>', 'group' => $groupEmbed)), 'avatar' => $avatar, 'contentImage' => $previewImage, 'url' => $groupUrl); $userIds = GROUPS_BOL_Service::getInstance()->findGroupUserIdList($group->id); foreach ($userIds as $uid) { if ($uid == $userId) { continue; } $notificationParams['userId'] = $uid; $event = new OW_Event('notifications.add', $notificationParams, $notificationData); OW::getEventManager()->trigger($event); } }