Esempio n. 1
0
 /**
  * Delete the discussion
  * @param  [type] $oid [description]
  * @return [type]
  */
 public function delete($oid = null)
 {
     // Delete the stream related to the discussion replies
     CActivities::remove('groups.discussion.reply', $this->id);
     $result = parent::delete($oid);
     if ($result) {
         $this->_updateGroupStats();
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
');">
                        <svg viewBox="0 0 16 16" class="joms-icon">
                            <use xlink:href="<?php 
    echo CRoute::getURI();
    ?>
#joms-icon-warning"></use>
                        </svg>
                    </a>
                <?php 
}
?>

            </div>
            <p class="joms-focus__info--desktop">
                <?php 
echo CActivities::truncateComplex(strip_tags($group->summary), $summaryLength, true);
?>
            </p>
        </div>
        <div class="joms-focus__actions__wrapper">
            <div class="joms-focus__actions--desktop" style="position:relative">
                <?php 
if ($isMember) {
    ?>
                    <!-- invite friend button -->
                    <a href="javascript:" class="joms-focus__button--add" onclick="joms.api.groupInvite('<?php 
    echo $group->id;
    ?>
')">
                        <?php 
    echo JText::_('COM_COMMUNITY_INVITE_FRIENDS');
Esempio n. 4
0
 public function ajaxAlbumRemoveWall($wallId)
 {
     require_once JPATH_COMPONENT . '/libraries/activities.php';
     $filter = JFilterInput::getInstance();
     $wallId = $filter->clean($wallId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $response = new JAXResponse();
     $json = array();
     $wallsModel = $this->getModel('wall');
     $wall = $wallsModel->get($wallId);
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($wall->contentid);
     $my = CFactory::getUser();
     if ($my->id == $album->creator || COwnerHelper::isCommunityAdmin()) {
         if (!$wallsModel->deletePost($wallId)) {
             $json['error'] = JText::_('COM_COMMUNITY_GROUPS_REMOVE_WALL_ERROR');
         } else {
             CActivities::removeWallActivities(array('app' => 'albums', 'cid' => $wall->contentid, 'createdAfter' => $wall->date), $wallId);
         }
     } else {
         $json['error'] = JText::_('COM_COMMUNITY_GROUPS_REMOVE_WALL_ERROR');
     }
     if (!$json['error']) {
         $json['success'] = true;
     }
     die(json_encode($json));
 }
Esempio n. 5
0
 * 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;
$config = CFactory::getConfig();
$mood = $this->acts[0]->params->get('mood', NULL);
$isPhotoModal = $config->get('album_mode') == 1;
?>

<?php 
if (count($photos) > 0) {
    ?>

    <p><?php 
    $title = $this->acts[0]->title;
    echo CActivities::shorten($title, $this->acts[0]->id, 0, $config->getInt('streamcontentlength'));
    ?>
</p>

    <?php 
    if (count($photos) > 1) {
        ?>

        <div class="joms-media--images">
        <?php 
        foreach ($photos as $photo) {
            ?>
            <a
                <?php 
            if ($isPhotoModal) {
                ?>
Esempio n. 6
0
    <div class="joms-comment__header">
        <div class="joms-avatar--comment">
            <?php 
echo $avatarHTML;
?>
        </div>
        <div class="joms-comment__body joms-js--comment-body">
            <a class="joms-comment__user" href="<?php 
echo $authorLink;
?>
"><?php 
echo $author;
?>
</a>
            <span class="joms-js--comment-content"><?php 
echo CActivities::shorten($content, $wall->id, 0, $config->getInt('stream_comment_length'), 'comment');
?>
</span>
            <?php 
if (!empty($photoThumbnail)) {
    ?>
                <div style="padding: 5px 0">
                    <a href="javascript:" onclick="joms.api.photoZoom('<?php 
    echo $photoThumbnail;
    ?>
');">
                        <img class="joms-stream-thumb" src="<?php 
    echo $photoThumbnail;
    ?>
" alt="" />
                    </a>
Esempio n. 7
0
 /**
  * Called by status box to add new stream data
  *
  * @param type $message
  * @param type $attachment
  * @return type
  */
 public function ajaxStreamAdd($message, $attachment, $streamFilter = FALSE)
 {
     $streamHTML = '';
     // $attachment pending filter
     $cache = CFactory::getFastCache();
     $cache->clean(array('activities'));
     $my = CFactory::getUser();
     $userparams = $my->getParams();
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     //@rule: In case someone bypasses the status in the html, we enforce the character limit.
     $config = CFactory::getConfig();
     if (JString::strlen($message) > $config->get('statusmaxchar')) {
         $message = JHTML::_('string.truncate', $message, $config->get('statusmaxchar'));
     }
     $message = JString::trim($message);
     $objResponse = new JAXResponse();
     $rawMessage = $message;
     // @rule: Autolink hyperlinks
     // @rule: Autolink to users profile when message contains @username
     // $message     = CUserHelper::replaceAliasURL($message); // the processing is done on display side
     $emailMessage = CUserHelper::replaceAliasURL($rawMessage, true);
     // @rule: Spam checks
     if ($config->get('antispam_akismet_status')) {
         $filter = CSpamFilter::getFilter();
         $filter->setAuthor($my->getDisplayName());
         $filter->setMessage($message);
         $filter->setEmail($my->email);
         $filter->setURL(CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
         $filter->setType('message');
         $filter->setIP($_SERVER['REMOTE_ADDR']);
         if ($filter->isSpam()) {
             $objResponse->addAlert(JText::_('COM_COMMUNITY_STATUS_MARKED_SPAM'));
             return $objResponse->sendResponse();
         }
     }
     $attachment = json_decode($attachment, true);
     switch ($attachment['type']) {
         case 'message':
             //if (!empty($message)) {
             switch ($attachment['element']) {
                 case 'profile':
                     //only update user status if share messgage is on his profile
                     if (COwnerHelper::isMine($my->id, $attachment['target'])) {
                         //save the message
                         $status = $this->getModel('status');
                         /* If no privacy in attachment than we apply default: Public */
                         if (!isset($attachment['privacy'])) {
                             $attachment['privacy'] = COMMUNITY_STATUS_PRIVACY_PUBLIC;
                         }
                         $status->update($my->id, $rawMessage, $attachment['privacy']);
                         //set user status for current session.
                         $today = JFactory::getDate();
                         $message2 = empty($message) ? ' ' : $message;
                         $my->set('_status', $rawMessage);
                         $my->set('_posted_on', $today->toSql());
                         // Order of replacement
                         $order = array("\r\n", "\n", "\r");
                         $replace = '<br />';
                         // Processes \r\n's first so they aren't converted twice.
                         $messageDisplay = str_replace($order, $replace, $message);
                         $messageDisplay = CKses::kses($messageDisplay, CKses::allowed());
                         //update user status
                         $objResponse->addScriptCall("joms.jQuery('#profile-status span#profile-status-message').html('" . addslashes($messageDisplay) . "');");
                     }
                     //if actor posted something to target, the privacy should be under target's profile privacy settings
                     if (!COwnerHelper::isMine($my->id, $attachment['target']) && $attachment['target'] != '') {
                         $attachment['privacy'] = CFactory::getUser($attachment['target'])->getParams()->get('privacyProfileView');
                     }
                     //push to activity stream
                     $act = new stdClass();
                     $act->cmd = 'profile.status.update';
                     $act->actor = $my->id;
                     $act->target = $attachment['target'];
                     $act->title = $message;
                     $act->content = '';
                     $act->app = $attachment['element'];
                     $act->cid = $my->id;
                     $act->access = $attachment['privacy'];
                     $act->comment_id = CActivities::COMMENT_SELF;
                     $act->comment_type = 'profile.status';
                     $act->like_id = CActivities::LIKE_SELF;
                     $act->like_type = 'profile.status';
                     $activityParams = new CParameter('');
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         /* Save geo name */
                         $act->location = $attachment['location'][0];
                         $act->latitude = $attachment['location'][1];
                         $act->longitude = $attachment['location'][2];
                     }
                     $headMeta = new CParameter('');
                     if (isset($attachment['fetch'])) {
                         $headMeta->set('title', $attachment['fetch'][2]);
                         $headMeta->set('description', $attachment['fetch'][3]);
                         $headMeta->set('image', $attachment['fetch'][1]);
                         $headMeta->set('link', $attachment['fetch'][0]);
                         //do checking if this is a video link
                         $video = JTable::getInstance('Video', 'CTable');
                         $isValidVideo = @$video->init($attachment['fetch'][0]);
                         if ($isValidVideo) {
                             $headMeta->set('type', 'video');
                             $headMeta->set('video_provider', $video->type);
                             $headMeta->set('video_id', $video->getVideoId());
                             $headMeta->set('height', $video->getHeight());
                             $headMeta->set('width', $video->getWidth());
                         }
                         $activityParams->set('headMetas', $headMeta->toString());
                     }
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $activityParams->set('mood', $attachment['mood']);
                     }
                     $act->params = $activityParams->toString();
                     //CActivityStream::add($act);
                     //check if the user points is enabled
                     if (CUserPoints::assignPoint('profile.status.update')) {
                         /* Let use our new CApiStream */
                         $activityData = CApiActivities::add($act);
                         CTags::add($activityData);
                         $recipient = CFactory::getUser($attachment['target']);
                         $params = new CParameter('');
                         $params->set('actorName', $my->getDisplayName());
                         $params->set('recipientName', $recipient->getDisplayName());
                         $params->set('url', CUrlHelper::userLink($act->target, false));
                         $params->set('message', $message);
                         $params->set('stream', JText::_('COM_COMMUNITY_SINGULAR_STREAM'));
                         $params->set('stream_url', CRoute::_('index.php?option=com_community&view=profile&userid=' . $activityData->actor . '&actid=' . $activityData->id));
                         CNotificationLibrary::add('profile_status_update', $my->id, $attachment['target'], JText::sprintf('COM_COMMUNITY_FRIEND_WALL_POST', $my->getDisplayName()), '', 'wall.post', $params);
                         //email and add notification if user are tagged
                         CUserHelper::parseTaggedUserNotification($message, $my, $activityData, array('type' => 'post-comment'));
                     }
                     break;
                     // Message posted from Group page
                 // Message posted from Group page
                 case 'groups':
                     //
                     $groupLib = new CGroups();
                     $group = JTable::getInstance('Group', 'CTable');
                     $group->load($attachment['target']);
                     // Permission check, only site admin and those who has
                     // mark their attendance can post message
                     if (!COwnerHelper::isCommunityAdmin() && !$group->isMember($my->id) && $config->get('lockgroupwalls')) {
                         $objResponse->addScriptCall("alert('permission denied');");
                         return $objResponse->sendResponse();
                     }
                     $act = new stdClass();
                     $act->cmd = 'groups.wall';
                     $act->actor = $my->id;
                     $act->target = 0;
                     $act->title = $message;
                     $act->content = '';
                     $act->app = 'groups.wall';
                     $act->cid = $attachment['target'];
                     $act->groupid = $group->id;
                     $act->group_access = $group->approvals;
                     $act->eventid = 0;
                     $act->access = 0;
                     $act->comment_id = CActivities::COMMENT_SELF;
                     $act->comment_type = 'groups.wall';
                     $act->like_id = CActivities::LIKE_SELF;
                     $act->like_type = 'groups.wall';
                     $activityParams = new CParameter('');
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         /* Save geo name */
                         $act->location = $attachment['location'][0];
                         $act->latitude = $attachment['location'][1];
                         $act->longitude = $attachment['location'][2];
                     }
                     $headMeta = new CParameter('');
                     if (isset($attachment['fetch'])) {
                         $headMeta->set('title', $attachment['fetch'][2]);
                         $headMeta->set('description', $attachment['fetch'][3]);
                         $headMeta->set('image', $attachment['fetch'][1]);
                         $headMeta->set('link', $attachment['fetch'][0]);
                         //do checking if this is a video link
                         $video = JTable::getInstance('Video', 'CTable');
                         $isValidVideo = @$video->init($attachment['fetch'][0]);
                         if ($isValidVideo) {
                             $headMeta->set('type', 'video');
                             $headMeta->set('video_provider', $video->type);
                             $headMeta->set('video_id', $video->getVideoId());
                             $headMeta->set('height', $video->getHeight());
                             $headMeta->set('width', $video->getWidth());
                         }
                         $activityParams->set('headMetas', $headMeta->toString());
                     }
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $activityParams->set('mood', $attachment['mood']);
                     }
                     $act->params = $activityParams->toString();
                     $activityData = CApiActivities::add($act);
                     CTags::add($activityData);
                     CUserPoints::assignPoint('group.wall.create');
                     $recipient = CFactory::getUser($attachment['target']);
                     $params = new CParameter('');
                     $params->set('message', $emailMessage);
                     $params->set('group', $group->name);
                     $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
                     $params->set('url', CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id, false));
                     //Get group member emails
                     $model = CFactory::getModel('Groups');
                     $members = $model->getMembers($attachment['target'], null, true, false, true);
                     $membersArray = array();
                     if (!is_null($members)) {
                         foreach ($members as $row) {
                             if ($my->id != $row->id) {
                                 $membersArray[] = $row->id;
                             }
                         }
                     }
                     $groupParams = new CParameter($group->params);
                     if ($groupParams->get('wallnotification')) {
                         CNotificationLibrary::add('groups_wall_create', $my->id, $membersArray, JText::sprintf('COM_COMMUNITY_NEW_WALL_POST_NOTIFICATION_EMAIL_SUBJECT', $my->getDisplayName(), $group->name), '', 'groups.post', $params);
                     }
                     //@since 4.1 when a there is a new post in group, dump the data into group stats
                     $statsModel = CFactory::getModel('stats');
                     $statsModel->addGroupStats($group->id, 'post');
                     // Add custom stream
                     // Reload the stream with new stream data
                     $streamHTML = $groupLib->getStreamHTML($group, array('showLatestActivityOnTop' => true));
                     break;
                     // Message posted from Event page
                 // Message posted from Event page
                 case 'events':
                     $eventLib = new CEvents();
                     $event = JTable::getInstance('Event', 'CTable');
                     $event->load($attachment['target']);
                     // Permission check, only site admin and those who has
                     // mark their attendance can post message
                     if (!COwnerHelper::isCommunityAdmin() && !$event->isMember($my->id) && $config->get('lockeventwalls')) {
                         $objResponse->addScriptCall("alert('permission denied');");
                         return $objResponse->sendResponse();
                     }
                     // If this is a group event, set the group object
                     $groupid = $event->type == 'group' ? $event->contentid : 0;
                     //
                     $groupLib = new CGroups();
                     $group = JTable::getInstance('Group', 'CTable');
                     $group->load($groupid);
                     $act = new stdClass();
                     $act->cmd = 'events.wall';
                     $act->actor = $my->id;
                     $act->target = 0;
                     $act->title = $message;
                     $act->content = '';
                     $act->app = 'events.wall';
                     $act->cid = $attachment['target'];
                     $act->groupid = $event->type == 'group' ? $event->contentid : 0;
                     $act->group_access = $group->approvals;
                     $act->eventid = $event->id;
                     $act->event_access = $event->permission;
                     $act->access = 0;
                     $act->comment_id = CActivities::COMMENT_SELF;
                     $act->comment_type = 'events.wall';
                     $act->like_id = CActivities::LIKE_SELF;
                     $act->like_type = 'events.wall';
                     $activityParams = new CParameter('');
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         /* Save geo name */
                         $act->location = $attachment['location'][0];
                         $act->latitude = $attachment['location'][1];
                         $act->longitude = $attachment['location'][2];
                     }
                     $headMeta = new CParameter('');
                     if (isset($attachment['fetch'])) {
                         $headMeta->set('title', $attachment['fetch'][2]);
                         $headMeta->set('description', $attachment['fetch'][3]);
                         $headMeta->set('image', $attachment['fetch'][1]);
                         $headMeta->set('link', $attachment['fetch'][0]);
                         //do checking if this is a video link
                         $video = JTable::getInstance('Video', 'CTable');
                         $isValidVideo = @$video->init($attachment['fetch'][0]);
                         if ($isValidVideo) {
                             $headMeta->set('type', 'video');
                             $headMeta->set('video_provider', $video->type);
                             $headMeta->set('video_id', $video->getVideoId());
                             $headMeta->set('height', $video->getHeight());
                             $headMeta->set('width', $video->getWidth());
                         }
                         $activityParams->set('headMetas', $headMeta->toString());
                     }
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $activityParams->set('mood', $attachment['mood']);
                     }
                     $act->params = $activityParams->toString();
                     $activityData = CApiActivities::add($act);
                     CTags::add($activityData);
                     // add points
                     CUserPoints::assignPoint('event.wall.create');
                     $params = new CParameter('');
                     $params->set('message', $emailMessage);
                     $params->set('event', $event->title);
                     $params->set('event_url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
                     $params->set('url', CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false));
                     //Get event member emails
                     $members = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 12, CC_RANDOMIZE);
                     $membersArray = array();
                     if (!is_null($members)) {
                         foreach ($members as $row) {
                             if ($my->id != $row->id) {
                                 $membersArray[] = $row->id;
                             }
                         }
                     }
                     CNotificationLibrary::add('events_wall_create', $my->id, $membersArray, JText::sprintf('COM_COMMUNITY_NEW_WALL_POST_NOTIFICATION_EMAIL_SUBJECT_EVENTS', $my->getDisplayName(), $event->title), '', 'events.post', $params);
                     //@since 4.1 when a there is a new post in event, dump the data into event stats
                     $statsModel = CFactory::getModel('stats');
                     $statsModel->addEventStats($event->id, 'post');
                     // Reload the stream with new stream data
                     $streamHTML = $eventLib->getStreamHTML($event, array('showLatestActivityOnTop' => true));
                     break;
             }
             $objResponse->addScriptCall('__callback', '');
             // /}
             break;
         case 'photo':
             switch ($attachment['element']) {
                 case 'profile':
                     $photoIds = $attachment['id'];
                     //use User Preference for Privacy
                     //$privacy = $userparams->get('privacyPhotoView'); //$privacy = $attachment['privacy'];
                     $photo = JTable::getInstance('Photo', 'CTable');
                     if (!isset($photoIds[0]) || $photoIds[0] <= 0) {
                         //$objResponse->addScriptCall('__callback', JText::sprintf('COM_COMMUNITY_PHOTO_UPLOADED_SUCCESSFULLY', $photo->caption));
                         exit;
                     }
                     //always get album id from the photo itself, do not let it assign by params from user post data
                     $photoModel = CFactory::getModel('photos');
                     $photo = $photoModel->getPhoto($photoIds[0]);
                     /* OK ! If album_id is not provided than we use album id from photo ( it should be default album id ) */
                     $albumid = isset($attachment['album_id']) ? $attachment['album_id'] : $photo->albumid;
                     $album = JTable::getInstance('Album', 'CTable');
                     $album->load($albumid);
                     $privacy = $album->permissions;
                     //limit checking
                     //                        $photoModel = CFactory::getModel( 'photos' );
                     //                        $config       = CFactory::getConfig();
                     //                        $total        = $photoModel->getTotalToday( $my->id );
                     //                        $max      = $config->getInt( 'limit_photo_perday' );
                     //                        $remainingUploadCount = $max - $total;
                     $params = array();
                     foreach ($photoIds as $key => $photoId) {
                         if (CLimitsLibrary::exceedDaily('photos')) {
                             unset($photoIds[$key]);
                             continue;
                         }
                         $photo->load($photoId);
                         $photo->permissions = $privacy;
                         $photo->published = 1;
                         $photo->status = 'ready';
                         $photo->albumid = $albumid;
                         /* We must update this photo into correct album id */
                         $photo->store();
                         $params[] = clone $photo;
                     }
                     if ($config->get('autoalbumcover') && !$album->photoid) {
                         $album->photoid = $photoIds[0];
                         $album->store();
                     }
                     // Break if no photo added, which is likely because of daily limit.
                     if (count($photoIds) < 1) {
                         $objResponse->addScriptCall('__throwError', JText::_('COM_COMMUNITY_PHOTO_UPLOAD_LIMIT_EXCEEDED'));
                         return $objResponse->sendResponse();
                     }
                     // Trigger onPhotoCreate
                     //
                     $apps = CAppPlugins::getInstance();
                     $apps->loadApplications();
                     $apps->triggerEvent('onPhotoCreate', array($params));
                     $act = new stdClass();
                     $act->cmd = 'photo.upload';
                     $act->actor = $my->id;
                     $act->access = $privacy;
                     //$attachment['privacy'];
                     $act->target = $attachment['target'] == $my->id ? 0 : $attachment['target'];
                     $act->title = $message;
                     $act->content = '';
                     // Generated automatically by stream. No need to add anything
                     $act->app = 'photos';
                     $act->cid = $albumid;
                     $act->location = $album->location;
                     /* Comment and like for individual photo upload is linked
                      * to the photos itsel
                      */
                     $act->comment_id = $photo->id;
                     $act->comment_type = 'photos';
                     $act->like_id = $photo->id;
                     $act->like_type = 'photo';
                     $albumUrl = 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $my->id;
                     $albumUrl = CRoute::_($albumUrl);
                     $photoUrl = 'index.php?option=com_community&view=photos&task=photo&albumid=' . $album->id . '&userid=' . $photo->creator . '&photoid=' . $photo->id;
                     $photoUrl = CRoute::_($photoUrl);
                     $params = new CParameter('');
                     $params->set('multiUrl', $albumUrl);
                     $params->set('photoid', $photo->id);
                     $params->set('action', 'upload');
                     $params->set('stream', '1');
                     $params->set('photo_url', $photoUrl);
                     $params->set('style', COMMUNITY_STREAM_STYLE);
                     $params->set('photosId', implode(',', $photoIds));
                     if (count($photoIds > 1)) {
                         $params->set('count', count($photoIds));
                         $params->set('batchcount', count($photoIds));
                     }
                     //Store mood in param
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $params->set('mood', $attachment['mood']);
                     }
                     // Add activity logging
                     // CActivityStream::remove($act->app, $act->cid);
                     $activityData = CActivityStream::add($act, $params->toString());
                     // Add user points
                     CUserPoints::assignPoint('photo.upload');
                     //add a notification to the target user if someone posted photos on target's profile
                     if ($my->id != $attachment['target']) {
                         $recipient = CFactory::getUser($attachment['target']);
                         $params = new CParameter('');
                         $params->set('actorName', $my->getDisplayName());
                         $params->set('recipientName', $recipient->getDisplayName());
                         $params->set('url', CUrlHelper::userLink($act->target, false));
                         $params->set('message', $message);
                         $params->set('stream', JText::_('COM_COMMUNITY_SINGULAR_STREAM'));
                         $params->set('stream_url', CRoute::_('index.php?option=com_community&view=profile&userid=' . $activityData->actor . '&actid=' . $activityData->id));
                         CNotificationLibrary::add('profile_status_update', $my->id, $attachment['target'], JText::sprintf('COM_COMMUNITY_NOTIFICATION_STREAM_PHOTO_POST', count($photoIds)), '', 'wall.post', $params);
                     }
                     //email and add notification if user are tagged
                     CUserHelper::parseTaggedUserNotification($message, $my, $activityData, array('type' => 'post-comment'));
                     $objResponse->addScriptCall('__callback', JText::sprintf('COM_COMMUNITY_PHOTO_UPLOADED_SUCCESSFULLY', $photo->caption));
                     break;
                 case 'events':
                     $event = JTable::getInstance('Event', 'CTable');
                     $event->load($attachment['target']);
                     $privacy = 0;
                     //if this is a group event, we need to follow the group privacy
                     if ($event->type == 'group' && $event->contentid) {
                         $group = JTable::getInstance('Group', 'CTable');
                         $group->load(${$event}->contentid);
                         $privacy = $group->approvals ? PRIVACY_GROUP_PRIVATE_ITEM : 0;
                     }
                     $photoIds = $attachment['id'];
                     $photo = JTable::getInstance('Photo', 'CTable');
                     $photo->load($photoIds[0]);
                     $albumid = isset($attachment['album_id']) ? $attachment['album_id'] : $photo->albumid;
                     $album = JTable::getInstance('Album', 'CTable');
                     $album->load($albumid);
                     $params = array();
                     foreach ($photoIds as $photoId) {
                         $photo->load($photoId);
                         $photo->caption = $message;
                         $photo->permissions = $privacy;
                         $photo->published = 1;
                         $photo->status = 'ready';
                         $photo->albumid = $albumid;
                         $photo->store();
                         $params[] = clone $photo;
                     }
                     // Trigger onPhotoCreate
                     //
                     $apps = CAppPlugins::getInstance();
                     $apps->loadApplications();
                     $apps->triggerEvent('onPhotoCreate', array($params));
                     $act = new stdClass();
                     $act->cmd = 'photo.upload';
                     $act->actor = $my->id;
                     $act->access = $privacy;
                     $act->target = $attachment['target'] == $my->id ? 0 : $attachment['target'];
                     $act->title = $message;
                     //JText::sprintf('COM_COMMUNITY_ACTIVITIES_UPLOAD_PHOTO' , '{photo_url}', $album->name );
                     $act->content = '';
                     // Generated automatically by stream. No need to add anything
                     $act->app = 'photos';
                     $act->cid = $album->id;
                     $act->location = $album->location;
                     $act->eventid = $event->id;
                     $act->group_access = $privacy;
                     // just in case this event belongs to a group
                     //$act->access      = $attachment['privacy'];
                     /* Comment and like for individual photo upload is linked
                      * to the photos itsel
                      */
                     $act->comment_id = $photo->id;
                     $act->comment_type = 'photos';
                     $act->like_id = $photo->id;
                     $act->like_type = 'photo';
                     $albumUrl = 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $my->id;
                     $albumUrl = CRoute::_($albumUrl);
                     $photoUrl = 'index.php?option=com_community&view=photos&task=photo&albumid=' . $album->id . '&userid=' . $photo->creator . '&photoid=' . $photo->id;
                     $photoUrl = CRoute::_($photoUrl);
                     $params = new CParameter('');
                     $params->set('multiUrl', $albumUrl);
                     $params->set('photoid', $photo->id);
                     $params->set('action', 'upload');
                     $params->set('stream', '1');
                     // this photo uploaded from status stream
                     $params->set('photo_url', $photoUrl);
                     $params->set('style', COMMUNITY_STREAM_STYLE);
                     // set stream style
                     $params->set('photosId', implode(',', $photoIds));
                     // Add activity logging
                     if (count($photoIds > 1)) {
                         $params->set('count', count($photoIds));
                         $params->set('batchcount', count($photoIds));
                     }
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $params->set('mood', $attachment['mood']);
                     }
                     // CActivityStream::remove($act->app, $act->cid);
                     $activityData = CActivityStream::add($act, $params->toString());
                     // Add user points
                     CUserPoints::assignPoint('photo.upload');
                     // Reload the stream with new stream data
                     $eventLib = new CEvents();
                     $event = JTable::getInstance('Event', 'CTable');
                     $event->load($attachment['target']);
                     $streamHTML = $eventLib->getStreamHTML($event, array('showLatestActivityOnTop' => true));
                     $objResponse->addScriptCall('__callback', JText::sprintf('COM_COMMUNITY_PHOTO_UPLOADED_SUCCESSFULLY', $photo->caption));
                     break;
                 case 'groups':
                     //
                     $groupLib = new CGroups();
                     $group = JTable::getInstance('Group', 'CTable');
                     $group->load($attachment['target']);
                     $photoIds = $attachment['id'];
                     $privacy = $group->approvals ? PRIVACY_GROUP_PRIVATE_ITEM : 0;
                     $photo = JTable::getInstance('Photo', 'CTable');
                     $photo->load($photoIds[0]);
                     $albumid = isset($attachment['album_id']) ? $attachment['album_id'] : $photo->albumid;
                     $album = JTable::getInstance('Album', 'CTable');
                     $album->load($albumid);
                     $params = array();
                     foreach ($photoIds as $photoId) {
                         $photo->load($photoId);
                         $photo->caption = $message;
                         $photo->permissions = $privacy;
                         $photo->published = 1;
                         $photo->status = 'ready';
                         $photo->albumid = $albumid;
                         $photo->store();
                         $params[] = clone $photo;
                     }
                     // Trigger onPhotoCreate
                     //
                     $apps = CAppPlugins::getInstance();
                     $apps->loadApplications();
                     $apps->triggerEvent('onPhotoCreate', array($params));
                     $act = new stdClass();
                     $act->cmd = 'photo.upload';
                     $act->actor = $my->id;
                     $act->access = $privacy;
                     $act->target = $attachment['target'] == $my->id ? 0 : $attachment['target'];
                     $act->title = $message;
                     //JText::sprintf('COM_COMMUNITY_ACTIVITIES_UPLOAD_PHOTO' , '{photo_url}', $album->name );
                     $act->content = '';
                     // Generated automatically by stream. No need to add anything
                     $act->app = 'photos';
                     $act->cid = $album->id;
                     $act->location = $album->location;
                     $act->groupid = $group->id;
                     $act->group_access = $group->approvals;
                     $act->eventid = 0;
                     //$act->access      = $attachment['privacy'];
                     /* Comment and like for individual photo upload is linked
                      * to the photos itsel
                      */
                     $act->comment_id = $photo->id;
                     $act->comment_type = 'photos';
                     $act->like_id = $photo->id;
                     $act->like_type = 'photo';
                     $albumUrl = 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $my->id;
                     $albumUrl = CRoute::_($albumUrl);
                     $photoUrl = 'index.php?option=com_community&view=photos&task=photo&albumid=' . $album->id . '&userid=' . $photo->creator . '&photoid=' . $photo->id;
                     $photoUrl = CRoute::_($photoUrl);
                     $params = new CParameter('');
                     $params->set('multiUrl', $albumUrl);
                     $params->set('photoid', $photo->id);
                     $params->set('action', 'upload');
                     $params->set('stream', '1');
                     // this photo uploaded from status stream
                     $params->set('photo_url', $photoUrl);
                     $params->set('style', COMMUNITY_STREAM_STYLE);
                     // set stream style
                     $params->set('photosId', implode(',', $photoIds));
                     // Add activity logging
                     if (count($photoIds > 1)) {
                         $params->set('count', count($photoIds));
                         $params->set('batchcount', count($photoIds));
                     }
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $params->set('mood', $attachment['mood']);
                     }
                     // CActivityStream::remove($act->app, $act->cid);
                     $activityData = CActivityStream::add($act, $params->toString());
                     // Add user points
                     CUserPoints::assignPoint('photo.upload');
                     // Reload the stream with new stream data
                     $streamHTML = $groupLib->getStreamHTML($group, array('showLatestActivityOnTop' => true));
                     $objResponse->addScriptCall('__callback', JText::sprintf('COM_COMMUNITY_PHOTO_UPLOADED_SUCCESSFULLY', $photo->caption));
                     break;
                     dafault:
                     return;
             }
             break;
         case 'video':
             switch ($attachment['element']) {
                 case 'profile':
                     // attachment id
                     $fetch = $attachment['fetch'];
                     $cid = $fetch[0];
                     $privacy = isset($attachment['privacy']) ? $attachment['privacy'] : COMMUNITY_STATUS_PRIVACY_PUBLIC;
                     $video = JTable::getInstance('Video', 'CTable');
                     $video->load($cid);
                     $video->set('creator_type', VIDEO_USER_TYPE);
                     $video->set('status', 'ready');
                     $video->set('permissions', $privacy);
                     $video->set('title', $fetch[3]);
                     $video->set('description', $fetch[4]);
                     $video->set('category_id', $fetch[5]);
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         $video->set('location', $attachment['location'][0]);
                         $video->set('latitude', $attachment['location'][1]);
                         $video->set('longitude', $attachment['location'][2]);
                     }
                     // Add activity logging
                     $url = $video->getViewUri(false);
                     $act = new stdClass();
                     $act->cmd = 'videos.linking';
                     $act->actor = $my->id;
                     $act->target = $attachment['target'] == $my->id ? 0 : $attachment['target'];
                     $act->access = $privacy;
                     //filter empty message
                     $act->title = $message;
                     $act->app = 'videos.linking';
                     $act->content = '';
                     $act->cid = $video->id;
                     $act->location = $video->location;
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         /* Save geo name */
                         $act->location = $attachment['location'][0];
                         $act->latitude = $attachment['location'][1];
                         $act->longitude = $attachment['location'][2];
                     }
                     $act->comment_id = $video->id;
                     $act->comment_type = 'videos.linking';
                     $act->like_id = $video->id;
                     $act->like_type = 'videos.linking';
                     $params = new CParameter('');
                     $params->set('video_url', $url);
                     $params->set('style', COMMUNITY_STREAM_STYLE);
                     // set stream style
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $params->set('mood', $attachment['mood']);
                     }
                     //
                     $activityData = CActivityStream::add($act, $params->toString());
                     //this video must be public because it's posted on someone else's profile
                     if ($my->id != $attachment['target']) {
                         $video->set('permissions', COMMUNITY_STATUS_PRIVACY_PUBLIC);
                         $params = new CParameter();
                         $params->set('activity_id', $activityData->id);
                         // activity id is used to remove the activity if someone deleted this video
                         $params->set('target_id', $attachment['target']);
                         $video->params = $params->toString();
                         //also send a notification to the user
                         $recipient = CFactory::getUser($attachment['target']);
                         $params = new CParameter('');
                         $params->set('actorName', $my->getDisplayName());
                         $params->set('recipientName', $recipient->getDisplayName());
                         $params->set('url', CUrlHelper::userLink($act->target, false));
                         $params->set('message', $message);
                         $params->set('stream', JText::_('COM_COMMUNITY_SINGULAR_STREAM'));
                         $params->set('stream_url', CRoute::_('index.php?option=com_community&view=profile&userid=' . $activityData->actor . '&actid=' . $activityData->id));
                         CNotificationLibrary::add('profile_status_update', $my->id, $attachment['target'], JText::_('COM_COMMUNITY_NOTIFICATION_STREAM_VIDEO_POST'), '', 'wall.post', $params);
                     }
                     $video->store();
                     // @rule: Add point when user adds a new video link
                     //
                     CUserPoints::assignPoint('video.add', $video->creator);
                     //email and add notification if user are tagged
                     CUserHelper::parseTaggedUserNotification($message, $my, $activityData, array('type' => 'post-comment'));
                     // Trigger for onVideoCreate
                     //
                     $apps = CAppPlugins::getInstance();
                     $apps->loadApplications();
                     $params = array();
                     $params[] = $video;
                     $apps->triggerEvent('onVideoCreate', $params);
                     $this->cacheClean(array(COMMUNITY_CACHE_TAG_VIDEOS, COMMUNITY_CACHE_TAG_FRONTPAGE, COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_VIDEOS_CAT, COMMUNITY_CACHE_TAG_ACTIVITIES));
                     $objResponse->addScriptCall('__callback', JText::sprintf('COM_COMMUNITY_VIDEOS_UPLOAD_SUCCESS', $video->title));
                     break;
                 case 'groups':
                     // attachment id
                     $fetch = $attachment['fetch'];
                     $cid = $fetch[0];
                     $privacy = 0;
                     //$attachment['privacy'];
                     $video = JTable::getInstance('Video', 'CTable');
                     $video->load($cid);
                     $video->set('status', 'ready');
                     $video->set('groupid', $attachment['target']);
                     $video->set('permissions', $privacy);
                     $video->set('creator_type', VIDEO_GROUP_TYPE);
                     $video->set('title', $fetch[3]);
                     $video->set('description', $fetch[4]);
                     $video->set('category_id', $fetch[5]);
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         $video->set('location', $attachment['location'][0]);
                         $video->set('latitude', $attachment['location'][1]);
                         $video->set('longitude', $attachment['location'][2]);
                     }
                     $video->store();
                     //
                     $groupLib = new CGroups();
                     $group = JTable::getInstance('Group', 'CTable');
                     $group->load($attachment['target']);
                     // Add activity logging
                     $url = $video->getViewUri(false);
                     $act = new stdClass();
                     $act->cmd = 'videos.linking';
                     $act->actor = $my->id;
                     $act->target = $attachment['target'] == $my->id ? 0 : $attachment['target'];
                     $act->access = $privacy;
                     //filter empty message
                     $act->title = $message;
                     $act->app = 'videos';
                     $act->content = '';
                     $act->cid = $video->id;
                     $act->groupid = $video->groupid;
                     $act->group_access = $group->approvals;
                     $act->location = $video->location;
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         /* Save geo name */
                         $act->location = $attachment['location'][0];
                         $act->latitude = $attachment['location'][1];
                         $act->longitude = $attachment['location'][2];
                     }
                     $act->comment_id = $video->id;
                     $act->comment_type = 'videos';
                     $act->like_id = $video->id;
                     $act->like_type = 'videos';
                     $params = new CParameter('');
                     $params->set('video_url', $url);
                     $params->set('style', COMMUNITY_STREAM_STYLE);
                     // set stream style
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $params->set('mood', $attachment['mood']);
                     }
                     $activityData = CActivityStream::add($act, $params->toString());
                     // @rule: Add point when user adds a new video link
                     CUserPoints::assignPoint('video.add', $video->creator);
                     // Trigger for onVideoCreate
                     $apps = CAppPlugins::getInstance();
                     $apps->loadApplications();
                     $params = array();
                     $params[] = $video;
                     $apps->triggerEvent('onVideoCreate', $params);
                     $this->cacheClean(array(COMMUNITY_CACHE_TAG_VIDEOS, COMMUNITY_CACHE_TAG_FRONTPAGE, COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_VIDEOS_CAT, COMMUNITY_CACHE_TAG_ACTIVITIES));
                     $objResponse->addScriptCall('__callback', JText::sprintf('COM_COMMUNITY_VIDEOS_UPLOAD_SUCCESS', $video->title));
                     // Reload the stream with new stream data
                     $streamHTML = $groupLib->getStreamHTML($group, array('showLatestActivityOnTop' => true));
                     break;
                 case 'events':
                     //event videos
                     $fetch = $attachment['fetch'];
                     $cid = $fetch[0];
                     $privacy = 0;
                     //$attachment['privacy'];
                     $video = JTable::getInstance('Video', 'CTable');
                     $video->load($cid);
                     $video->set('status', 'ready');
                     $video->set('eventid', $attachment['target']);
                     $video->set('permissions', $privacy);
                     $video->set('creator_type', VIDEO_EVENT_TYPE);
                     $video->set('title', $fetch[3]);
                     $video->set('description', $fetch[4]);
                     $video->set('category_id', $fetch[5]);
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         $video->set('location', $attachment['location'][0]);
                         $video->set('latitude', $attachment['location'][1]);
                         $video->set('longitude', $attachment['location'][2]);
                     }
                     $video->store();
                     //
                     $eventLib = new CEvents();
                     $event = JTable::getInstance('Event', 'CTable');
                     $event->load($attachment['target']);
                     $group = new stdClass();
                     if ($event->type == 'group' && $event->contentid) {
                         // check if this a group event, and follow the permission
                         $group = JTable::getInstance('Group', 'CTable');
                         $group->load($event->contentid);
                     }
                     // Add activity logging
                     $url = $video->getViewUri(false);
                     $act = new stdClass();
                     $act->cmd = 'videos.linking';
                     $act->actor = $my->id;
                     $act->target = $attachment['target'] == $my->id ? 0 : $attachment['target'];
                     $act->access = $privacy;
                     //filter empty message
                     $act->title = $message;
                     $act->app = 'videos';
                     $act->content = '';
                     $act->cid = $video->id;
                     $act->groupid = 0;
                     $act->group_access = isset($group->approvals) ? $group->approvals : 0;
                     // if this is a group event
                     $act->location = $video->location;
                     /* Save cords if exists */
                     if (isset($attachment['location'])) {
                         /* Save geo name */
                         $act->location = $attachment['location'][0];
                         $act->latitude = $attachment['location'][1];
                         $act->longitude = $attachment['location'][2];
                     }
                     $act->eventid = $event->id;
                     $act->comment_id = $video->id;
                     $act->comment_type = 'videos';
                     $act->like_id = $video->id;
                     $act->like_type = 'videos';
                     $params = new CParameter('');
                     $params->set('video_url', $url);
                     $params->set('style', COMMUNITY_STREAM_STYLE);
                     // set stream style
                     //Store mood in paramm
                     if (isset($attachment['mood']) && $attachment['mood'] != 'Mood') {
                         $params->set('mood', $attachment['mood']);
                     }
                     $activityData = CActivityStream::add($act, $params->toString());
                     // @rule: Add point when user adds a new video link
                     CUserPoints::assignPoint('video.add', $video->creator);
                     // Trigger for onVideoCreate
                     $apps = CAppPlugins::getInstance();
                     $apps->loadApplications();
                     $params = array();
                     $params[] = $video;
                     $apps->triggerEvent('onVideoCreate', $params);
                     $this->cacheClean(array(COMMUNITY_CACHE_TAG_VIDEOS, COMMUNITY_CACHE_TAG_FRONTPAGE, COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_VIDEOS_CAT, COMMUNITY_CACHE_TAG_ACTIVITIES));
                     $objResponse->addScriptCall('__callback', JText::sprintf('COM_COMMUNITY_VIDEOS_UPLOAD_SUCCESS', $video->title));
                     // Reload the stream with new stream data
                     $streamHTML = $eventLib->getStreamHTML($event, array('showLatestActivityOnTop' => true));
                     break;
                 default:
                     return;
             }
             break;
         case 'event':
             switch ($attachment['element']) {
                 case 'profile':
                     require_once COMMUNITY_COM_PATH . '/controllers/events.php';
                     $eventController = new CommunityEventsController();
                     // Assign default values where necessary
                     $attachment['description'] = $message;
                     $attachment['ticket'] = 0;
                     $attachment['offset'] = 0;
                     $event = $eventController->ajaxCreate($attachment, $objResponse);
                     $objResponse->addScriptCall('window.location="' . $event->getLink() . '";');
                     if (CFactory::getConfig()->get('event_moderation')) {
                         $objResponse->addAlert(JText::sprintf('COM_COMMUNITY_EVENTS_MODERATION_NOTICE', $event->title));
                     }
                     break;
                 case 'groups':
                     require_once COMMUNITY_COM_PATH . '/controllers/events.php';
                     $eventController = new CommunityEventsController();
                     //
                     $groupLib = new CGroups();
                     $group = JTable::getInstance('Group', 'CTable');
                     $group->load($attachment['target']);
                     // Assign default values where necessary
                     $attachment['description'] = $message;
                     $attachment['ticket'] = 0;
                     $attachment['offset'] = 0;
                     $event = $eventController->ajaxCreate($attachment, $objResponse);
                     CEvents::addGroupNotification($event);
                     $objResponse->addScriptCall('window.location="' . $event->getLink() . '";');
                     // Reload the stream with new stream data
                     $streamHTML = $groupLib->getStreamHTML($group, array('showLatestActivityOnTop' => true));
                     if (CFactory::getConfig()->get('event_moderation')) {
                         $objResponse->addAlert(JText::sprintf('COM_COMMUNITY_EVENTS_MODERATION_NOTICE', $event->title));
                     }
                     break;
             }
             break;
         case 'link':
             break;
     }
     //no matter what kind of message it is, always filter the hashtag if there's any
     if (!empty($act->title) && isset($activityData->id) && $activityData->id) {
         //use model to check if this has a tag in it and insert into the table if possible
         $hashtags = CContentHelper::getHashTags($act->title);
         if (count($hashtags)) {
             //$hashTag
             $hashtagModel = CFactory::getModel('hashtags');
             foreach ($hashtags as $tag) {
                 $hashtagModel->addActivityHashtag($tag, $activityData->id);
             }
         }
     }
     // Frontpage filter
     if ($streamFilter != false) {
         $streamFilter = json_decode($streamFilter);
         $filter = $streamFilter->filter;
         $value = $streamFilter->value;
         $extra = false;
         // Append added data to the list.
         if (isset($activityData) && $activityData->id) {
             $model = CFactory::getModel('Activities');
             $extra = $model->getActivity($activityData->id);
         }
         switch ($filter) {
             case 'privacy':
                 if ($value == 'me-and-friends' && $my->id != 0) {
                     $streamHTML = CActivities::getActivitiesByFilter('active-user-and-friends', $my->id, 'frontpage', true, array(), $extra);
                 } else {
                     $streamHTML = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array(), $extra);
                 }
                 break;
             case 'apps':
                 $streamHTML = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array('apps' => array($value)), $extra);
                 break;
             case 'hashtag':
                 $streamHTML = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array($filter => $value), $extra);
                 break;
             default:
                 $defaultFilter = $config->get('frontpageactivitydefault');
                 if ($defaultFilter == 'friends' && $my->id != 0) {
                     $streamHTML = CActivities::getActivitiesByFilter('active-user-and-friends', $my->id, 'frontpage', true, array(), $extra);
                 } else {
                     $streamHTML = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array(), $extra);
                 }
                 break;
         }
     }
     if (!isset($attachment['filter'])) {
         $attachment['filter'] = '';
         $filter = $config->get('frontpageactivitydefault');
         $filter = explode(':', $filter);
         $attachment['filter'] = isset($filter[1]) ? $filter[1] : $filter[0];
     }
     if (empty($streamHTML)) {
         if (!isset($attachment['target'])) {
             $attachment['target'] = '';
         }
         if (!isset($attachment['element'])) {
             $attachment['element'] = '';
         }
         $streamHTML = CActivities::getActivitiesByFilter($attachment['filter'], $attachment['target'], $attachment['element'], true, array('show_featured' => true, 'showLatestActivityOnTop' => true));
     }
     $objResponse->addAssign('activity-stream-container', 'innerHTML', $streamHTML);
     // Log user engagement
     CEngagement::log($attachment['type'] . '.share', $my->id);
     return $objResponse->sendResponse();
 }
Esempio n. 8
0
 public function ajaxGetActivities($filter, $user_id = 0, $view = '')
 {
     $objResponse = new JAXResponse();
     $input_filter = JFilterInput::getInstance();
     $filter = $input_filter->clean($filter, 'string');
     $user_id = $input_filter->clean($user_id, 'int');
     $view = $input_filter->clean($view, 'string');
     $html = CActivities::getActivitiesByFilter($filter, $user_id);
     $html = '<div class="cActivity-LoadLatest joms-latest-activities-container"><a id="activity-update-click" class="btn btn-block" href="javascript:void(0);"></a></div>' . $html;
     $objResponse->addAssign('activity-stream-container', 'innerHTML', $html);
     $objResponse->addScriptCall("joms.filters.hideLoading();");
     // Set main UL data attributes 'filter'
     $objResponse->addScriptCall("joms.jQuery('#activity-stream-container ul.cStreamList').data('filter', '" . $filter . "');");
     return $objResponse->sendResponse();
 }
Esempio n. 9
0
 /**
  * Get latest activities with HTML to render
  * @return array
  */
 public function showLatestActivities()
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $jinput = JFactory::getApplication()->input;
     /* We do store filters into session than we can reuse it under ajax */
     $filter = $jinput->get('filter', $config->get('frontpageactivitydefault'));
     $value = $jinput->get('value', '', 'RAW');
     if (strpos($filter, ':') !== false && $my->id != 0) {
         $filter = explode(':', $filter);
         JFactory::getApplication()->redirect(CRoute::_('index.php?option=com_community&view=frontpage&filter=' . $filter[0] . '&value=' . $filter[1], false));
     }
     $userActivities = '';
     /* Filtering */
     switch ($filter) {
         /* Filter by privacy */
         case 'privacy':
             /* Filter by me and my friends */
             if ($value == 'me-and-friends' && $my->id != 0) {
                 /**
                  *
                  * @param type $filter
                  * @param type $userId
                  * @param type $view
                  * @param type $showMore
                  */
                 $userActivities = CActivities::getActivitiesByFilter('active-user-and-friends', $my->id, 'frontpage', true);
             } else {
                 /* No filter. Get all */
                 $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true);
             }
             break;
             /* Filter by type */
         /* Filter by type */
         case 'apps':
             /* By default we use all */
             $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array('apps' => array($value)));
             break;
             /* By default we do filter by privacy and follow backend configured */
         /* By default we do filter by privacy and follow backend configured */
         case 'hashtag':
             //filter by hashtag
             $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array($filter => $value));
             break;
         default:
             $defaultFilter = $config->get('frontpageactivitydefault');
             /* Filter by me and my friends and of course not for guess */
             if ($defaultFilter == 'friends' && $my->id != 0) {
                 $userActivities = CActivities::getActivitiesByFilter('active-user-and-friends', $my->id, 'frontpage', true);
             } else {
                 $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true);
             }
             break;
     }
     $activities = array();
     $activities['HTML'] = $userActivities;
     return $activities;
 }
Esempio n. 10
0
 /**
  *
  * @return string
  */
 public function getTitle()
 {
     return CActivities::format($this->get('title'));
 }
Esempio n. 11
0
* @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>
Esempio n. 12
0
    ?>
</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>
Esempio n. 13
0
 public function ajaxGetActivities($filter, $user_id = 0, $view = '')
 {
     $objResponse = new JAXResponse();
     $input_filter = JFilterInput::getInstance();
     $filter = $input_filter->clean($filter, 'string');
     $user_id = $input_filter->clean($user_id, 'int');
     $view = $input_filter->clean($view, 'string');
     include_once JPATH_COMPONENT . DS . 'libraries' . DS . 'activities.php';
     $html = CActivities::getActivitiesByFilter($filter, $user_id);
     $objResponse->addAssign('activity-stream-container', 'innerHTML', $html);
     $objResponse->addScriptCall("joms.filters.hideLoading();");
     return $objResponse->sendResponse();
 }
Esempio n. 14
0
 /**
  * Delete the photo, the original and the actual resized photos and thumbnails
  */
 public function delete()
 {
     CFactory::load('libraries', 'storage');
     $storage = CStorage::getStorage($this->storage);
     $storage->delete($this->image);
     $storage->delete($this->thumbnail);
     JFile::delete(JPATH_ROOT . DS . $this->original);
     // If the original path is empty, we can delete it too
     $files = JFolder::files(dirname(JPATH_ROOT . DS . $this->original));
     if (empty($files)) {
         JFolder::delete(dirname(JPATH_ROOT . DS . $this->original));
     }
     // if the photo is the album cover, set the album cover as default 0
     $album =& JTable::getInstance('Album', 'CTable');
     $album->load($this->albumid);
     $album->set('photoid', 0);
     $album->store();
     // delete the tags
     CFactory::load('libraries', 'phototagging');
     CPhotoTagging::removeTagByPhoto($this->id);
     // delete the activities
     CFactory::load('libraries', 'activities');
     CActivities::remove('photos', $this->id);
     // delete the comments
     $wall = CFactory::getModel('wall');
     $wall->deleteAllChildPosts($this->id, 'photos');
     return parent::delete();
 }
Esempio n. 15
0
    function _getEventsHTML($createEvents, $rows, $user, $config, $totalEvents, $creatable)
    {
        $titleLength = $config->get('header_title_length', 30);
        $summaryLength = $config->get('header_summary_length', 80);
        ob_start();
        ?>

        <?php 
        if ($rows) {
            ?>
        <ul class="joms-list--event">
        <?php 
            foreach ($rows as $row) {
                $event = JTable::getInstance('Event', 'CTable');
                $event->load($row->id);
                $creator = CFactory::getUser($event->creator);
                // Get the formated date & time
                $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_12H') : JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_24H');
                $startdatehtml = CTimeHelper::getFormattedTime($event->startdate, $format);
                $enddatehtml = CTimeHelper::getFormattedTime($event->enddate, $format);
                ?>

            <li class="joms-media--event" title="<?php 
                echo CActivities::truncateComplex($event->summary, $summaryLength, true);
                ?>
">
                <div class="joms-media__calendar">
                    <span class="month"><?php 
                echo CEventHelper::formatStartDate($event, JText::_('M'));
                ?>
</span>
                    <span class="date"><?php 
                echo CEventHelper::formatStartDate($event, JText::_('d'));
                ?>
</span>
                </div>
                <div class="joms-media__body">
                    <h4 class="reset-gap"><a href="<?php 
                echo CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
                ?>
"><?php 
                echo $event->title;
                ?>
</a></h4>
                    <div class="joms-gap--small"></div>
                    <?php 
                echo CActivities::truncateComplex($event->summary, $summaryLength, true);
                ?>
                    <span class="joms-block joms-text--light"><?php 
                echo $event->location;
                ?>
</span>
                    <div class="joms-gap--small"></div>
                    <a href="<?php 
                echo CRoute::_('index.php?option=com_community&view=events&task=viewguest&eventid=' . $event->id . '&type=' . COMMUNITY_EVENT_STATUS_ATTEND);
                ?>
"><?php 
                echo JText::sprintf(!CStringHelper::isSingular($event->confirmedcount) ? 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT_MANY' : 'COM_COMMUNITY_EVENTS_ATTANDEE_COUNT', $event->confirmedcount);
                ?>
</a>
                </div>
            </li>
            <?php 
            }
            ?>
        </ul>
        <?php 
        } else {
            ?>
            <div><?php 
            echo JText::_('PLG_MYEVENTS_NO_EVENTS_CREATED_BY_THE_USER_YET');
            ?>
</div>
        <?php 
        }
        ?>
        <small>
        <?php 
        if ($creatable) {
            ?>
        <a class="joms-button--link" href="<?php 
            echo CRoute::_('index.php?option=com_community&view=events&task=create');
            ?>
"><?php 
            echo JText::_('COM_COMMUNITY_EVENTS_CREATE');
            ?>
</a>
        <?php 
        }
        ?>
        <a class="joms-button--link" href="<?php 
        echo CRoute::_('index.php?option=com_community&view=events');
        ?>
"><?php 
        echo JText::_('COM_COMMUNITY_EVENTS_ALL_EVENTS') . ' (' . $totalEvents . ')';
        ?>
</a>
        </small>

        <?php 
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }
Esempio n. 16
0
 /**
  * Return HTML formatted stream for groups
  * @param object $group
  * @deprecated use activities library instead
  */
 public function getStreamHTML($group, $filters = array())
 {
     $activities = new CActivities();
     $streamHTML = $activities->getOlderStream(1000000000, 'active-group', $group->id, null, $filters);
     // $streamHTML = $activities->getAppHTML(
     // 			array(
     // 				'app' => CActivities::APP_GROUPS,
     // 				'groupid' => $group->id,
     // 				'apptype' => 'group'
     // 			)
     // 		);
     return $streamHTML;
 }
            $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');
}
Esempio n. 18
0
 /**
  * Return HTML formatted stream for events
  * @param type $eventid 
  */
 public function getStreamHTML($event)
 {
     CFactory::load('libraries', 'activities');
     $activities = new CActivities();
     $streamHTML = $activities->getAppHTML(array('app' => CActivities::APP_EVENTS, 'eventid' => $event->id, 'apptype' => 'event'));
     return $streamHTML;
 }
Esempio n. 19
0
        </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 
 * 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;
$string = 'COM_COMMUNITY_GROUPS_DISCUSSION_CREATOR_TIME_LINK';
if ($isTimeLapsed == 'lapse') {
    $string = 'COM_COMMUNITY_GROUPS_DISCUSSION_CREATOR_TIME_LINK_LAPSED';
}
?>
<div class="joms-page">
    <?php 
echo $submenu;
?>
    <h3 class="joms-page__title">
        <?php 
echo CActivities::truncateComplex($discussion->title, 60, true);
?>
    </h3>
    <?php 
if ($canCreate) {
    ?>
    <button class="joms-button--primary joms-button--small joms-button--full-small" onclick="window.location='<?php 
    echo CRoute::_('index.php?option=com_community&view=groups&groupid=' . $group->id . '&task=adddiscussion');
    ?>
';"><?php 
    echo JText::_('COM_COMMUNITY_CREATE_ANOTHER_DISCUSSION');
    ?>
</button>
    <?php 
}
?>
Esempio n. 21
0
 /**
  * Delete the photo, the original and the actual resized photos and thumbnails
  */
 public function delete($pk = null)
 {
     $storage = CStorage::getStorage($this->storage);
     $storage->delete($this->image);
     $storage->delete($this->thumbnail);
     /* We did store original than now time to remove it */
     if (!empty($this->original)) {
         /* Original do not sync with 3rd storage than we don't need to use $storage->delete; even it would be same */
         if (JFile::exists(JPATH_ROOT . '/' . $this->original)) {
             JFile::delete(JPATH_ROOT . '/' . $this->original);
         }
         $originalDir = dirname(JPATH_ROOT . '/' . $this->original);
         $files = JFolder::files($originalDir);
         /* If the original path is empty, we can delete it too */
         if (empty($files)) {
             JFolder::delete($originalDir);
         }
     }
     // if the photo is the album cover, set the album cover as default 0
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($this->albumid);
     $album->set('photoid', 0);
     $album->store();
     // delete the tags
     CFactory::load('libraries', 'phototagging');
     $phototagging = new CPhotoTagging();
     $phototagging->removeTagByPhoto($this->id);
     // delete the activities
     CActivities::remove('photos', $this->id);
     //Remove photo from activity stream
     CActivityStream::remove('photo.like', $this->id);
     // delete the comments
     $wall = CFactory::getModel('wall');
     $wall->deleteAllChildPosts($this->id, 'photos');
     /* And now finally we do delete this photo in database */
     /* return parent::delete(); */
     /**
      * @since 3.2
      * We do not delete database record for now. Leave it for cron !
      * @todo Considering local files should be deleted this time or not ?
      */
     $this->published = 0;
     $this->status = 'delete';
     $this->store();
 }
Esempio n. 22
0
 /**
  * Get latest activities with HTML to render
  * @return array
  */
 public function showLatestActivities()
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $jinput = JFactory::getApplication()->input;
     /* We do store filters into session than we can reuse it under ajax */
     $filter = $defaultFilter = $jinput->get('filter', $config->get('frontpageactivitydefault'));
     $value = $jinput->get('value', '', 'RAW');
     if ((strpos($filter, ':') !== false || $filter == 'all') && $my->id != 0) {
         //filter overide, if user has set their own filter, it should rewrite the system default filter
         if ($my->id && $my->_cparams->get('frontpageactivitydefault') != '') {
             $filter = $my->_cparams->get('frontpageactivitydefault');
         }
         if (!is_array($filter)) {
             //break this filter down if needed
             $filter = explode(':', $filter);
         }
         if ($filter[0] != $defaultFilter) {
             //prevent unlimited loop if both are set to "all"
             JFactory::getApplication()->redirect(CRoute::_('index.php?option=com_community&view=frontpage&filter=' . $filter[0] . '&value=' . $filter[1], false));
         }
     }
     $userActivities = '';
     /* Filtering */
     switch ($filter) {
         /* Filter by privacy */
         case 'privacy':
             /* Filter by me and my friends */
             if ($value == 'me-and-friends' && $my->id != 0) {
                 /**
                  *
                  * @param type $filter
                  * @param type $userId
                  * @param type $view
                  * @param type $showMore
                  */
                 $userActivities = CActivities::getActivitiesByFilter('active-user-and-friends', $my->id, 'frontpage', true);
             } else {
                 /* No filter. Get all */
                 $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true);
             }
             break;
             /* Filter by type */
         /* Filter by type */
         case 'apps':
             /* By default we use all */
             $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array('apps' => array($value)));
             break;
             /* By default we do filter by privacy and follow backend configured */
         /* By default we do filter by privacy and follow backend configured */
         case 'hashtag':
             //filter by hashtag
             $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array($filter => $value));
             break;
         case 'keyword':
             //filter by keyword
             $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array($filter => $value));
             break;
         default:
             $defaultFilter = $config->get('frontpageactivitydefault');
             /* Filter by me and my friends and of course not for guess */
             if ($defaultFilter == 'friends' && $my->id != 0) {
                 $userActivities = CActivities::getActivitiesByFilter('active-user-and-friends', $my->id, 'frontpage', true);
             } else {
                 $userActivities = CActivities::getActivitiesByFilter('all', $my->id, 'frontpage', true, array('show_featured' => true));
             }
             break;
     }
     $activities = array();
     $activities['HTML'] = $userActivities;
     return $activities;
 }
Esempio n. 23
0
 * @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>
            $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');
}
Esempio n. 25
0
 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));
 }
Esempio n. 26
0
');">
                            <svg viewBox="0 0 16 16" class="joms-icon">
                                <use xlink:href="<?php 
    echo CRoute::getURI();
    ?>
#joms-icon-warning"></use>
                            </svg>
                        </a>
                        <?php 
}
?>

                    </div>
                    <p class="joms-focus__info--desktop">
                        <?php 
echo CActivities::truncateComplex($event->summary, $summaryLength, true);
?>
                    </p>
                </div>
                <div class="joms-focus__actions__wrapper">
                    <?php 
if ($my->id != 0) {
    ?>
                    <div class="joms-focus__actions--desktop">

                        <?php 
    if ($handler->isAllowed() && !$isPastEvent && CEventHelper::showAttendButton($event)) {
        ?>
                            <a href="javascript:" class="joms-focus__button--add"
                                onclick="joms.api.eventResponse('<?php 
        echo $event->id;
Esempio n. 27
0
    <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>
Esempio n. 28
0
$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();
Esempio n. 29
0
?>
</button>&nbsp;
            <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;
    ?>
Esempio n. 30
0
 /**
  * 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);
 }