public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $params) { JPluginHelper::importPlugin('content'); $dispatcher = JDispatcher::getInstance(); $html = ""; if (!empty($row)) { $html .= '<div class="joms-app--myarticle">'; $html .= '<ul class="joms-list">'; foreach ($row as $data) { $text_limit = $params->get('limit', 50); $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0)); if (empty($cat[$data->catid])) { $cat[$data->catid] = ""; } $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid; $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid); $created = new JDate($data->created); $date = CTimeHelper::timeLapse($created); $html .= ' <li>'; $html .= ' <a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>'; $html .= '<span class="joms-block joms-text--small joms-text--light">' . $date . '</span>'; $html .= ' </li>'; } $html .= '</ul>'; $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles'); $html .= "<div class='joms-gap'></div><div class='list-articles--button'><small><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></small></div>"; $html .= '</div>'; } else { $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>"; } return $html; }
public function getLastUpdated($raw = false) { $this->_lastupdated = $this->created; if ($raw) { return $this->_lastupdated; } if ($this->_lastupdated == '0000-00-00 00:00:00' || $this->_lastupdated == '') { $this->_lastupdated = $this->created; if ($this->_lastupdated == '' || $this->_lastupdated == '0000-00-00 00:00:00') { $this->_lastupdated = JText::_('COM_COMMUNITY_NO_LAST_ACTIVITY'); } else { $lastUpdated = new JDate($this->_lastupdated); //$this->_lastupdated = CActivityStream::_createdLapse( $lastUpdated, false ); $this->_lastupdated = CTimeHelper::timeLapse($lastUpdated); } } else { $lastUpdated = new JDate($this->_lastupdated); //$this->_lastupdated = CActivityStream::_createdLapse( $lastUpdated, false ); $this->_lastupdated = CTimeHelper::timeLapse($lastUpdated); } return $this->_lastupdated; }
/** * View method to display specific discussion from a group * @since 2.4 * @access public * @param Object Data object passed from controller */ public function viewdiscussion() { $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $jconfig = JFactory::getConfig(); $config = CFactory::getConfig(); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); // Get necessary variables CFactory::load('models', 'groups'); CFactory::load('models', 'discussions'); $my = CFactory::getUser(); $groupId = JRequest::getInt('groupid', '', 'GET'); $topicId = JRequest::getInt('topicid', '', 'GET'); // Load necessary library and objects $groupModel = CFactory::getModel('groups'); $group =& JTable::getInstance('Group', 'CTable'); $discussion =& JTable::getInstance('Discussion', 'CTable'); $group->load($groupId); $discussion->load($topicId); $isBanned = $group->isBanned($my->id); $document->addCustomTag('<link rel="image_src" href="' . $group->getThumbAvatar() . '" />'); // @rule: Test if the group is unpublished, don't display it at all. if (!$group->published) { $this->_redirectUnpublishGroup(); return; } $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussion&topicid=' . $topicId . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_GROUPS_LATEST_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); CFactory::load('helpers', 'owner'); if ($group->approvals == 1 && !$group->isMember($my->id) && !COwnerHelper::isCommunityAdmin()) { $this->noAccess(JText::_('COM_COMMUNITY_GROUPS_PRIVATE_NOTICE')); return; } // Execute discussion onDisplay filter $appsLib =& CAppPlugins::getInstance(); $appsLib->loadApplications(); $args = array(); $args[] =& $discussion; $appsLib->triggerEvent('onDiscussionDisplay', $args); // Get the discussion creator info $creator = CFactory::getUser($discussion->creator); // Format the date accordingly. //$discussion->created = CTimeHelper::getDate( $discussion->created ); $dayinterval = ACTIVITY_INTERVAL_DAY; $timeFormat = $config->get('activitiestimeformat'); $dayFormat = $config->get('activitiesdayformat'); if ($config->get('activitydateformat') == COMMUNITY_DATE_FIXED) { $discussion->created = CTimeHelper::getDate($discussion->created)->toFormat(JText::_('DATE_FORMAT_LC2'), true); } else { $discussion->created = CTimeHelper::timeLapse(CTimeHelper::getDate($discussion->created)); } // Set page title $document->setTitle(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title)); // Add pathways $this->_addGroupInPathway($group->id); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION'), CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussions&groupid=' . $group->id)); $this->addPathway(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title)); CFactory::load('helpers', 'owner'); $isGroupAdmin = $groupModel->isAdmin($my->id, $group->id); if ($my->id == $creator->id || $isGroupAdmin || COwnerHelper::isCommunityAdmin()) { $title = JText::_('COM_COMMUNITY_DELETE_DISCUSSION'); $titleLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK_DISCUSSION') : JText::_('COM_COMMUNITY_LOCK_DISCUSSION'); $actionLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK') : JText::_('COM_COMMUNITY_LOCK'); $this->addSubmenuItem('', $actionLock, "joms.groups.lockTopic('" . $titleLock . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.groups.removeTopic('" . $title . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT); $this->addSubmenuItem('index.php?option=com_community&view=groups&task=editdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id, JText::_('COM_COMMUNITY_EDIT'), '', SUBMENU_RIGHT); } $this->showSubmenu(); CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('discussions', $discussion->id, $isGroupAdmin, $jconfig->get('list_limit'), 0, 'wall.content', 'groups,discussion'); $wallCount = CWallLibrary::getWallCount('discussions', $discussion->id); $viewAllLink = CRoute::_('index.php?option=com_community&view=groups&task=discussapp&topicid=' . $discussion->id . '&app=walls'); $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); // Test if the current browser is a member of the group $isMember = $group->isMember($my->id); $waitingApproval = false; // If I have tried to join this group, but not yet approved, display a notice if ($groupModel->isWaitingAuthorization($my->id, $group->id)) { $waitingApproval = true; } $wallForm = ''; $config = CFactory::getConfig(); // Only get the wall form if user is really allowed to see it. if (!$config->get('lockgroupwalls') || $config->get('lockgroupwalls') && $isMember && !$isBanned && !$waitingApproval || COwnerHelper::isCommunityAdmin()) { $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>'; $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply'); $wallForm = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>'; $wallForm .= $discussion->lock ? $outputLock : $outputUnLock; } if (empty($wallForm)) { //user must join in order to see this page $tmpl = new CTemplate(); $wallForm = $tmpl->set('groupid', $groupId)->fetch('groups.joingroup'); $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>'; $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply'); $wallForm2 = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>'; $wallForm2 .= $discussion->lock ? $outputLock : $outputUnLock; $wallForm = $wallForm . '<div style="display:none" class="reply-form">' . $wallForm2 . '</div>'; } $config = CFactory::getConfig(); // Get creator link $creatorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $creator->id); // Get reporting html CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION_REPORT'), 'groups,reportDiscussion', array($discussion->id)); CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id)); $bookmarksHTML = $bookmarks->getHTML(); $tmpl = new CTemplate(); echo $tmpl->set('bookmarksHTML', $bookmarksHTML)->set('discussion', $discussion)->set('creator', $creator)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('creatorLink', $creatorLink)->set('reportHTML', $reportHTML)->set('groupid', $groupId)->fetch('groups.viewdiscussion'); }
/** * Method to get the last update * * @return type */ public function getLastUpdate() { // If new albums that has just been created and // does not contain any images, the lastupdated will always be 0000-00-00 00:00:00:00 // Try to use the albums creation date instead. if ($this->lastupdated == '0000-00-00 00:00:00' || $this->lastupdated == '') { $lastupdated = $this->created; if ($this->lastupdated == '' || $this->lastupdated == '0000-00-00 00:00:00') { $lastupdated = JText::_('COM_COMMUNITY_PHOTOS_NO_ACTIVITY'); } else { $lastUpdated = new JDate($this->lastupdated); $lastupdated = CTimeHelper::timeLapse($lastUpdated, false); } } else { $lastUpdated = new JDate($this->lastupdated); $lastupdated = CTimeHelper::timeLapse($lastUpdated, false); } return $lastupdated; }
/** * @since 2.6 * @param user id * @return array of the latest group announcement the user is in */ public function getGroupAnnouncementUpdate($userid, $limit = 3) { $userGroups = $this->getGroupIds($userid); $albumsDetails = array(); if ($limit > 0) { $extraSQL = ' LIMIT ' . $limit; } if (count($userGroups) > 0) { $db = $this->getDBO(); $groups_id = implode(',', $userGroups); $query = 'SELECT b.*, g.name AS group_name FROM ' . $db->quoteName('#__community_groups_bulletins') . ' AS b, ' . $db->quoteName('#__community_groups') . ' AS g WHERE b.groupid IN (' . $groups_id . ' ) AND g.id=b.groupid ORDER BY b.id DESC ' . $extraSQL; $db->setQuery($query); $announcements = $db->loadAssocList(); foreach ($announcements as &$announcement) { //grouplink $announcement['group_link'] = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $announcement['groupid']); $announcement['announcement_link'] = CRoute::_('index.php?option=com_community&view=groups&task=viewbulletin&groupid=' . $announcement['groupid'] . '&bulletinid=' . $announcement['id']); $date = CTimeHelper::getDate($announcement['date']); $announcement['created_interval'] = CTimeHelper::timeLapse($date); $announcement['user_avatar'] = CFactory::getUser($announcement['created_by'])->getThumbAvatar(); $announcement['user_name'] = CFactory::getUser($announcement['created_by'])->getName(); } } return $announcements; }
/** * Popup message notification */ public function ajaxGetInbox() { $objResponse = new JAXResponse(); $inboxModel = CFactory::getModel('inbox'); $messages = $inboxModel->getInbox(false); // format for template $data = array(); foreach ($messages as $row) { $user = CFactory::getUser($row->from); $obj = new stdClass(); $obj->user = $user; $obj->title = $row->subject; $obj->link = CRoute::_('index.php?option=com_community&view=inbox&task=read&msgid=' . $row->parent); $obj->created = CTimeHelper::timeLapse(CTimeHelper::getDate($row->posted_on)); $obj->action = null; $data[] = $obj; } $tmpl = new CTemplate(); $html = $tmpl->set('notifications', $data)->set('link', CRoute::_('index.php?option=com_community&view=inbox'))->set('link_text', JText::_('COM_COMMUNITY_NOTIFICATIONS_SHOW_ALL_MSG'))->set('empty_notice', JText::_('COM_COMMUNITY_NOTIFICATIONS_NO_MESSAGE'))->fetch('notification.list'); $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_MESSAGE')); $objResponse->addScriptCall('cWindowAddContent', $html); return $objResponse->sendResponse(); }
/** * Return formatted comment given the wall item */ public static function formatComment($wall) { $config = CFactory::getConfig(); $my = CFactory::getUser(); $actModel = CFactory::getModel('activities'); $like = new CLike(); $likeCount = $like->getLikeCount('comment', $wall->id); $isLiked = $like->userLiked('comment', $wall->id, $my->id); $user = CFactory::getUser($wall->post_by); // Censor if the user is banned if ($user->block) { $wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED'); } else { // strip out the comment data $CComment = new CComment(); $wall->comment = $CComment->stripCommentData($wall->comment); // Need to perform basic formatting here // 1. support nl to br, // 2. auto-link text $CTemplate = new CTemplate(); $wall->comment = $origComment = $CTemplate->escape($wall->comment); $wall->comment = CStringHelper::autoLink($wall->comment); } $commentsHTML = ''; $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>'; $date = new JDate($wall->date); $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> '; $commentsHTML .= $wall->comment; $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date); $cid = isset($wall->contentid) ? $wall->contentid : null; $activity = $actModel->getActivity($cid); $ownPost = $my->id == $wall->post_by; $allowRemove = $my->authorise('community.delete', 'walls', $wall); $canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin(); // only poster can edit if ($allowRemove) { $commentsHTML .= ' <span class="wall-coc-remove-link">• <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>'; } $commentsHTML .= '</span>'; $commentsHTML .= '</div>'; $editHTML = ''; if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) { $editHTML .= '<a href="javascript:" class="joms-button--edit">'; $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>'; $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>'; $editHTML .= '</a>'; } $removeHTML = ''; if ($allowRemove) { $removeHTML .= '<a href="javascript:" class="joms-button--remove">'; $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>'; $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>'; $removeHTML .= '</a>'; } $removeTagHTML = ''; if (CActivitiesHelper::hasTag($my->id, $wall->comment)) { $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>'; } /* user deleted */ if ($user->guest == 1) { $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> '; } else { $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> '; } $params = $wall->params; $paramsHTML = ''; $image = (array) $params->get('image'); $photoThumbnail = false; if ($params->get('attached_photo_id') > 0) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($params->get('attached_photo_id')); $photoThumbnail = $photo->getThumbURI(); $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>'; } else { if ($params->get('title')) { $video = self::detectVideo($params->get('url')); if (is_object($video)) { $paramsHTML .= '<div class="joms-media--video joms-js--video"'; $paramsHTML .= ' data-type="' . $video->type . '"'; $paramsHTML .= ' data-id="' . $video->id . '"'; $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"'; $paramsHTML .= ' style="margin-top:10px;">'; $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<img src="' . $video->getThumbnail() . '">'; $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">'; $paramsHTML .= '<div class="mejs-overlay-button"></div>'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>'; $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>'; $paramsHTML .= '</div>'; $paramsHTML .= '</div>'; } else { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">'; if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) { $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>'; } if ($params->get('image')) { $paramsHTML .= $params->get('link'); $paramsHTML .= '<div class="joms-media__thumbnail">'; $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">'; $paramsHTML .= '<img src="' . array_shift($image) . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $url = $params->get('url') ? $params->get('url') : '#'; $paramsHTML .= '<div class="joms-media__body">'; $paramsHTML .= '<a href="' . $url . '">'; $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>'; $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>'; if ($params->get('link')) { $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>'; } $paramsHTML .= '</a></div></div>'; } } } if (!$params->get('title') && $params->get('url')) { $paramsHTML .= '<div class="joms-gap"></div>'; $paramsHTML .= '<div class="joms-media--album">'; $paramsHTML .= '<a href="' . $params->get('url') . '">'; $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />'; $paramsHTML .= '</a>'; $paramsHTML .= '</div>'; } $wall->comment = nl2br($wall->comment); $wall->comment = CUserHelper::replaceAliasURL($wall->comment); $wall->comment = CStringHelper::getEmoticon($wall->comment); $wall->comment = CStringHelper::converttagtolink($wall->comment); // convert to hashtag $template = new CTemplate(); $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML); $commentsHTML = $template->fetch('stream/single-comment'); return $commentsHTML; }
echo JText::_('COM_COMMUNITY_INBOX_REMOVE'); ?> </span> </a> </div> <div class="joms-list--message__checkbox js-mail-checkbox"> <span> <input type="checkbox" class="joms-checkbox" name="message[]" value="<?php echo $message->id; ?> " onclick="checkSelected();"> </span> </div> <small class="joms-list--message__time"> <?php $postdate = CTimeHelper::timeLapse(CTimeHelper::getDate($message->posted_on)); echo $postdate; ?> <svg class="joms-icon" viewBox="0 0 16 16"> <use xlink:href="<?php echo CRoute::getURI(); ?> #joms-icon-clock"/> </svg> </small> </div> <?php } ?> </div>
/** * Return create time formatted by follow configured * @return string */ public function getCreateTimeFormatted() { $config = CFactory::getConfig(); $date = JFactory::getDate($this->get('created')); if ($config->get('activitydateformat') == "lapse") { $createdTime = CTimeHelper::timeLapse($date, false); } else { $createdTime = $date->format($config->get('profileDateFormat')); } return $createdTime; }
<img src="<?php echo $user->getThumbAvatar(); ?> " alt="<?php echo $user->getDisplayName(); ?> " data-author="<?php echo $user->id; ?> " /> </a> </div> <div class="joms-stream__meta"> <div class="joms-stream__time"> <small><?php echo CTimeHelper::timeLapse(CTimeHelper::getDate($row->created)); ?> </small> </div> </div> </div> <div class="joms-stream__body"> <div class="cStream-Headline"><?php $content = CContentHelper::injectTags($row->content, $row->params, true); if ($isPhotoModal && $row->cmd_type == 'notif_photos_like') { preg_match_all('/(albumid|photoid)=(\\d+)/', $content, $matches); // Get albumid and photoid. $albumid = false; $photoid = false; foreach ($matches[1] as $index => $varname) { if ($varname == 'albumid') {
public static function _getKunenaHTML($usr_info, $userId, $userName, $items, $fbItemid) { ob_start(); if ($usr_info) { if (!empty($items)) { ?> <div id="applications-kunena"> <?php foreach ($items as $item) { $fbURL = JRoute::_("index.php?option=com_kunena&func=view" . $fbItemid . "&catid=" . $item->catid . "&id=" . $item->id . "#" . $item->id); $fbCatURL = JRoute::_("index.php?option=com_kunena" . $fbItemid . "&func=showcat&catid=" . $item->catid); $postDate = new JDate($item->time); ?> <div class="apps-item"> <b> <a href="<?php echo $fbURL; ?> " class="apps-headline"><?php echo stripslashes($item->subject); ?> </a> </b> in <a href="<?php echo $fbCatURL; ?> "><?php echo $item->catname; ?> </a> on <?php echo CTimeHelper::timeLapse($postDate, false); ?> </div> <?php } ?> </div> <?php } else { ?> <div class="icon-nopost"> <img src="<?php echo JURI::base(); ?> plugins/community/kunena/kunena/no-post.gif" alt=""/> </div> <div class="content-nopost"> <?php echo $userName . ' ' . JText::_('PLG_KUNENA_NO_DISCUSSION_JOIN'); ?> </div> <?php } } else { ?> <div class="icon-nopost"> <img src="<?php echo JURI::base(); ?> plugins/community/kunena/kunena/no-post.gif" alt=""/> </div> <div class="content-nopost"> <?php echo JText::_('PLG_KUNENA_NO_FORUM_POST'); ?> </div> <?php } $contents = ob_get_contents(); ob_end_clean(); return $contents; }
<div class="body"> <div class="name"> <a href="<?php echo JURI::root() . '/administrator/index.php?option=com_community&view=users&layout=edit&id=' . $member->id; ?> "><?php echo $member->getDisplayName(); ?> </a> </div> <div class="time"> <i class="js-icon-time"></i> <span class="green"><?php echo CTimeHelper::timeLapse(JFactory::getDate($member->registerDate)); ?> </span> </div> <div id="member-label-<?php echo $member->id; ?> "> <span class="label <?php echo $this->getLabelCss($member->memberstatus); ?> "><?php echo $member->memberstatus; ?> </span>
</a> </div> <?php } else { if ($paramsHTML) { ?> <?php echo $paramsHTML; ?> <?php } } ?> <span class="joms-comment__time"><small><?php echo CTimeHelper::timeLapse($date); ?> </small></span> <div class="joms-comment__actions joms-js--comment-actions"> <?php // this is for like button if ($my->id) { if ($isLiked != COMMUNITY_LIKE) { ?> <a class="joms-button--liked" href="javascript:" onclick="joms.api.commentLike('<?php echo $wall->id; ?> ');" data-lang-like="<?php
/** * Return an array of activity data */ function _getData($actor, $target, $date = null, $maxEntry = 20, $type = '', $exclusions = null, $displayArchived = false) { $activities = CFactory::getModel('activities'); $appModel = CFactory::getModel('apps'); $html = ''; $numLines = 0; $my = CFactory::getUser(); $actorId = $actor; $htmlData = array(); $config = CFactory::getConfig(); //Get blocked list $model = CFactory::getModel('block'); $blockLists = $model->getBanList($my->id); $blockedUserId = array(); foreach ($blockLists as $blocklist) { $blockedUserId[] = $blocklist->blocked_userid; } // Exclude banned userid if (!empty($target) && !empty($blockedUserId)) { $target = array_diff($target, $blockedUserId); } if (!empty($type)) { $rows = $activities->getAppActivities($type, $actor, $maxEntry, $config->get('respectactivityprivacy'), $exclusions, $displayArchived); } else { $rows = $activities->getActivities($actor, $target, $date, $maxEntry, $config->get('respectactivityprivacy'), $exclusions, $displayArchived); } $day = -1; // Initialize exclusions variables. $exclusions = is_array($exclusions) ? $exclusions : array(); // If exclusion is set, we need to remove activities that arrives // after the exclusion list is set. $maxExclude = null; if (count($exclusions) > 0) { $maxExclude = max($exclusions); } // Inject additional properties for processing for ($i = 0; $i < count($rows); $i++) { $row =& $rows[$i]; // A 'used' activities = activities that has been aggregated $row->used = false; // If the id is larger than any of the exclusion list, // we simply hide it if (!empty($maxExclude) && $row->id > $maxExclude) { $row->used = true; } } $dayinterval = ACTIVITY_INTERVAL_DAY; $lastTitle = ''; for ($i = 0; $i < count($rows) && count($htmlData) <= $maxEntry; $i++) { $row = $rows[$i]; $oRow =& $rows[$i]; // store aggregated activities $oRow->activities = array(); if (!$row->used && count($htmlData) <= $maxEntry) { $oRow =& $rows[$i]; if (!isset($row->used)) { $row->used = false; } if ($day != $row->daydiff) { $act = new stdClass(); $act->type = 'content'; $day = $row->daydiff; if ($day == 0) { $act->title = JText::_('TODAY'); } else { if ($day == 1) { $act->title = JText::_('CC YESTERDAY'); } else { if ($day < 7) { $act->title = JText::sprintf('CC DAYS AGO', $day); } else { if ($day >= 7 && $day < 30) { $dayinterval = ACTIVITY_INTERVAL_WEEK; $act->title = intval($day / $dayinterval) == 1 ? JText::_('CC WEEK AGO') : JText::sprintf('CC WEEKS AGO', intval($day / $dayinterval)); } else { if ($day >= 30) { $dayinterval = ACTIVITY_INTERVAL_MONTH; $act->title = intval($day / $dayinterval) == 1 ? JText::_('CC MONTH AGO') : JText::sprintf('CC MONTHS AGO', intval($day / $dayinterval)); } } } } } // set to a new 'title' type if this new one has a new title // only add if this is a new title if ($act->title != $lastTitle) { $lastTitle = $act->title; $act->type = 'title'; $htmlData[] = $act; } } $act = new stdClass(); $act->type = 'content'; $title = $row->title; $app = $row->app; $cid = $row->cid; $actor = $row->actor; for ($j = $i; $j < count($rows) && $row->daydiff == $day; $j++) { $row = $rows[$j]; // we aggregate stream that has the same content on the same day. // we should not however aggregate content that does not support // multiple content. How do we detect? easy, they don't have // {multiple} in the title string // However, if the activity is from the same user, we only want // to show the laste acitivity if ($row->daydiff == $day && $row->title == $title && $app == $row->app && $cid == $row->cid && (JString::strpos($row->title, '{/multiple}') !== FALSE || $row->actor == $actor)) { // @rule: If an exclusion is added, we need to fetch activities without these items. // Aggregated activities should also be excluded. $exclusions[] = $row->id; $row->used = true; $oRow->activities[] = $row; } } $app = !empty($oRow->app) ? $this->_appLink($oRow->app, $oRow->actor, $oRow->target) : ''; $oRow->title = JString::str_ireplace('{app}', $app, $oRow->title); $favicon = ''; // this should not really be empty if (!empty($oRow->app)) { // check if the image icon exist in template folder if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'templates' . DS . $config->get('template') . DS . 'images' . DS . 'favicon' . DS . $oRow->app . '.png')) { $favicon = JURI::root() . 'components/com_community/templates/' . $config->get('template') . '/images/favicon/' . $oRow->app . '.png'; } else { // check if the image icon exist in asset folder if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'assets' . DS . 'favicon' . DS . $oRow->app . '.png')) { $favicon = JURI::root() . 'components/com_community/assets/favicon/' . $oRow->app . '.png'; } elseif (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'plugins' . DS . 'community' . DS . $oRow->app . DS . 'favicon.png')) { $favicon = JURI::root() . 'plugins/community/' . $oRow->app . '/favicon.png'; } else { $favicon = JURI::root() . 'components/com_community/assets/favicon/default.png'; } } } else { $favicon = JURI::root() . 'components/com_community/assets/favicon/default.png'; } $act->favicon = $favicon; $target = $this->_targetLink($oRow->target, true); $oRow->title = JString::str_ireplace('{target}', $target, $oRow->title); if (count($oRow->activities) > 0) { // multiple $actorsLink = ''; foreach ($oRow->activities as $actor) { if (empty($actorsLink)) { $actorsLink = $this->_actorLink(intval($actor->actor)); } else { // only add if this actor is NOT already linked $alink = $this->_actorLink(intval($actor->actor)); $pos = strpos($actorsLink, $alink); if ($pos === false) { $actorsLink .= ', ' . $alink; } } } $actorLink = $this->_actorLink(intval($oRow->actor)); $count = count($oRow->activities); $oRow->title = preg_replace('/\\{single\\}(.*?)\\{\\/single\\}/i', '', $oRow->title); $search = array('{multiple}', '{/multiple}'); $oRow->title = JString::str_ireplace($search, '', $oRow->title); $oRow->title = JString::str_ireplace('{actors}', $actorsLink, $oRow->title); $oRow->title = JString::str_ireplace('{actor}', $actorLink, $oRow->title); $oRow->title = JString::str_ireplace('{count}', $count, $oRow->title); } else { // single $actorLink = $this->_actorLink(intval($oRow->actor)); $oRow->title = preg_replace('/\\{multiple\\}(.*)\\{\\/multiple\\}/i', '', $oRow->title); $search = array('{single}', '{/single}'); $oRow->title = JString::str_ireplace($search, '', $oRow->title); $oRow->title = JString::str_ireplace('{actor}', $actorLink, $oRow->title); } // @rule: If an exclusion is added, we need to fetch activities without these items. // Compile exclusion lists. $exclusions[] = $oRow->id; // If the param contains any data, replace it with the content preg_match_all("/{(.*?)}/", $oRow->title, $matches, PREG_SET_ORDER); if (!empty($matches)) { $params = new JParameter($oRow->params); foreach ($matches as $val) { $replaceWith = $params->get($val[1], null); //if the replacement start with 'index.php', we can CRoute it if (strpos($replaceWith, 'index.php') === 0) { $replaceWith = CRoute::_($replaceWith); } if (!is_null($replaceWith)) { $oRow->title = JString::str_ireplace($val[0], $replaceWith, $oRow->title); } } } $act->id = $oRow->id; $act->title = $oRow->title; $act->actor = $oRow->actor; $act->content = $this->getActivityContent($oRow); $timeFormat = $config->get('activitiestimeformat'); $dayFormat = $config->get('activitiesdayformat'); $date = CTimeHelper::getDate($oRow->created); $createdTime = ''; if ($config->get('activitydateformat') == COMMUNITY_DATE_FIXED) { $createdTime = $date->toFormat($dayinterval == ACTIVITY_INTERVAL_DAY ? $timeFormat : $dayFormat); } else { $createdTime = CTimeHelper::timeLapse($date); } $act->created = $createdTime; $act->createdDate = $date->toFormat(JText::_('DATE_FORMAT_LC2')); $act->app = $oRow->app; $htmlData[] = $act; } } $objActivity = new stdClass(); $objActivity->data = $htmlData; $objActivity->exclusions = empty($htmlData) ? false : implode(',', $exclusions); return $objActivity; }
/** * Return formatted comment given the wall item */ public static function formatComment($wall) { CFactory::load('helpers', 'owner'); $my = CFactory::getUser(); // Save processing time if (!$wall->comment) { return ''; } // strip out the comment data CFactory::load('libraries', 'comment'); $wall->comment = CComment::stripCommentData($wall->comment); // Need to perform basic formatting here // 1. support nl to br, // 2. auto-link text CFactory::load('helpers', 'linkgenerator'); $wall->comment = CTemplate::escape($wall->comment); $wall->comment = CLinkGeneratorHelper::replaceURL($wall->comment); $wall->comment = nl2br($wall->comment); CFactory::load('helpers', 'time'); $user = CFactory::getUser($wall->post_by); $commentsHTML = ''; $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>'; $date = new JDate($wall->date); $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> '; $commentsHTML .= $wall->comment; $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date); // Only site admin, or wall author can remove it // @todo: the target stream activity should also be able to delete it if (COwnerHelper::isCommunityAdmin() || $my->id == $wall->post_by) { $commentsHTML .= ' <span class="wall-coc-remove-link">• <a onclick="joms.miniwall.remove(' . $wall->id . ');" href="#removeThisComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>'; } $commentsHTML .= '</span>'; $commentsHTML .= '</div>'; return $commentsHTML; }
private function getPhotoInfoHeader($photo) { $date = CTimeHelper::getDate($photo->created); $config = CFactory::getConfig(); $creator = CFactory::getUser($photo->creator); if ($config->get('activitydateformat') == 'lapse') { $created = CTimeHelper::timeLapse($date); } else { $created = $date->Format(JText::_('DATE_FORMAT_LC2')); } $userThumb = CUserHelper::getThumb($creator->id, 'avatar'); $caption = $photo->caption; $template = new CTemplate(); return $template->set('creator', $creator)->set('permission', $photo->permissions)->set('created', $created)->set('userThumb', $userThumb)->set('caption', $caption)->fetch('wall/info'); }
/** * Return an array of activity data * * @param mixed $type string or arrayn or string */ private function _getData($options) { $dispatcher =& CDispatcher::getInstanceStatic(); $observers =& $dispatcher->getObservers(); $plgObj = false; for ($i = 0; $i < count($observers); $i++) { if ($observers[$i] instanceof plgCommunityWordfilter) { $plgObj = $observers[$i]; } } // Default params $default = array('actor' => 0, 'target' => 0, 'date' => null, 'app' => null, 'cid' => null, 'groupid' => null, 'eventid' => null, 'maxList' => 20, 'type' => '', 'exclusions' => null, 'displayArchived' => false); $options = array_merge($default, $options); extract($options); CFactory::load('libraries', 'mapping'); CFactory::load('libraries', 'wall'); CFactory::load('libraries', 'groups'); CFactory::load('libraries', 'events'); CFactory::load('helpers', 'friends'); $activities = CFactory::getModel('activities'); $appModel = CFactory::getModel('apps'); $html = ''; $numLines = 0; $my = CFactory::getUser(); $actorId = $actor; $htmlData = array(); $config = CFactory::getConfig(); //Get blocked list $model = CFactory::getModel('block'); $blockLists = $model->getBanList($my->id); $blockedUserId = array(); foreach ($blockLists as $blocklist) { $blockedUserId[] = $blocklist->blocked_userid; } // Exclude banned userid if (!empty($target) && !empty($blockedUserId)) { $target = array_diff($target, $blockedUserId); } if (!empty($app)) { $rows = $activities->getAppActivities($options); } else { $rows = $activities->getActivities($actor, $target, $date, $maxList, $config->get('respectactivityprivacy'), $exclusions, $displayArchived); } $day = -1; // If exclusion is set, we need to remove activities that arrives // after the exclusion list is set. // Inject additional properties for processing for ($i = 0; $i < count($rows); $i++) { $row =& $rows[$i]; // A 'used' activities = activities that has been aggregated $row->used = false; // If the id is larger than any of the exclusion list, // we simply hide it if (isset($exclusion) && $exclusion > 0 && $row->id > $exclusions) { $row->used = true; } } unset($row); $dayinterval = ACTIVITY_INTERVAL_DAY; $lastTitle = ''; // Experimental Viewer Sensitive Profile Status $viewer = CFactory::getUser()->id; $view = JRequest::getCmd('view'); foreach ($rows as $row) { /* if ($row->app=='profile') { // strip off {actor} and {target} from the previous format $row->title = CString::str_ireplace('{actor} to {target}', '', $row->title); $row->title = CString::str_ireplace('{actor}', '', $row->title); $row->title = CString::str_ireplace('{target}', '', $row->title); // self-post status and status from other on viewer's profile - don't display target // @todo: this really need to go to the template instead $titleString = ($row->actor == $row->target || $row->target == 0 ) ? '{actor}' : '{actor} <span class="com_icons com_icons12 com_icons-inline com_icons-rarr">»</span> {target}'; $titleString = '<div class="newsfeed-content-actor">'.$titleString. '</div>%1$s'; $row->title = JText::sprintf($titleString,$row->title); } */ if ($row->app == 'events.wall' || $row->app == 'groups.wall') { //add actor //$row->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_STATUS_MESSAGE',$row->title); } } for ($i = 0; $i < count($rows) && count($htmlData) <= $maxList; $i++) { $row = $rows[$i]; $oRow =& $rows[$i]; // The original object // store aggregated activities $oRow->activities = array(); if (!$row->used && count($htmlData) <= $maxList) { $oRow =& $rows[$i]; if (!isset($row->used)) { $row->used = false; } if ($day != $row->getDayDiff()) { $act = new stdClass(); $act->type = 'content'; $day = $row->getDayDiff(); if ($day == 0) { $act->title = JText::_('TODAY'); } else { if ($day == 1) { $act->title = JText::_('COM_COMMUNITY_ACTIVITIES_YESTERDAY'); } else { if ($day < 7) { $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_DAYS_AGO', $day); } else { if ($day >= 7 && $day < 30) { $dayinterval = ACTIVITY_INTERVAL_WEEK; $act->title = intval($day / $dayinterval) == 1 ? JText::_('COM_COMMUNITY_ACTIVITIES_WEEK_AGO') : JText::sprintf('COM_COMMUNITY_ACTIVITIES_WEEK_AGO_MANY', intval($day / $dayinterval)); } else { if ($day >= 30) { $dayinterval = ACTIVITY_INTERVAL_MONTH; $act->title = intval($day / $dayinterval) == 1 ? JText::_('COM_COMMUNITY_ACTIVITIES_MONTH_AGO') : JText::sprintf('COM_COMMUNITY_ACTIVITIES_MONTH_AGO_MANY', intval($day / $dayinterval)); } } } } } // set to a new 'title' type if this new one has a new title // only add if this is a new title if ($act->title != $lastTitle) { $lastTitle = $act->title; $act->type = 'title'; $htmlData[] = $act; } } $act = new stdClass(); $act->type = 'content'; // Set to compact view if necessary // This method is a bit crude, but we have no other reliable data // to choose which will go to compact view // Attend an event $act->compactView = !(strpos($oRow->params, 'action=events.attendence.attend') === FALSE); $act->compactView = $act->compactView || !(strpos($oRow->params, '"action":"events.attendence.attend"') === FALSE); // Create an event $act->compactView = $act->compactView || !(strpos($oRow->params, 'action=events.create') === FALSE); $act->compactView = $act->compactView || !(strpos($oRow->params, '"action":"events.create"') === FALSE); // Update/join group $act->compactView = $act->compactView || $oRow->app == 'groups' && empty($oRow->content); // Add as friend $act->compactView = $act->compactView || $oRow->app == 'friends'; // Add/Remove app. This is tricky since string is hard-coded // and no other info is available $act->compactView = $act->compactView || $oRow->title == JText::_('COM_COMMUNITY_ACTIVITIES_APPLICATIONS_ADDED'); // Feature a user $act->compactView = $act->compactView || $oRow->app == 'users'; $title = $row->title; $app = $row->app; $cid = $row->cid; $actor = $row->actor; //Check for event or group title if exists if ($row->eventid) { $eventModel = CFactory::getModel('events'); $act->appTitle = $eventModel->getTitle($row->eventid); } else { if ($row->groupid) { $groupModel = CFactory::getModel('groups'); $act->appTitle = $groupModel->getGroupName($row->groupid); } } for ($j = $i; $j < count($rows) && $row->getDayDiff() == $day; $j++) { $row = $rows[$j]; // we aggregate stream that has the same content on the same day. // we should not however aggregate content that does not support // multiple content. How do we detect? easy, they don't have // {multiple} in the title string // However, if the activity is from the same user, we only want // to show the laste acitivity if ($row->getDayDiff() == $day && $row->title == $title && $app == $row->app && $cid == $row->cid && (JString::strpos($row->title, '{/multiple}') !== FALSE || $row->actor == $actor)) { // @rule: If an exclusion is added, we need to fetch activities without these items. // Aggregated activities should also be excluded. $row->used = true; $oRow->activities[] = $row; } } $app = !empty($oRow->app) ? $this->_appLink($oRow->app, $oRow->actor, $oRow->target, $oRow->title) : ''; $oRow->title = CString::str_ireplace('{app}', $app, $oRow->title); $favicon = ''; // this should not really be empty if (!empty($oRow->app)) { // Favicon override with group image for known group stream data //if(in_array($oRow->app, CGroups::getStreamAppCode())){ if ($oRow->groupid) { // check if the image icon exist in template folder $favicon = JURI::root() . 'components/com_community/assets/favicon/groups.png'; if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'templates' . DS . $config->get('template') . DS . 'images' . DS . 'favicon' . DS . 'groups.png')) { $favicon = JURI::root() . 'components/com_community/templates/' . $config->get('template') . '/images/favicon/groups.png'; } } // Favicon override with event image for known event stream data // This would override group favicon if ($oRow->eventid) { // check if the image icon exist in template folder $favicon = JURI::root() . 'components/com_community/assets/favicon/events.png'; if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'templates' . DS . $config->get('template') . DS . 'images' . DS . 'favicon' . DS . 'groups.png')) { $favicon = JURI::root() . 'components/com_community/templates/' . $config->get('template') . '/images/favicon/events.png'; } } // If it is not group or event stream, use normal favicon search if (!($oRow->groupid || $oRow->eventid)) { // check if the image icon exist in template folder if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'templates' . DS . $config->get('template') . DS . 'images' . DS . 'favicon' . DS . $oRow->app . '.png')) { $favicon = JURI::root() . 'components/com_community/templates/' . $config->get('template') . '/images/favicon/' . $oRow->app . '.png'; } else { // check if the image icon exist in asset folder if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'assets' . DS . 'favicon' . DS . $oRow->app . '.png')) { $favicon = JURI::root() . 'components/com_community/assets/favicon/' . $oRow->app . '.png'; } elseif (JFile::exists(CPluginHelper::getPluginPath('community', $oRow->app) . DS . $oRow->app . DS . 'favicon.png')) { $favicon = JURI::root() . CPluginHelper::getPluginURI('community', $oRow->app) . '/' . $oRow->app . '/favicon.png'; } else { $favicon = JURI::root() . 'components/com_community/assets/favicon/default.png'; } } } } else { $favicon = JURI::root() . 'components/com_community/assets/favicon/default.png'; } $act->favicon = $favicon; $target = $this->_targetLink($oRow->target, true); $oRow->title = CString::str_ireplace('{target}', $target, $oRow->title); if (count($oRow->activities) > 1) { // multiple $actorsLink = ''; foreach ($oRow->activities as $actor) { if (empty($actorsLink)) { $actorsLink = $this->_actorLink(intval($actor->actor)); } else { // only add if this actor is NOT already linked $alink = $this->_actorLink(intval($actor->actor)); $pos = strpos($actorsLink, $alink); if ($pos === false) { $actorsLink .= ', ' . $alink; } } } $actorLink = $this->_actorLink(intval($oRow->actor)); $count = count($oRow->activities); $oRow->title = preg_replace('/\\{single\\}(.*?)\\{\\/single\\}/i', '', $oRow->title); $search = array('{multiple}', '{/multiple}'); $oRow->title = CString::str_ireplace($search, '', $oRow->title); //Joomla 1.6 CString::str_ireplace issue of not replacing correctly strings with backslashes $oRow->title = str_ireplace($search, '', $oRow->title); $oRow->title = CString::str_ireplace('{actors}', $actorsLink, $oRow->title); $oRow->title = CString::str_ireplace('{actor}', $actorLink, $oRow->title); $oRow->title = CString::str_ireplace('{count}', $count, $oRow->title); } else { // single $actorLink = $this->_actorLink(intval($oRow->actor)); $oRow->title = preg_replace('/\\{multiple\\}(.*)\\{\\/multiple\\}/i', '', $oRow->title); $search = array('{single}', '{/single}'); $oRow->title = CString::str_ireplace($search, '', $oRow->title); $oRow->title = CString::str_ireplace('{actor}', $actorLink, $oRow->title); } // If the param contains any data, replace it with the content preg_match_all("/{(.*?)}/", $oRow->title, $matches, PREG_SET_ORDER); if (!empty($matches)) { $params = new CParameter($oRow->params); foreach ($matches as $val) { $replaceWith = $params->get($val[1], null); //if the replacement start with 'index.php', we can CRoute it if (strpos($replaceWith, 'index.php') === 0) { $replaceWith = CRoute::_($replaceWith); } if (!is_null($replaceWith)) { $oRow->title = CString::str_ireplace($val[0], $replaceWith, $oRow->title); } } } // Format the title $oRow->title = $plgObj ? $plgObj->_censor($oRow->title) : $oRow->title; $oRow->title = $this->_formatTitle($oRow); $act->id = $oRow->id; $act->title = $oRow->title; $act->actor = $oRow->actor; $act->target = $oRow->target; $act->content = $this->getActivityContent($oRow); $timeFormat = $config->get('activitiestimeformat'); $dayFormat = $config->get('activitiesdayformat'); $date = CTimeHelper::getDate($oRow->created); $createdTime = ''; if ($config->get('activitydateformat') == COMMUNITY_DATE_FIXED) { $createdTime = $date->toFormat($dayinterval == ACTIVITY_INTERVAL_DAY ? $timeFormat : $dayFormat, true); } else { $createdTime = CTimeHelper::timeLapse($date); } $act->created = $createdTime; $act->createdDate = C_JOOMLA_15 == 1 ? $date->toFormat(JText::_('DATE_FORMAT_LC2')) : $date->Format(JText::_('DATE_FORMAT_LC2')); $act->createdDateRaw = $oRow->created; $act->app = $oRow->app; $act->eventid = $oRow->eventid; $act->groupid = $oRow->groupid; $act->group_access = $oRow->group_access; $act->event_access = $oRow->event_access; $act->location = $oRow->getLocation(); $act->commentCount = $oRow->getCommentCount(); $act->commentAllowed = $oRow->allowComment(); $act->commentLast = $oRow->getLastComment(); $act->likeCount = $oRow->getLikeCount(); $act->likeAllowed = $oRow->allowLike(); $act->isFriend = $my->isFriendWith($act->actor); $act->isMyGroup = $my->isInGroup($oRow->groupid); $act->isMyEvent = $my->isInEvent($oRow->eventid); $act->userLiked = $oRow->userLiked($my->id); $htmlData[] = $act; } } $objActivity = new stdClass(); $objActivity->data = $htmlData; return $objActivity; }
public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $myblogItemId, $introtext, $params) { JPluginHelper::importPlugin('content'); $dispatcher = JDispatcher::getInstance(); $html = ""; if (!empty($row)) { $html .= '<div id="application-myarticles" class="joms-tab__app">'; $html .= '<ul class="list-articles cResetList">'; foreach ($row as $data) { $text_limit = $params->get('limit', 50); if (JString::strlen($data->introtext) > $text_limit) { $content = strip_tags(JString::substr($data->introtext, 0, $text_limit)); $content .= " ....."; } else { $content = $data->introtext; } $data->text = $content; $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0)); if (empty($data->permalink)) { $myblog = 0; $permalink = ""; } else { $myblog = 1; $permalink = $data->permalink; } if (empty($cat[$data->catid])) { $cat[$data->catid] = ""; } $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid; $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid, $myblog, $permalink, $myblogItemId); $created = new JDate($data->created); $date = CTimeHelper::timeLapse($created); $html .= ' <li>'; $html .= ' <span class="joms-text--small">' . $date . '</span>'; $html .= ' <a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>'; if ($introtext == 1) { $html .= '<p>' . $content . '</p>'; } $html .= ' </li>'; } $html .= '</ul>'; if ($app == 1) { jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $html .= ' <div class="list-articles--button"> ' . $pagination->getPagesLinks() . ' </div>'; } else { $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles'); $html .= "<div class='list-articles--button'><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></div>"; } $html .= '</div>'; } else { $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>"; } return $html; }
/** * Popup message notification */ public function ajaxGetInbox() { $inboxModel = CFactory::getModel('inbox'); //$messages = $inboxModel->getInbox(false); $messages = $inboxModel->getUnReadInbox(); // format for template $data = array(); foreach ($messages as $row) { $user = CFactory::getUser($row->from); $obj = new stdClass(); $obj->user = $user; $obj->subject = $row->subject; $obj->link = CRoute::_('index.php?option=com_community&view=inbox&task=read&msgid=' . $row->parent); $obj->created = CTimeHelper::timeLapse(CTimeHelper::getDate($row->posted_on)); $data[] = $obj; } $template = new CTemplate(); $html = $template->set('rows', $data)->fetch('notification/inbox'); $json = array('title' => JText::_('COM_COMMUNITY_MESSAGE'), 'html' => $html); die(json_encode($json)); }
$this->load('activities/videos/like'); } else { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($act->cid); // if($album->permissions == 30 && !CFriendsHelper::isConnected($my->id,$album->creator)){ // return false; // } $params = $act->params; $users = $params->get('actors'); if (!is_array($users)) { $users = array_reverse(explode(',', $users)); } $user = CFactory::getUser($users[0]); $date = JFactory::getDate($act->created); if ($config->get('activitydateformat') == "lapse") { $createdTime = CTimeHelper::timeLapse($date); } else { $createdTime = $date->format($config->get('profileDateFormat')); } $isPhotoModal = $config->get('album_mode') == 1; ?> <div class="joms-stream__header"> <div class= "joms-avatar--stream <?php echo CUserHelper::onlineIndicator($user); ?> "> <?php if (count($users) > 1 && false) { // added false for now because we have to show the last user avatar ?>
?> "> </a> </div> <div class="joms-comment__meta"> <span class="joms-comment__time"> <a href="<?php echo $authorLink; ?> "><strong><?php echo $user->getDisplayName(); ?> </strong></a> <small> <?php echo CTimeHelper::timeLapse(CTimeHelper::getDate($msg->posted_on)); ?> </small> </span> <div class="joms-js--inbox-content"> <?php $content = CUserHelper::replaceAliasURL($content); $content = filter_var(htmlspecialchars_decode($content), FILTER_UNSAFE_RAW); echo $content; ?> </div> <div> <?php if (CActivitiesHelper::hasTag($my->id, $originalContent)) { ?> <div class="joms-comment__actions">