Beispiel #1
0
 public function prepareCreateMilestoneStream(SocialStreamItem $streamItem, $includePrivacy = true)
 {
     $params = FD::registry($streamItem->params);
     $milestone = FD::table('Milestone');
     $milestone->bind($params->get('milestone'));
     // Get the group data
     FD::load('event');
     $event = new SocialEvent();
     $event->bind($params->get('event'));
     // Get the actor
     $actor = $streamItem->actor;
     $app = $this->getApp();
     $permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $app->getAlias(), 'milestoneId' => $milestone->id));
     $this->set('permalink', $permalink);
     $this->set('milestone', $milestone);
     $this->set('actor', $actor);
     $this->set('event', $event);
     $streamItem->title = parent::display('streams/create.milestone.title');
     $streamItem->content = parent::display('streams/create.milestone.content');
     $streamItem->opengraph->addDescription(JText::sprintf('APP_EVENT_TASKS_STREAM_OPENGRAPH_CREATE_MILESTONE', $streamItem->actor->getName(), $event->getName()));
 }
Beispiel #2
0
 /**
  * Post action after completing an event creation to redirect either to the event listing for the event item.
  *
  * @author Jason Rey <*****@*****.**>
  * @since  1.3
  * @access public
  * @param  SocialEvent    $event The SocialEvent object.
  */
 public function complete($event)
 {
     $this->info->set($this->getMessage());
     if ($event->state == SOCIAL_STATE_PUBLISHED) {
         return $this->redirect(FRoute::events(array('layout' => 'item', 'id' => $event->getAlias()), false));
     }
     return $this->redirect(FRoute::events(array(), false));
 }
Beispiel #3
0
 /**
  * Processes mentions in a stream object
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function formatMentions(SocialStreamItem &$stream)
 {
     // Get the current view
     $view = JRequest::getCmd('view', '');
     // Get the stream's content
     $content = $stream->content;
     // Get tags for the stream
     $tags = isset($stream->tags) ? $stream->tags : array();
     // If there is no tags, just skip this and escape the content
     if (!$tags) {
         return FD::string()->escape($content);
     }
     // We need to store the changes in an array and replace it accordingly based on the counter.
     $items = array();
     // We need to merge the mentions and hashtags since we are based on the offset.
     $i = 0;
     foreach ($tags as $tag) {
         if ($tag->type == 'user') {
             $replace = '<a href="' . $tag->user->getPermalink() . '" data-popbox="module://easysocial/profile/popbox" data-popbox-position="top-left" data-user-id="' . $tag->user->id . '" class="mentions-user">' . $tag->user->getName() . '</a>';
         }
         if ($tag->type == 'hashtag') {
             // $alias = JFilterOutput::stringURLSafe($tag->title);
             $alias = $tag->title;
             $url = '';
             if ($view == 'groups') {
                 $clusterReg = FD::registry($stream->params);
                 $object = $clusterReg->get($stream->cluster_type);
                 switch ($stream->cluster_type) {
                     case SOCIAL_TYPE_GROUP:
                         // for now we assume all is group type.
                         $group = new SocialGroup();
                         $group->bind($object);
                         $url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'tag' => $alias));
                         break;
                     case SOCIAL_TYPE_EVENT:
                         $event = new SocialEvent();
                         $event->bind($object);
                         $url = FRoute::events(array('layout' => 'item', 'id' => $event->getAlias(), 'tag' => $alias));
                         break;
                     default:
                         FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $alias));
                         break;
                 }
             } else {
                 $url = FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $alias));
             }
             $replace = '<a href="' . $url . '" class="mentions-hashtag">#' . $tag->title . '</a>';
         }
         $links[$i] = $replace;
         $replace = '[si:mentions]' . $i . '[/si:mentions]';
         $content = JString::substr_replace($content, $replace, $tag->offset, $tag->length);
         $i++;
     }
     // Once we have the content, escape it
     $content = FD::string()->escape($content);
     if ($links) {
         for ($x = 0; $x < count($links); $x++) {
             $content = str_ireplace('[si:mentions]' . $x . '[/si:mentions]', $links[$x], $content);
         }
     }
     return $content;
 }
Beispiel #4
0
 /**
  * Post action after completing an event creation to redirect either to the event listing for the event item.
  *
  * @author Jason Rey <*****@*****.**>
  * @since  1.3
  * @access public
  * @param  SocialEvent    $event The SocialEvent object.
  */
 public function complete($event)
 {
     // Recurring support
     // If no recurring data, then just redirect accordingly.
     // If event is in pending, then also redirect accordingly.
     if (empty($event->recurringData) || $event->isPending()) {
         $this->info->set($this->getMessage());
         if ($event->isPublished()) {
             return $this->redirect(FRoute::events(array('layout' => 'item', 'id' => $event->getAlias()), false));
         }
         return $this->redirect(FRoute::events(array(), false));
     }
     // If has recurring data, then we need to show the complete page to create all the necessary recurring events
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_EVENTS'), FRoute::events());
     FD::page()->breadcrumb($event->getName(), $event->getPermalink());
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_CREATE_RECURRING_EVENT'));
     FD::page()->title(JText::_('COM_EASYSOCIAL_PAGE_TITLE_CREATE_RECURRING_EVENT'));
     // Get the recurring schedule
     $schedule = FD::model('Events')->getRecurringSchedule(array('eventStart' => $event->getEventStart(), 'end' => $event->recurringData->end, 'type' => $event->recurringData->type, 'daily' => $event->recurringData->daily));
     $this->set('schedule', $schedule);
     $this->set('event', $event);
     echo parent::display('site/events/createRecurring');
 }