protected function getListCmp() { $new = new BASE_CMP_MiniAvatarUserList(array_slice($this->IdList, 0, self::DISPLAY_COUNT)); switch (true) { case $this->count <= 8: $new->setCustomCssClass('ow_big_avatar'); break; default: //$new->setCustomCssClass(BASE_CMP_MiniAvatarUserList::CSS_CLASS_MINI_AVATAR); break; } return $new; }
public function onFeedItemRenderActivity(OW_Event $event) { $params = $event->getParams(); $data = $event->getData(); if ($params['action']['entityType'] != GROUPS_BOL_Service::FEED_ENTITY_TYPE || $params['feedType'] == 'groups') { return; } $groupId = $params['action']['entityId']; $usersCount = GROUPS_BOL_Service::getInstance()->findUserListCount($groupId); if ($usersCount == 1) { return; } $users = GROUPS_BOL_Service::getInstance()->findGroupUserIdList($groupId, GROUPS_BOL_Service::PRIVACY_EVERYBODY); $activityUserIds = array(); foreach ($params['activity'] as $activity) { if ($activity['activityType'] == 'groups-join') { $activityUserIds[] = $activity['data']['userId']; } } $lastUserId = reset($activityUserIds); $follows = array_intersect($activityUserIds, $users); $notFollows = array_diff($users, $activityUserIds); $idlist = array_merge($follows, $notFollows); $viewMoreUrl = null; if (count($idlist) > 5) { $viewMoreUrl = array("routeName" => "groups-user-list", "vars" => array("groupId" => $groupId)); } if (is_array($data["content"])) { $data["content"]["vars"]["userList"] = array("label" => array("key" => "groups+feed_activity_users", "vars" => array("usersCount" => $usersCount)), "viewAllUrl" => $viewMoreUrl, "ids" => array_slice($idlist, 0, 5)); } else { $avatarList = new BASE_CMP_MiniAvatarUserList(array_slice($idlist, 0, 5)); $avatarList->setEmptyListNoRender(true); if (count($idlist) > 5) { $avatarList->setViewMoreUrl(OW::getRouter()->urlForRoute($viewMoreUrl["routeName"], $viewMoreUrl["vars"])); } $language = OW::getLanguage(); $content = $avatarList->render(); if ($lastUserId) { $userName = BOL_UserService::getInstance()->getDisplayName($lastUserId); $userUrl = BOL_UserService::getInstance()->getUserUrl($lastUserId); $content .= $language->text('groups', 'feed_activity_joined', array('user' => '<a href="' . $userUrl . '">' . $userName . '</a>')); } $data['assign']['activity'] = array('template' => 'activity', 'vars' => array('title' => $language->text('groups', 'feed_activity_users', array('usersCount' => $usersCount)), 'content' => $content)); } $event->setData($data); }
function eventx_feed_on_item_render_activity(OW_Event $event) { $params = $event->getParams(); $data = $event->getData(); if ($params['action']['entityType'] != 'eventx') { return; } $eventId = $params['action']['entityId']; $usersCount = EVENTX_BOL_EventService::getInstance()->findEventUsersCount($eventId, EVENTX_BOL_EventService::USER_STATUS_YES); if ($usersCount == 1) { return; } $users = EVENTX_BOL_EventService::getInstance()->findEventUsers($eventId, EVENTX_BOL_EventService::USER_STATUS_YES, null, 6); $userIds = array(); foreach ($users as $user) { $userIds[] = $user->getUserId(); } $activityUserIds = array(); foreach ($params['activity'] as $activity) { if ($activity['activityType'] == 'event-join') { $activityUserIds[] = $activity['data']['userId']; } } $lastUserId = reset($activityUserIds); $follows = array_intersect($activityUserIds, $userIds); $notFollows = array_diff($userIds, $activityUserIds); $idlist = array_merge($follows, $notFollows); $avatarList = new BASE_CMP_MiniAvatarUserList(array_slice($idlist, 0, 5)); $avatarList->setEmptyListNoRender(true); if (count($idlist) > 5) { $avatarList->setViewMoreUrl(OW::getRouter()->urlForRoute('eventx.main_user_list', array('eventId' => $eventId))); } $language = OW::getLanguage(); $avatarList = new BASE_CMP_MiniAvatarUserList($idlist); $content = $avatarList->render(); if ($lastUserId) { $userName = BOL_UserService::getInstance()->getDisplayName($lastUserId); $userUrl = BOL_UserService::getInstance()->getUserUrl($lastUserId); $content .= $language->text('eventx', 'feed_activity_joined', array('user' => '<a href="' . $userUrl . '">' . $userName . '</a>')); } $data['assign']['activity'] = array('template' => 'activity', 'vars' => array('title' => $language->text('eventx', 'feed_activity_users', array('usersCount' => $usersCount)), 'content' => $content)); $event->setData($data); }