Exemple #1
0
 public function ajaxTogglePublish($id, $type, $eventName = false)
 {
     // Send email notification to owner when a group is published.
     $config = CFactory::getConfig();
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($id);
     // Added published = 2 for new created event under moderation.
     if ($type == 'published' && $event->published == 2) {
         $lang = JFactory::getLanguage();
         $lang->load('com_community', JPATH_ROOT);
         $my = CFactory::getUser();
         // Add notification
         //CFactory::load('libraries', 'notification');
         //CFactory::load('helpers', 'event');
         if ($event->type == CEventHelper::GROUP_TYPE && $event->contentid != 0) {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '&groupid=' . $event->contentid;
         } else {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id;
         }
         //Send notification email to owner
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         $params->set('event', $event->title);
         $params->set('event_url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         CNotificationLibrary::add('events_notify_creator', $my->id, $event->creator, JText::_('COM_COMMUNITY_EVENTS_PUBLISHED_MAIL_SUBJECT'), '', 'events.notifycreator', $params);
         //CFactory::load('libraries', 'events');
         // Add activity stream for new created event.
         $event->published = 1;
         // by pass published checking.
         CEvents::addEventStream($event);
         // send notification email to group's member for new created event.
         CEvents::addGroupNotification($event);
     }
     return parent::ajaxTogglePublish($id, $type, 'events');
 }
Exemple #2
0
 private function _addActivityStream($event)
 {
     CEvents::addEventStream($event);
 }