예제 #1
0
 /**
  * Return the number of recent activities since the given id
  * @param  [type] $streamid [description]
  * @param  [type] $filter   [description]
  * @return [type]           [description]
  */
 public function ajaxGetRecentActivitiesCount($streamid, $filter = null, $filterId = null, $filterValue = null)
 {
     $response = new JAXResponse();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $html = '';
     $activitiesLib = new CActivities();
     $html = $activitiesLib->getLatestStreamCount($streamid, $filter, $filterId, $filterValue);
     $nextActivitiesCheck = $config->get('stream_refresh_interval');
     // if stream only for guest/disable dont load the auto refresh
     if ($my->id == 0 && ($this->get('showactivitystream') === 2 || $this->get('showactivitystream') === 0)) {
         return false;
     }
     // Only reload the next
     if (!$config->get('enable_refresh') || $config->get('showactivitystream') == '0') {
         $nextActivitiesCheck = 0;
     }
     $newMessage = $html == 1 ? JText::sprintf('COM_COMMUNITY_NEW_MESSAGES', $html) : JText::sprintf('COM_COMMUNITY_NEW_MESSAGES_MANY', $html);
     $json = array('count' => $html, 'html' => $newMessage, 'nextPingDelay' => $nextActivitiesCheck);
     die(json_encode($json));
 }