示例#1
0
 public function onDelete(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     foreach ($params["entityIds"] as $groupId) {
         $this->service->deleteGroup($groupId);
     }
 }
示例#2
0
文件: cron.php 项目: vazahat/dudex
 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;
     }
 }
示例#3
0
 /**
  * @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));
 }
示例#4
0
 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);
 }
示例#5
0
 /**
  * @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);
 }
示例#6
0
 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);
 }
示例#7
0
文件: import.php 项目: vazahat/dudex
 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);
             }
         }
     }
 }
示例#8
0
 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;
 }
示例#9
0
 /**
  * @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);
 }
示例#10
0
 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);
 }
示例#11
0
 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);
 }
示例#12
0
 /**
  * @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));
 }
示例#13
0
文件: header.php 项目: vazahat/dudex
 public function getToolbar()
 {
     $toolbar = array();
     $groupInfo = $this->getGroupInfo();
     $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' => $this->group->id, 'title' => $groupInfo['title'], 'href' => $groupInfo['url'], 'ownerId' => $this->group->userId)));
     OW::getDocument()->addOnloadScript($js, 1001);
     if ($this->groupService->isCurrentUserCanEdit($this->group)) {
         $toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $this->groupId)));
     }
     if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $this->group->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' => $this->groupId));
     OW::getEventManager()->trigger($event);
     foreach ($event->getData() as $item) {
         $toolbar[] = $item;
     }
     return $toolbar;
 }
示例#14
0
 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);
 }
示例#15
0
文件: core.php 项目: vazahat/dudex
 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();
     }
 }
示例#16
0
 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);
 }
示例#17
0
 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);
 }
示例#18
0
 /**
  * @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);
 }
示例#19
0
文件: service.php 项目: vazahat/dudex
 public function countGroups()
 {
     return GROUPS_BOL_Service::getInstance()->findGroupListCount(GROUPS_BOL_Service::LIST_LATEST);
 }
示例#20
0
文件: header.php 项目: vazahat/dudex
 public function __construct()
 {
     parent::__construct();
     $this->service = GHEADER_BOL_Service::getInstance();
     $this->groupService = GROUPS_BOL_Service::getInstance();
 }
示例#21
0
 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');
 }
示例#22
0
文件: groups.php 项目: vazahat/dudex
 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;
 }
示例#23
0
 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);
 }
示例#24
0
 protected function assignList(BASE_CLASS_WidgetParameter $params)
 {
     $groupId = $params->additionalParamList['entityId'];
     $list = GROUPS_BOL_Service::getInstance()->findGroupUserIdList($groupId, 'everybody');
     return $list;
 }
示例#25
0
 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);
 }
示例#26
0
 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);
 }
示例#27
0
文件: admin.php 项目: vazahat/dudex
 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);
     }
 }
示例#28
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);
 }
示例#29
0
 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);
 }
示例#30
0
 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);
     }
 }