Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. public static function getPlugPecAllNotifications()
  2. {
  3. $allNotifications = array();
  4. $jomUser = CFactory::getUser();
  5. $currentUser = $jomUser->_userid;
  6. $types = AllNotificationsHelper::getPlugPecNotificationsType();
  7. $notificationModel = CFactory::getModel('notification');
  8. $chatModel = CFactory::getModel('chat');
  9. $myParams = $jomUser->getParams();
  10. $notifCount = 10;
  11. $notifications = $notificationModel->getNotification($currentUser,'0',$notifCount,$myParams->get('lastnotificationlist',''));
  12.  
  13. foreach($notifications as $key => $notification)
  14. {
  15. $params = json_decode($notification->params);
  16. if($params->group_url) {
  17. $group_id = explode('groupid=',$params->group_url)[1];
  18. $notification->group = AllNotificationsHelper::getPlugPecGroupName($group_id);
  19. }
  20. $parts = parse_url($params->url);
  21. $component_array = parse_str($parts['query'], $query);
  22. $component = $query['option'];
  23. $notification->actorUser = CFactory::getUser($notification->actor);
  24. $notification->actorAvatar = $notification->actorUser->getThumbAvatar();
  25. $notification->actorName = $notification->actorUser->getDisplayName();
  26. $notification->componentName = JText::_(strtoupper($component));
  27. $notification->timeDiff = CTimeHelper::timeLapse(CTimeHelper::getDate($notification->created));
  28. $notification->contentHtml = CContentHelper::injectTags($notification->content,$notification->params,true);
  29.  
  30. foreach($types as $type)
  31. {
  32. if($notification->cmd_type == $type)
  33. {
  34. if($notification->group)
  35. {
  36. $allNotifications[$type][$notification->group][$key] = $notification;
  37. } else if ($notification->componentName) {
  38. $allNotifications[$type][$notification->componentName][$key] = $notification;
  39. } else {
  40. $allNotifications[$type][$key] = $notification;
  41. }
  42.  
  43. }
  44. }
  45. }
  46.  
  47. return json_encode($allNotifications);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement