Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function getPlugPecAllNotifications()
- {
- $allNotifications = array();
- $jomUser = CFactory::getUser();
- $currentUser = $jomUser->_userid;
- $types = AllNotificationsHelper::getPlugPecNotificationsType();
- $notificationModel = CFactory::getModel('notification');
- $chatModel = CFactory::getModel('chat');
- $myParams = $jomUser->getParams();
- $notifCount = 10;
- $notifications = $notificationModel->getNotification($currentUser,'0',$notifCount,$myParams->get('lastnotificationlist',''));
- foreach($notifications as $key => $notification)
- {
- $params = json_decode($notification->params);
- if($params->group_url) {
- $group_id = explode('groupid=',$params->group_url)[1];
- $notification->group = AllNotificationsHelper::getPlugPecGroupName($group_id);
- }
- $parts = parse_url($params->url);
- $component_array = parse_str($parts['query'], $query);
- $component = $query['option'];
- $notification->actorUser = CFactory::getUser($notification->actor);
- $notification->actorAvatar = $notification->actorUser->getThumbAvatar();
- $notification->actorName = $notification->actorUser->getDisplayName();
- $notification->componentName = JText::_(strtoupper($component));
- $notification->timeDiff = CTimeHelper::timeLapse(CTimeHelper::getDate($notification->created));
- $notification->contentHtml = CContentHelper::injectTags($notification->content,$notification->params,true);
- foreach($types as $type)
- {
- if($notification->cmd_type == $type)
- {
- if($notification->group)
- {
- $allNotifications[$type][$notification->group][$key] = $notification;
- } else if ($notification->componentName) {
- $allNotifications[$type][$notification->componentName][$key] = $notification;
- } else {
- $allNotifications[$type][$key] = $notification;
- }
- }
- }
- }
- return json_encode($allNotifications);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement