public function ajaxRemoveMood($activityId) { $my = CFactory::getUser(); if ($my->id == 0) { $this->ajaxBlockUnregister(); } $act = JTable::getInstance('Activity', 'CTable'); $act->load($activityId); $act->removeMood(); $html = CActivities::format($act->title); $json = array('success' => true, 'html' => $html); die(json_encode($json)); }
</span> </div> <?php $my = CFactory::getUser(); if ($my->id > 0) { $this->load('activities.stream.options'); } ?> </div> <div class="joms-stream__body"> <p> <span> <?php $comment = JHTML::_('string.truncate', $wall->comment, $config->getInt('streamcontentlength')); $comment = CActivities::format($comment); echo $comment; ?> </span> </p> <div class="joms-media--video joms-js--video" data-type="<?php echo $video->type; ?> " data-id="<?php echo $video->video_id; ?> " data-path="<?php
* @copyright (C) 2014 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <*****@*****.**> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); ?> <div class="joms-media"> <h4 class="joms-text--title"> <a href="<?php echo $stream->link; ?> "> <?php echo CActivities::truncateComplex($stream->title, 60, true); ?> </a> </h4> <p class="joms-text--desc"><?php echo CActivities::format($attachment->message); ?> </p> <?php echo $stream->group->name; ?> </div>
/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ public function display($tpl = null) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $model = $this->getModel('Activities'); $activities = $model->getActivities(); foreach ($activities as $key => $activity) { $param = new CParameter($activity->params); switch ($activity->app) { case 'users.featured': $user = CFactory::getUser($param->get('userid')); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', '<a href="' . CRoute::_(JUri::root() . $param->get('owner_url')) . '" class="cStream-Author">' . $user->getDisplayName() . '</a>'); break; case 'events.wall': case 'groups.wall': case 'profile': $user = CFactory::getUser($activity->actor); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> '; if ($activity->eventid) { $event = JTable::getInstance('Event', 'cTable'); $event->load($activity->eventid); $html .= '➜ <a class="cStream-Reference" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '">' . $event->title . '</a>'; } elseif ($activity->groupid) { $group = JTable::getInstance('Group', 'cTable'); $group->load($activity->groupid); $html .= '➜ <a class="cStream-Reference" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id . '">' . $group->name . '</a>'; } elseif (!empty($activity->target) && $activity->target != $activity->actor) { $target = CFactory::getUser($activity->target); $html .= '➜ <a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $target->id . '">' . $target->getDisplayName() . '</a> '; $html .= CActivities::format($activity->title); } else { $html .= ' posted: "' . CActivities::format($activity->title) . '"'; } $activities[$key]->title = $html; break; case 'groups.avatar.upload': $user = CFactory::getUser($activity->actor); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> '; $html .= JText::_('COM_COMMUNITY_ACTIVITIES_NEW_GROUP_AVATAR'); $activities[$key]->title = $html; break; case 'profile.avatar.upload': $user = CFactory::getUser($activity->actor); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> '; $html .= JText::_('COM_COMMUNITY_ACTIVITIES_NEW_AVATAR'); $activities[$key]->title = $html; break; case 'albums.comment': case 'albums': $album = JTable::getInstance('Album', 'CTable'); $album->load($activity->cid); $user = CFactory::getUser($activity->actor); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> '; $html .= JText::sprintf('COM_COMMUNITY_ACTIVITIES_WALL_POST_ALBUM', CRoute::_($album->getURI()), $this->escape($album->name)); $activities[$key]->title = $html; break; case 'profile.like': case 'groups.like': case 'events.like': case 'photo.like': case 'videos.like': case 'album.like': $actors = $param->get('actors'); $user = CFactory::getUser($activity->actor); $users = explode(',', $actors); $userCount = count($users); switch ($activity->app) { case 'profile.like': $cid = CFactory::getUser($activity->cid); $urlLink = JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $cid->id; $name = $cid->getDisplayName(); $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_PROFILE'; break; case 'groups.like': $cid = JTable::getInstance('Group', 'CTable'); $cid->load($activity->groupid); $urlLink = JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $cid->id; $name = $cid->name; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_GROUP'; break; case 'events.like': $cid = JTable::getInstance('Event', 'CTable'); $cid->load($activity->eventid); $urlLink = JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $cid->id; $name = $cid->title; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_EVENT'; break; case 'photo.like': $cid = JTable::getInstance('Photo', 'CTable'); $cid->load($activity->cid); $urlLink = JUri::root() . 'index.php?option=com_community&view=photos&task=photo&albumid=' . $cid->albumid . '&userid=' . $cid->creator . '&photoid=' . $cid->id; $name = $cid->caption; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_PHOTO'; break; case 'videos.like': $cid = JTable::getInstance('Video', 'CTable'); $cid->load($activity->cid); $urlLink = JURI::root() . 'index.php?option=com_community&view=videos&task=video&userid=' . $cid->creator . '&videoid=' . $cid->id; $name = $cid->getTitle(); $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_VIDEO'; break; case 'album.like': $cid = JTable::getInstance('Album', 'CTable'); $cid->load($activity->cid); $urlLink = Juri::root() . 'index.php?option=com_community&view=photos&task=album&albumid=' . $cid->id . '&userid=' . $cid->creator; $name = $cid->name; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_ALBUM'; break; } $slice = 2; if ($userCount > 2) { $slice = 1; } $users = array_slice($users, 0, $slice); $actorsHTML = array(); foreach ($users as $actor) { $user = CFactory::getUser($actor); $actorsHTML[] = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>'; } $others = ''; if ($userCount > 2) { $others = JText::sprintf('COM_COMMUNITY_STREAM_OTHERS_JOIN_GROUP', $userCount - 1); } $jtext = $userCount > 1 ? 'COM_COMMUNITY_STREAM_LIKES_PLURAL' : 'COM_COMMUNITY_STREAM_LIKES_SINGULAR'; $activities[$key]->title = implode(' ' . JText::_('COM_COMMUNITY_AND') . ' ', $actorsHTML) . $others . JText::sprintf($jtext, $urlLink, $name, JText::_($element)); break; case 'cover.upload': $user = CFactory::getUser($activity->actor); $type = $param->get('type'); $extraMessage = ''; if (strtolower($type) !== 'profile') { $id = strtolower($type . 'id'); $cTable = JTable::getInstance(ucfirst($type), 'CTable'); $cTable->load($activity->{$id}); if ($type == 'group') { $extraMessage = ', <a target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $cTable->id . '">' . $cTable->name . '</a>'; } if ($type == 'event') { $extraMessage = ', <a target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $cTable->id . '">' . $cTable->title . '</a>'; } } $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> '; if ($type == 'profile') { $html .= JText::_('COM_COMMUNITY_PHOTOS_COVER_UPLOAD_PROFILE'); } else { $html .= JText::sprintf('COM_COMMUNITY_PHOTOS_COVER_UPLOAD', strtolower(Jtext::_('COM_COMMUNITY_COVER_' . strtoupper($type)))) . $extraMessage; } $activities[$key]->title = $html; break; case 'events.attend': case 'events': $user = CFactory::getUser($activity->actor); $action = $param->get('action'); $event = JTable::getInstance('Event', 'CTable'); $event->load($activity->eventid); switch ($action) { case 'events.create': $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> -'; $html .= JText::sprintf('COM_COMMUNITY_EVENTS_ACTIVITIES_NEW_EVENT', JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, $event->title); $activities[$key]->title = $html; break; case 'events.attendence.attend': $users = explode(',', $param->get('actors')); $actorsHTML = array(); foreach ($users as $actor) { if (!$actor) { $actor = $activity->actor; } $user = CFactory::getUser($actor); $actorsHTML[] = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>'; } $activities[$key]->title = implode(', ', $actorsHTML) . ' - ' . JText::sprintf('COM_COMMUNITY_ACTIVITIES_EVENT_ATTEND', JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, $event->title); break; } break; case 'friends.connect': $user1 = CFactory::getUser($activity->actor); $user2 = CFactory::getUser($activity->target); $html = JText::sprintf('COM_COMMUNITY_STREAM_OTHER_FRIENDS', $user1->getDisplayName(), $user2->getDisplayName(), JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user1->id, JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user2->id); $activities[$key]->title = $html; break; case 'groups.bulletin': $user = CFactory::getUser($activity->actor); $bulletin = JTable::getInstance('Bulletin', 'CTable'); $bulletin->load($activity->cid); $group = JTable::getInstance('Group', 'CTable'); $group->load($bulletin->groupid); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>' . JText::sprintf('COM_COMMUNITY_GROUPS_NEW_GROUP_NEWS', CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewbulletin&groupid=' . $group->id . '&bulletinid=' . $bulletin->id), $bulletin->title); $activities[$key]->title = $html; break; case 'groups.discussion': $user = CFactory::getUser($activity->actor); $discussion = JTable::getInstance('Discussion', 'CTable'); $discussion->load($activity->cid); $discussionLink = CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $discussion->groupid . '&topicid=' . $discussion->id); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>' . JText::sprintf('COM_COMMUNITY_GROUPS_NEW_GROUP_DISCUSSION', $discussionLink, $discussion->title); $activities[$key]->title = $html; break; case 'groups.discussion.reply': $user = CFactory::getUser($activity->actor); $discussion = JTable::getInstance('Discussion', 'CTable'); $discussion->load($activity->cid); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>' . JText::sprintf('COM_COMMUNITY_GROUPS_REPLY_DISCUSSION', CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $discussion->groupid . '&topicid=' . $discussion->id), $discussion->title); $activities[$key]->title = $html; break; case 'groups.join': $user = CFactory::getUser($activity->actor); $users = explode(',', $param->get('actors')); $userCount = count($users); $group = JTable::getInstance('Group', 'CTable'); $group->load($activity->cid); $slice = 2; if ($userCount > 2) { $slice = 1; } $users = array_slice($users, 0, $slice); $actorsHTML = array(); foreach ($users as $actor) { $user = CFactory::getUser($actor); $actorsHTML[] = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>'; } $others = ''; if ($userCount > 2) { $others = JText::sprintf('COM_COMMUNITY_STREAM_OTHERS_JOIN_GROUP', $userCount - 1); } $html = implode(' ' . JText::_('COM_COMMUNITY_AND') . ' ', $actorsHTML) . $others . JText::sprintf('COM_COMMUNITY_GROUPS_GROUP_JOIN', JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id, $group->name); $activities[$key]->title = $html; break; case 'groups.update': $user = CFactory::getUser($activity->actor); $group = JTable::getInstance('Group', 'CTable'); $group->load($activity->cid); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> - ' . JText::sprintf('COM_COMMUNITY_GROUPS_GROUP_UPDATED', JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id, $group->name); $activities[$key]->title = $html; break; case 'photos': $user = CFactory::getUser($activity->actor); $album = JTable::getInstance('Album', 'CTable'); $album->load($activity->cid); $html = ''; if ($activity->groupid) { $group = JTable::getInstance('Group', 'CTable'); $group->load($activity->groupid); $html .= '<a class="cStream-Reference" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id . '">' . $group->name . '</a> -'; } $html .= ' <a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>'; $count = $param->get('count', 1); $url = Juri::root() . 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $user->id; if (CStringHelper::isPlural($count)) { $html .= JText::sprintf('COM_COMMUNITY_ACTIVITY_PHOTO_UPLOAD_TITLE_MANY', $count, $url, CStringHelper::escape($album->name)); } else { $html .= JText::sprintf('COM_COMMUNITY_ACTIVITY_PHOTO_UPLOAD_TITLE', $url, CStringHelper::escape($album->name)); } $activities[$key]->title = $html; break; case 'photos.comment': $user = CFactory::getUser($activity->actor); $wall = JTable::getInstance('Wall', 'CTable'); $wall->load($param->get('wallid')); $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($activity->cid); $url = JUri::root() . 'index.php?option=com_community&view=photos&task=photo&albumid=' . $photo->albumid . '&userid=' . $photo->creator . '&photoid=' . $photo->id; $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a> ' . JText::sprintf('COM_COMMUNITY_ACTIVITIES_WALL_POST_PHOTO', $url, $this->escape($photo->caption)); $activities[$key]->title = $html; break; case 'system.message': case 'system.videos.popular': case 'system.photos.popular': case 'system.members.popular': case 'system.photos.total': case 'system.groups.popular': case 'system.members.registered': $action = $param->get('action'); switch ($action) { case 'registered_users': $usersModel = CFactory::getModel('user'); $now = new JDate(); $date = CTimeHelper::getDate(); $users = $usersModel->getLatestMember(10); $totalRegistered = count($users); $title = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $totalRegistered, $date->monthToString($now->format('%m'))); $activities[$key]->title = $title; break; case 'total_photos': $photosModel = CFactory::getModel('photos'); $total = $photosModel->getTotalSitePhotos(); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_TOTAL_PHOTOS_ACTIVITY_TITLE', CRoute::_(JURI::root() . 'index.php?option=com_community&view=photos'), $total); break; case 'top_videos': $activities[$key]->title = JText::_('COM_COMMUNITY_ACTIVITIES_TOP_VIDEOS'); break; case 'top_photos': $activities[$key]->title = JText::_('COM_COMMUNITY_ACTIVITIES_TOP_PHOTOS'); break; case 'top_users': $activities[$key]->title = JText::_('COM_COMMUNITY_ACTIVITIES_TOP_MEMBERS'); break; case 'top_groups': $groupsModel = $this->getModel('groups'); $activeGroup = $groupsModel->getMostActiveGroup(); if (is_null($activeGroup)) { $title = JText::_('COM_COMMUNITY_GROUPS_NONE_CREATED'); } else { $title = JText::sprintf('COM_COMMUNITY_MOST_POPULAR_GROUP_ACTIVITY_TITLE', CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $activeGroup->id), $activeGroup->name); } $activities[$key]->title = $title; break; case 'message': break; } break; case 'videos.linking': case 'videos': $video = JTable::getInstance('Video', 'CTable'); $video->load($activity->cid); $actor = CFactory::getUser($activity->actor); $html = $this->_getUserLink($activity->actor); $html .= JText::sprintf('COM_COMMUNITY_ACTIVITY_VIDEO_SHARE_TITLE', JUri::root() . $video->getViewURI(false), $this->escape($video->title)); $activities[$key]->title = $html; break; case 'videos.featured': $video = JTable::getInstance('Video', 'CTable'); $video->load($activity->cid); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_VIDEOS_IS_FEATURED', '<a href="' . CRoute::_(JUri::root() . 'index.php?option=com_community&view=videos&task=video&userid=' . $video->creator . '&videoid=' . $video->id) . '" class="cStream-Title">' . $this->escape($video->title) . '</a>'); break; case 'albums.featured': $album = JTable::getInstance('Album', 'CTable'); $album->load($activity->cid); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_ALBUM_IS_FEATURED', '<a href="' . CRoute::_(JUri::root() . 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $album->creator) . '" class="cStream-Title">' . $this->escape($album->name) . '</a>'); break; } } //exit; $userModel = $this->getModel('Users', false); $currentUser = $jinput->request->get('actor', JText::_('COM_COMMUNITY_ACTIVITIES_ENTER_NAME_VALUE'), 'NONE'); $currentArchived = $jinput->request->get('archived', 0, 'NONE'); $currentApp = $jinput->request->get('app', 'none', 'NONE'); $filterApps = $model->getFilterApps(); $this->assignRef('filterApps', $filterApps); $this->assignRef('currentApp', $currentApp); $this->assignRef('currentUser', $currentUser); $this->assignRef('currentArchive', $currentArchived); $this->assignRef('pagination', $model->getPagination()); $this->assignRef('activities', $activities); parent::display($tpl); }
$attachment->type = 'general'; break; } !isset($attachment->type) ? $attachments = array() : ($attachments[] = $attachment); $groupString = ""; if (isset($activity->groupid) && !empty($activity->groupid)) { $groupTable = JTable::getInstance('Group', 'CTable'); $groupTable->load($activity->groupid); $groupString = JText::sprintf('COM_COMMUNITY_SHARE_VIDEO_FROM_GROUP', $groupTable->getLink(), $groupTable->name); } $stream = new stdClass(); $stream->actor = $user; $stream->target = null; $stream->headline = JText::sprintf('COM_COMMUNITY_ACTIVITY_SHARE_STATUS', CUrlHelper::userLink($user->id), $user->getDisplayName(), CUrlHelper::userLink($actor->id), $actor->getDisplayName(), isset($app[$activity->app]) ? $app[$activity->app] : '') . $groupString; $stream->message = CActivities::format($act->title); $stream->mood = $params->get('mood', NULL); $stream->sharedMessage = CActivities::format($activity->title); $stream->sharedMood = $activityParam->get('mood', NULL); $stream->groupid = $activity->groupid; $stream->eventid = ""; $stream->access = $this->act->access; $stream->attachments = $attachments; /** * @todo Need to clearly this one * Right now it's return on right data */ $stream->attachments[] = CActivityStream::formatStreamAttachment($activity); $stream->createdtime = $createdTime; $this->set('stream', $stream); $this->load('stream/base-extended'); }
<a href="<?php echo CUrlHelper::userLink($row->lastreplyuser->id); ?> " class="pull-left"> <img src="<?php echo $row->lastreplyuser->getThumbAvatar(); ?> " alt="<?php echo $row->lastreplyuser->getDisplayName(); ?> " /> </a> </div> <div class="span10"> <p><?php echo CActivities::format($this->escape($row->lastmessage)); ?> <p> <?php if (isset($row->lastreplier) && !empty($row->lastreplier)) { ?> <div class="cStream-Actions clearfix small"> <span><?php echo JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_REPLY_TIME', '<a href="' . CUrlHelper::userLink($row->lastreplier->post_by->id) . '">' . $row->lastreplier->post_by->getDisplayName() . '</a>', JHTML::_('date', $row->lastreplier->date, JText::_('DATE_FORMAT_LC'))); ?> </span> </div> <?php } ?>
$date = JFactory::getDate($this->act->created); if ($config->get('activitydateformat') == "lapse") { $createdTime = CTimeHelper::timeLapse($date); } else { $createdTime = $date->format($config->get('profileDateFormat')); } $stream->actor = $user; $stream->target = null; $stream->headline = CVideos::getActivityTitleHTML($act); $stream->message = ""; $stream->groupid = $act->groupid; $stream->eventid = $act->eventid; $stream->attachments = array(); $stream->access = $video->permissions; $stream->createdtime = $createdTime; $quoteContent = CActivities::format($act->title, $mood); if (!empty($quoteContent) && $param->get('style') == COMMUNITY_STREAM_STYLE) { $attachment = new stdClass(); $attachment->type = 'text'; $attachment->message = $quoteContent; $attachment->hasMood = is_null($mood) ? false : true; /* Temporary fix for sprint 2 */ if ($this->act instanceof CTableActivity) { /* If this's CTableActivity then we use getProperties() */ $activity = new CActivity($this->act->getProperties()); } else { /* If it's standard object than we just passing it */ $activity = new CActivity($this->act); } $attachment->activity = $activity; $attachment->address = $activity->getLocation();
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <*****@*****.**> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ defined('_JEXEC') or die('Restricted access'); ?> <div class="joms-stream__body joms-stream-box" > <h4> <?php $url = CRoute::_('index.php?option=com_community'); ?> <svg viewBox="0 0 16 16" class="joms-icon"> <use xlink:href="<?php echo $url; ?> #joms-icon-bullhorn"></use> </svg> <?php echo JText::_('COM_COMMUNITY_STREAM_ADMIN_ANNOUNCEMENT'); ?> </h4> <p><?php echo CActivities::format($this->act->title); ?> </p> </div>
/** * * @return string */ public function getTitle() { return CActivities::format($this->get('title')); }
/** * Return HTML for acitivity stream * @param JTableActiities $act activity object * @return string html formatted output */ public static function getActivityContentHTML($act) { // Ok, the activity could be an upload OR a wall comment. In the future, the content should // indicate which is which $html = ''; //$param = new CParameter( $act->params ); $action = $act->params->get('action', false); $photoid = $act->params->get('photoid', 0); $url = $act->params->get('url', false); $act->title = CActivities::format($act->title, $act->params->get('mood', null)); if ($action == 'wall') { // unfortunately, wall post can also have 'photo' as its $act->apps. If the photo id is availble // for (newer activity stream, inside the param), we will show the photo snippet as well. Otherwise // just print out the wall content // Version 1.6 onwards, $params will contain photoid information // older version would have #photoid in the $title, since we link it to the photo $photoid = $param->get('photoid', false); if ($photoid) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($act->cid); $helper = new CAlbumsHelper($photo->albumid); if ($helper->showActivity()) { $tmpl = new CTemplate(); return $tmpl->set('url', $url)->set('photo', $photo)->set('param', $param)->set('act', $act)->fetch('activity.photos.wall'); } } return ''; } elseif ($action == 'upload' && $photoid > 0) { $photoModel = CFactory::getModel('photos'); // Album object should have been created in the activities library $album = $act->album; $albumsHelper = new CAlbumsHelper($album); if ($albumsHelper->isPublic()) { // If content has link to image, we could assume it is "upload photo" action // since old content add this automatically. // The $act->cid will be the album id, Retrive the recent photos uploaded // If $act->activities has data, that means this is an aggregated content // display some of them $db = JFactory::getDBO(); // If count is more than 1, get the last few photos, otherwise // the photo might have a custom message along with it. Show that single photo $count = $act->params->get('count', 1); $photosId = $act->params->get('photosId', null); $batchCount = $act->params->get('batchcount', $count); if (is_null($photosId)) { if ($count == 1) { $album->id = empty($album->id) ? 0 : $album->id; $sql = "SELECT * FROM #__community_photos WHERE `albumid`=" . $album->id . " AND `id`=" . $photoid . " AND `status` != 'temp'"; $db->setQuery($sql); $result = $db->loadObjectList(); } else { $album->id = empty($album->id) ? 0 : $album->id; $sql = "SELECT * FROM #__community_photos WHERE `albumid`=" . $album->id . " AND `status` != 'temp'" . " ORDER BY `id` DESC LIMIT 0, 5"; $db->setQuery($sql); $result = $db->loadObjectList(); } } else { $result = explode(',', $photosId); } $photos = array(); if (is_array($result) && count($result) > 0) { foreach ($result as $row) { $photo = JTable::getInstance('Photo', 'CTable'); if (is_null($photosId)) { $photo->bind($row); } else { $photo->load($row); } if ($photo->status != 'delete' && $photo->id) { $photos[] = $photo; } if ($photo->status == 'delete') { $batchCount--; } } foreach ($photos as $key => $data) { if ($data->id == $photoid) { unset($photos[$key]); /* remove this photo */ array_unshift($photos, $data); /* move it to beginning of array */ } } $photos = array_slice($photos, 0, 5); // limit to 5 photos only if (empty($act->activities)) { $acts[] = $act; } else { $acts = $act->activities; } $tmpl = new CTemplate(); if ($batchCount == 0) { $batchCount = 1; } return $tmpl->set('album', $album)->set('acts', $acts)->set('photos', $photos)->set('count', $count)->set('batchCount', $batchCount)->set('stream', $act->params->get('stream', false))->fetch('stream/photo-upload'); } } } return $html; }
?> </div> </div> <?php } else { ?> <div class="joms-media"> <?php if ($this->act->app == 'profile' || $this->act->app == 'videos' || $this->act->app == 'groups.wall' || $this->act->app == 'events.wall') { ?> <p> <?php echo CActivities::format($this->act->title, $mood); ?> <?php if (!empty($this->act->location)) { //show location if needed ?> <span class="joms-status-location"> - <a href="javascript:" onclick="joms.api.locationView('<?php echo $this->act->get('id'); ?> ');"> <?php echo $this->act->location; ?> </a> </span>
public static function formatStreamAttachment($obj) { switch ($obj->app) { case 'videos.linking': $video = JTable::getInstance('Video', 'CTable'); $video->load($obj->cid); $attachment = new stdClass(); $attachment->type = 'videos.linking'; $attachment->type = 'video'; $attachment->id = $obj->cid; $attachment->title = $video->title; $attachment->thumbnail = $video->getThumbnail(); $attachment->description = $video->description; $attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())); $attachment->access = $obj->access; $attachment->video_type = $video->type; $attachment->link = $video->path; $attachment->video = $video; break; case 'profile.status.share': $params = new CParameter($obj->params); $act = JTable::getInstance('Activity', 'CTable'); $act->load($params->get('activityId')); $attachment = self::formatStreamAttachment($act); break; case 'groups.wall': case 'events.wall': case 'profile': $params = new CParameter($obj->params); $headMetas = $params->get('headMetas', NULL); $headers = new CParameter($headMetas); if (!is_null($headers->get('title'))) { $attachment = new stdClass(); $attachment->type = 'fetched'; $data = new stdClass(); $headers = new CParameter($headMetas); $data->title = $headers->get('title'); $data->description = $headers->get('description'); $data->thumb = $headers->get('image'); $data->app = $obj->app; $data->params = $obj->params; $attachment->message = CActivityStream::formatSharePopup($data)->content; } else { $attachment = new stdClass(); $attachment->type = 'quote'; $attachment->id = $obj->id; $attachment->location = $obj->location; $attachment->message = CActivities::format($obj->title, $params->get('mood')); } break; case 'videos': $video = JTable::getInstance('Video', 'CTable'); $video->load($obj->cid); $attachment = new stdClass(); $attachment->type = 'video'; $attachment->id = $obj->cid; $attachment->title = $video->title; $attachment->thumbnail = $video->getThumbnail(); $attachment->description = $video->description; $attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())); $attachment->link = $video->getURL(); $attachment->video_type = $video->type; $attachment->link = $video->path; $attachment->video = $video; break; case 'photos': $params = new CParameter($obj->params); $count = $params->get('count', 1); $photoId = $params->get('photoid', 0); $photoIds = explode(',', $params->get('photosId', 0)); $attachment = new stdClass(); if ($count == 1 && $photoId > 0) { $attachment->type = 'photo'; $photo = JTable::getInstance('Photo', 'CTable'); if ($photo->load($photoId) && $photo->status != 'delete') { $attachment->singlephoto = $photo->getImageURI(); $attachment->caption = $photo->caption; $attachment->thumbnail = $photo->getThumbURI(); $attachment->link = $params->get('photo_url'); $attachment->albumid = $photo->albumid; $attachment->id = $photo->id; } } elseif ($count > 1 && $photoId > 0) { $attachment->type = 'photos'; $album = JTable::getInstance('Album', 'CTable'); $album->load($obj->cid); if (count($photoIds) > 1) { foreach ($photoIds as $pid) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($pid); /* Make sure photo is not deleted */ if ($photo->status != 'delete') { $photos[] = $photo; } foreach ($photos as $key => $data) { if ($data->id == $photoId) { unset($photos[$key]); /* remove this photo */ array_unshift($photos, $data); /* move it to beginning of array */ } } } } else { $photos = $album->getLatestPhoto($count); } $tmpIdArray = array(); $tmpAlbumArray = array(); $tmpUrlArray = array(); $tmpThumbArray = array(); $tmpCaptionArray = array(); if ($count >= 5) { $photos = array_slice($photos, 0, 5); } foreach ($photos as $photo) { $tmpIdArray[] = $photo->id; $tmpAlbumArray[] = $photo->albumid; $tmpThumbArray[] = $photo->getImageURI(); $tmpUrlArray[] = $photo->getPhotoLink(); $tmpCaptionArray[] = $photo->caption; } $attachment->id = $tmpIdArray; $attachment->album = $tmpAlbumArray; $attachment->link = $tmpUrlArray; $attachment->thumbnail = $tmpThumbArray; $attachment->caption = $tmpCaptionArray; } break; case 'groups': $attachment = new stdClass(); $attachment->type = 'group_share'; $group = JTable::getInstance('Group', 'CTable'); $group->load($obj->cid); $attachment->message = new stdClass(); $attachment->message->title = $group->name; $attachment->message->description = $group->description; $attachment->message->link = $group->getLink(); break; case 'events': $attachment = new stdClass(); $attachment->type = 'event_share'; $event = JTable::getInstance('Event', 'CTable'); $event->load($obj->cid); $attachment->message = $event; break; case 'cover.upload': $params = new CParameter($obj->params); $attachment = new stdClass(); $attachment->type = 'cover'; $attachment->thumbnail = $params->get('attachment'); break; case 'profile.avatar.upload': $params = new CParameter($obj->params); $attachment = new stdClass(); $attachment->type = 'profile_avatar'; $attachment->thumbnail = $params->get('attachment'); break; default: $attachment = new stdClass(); $attachment->type = ''; break; } return $attachment; }
public static function getTitle($activities) { foreach ($activities as $key => $activity) { $param = new CParameter($activity->params); switch ($activity->app) { case 'users.featured': $user = CFactory::getUser($param->get('userid')); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', '<a href="' . CRoute::_(JUri::root() . $param->get('owner_url')) . '" class="cStream-Author">' . $user->getDisplayName() . '</a>'); break; case 'events.wall': case 'groups.wall': case 'profile': //$user = CFactory::getUser($activity->actor); $html = ''; if ($activity->eventid) { $event = JTable::getInstance('Event', 'cTable'); $event->load($activity->eventid); $html .= '<a class="cStream-Reference" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '">' . $event->title . '</a>'; } elseif ($activity->groupid) { $group = JTable::getInstance('Group', 'cTable'); $group->load($activity->groupid); $html .= '<a class="cStream-Reference" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id . '">' . $group->name . '</a>'; } elseif (!empty($activity->target) && $activity->target != $activity->actor) { $target = CFactory::getUser($activity->target); $html .= '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $target->id . '">' . $target->getDisplayName() . '</a> '; $html .= CActivities::format($activity->title); } else { $html .= JText::_('COM_COMMUNITY_STREAM_POSTED') . ' "' . CActivities::format($activity->title) . '"'; } $activities[$key]->title = $html; break; case 'profile.avatar.upload': //$user = CFactory::getUser($activity->actor); //$html = '<a class="cStream-Author" target="_blank" href="'.JUri::root().'index.php?option=com_community&view=profile&userid='.$user->id.'">'.$user->getDisplayName().'</a> '; $html = JText::_('COM_COMMUNITY_ACTIVITIES_NEW_AVATAR'); $activities[$key]->title = $html; break; case 'albums.comment': case 'albums': $album = JTable::getInstance('Album', 'CTable'); $album->load($activity->cid); $user = CFactory::getUser($activity->actor); //$html = '<a class="cStream-Author" target="_blank" href="'.JUri::root().'index.php?option=com_community&view=profile&userid='.$user->id.'">'.$user->getDisplayName().'</a> '; $html = JText::sprintf('COM_COMMUNITY_ACTIVITIES_WALL_POST_ALBUM', CRoute::_($album->getURI()), CStringHelper::escape($album->name)); $activities[$key]->title = $html; break; case 'profile.like': case 'groups.like': case 'events.like': case 'photo.like': case 'videos.like': case 'album.like': $actors = $param->get('actors'); $user = CFactory::getUser($activity->actor); $users = explode(',', $actors); $userCount = count($users); switch ($activity->app) { case 'profile.like': $cid = CFactory::getUser($activity->cid); $urlLink = JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $cid->id; $name = $cid->getDisplayName(); $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_PROFILE'; break; case 'groups.like': $cid = JTable::getInstance('Group', 'CTable'); $cid->load($activity->groupid); $urlLink = JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $cid->id; $name = $cid->name; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_GROUP'; break; case 'events.like': $cid = JTable::getInstance('Event', 'CTable'); $cid->load($activity->eventid); $urlLink = JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $cid->id; $name = $cid->title; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_EVENT'; break; case 'photo.like': $cid = JTable::getInstance('Photo', 'CTable'); $cid->load($activity->cid); $urlLink = JUri::root() . 'index.php?option=com_community&view=photos&task=photo&albumid=' . $cid->albumid . '&userid=' . $cid->creator . '&photoid=' . $cid->id; $name = $cid->caption; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_PHOTO'; break; case 'videos.like': $cid = JTable::getInstance('Video', 'CTable'); $cid->load($activity->cid); $urlLink = JURI::root() . 'index.php?option=com_community&view=videos&task=video&userid=' . $cid->creator . '&videoid=' . $cid->id; $name = $cid->getTitle(); $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_VIDEO'; break; case 'album.like': $cid = JTable::getInstance('Album', 'CTable'); $cid->load($activity->cid); $urlLink = Juri::root() . 'index.php?option=com_community&view=photos&task=album&albumid=' . $cid->id . '&userid=' . $cid->creator; $name = $cid->name; $element = 'COM_COMMUNITY_STREAM_LIKES_ELEMENT_ALBUM'; break; } $slice = 2; if ($userCount > 2) { $slice = 1; } $users = array_slice($users, 0, $slice); $actorsHTML = array(); foreach ($users as $actor) { $user = CFactory::getUser($actor); $actorsHTML[] = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>'; } $others = ''; if ($userCount > 2) { $others = JText::sprintf('COM_COMMUNITY_STREAM_OTHERS_JOIN_GROUP', $userCount - 1); } $jtext = $userCount > 1 ? 'COM_COMMUNITY_STREAM_LIKES_PLURAL' : 'COM_COMMUNITY_STREAM_LIKES_SINGULAR'; $activities[$key]->title = implode(' ' . JText::_('COM_COMMUNITY_AND') . ' ', $actorsHTML) . $others . JText::sprintf($jtext, $urlLink, $name, JText::_($element)); break; case 'cover.upload': $user = CFactory::getUser($activity->actor); $type = $param->get('type'); $extraMessage = ''; if (strtolower($type) !== 'profile') { $id = strtolower($type . 'id'); $cTable = JTable::getInstance(ucfirst($type), 'CTable'); $cTable->load($activity->{$id}); if ($type == 'group') { $extraMessage = ', <a target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $cTable->id . '">' . $cTable->name . '</a>'; } if ($type == 'event') { $extraMessage = ', <a target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $cTable->id . '">' . $cTable->title . '</a>'; } } //$html = '<a class="cStream-Author" target="_blank" href="'.JUri::root().'index.php?option=com_community&view=profile&userid='.$user->id.'">'.$user->getDisplayName().'</a> '; if ($type == 'profile') { $html = JText::_('COM_COMMUNITY_PHOTOS_COVER_UPLOAD_PROFILE'); } else { $html = JText::sprintf('COM_COMMUNITY_PHOTOS_COVER_UPLOAD', strtolower(Jtext::_('COM_COMMUNITY_COVER_' . strtoupper($type)))) . $extraMessage; } $activities[$key]->title = $html; break; case 'events.attend': case 'events': $user = CFactory::getUser($activity->actor); $action = $param->get('action'); $event = JTable::getInstance('Event', 'CTable'); $event->load($activity->eventid); switch ($action) { case 'events.create': //$html = '<a class="cStream-Author" target="_blank" href="'.JUri::root().'index.php?option=com_community&view=profile&userid='.$user->id.'">'.$user->getDisplayName().'</a> -'; $html = JText::sprintf('COM_COMMUNITY_EVENTS_ACTIVITIES_NEW_EVENT', JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, $event->title); $activities[$key]->title = $html; break; case 'events.attendence.attend': $users = explode(',', $param->get('actors')); $actorsHTML = array(); foreach ($users as $actor) { if (!$actor) { $actor = $activity->actor; } $user = CFactory::getUser($actor); $actorsHTML[] = '<a class="cStream-Author" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>'; } $activities[$key]->title = implode(', ', $actorsHTML) . ' - ' . JText::sprintf('COM_COMMUNITY_ACTIVITIES_EVENT_ATTEND', JUri::root() . 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, $event->title); break; } break; case 'friends.connect': $user1 = CFactory::getUser($activity->actor); $user2 = CFactory::getUser($activity->target); $html = JText::sprintf('COM_COMMUNITY_STREAM_OTHER_FRIENDS', $user1->getDisplayName(), $user2->getDisplayName(), JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user1->id, JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user2->id); $activities[$key]->title = $html; break; case 'groups.bulletin': $user = CFactory::getUser($activity->actor); $bulletin = JTable::getInstance('Bulletin', 'CTable'); $bulletin->load($activity->cid); $group = JTable::getInstance('Group', 'CTable'); $group->load($bulletin->groupid); $html = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>' . JText::sprintf('COM_COMMUNITY_GROUPS_NEW_GROUP_NEWS', CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewbulletin&groupid=' . $group->id . '&bulletinid=' . $bulletin->id), $bulletin->title); $activities[$key]->title = $html; break; case 'groups.discussion': $user = CFactory::getUser($activity->actor); $discussion = JTable::getInstance('Discussion', 'CTable'); $discussion->load($activity->cid); $discussionLink = CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $discussion->groupid . '&topicid=' . $discussion->id); $html = JText::sprintf('COM_COMMUNITY_GROUPS_NEW_GROUP_DISCUSSION', $discussionLink, $discussion->title); $activities[$key]->title = $html; break; case 'groups.discussion.reply': $user = CFactory::getUser($activity->actor); $discussion = JTable::getInstance('Discussion', 'CTable'); $discussion->load($activity->cid); $html = JText::sprintf('COM_COMMUNITY_GROUPS_REPLY_DISCUSSION', CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $discussion->groupid . '&topicid=' . $discussion->id), $discussion->title); $activities[$key]->title = $html; break; case 'groups.join': $user = CFactory::getUser($activity->actor); $users = explode(',', $param->get('actors')); $userCount = count($users); $group = JTable::getInstance('Group', 'CTable'); $group->load($activity->cid); $slice = 2; if ($userCount > 2) { $slice = 1; } $users = array_slice($users, 0, $slice); $actorsHTML = array(); foreach ($users as $actor) { $user = CFactory::getUser($actor); $actorsHTML[] = '<a class="cStream-Author" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=profile&userid=' . $user->id . '">' . $user->getDisplayName() . '</a>'; } $others = ''; if ($userCount > 2) { $others = JText::sprintf('COM_COMMUNITY_STREAM_OTHERS_JOIN_GROUP', $userCount - 1); } $html = implode(' ' . JText::_('COM_COMMUNITY_AND') . ' ', $actorsHTML) . $others . JText::sprintf('COM_COMMUNITY_GROUPS_GROUP_JOIN', JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id, $group->name); $activities[$key]->title = $html; break; case 'groups.update': $user = CFactory::getUser($activity->actor); $group = JTable::getInstance('Group', 'CTable'); $group->load($activity->cid); $html = JText::sprintf('COM_COMMUNITY_GROUPS_GROUP_UPDATED', JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id, $group->name); $activities[$key]->title = $html; break; case 'photos': $user = CFactory::getUser($activity->actor); $album = JTable::getInstance('Album', 'CTable'); $album->load($activity->cid); $html = ''; if ($activity->groupid) { $group = JTable::getInstance('Group', 'CTable'); $group->load($activity->groupid); $html .= '<a class="cStream-Reference" target="_blank" href="' . JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id . '">' . $group->name . '</a> -'; } //$html .= ' <a class="cStream-Author" target="_blank" href="'.JUri::root().'index.php?option=com_community&view=profile&userid='.$user->id.'">'.$user->getDisplayName().'</a>'; $count = $param->get('count', 1); $url = Juri::root() . 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $user->id; if (CStringHelper::isPlural($count)) { $html .= JText::sprintf('COM_COMMUNITY_ACTIVITY_PHOTO_UPLOAD_TITLE_MANY', $count, $url, CStringHelper::escape($album->name)); } else { $html .= JText::sprintf('COM_COMMUNITY_ACTIVITY_PHOTO_UPLOAD_TITLE', $url, CStringHelper::escape($album->name)); } $activities[$key]->title = $html; break; case 'photos.comment': $user = CFactory::getUser($activity->actor); $wall = JTable::getInstance('Wall', 'CTable'); $wall->load($param->get('wallid')); $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($activity->cid); $url = JUri::root() . 'index.php?option=com_community&view=photos&task=photo&albumid=' . $photo->albumid . '&userid=' . $photo->creator . '&photoid=' . $photo->id; $html = JText::sprintf('COM_COMMUNITY_ACTIVITIES_WALL_POST_PHOTO', $url, CStringHelper::escape($photo->caption)); $activities[$key]->title = $html; break; case 'system.message': case 'system.videos.popular': case 'system.photos.popular': case 'system.members.popular': case 'system.photos.total': case 'system.groups.popular': case 'system.members.registered': $action = $param->get('action'); switch ($action) { case 'registered_users': $usersModel = CFactory::getModel('user'); $now = new JDate(); $date = CTimeHelper::getDate(); $users = $usersModel->getLatestMember(10); $totalRegistered = count($users); $title = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $totalRegistered, $date->monthToString($now->format('%m'))); $activities[$key]->title = $title; break; case 'total_photos': $photosModel = CFactory::getModel('photos'); $total = $photosModel->getTotalSitePhotos(); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_TOTAL_PHOTOS_ACTIVITY_TITLE', CRoute::_(JURI::root() . 'index.php?option=com_community&view=photos'), $total); break; case 'top_videos': $activities[$key]->title = JText::_('COM_COMMUNITY_ACTIVITIES_TOP_VIDEOS'); break; case 'top_photos': $activities[$key]->title = JText::_('COM_COMMUNITY_ACTIVITIES_TOP_PHOTOS'); break; case 'top_users': $activities[$key]->title = JText::_('COM_COMMUNITY_ACTIVITIES_TOP_MEMBERS'); break; case 'top_groups': $groupsModel = CFactory::getModel('groups'); $activeGroup = $groupsModel->getMostActiveGroup(); if (is_null($activeGroup)) { $title = JText::_('COM_COMMUNITY_GROUPS_NONE_CREATED'); } else { $title = JText::sprintf('COM_COMMUNITY_MOST_POPULAR_GROUP_ACTIVITY_TITLE', CRoute::_(JUri::root() . 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $activeGroup->id), $activeGroup->name); } $activities[$key]->title = $title; break; case 'message': break; } break; case 'videos': $video = JTable::getInstance('Video', 'CTable'); $video->load($activity->cid); $actor = CFactory::getUser($activity->actor); //$html = self::_getUserLink($activity->actor); $html = JText::sprintf('COM_COMMUNITY_ACTIVITY_VIDEO_SHARE_TITLE', JUri::root() . $video->getViewURI(false), $video->title); $activities[$key]->title = $html; break; case 'videos.featured': $video = JTable::getInstance('Video', 'CTable'); $video->load($activity->cid); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_VIDEOS_IS_FEATURED', '' . CStringHelper::escape($video->title) . '</a>'); break; case 'albums.featured': $album = JTable::getInstance('Album', 'CTable'); $album->load($activity->cid); $activities[$key]->title = JText::sprintf('COM_COMMUNITY_ALBUM_IS_FEATURED', '' . CStringHelper::escape($album->name) . '</a>'); break; } $activities[$key]->title = CString::str_ireplace('{target}', self::_getUserLink($activities[$key]->target), $activities[$key]->title); $activities[$key]->title = preg_replace('/\\{multiple\\}(.*)\\{\\/multiple\\}/i', '', $activities[$key]->title); $search = array('{single}', '{/single}'); $activities[$key]->title = CString::str_ireplace($search, '', $activities[$key]->title); $activities[$key]->title = CString::str_ireplace('{actor}', self::_getUserLink($activities[$key]->actor), $activities[$key]->title); $activities[$key]->title = CString::str_ireplace('{app}', $activities[$key]->app, $activities[$key]->title); //strip out _QQQ_ $activities[$key]->title = CString::str_ireplace('_QQQ_', '', $activities[$key]->title); preg_match_all("/{(.*?)}/", $activities[$key]->title, $matches, PREG_SET_ORDER); if (!empty($matches)) { //$params = new CParameter( $row->params ); foreach ($matches as $val) { $replaceWith = $param->get($val[1], null); //if the replacement start with 'index.php', we can CRoute it if (strpos($replaceWith, 'index.php') === 0) { $replaceWith = JURI::root() . $replaceWith; } if (!is_null($replaceWith)) { $activities[$key]->title = CString::str_ireplace($val[0], $replaceWith, $activities[$key]->title); } } } $activities[$key]->title = preg_replace('/(<a href[^<>]+)>/is', '\\1 target="_blank">', $activities[$key]->title); } return $activities; }
/** * Return current user status * @return string user status */ public function getStatus($rawFormat = false) { jimport('joomla.filesystem.file'); // @rule: If user requested for a raw format, we should pass back the raw status. $statusmodel = CFactory::getModel('status'); $statusmodel = $statusmodel->get($this->_userid); $status = $statusmodel->status; if ($rawFormat) { return $status; } $CPluginHelper = new CPluginHelper(); if (JFile::Exists($CPluginHelper->getPluginURI('community', 'wordfilter') . '/wordfilter.php') && $CPluginHelper->isEnabled('community', 'wordfilter')) { require_once $CPluginHelper->getPluginURI('community', 'wordfilter') . '/wordfilter.php'; if (class_exists('plgCommunityWordfilter')) { $dispatcher = JDispatcher::getInstance(); $plugin = JPluginHelper::getPlugin('community', 'wordfilter'); $instance = new plgCommunityWordfilter($dispatcher, (array) $plugin); } $status = $instance->_censor($status); } // Damn it! this really should have been in the template! not littered in the code here $status = CActivities::format($status); return $status; }
<article> <a href="<?php echo $this->event->getLink(); ?> "> <i class="joms-icon-calendar-empty portrait-phone-only"></i> <?php echo JHTML::_('string.truncate', $this->event->title, $truncateVal, true, false); ?> </a> <div class="separator"></div> <p><?php echo JHTML::_('string.truncate', $this->event->description, $truncateVal, true, false); ?> </p> <ul class="list-unstyled content-details"> <li><i class="joms-icon-calendar"></i><?php echo CTimeHelper::getFormattedTime($this->event->startdate, $format); ?> </li> <li><i class="joms-icon-map-marker"></i><?php echo CActivities::format($activity->get('location')); ?> </li> </ul> </article> </div> <?php $this->load('activities.actions'); ?> </div>
$attachment->discussion_title = $table->title; $attachment->discussion_message = $table->message; $table = JTable::getInstance('Wall', 'CTable'); /* Get discussion information */ $tParams = new JRegistry($activity->params); $table->load($tParams->get('wallid')); $attachment->comment = $table->comment; $table = JTable::getInstance('Group', 'CTable'); $table->load($activity->groupid); $attachment->group_name = $table->name; break; } !isset($attachment->type) ? $attachments = array() : ($attachments[] = $attachment); $stream = new stdClass(); $stream->actor = $user; $stream->target = null; $stream->headline = JText::sprintf('COM_COMMUNITY_ACTIVITY_SHARE_STATUS', CUrlHelper::userLink($user->id), $user->getDisplayName(), CUrlHelper::userLink($actor->id), $actor->getDisplayName(), isset($app[$activity->app]) ? $app[$activity->app] : ''); $stream->message = CActivities::format($this->act->title); $stream->groupid = ""; $stream->eventid = ""; $stream->access = $this->act->access; $stream->attachments = $attachments; /** * @todo Need to clearly this one * Right now it's return on right data */ $stream->attachments[] = CActivityStream::formatStreamAttachment($activity); $stream->createdtime = $createdTime; $this->set('stream', $stream); $this->load('activities.stream'); }
echo JText::_('COM_COMMUNITY_CANCEL'); ?> </button> <button class="joms-button--primary joms-button--small" onclick="joms.view.stream.save('<?php echo $activity->get('id'); ?> ', this);"><?php echo JText::_('COM_COMMUNITY_SAVE'); ?> </button> </div> </div> <p data-type="stream-content"> <?php $title = empty($title) ? ltrim(CActivities::format($activity->get('title'), $mood), ' -') : CActivities::format($activity->get('title'), $mood); echo CActivities::shorten($title, $activity->get('id'), $isSingleAct, $config->getInt('streamcontentlength')); if ($address) { ?> <span class="joms-status-location"><?php if (!empty($title)) { ?> - <?php } echo JText::_('COM_COMMUNITY_AT'); ?> <a href="javascript:" onclick="joms.api.locationView('<?php echo $activity->get('id'); ?> ');"><?php echo $address;
?> "> </a> </div> <div class="joms-stream-content"> <header> <?php echo $activityString; ?> <p class="joms-share-meta date"> <?php echo $createdTime; ?> </p> <p class="reset-gap"><?php echo CActivities::format(JHTML::_('string.truncate', $wall->comment, $config->getInt('streamcontentlength'))); ?> </p> </header> <div class="joms-stream-box joms-responsive joms-fetch-wrapper clearfix"> <div class="row-fluid"> <div class="span3"> <a href="<?php echo $album->getURI(); ?> "> <img src="<?php echo $album->getCoverThumbURI(); ?> " />