本文整理汇总了PHP中CTimeHelper::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP CTimeHelper::getDate方法的具体用法?PHP CTimeHelper::getDate怎么用?PHP CTimeHelper::getDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTimeHelper
的用法示例。
在下文中一共展示了CTimeHelper::getDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profile
/**
* Displays the viewing profile page.
*
* @access public
* @param array An associative array to display the fields
*/
public function profile(&$data)
{
$mainframe = JFactory::getApplication();
$friendsModel = CFactory::getModel('friends');
$showfriends = JRequest::getVar('showfriends', false);
$userid = JRequest::getVar('userid', '');
$user = CFactory::getUser($userid);
$linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$document = JFactory::getDocument();
$document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
$document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
$document->setLink($linkUrl);
include_once JPATH_COMPONENT . '/libraries/activities.php';
$act = new CActivityStream();
$friendIds = $friendsModel->getFriendIds($user->id);
$friendIds = $showfriends ? $friendIds : null;
$rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
// add the avatar image
$rssImage = new JFeedImage();
$rssImage->url = $user->getThumbAvatar();
$rssImage->link = $linkUrl;
$rssImage->width = 64;
$rssImage->height = 64;
$document->image = $rssImage;
//CFactory::load( 'helpers' , 'string' );
//CFactory::load( 'helpers' , 'time' );
foreach ($rows->data as $row) {
if ($row->type != 'title') {
// Get activities link
$pattern = '/<a href=\\"(.*?)\\"/';
preg_match_all($pattern, $row->title, $matches);
// Use activity owner link when activity link is not available
if (!empty($matches[1][1])) {
$linkUrl = $matches[1][1];
} else {
if (!empty($matches[1][0])) {
$linkUrl = $matches[1][0];
}
}
// load individual item creator class
$item = new JFeedItem();
$item->title = $row->title;
$item->link = $linkUrl;
$item->description = "<img src=\"{$row->favicon}\" alt=\"\" /> " . $row->title;
$item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$pattern = '/href="(.*?)index.php/';
$replace = 'href="' . JURI::base() . 'index.php';
$string = $item->description;
$item->description = preg_replace($pattern, $replace, $string);
// loads item info into rss array
$document->addItem($item);
}
}
}
示例2: display
public function display($data = null)
{
$mainframe = JFactory::getApplication();
$config = CFactory::getConfig();
$document = JFactory::getDocument();
$document->setTitle(JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename')));
$document->setLink(CRoute::_('index.php?option=com_community'));
$my = CFactory::getUser();
CFactory::load('libraries', 'activities');
CFactory::load('helpers', 'string');
CFactory::load('helpers', 'time');
$act = new CActivityStream();
$rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
foreach ($rows->data as $row) {
if ($row->type != 'title') {
// load individual item creator class
$item = new JFeedItem();
// cannot escape the title. it's already formated. we should
// escape it during CActivityStream::add
//$item->title = CStringHelper::escape($row->title);
$item->title = $row->title;
$item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
$item->description = "<img src=\"{$row->favicon}\" alt=\"\"/> " . $row->title;
$item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
// loads item info into rss array
$document->addItem($item);
}
}
}
}
示例3: defined
<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@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');
$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')));
?>
<div class="joms-stream__body joms-stream-box">
<h4><?php
echo JText::_('COM_COMMUNITY_LAST_10_USERS_REGISTERED');
?>
</h4>
<?php
if ($totalRegistered > 0) {
?>
<div class="joms-list--block">
示例4: renderComment
public function renderComment($cmtObj)
{
$my = CFactory::getUser();
$user = CFactory::getUser($cmtObj->creator);
// Process the text
CFactory::load('helpers', 'string');
$cmtObj->text = nl2br(CStringHelper::escape($cmtObj->text));
//format the date
$dateObject = CTimeHelper::getDate($cmtObj->date);
$date = C_JOOMLA_15 == 1 ? $dateObject->toFormat(JText::_('DATE_FORMAT_LC2')) : $dateObject->Format(JText::_('DATE_FORMAT_LC2'));
$html = '';
$html .= '<div class="cComment">';
CFactory::load('helpers', 'user');
$html .= CUserHelper::getThumb($user->id, 'wall-coc-avatar');
CFactory::load('helpers', 'string');
$html = CStringHelper::replaceThumbnails($html);
$html .= '<a class="wall-coc-author" href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id) . '">' . $user->getDisplayName() . '</a> ';
$html .= JText::sprintf('COM_COMMUNITY_COMMENT_POSTED_ON', '<span class="wall-coc-date">' . $date . '</span>');
CFactory::load('helpers', 'owner');
if ($my->id == $user->id || COwnerHelper::isCommunityAdmin()) {
$html .= ' | <a class="coc-remove coc-' . $cmtObj->creator . '" onclick="joms.comments.remove(this);" href="javascript:void(0)">' . JText::_('COM_COMMUNITY_REMOVE') . '</a>';
}
$html .= '<p>' . $cmtObj->text . '</p>';
$html .= '</div>';
return $html;
}
示例5: getTotalMessageSent
public function getTotalMessageSent($userId)
{
//CFactory::load( 'helpers' , 'time' );
$date = CTimeHelper::getDate();
$db = $this->getDBO();
//Joomla 1.6 JDate::getOffset returns in second while in J1.5 it's in hours
$query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_msg') . ' AS a ' . 'WHERE a.' . $db->quoteName('from') . '=' . $db->Quote($userId) . ' AND TO_DAYS(' . $db->Quote($date->toSql(true)) . ') - TO_DAYS( DATE_ADD( a.' . $db->quoteName('posted_on') . ' , INTERVAL ' . $date->getOffset() / 3600 . ' HOUR ) ) = ' . $db->Quote('0') . ' AND a.' . $db->quoteName('parent') . '=a.' . $db->quoteName('id');
$db->setQuery($query);
$count = $db->loadResult();
return $count;
}
示例6: isEventExist
/**
* Check if the given group name exist.
* if id is specified, only search for those NOT within $id
*/
public function isEventExist($title, $location, $startdate, $enddate, $id = 0, $parent = 0)
{
$db = $this->getDBO();
$starttime = CTimeHelper::getDate($startdate);
$endtime = CTimeHelper::getDate($enddate);
$strSQL = 'SELECT count(*) FROM ' . $db->quoteName('#__community_events') . ' WHERE ' . $db->quoteName('title') . ' = ' . $db->Quote($title) . ' AND ' . $db->quoteName('location') . ' = ' . $db->Quote($location) . ' AND ' . $db->quoteName('startdate') . ' = ' . $db->Quote($starttime->toSql()) . ' AND ' . $db->quoteName('enddate') . ' = ' . $db->Quote($endtime->toSql()) . ' AND ' . $db->quoteName('id') . ' != ' . $db->Quote($id) . ' AND ' . $db->quoteName('id') . ' != ' . $db->Quote($parent) . ' AND ' . $db->quoteName('parent') . '=' . $db->Quote(0);
$db->setQuery($strSQL);
$result = $db->loadResult();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
return $result;
}
示例7:
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>
示例8: display
public function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$id = $jinput->get('listid', '', 'INT');
//JRequest::getVar( 'listid' , '' );
$list = JTable::getInstance('MemberList', 'CTable');
$list->load($id);
if (empty($list->id) || is_null($list->id)) {
echo JText::_('COM_COMMUNITY_INVALID_ID');
return;
}
/**
* Opengraph
*/
CHeadHelper::setType('website', $list->getTitle());
$tmpCriterias = $list->getCriterias();
$criterias = array();
foreach ($tmpCriterias as $criteria) {
$obj = new stdClass();
$obj->field = $criteria->field;
$obj->condition = $criteria->condition;
$obj->fieldType = $criteria->type;
switch ($criteria->type) {
case 'date':
case 'birthdate':
if ($criteria->condition == 'between') {
$date = explode(',', $criteria->value);
if (isset($date[1])) {
$delimeter = '-';
if (strpos($date[0], '/')) {
$delimeter = '/';
}
$startDate = explode($delimeter, $date[0]);
$endDate = explode($delimeter, $date[1]);
if (isset($startDate[2]) && isset($endDate[2])) {
//date format
$obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59');
} else {
//age format
$obj->value = array($date[0], $date[1]);
}
} else {
//wrong data, set to default
$obj->value = array(0, 0);
}
} else {
$delimeter = '-';
if (strpos($criteria->value, '/')) {
$delimeter = '/';
}
$startDate = explode($delimeter, $criteria->value);
if (isset($startDate[2])) {
//date format
$obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00';
} else {
//age format
$obj->value = $criteria->value;
}
}
break;
case 'checkbox':
default:
$obj->value = $criteria->value;
break;
}
$criterias[] = $obj;
}
//CFactory::load( 'helpers' , 'time');
$created = CTimeHelper::getDate($list->created);
//CFactory::load( 'libraries' , 'advancesearch' );
//CFactory::load( 'libraries' , 'filterbar' );
$sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL'));
$sorting = $jinput->get->get('sort', 'latest', 'STRING');
//JRequest::getVar( 'sort' , 'latest' , 'GET' );
$data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting);
$tmpl = new CTemplate();
$html = $tmpl->set('list', $list)->set('created', $created)->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('memberlist.result');
unset($tmpl);
//CFactory::load( 'libraries' , 'tooltip' );
//CFactory::load( 'helpers' , 'owner' );
//CFactory::load( 'libraries' , 'featured' );
$featured = new CFeatured(FEATURED_USERS);
$featuredList = $featured->getItemIds();
$my = CFactory::getUser();
$resultRows = array();
$friendsModel = CFactory::getModel('friends');
$alreadyfriend = array();
//CFactory::load( 'helpers' , 'friends' );
foreach ($data->result as $user) {
$obj = new stdClass();
$obj->user = $user;
$obj->friendsCount = $user->getFriendCount();
$obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$isFriend = CFriendsHelper::isConnected($user->id, $my->id);
$obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false;
//record friends
if ($obj->addFriend) {
$alreadyfriend[$user->id] = $user->id;
}
//.........这里部分代码省略.........
示例9: _getWallHTML
function _getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile)
{
CFactory::load('helpers', 'url');
CFactory::load('helpers', 'user');
CFactory::load('helpers', 'videos');
CFactory::load('libraries', 'comment');
CFactory::load('helpers', 'owner');
CFactory::load('helpers', 'time');
$user = CFactory::getUser($wall->post_by);
$date = CTimeHelper::getDate($wall->date);
$config = CFactory::getConfig();
// @rule: for site super administrators we want to allow them to view the remove link
$isOwner = COwnerHelper::isCommunityAdmin() ? true : $isOwner;
$isEditable = CWall::isEditable($processFunc, $wall->id);
// Apply any post processing on the content
$wall->comment = CWallLibrary::_processWallContent($wall->comment);
$commentsHTML = '';
$comment = new CComment();
// If the wall post is a user wall post (in profile pages), we
// add wall comment feature
if ($appType == 'user' || $appType == 'groups' || $appType == 'events') {
$commentsHTML = $comment->getHTML($wallComments, 'wall-cmt-' . $wall->id, CWall::canComment($wall->type, $wall->contentid));
}
$avatarHTML = CUserHelper::getThumb($wall->post_by, 'avatar');
//var_dump($avatarHTML);exit;
// @rule: We only allow editing of wall in 15 minutes
$now = JFactory::getDate();
$interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
$interval = COMMUNITY_WALLS_EDIT_INTERVAL - abs($interval);
$editInterval = round($interval / 60);
// Create new instance of the template
$tmpl = new CTemplate();
$tmpl->set('id', $wall->id);
$tmpl->set('author', $user->getDisplayName());
$tmpl->set('avatarHTML', $avatarHTML);
$tmpl->set('authorLink', CUrlHelper::userLink($user->id));
$tmpl->set('created', $date->toFormat(JText::_('DATE_FORMAT_LC2')));
$tmpl->set('content', $wall->comment);
$tmpl->set('commentsHTML', $commentsHTML);
$tmpl->set('avatar', $user->getThumbAvatar());
$tmpl->set('isMine', $isOwner);
$tmpl->set('isEditable', $isEditable);
$tmpl->set('editInterval', $editInterval);
$tmpl->set('processFunc', $processFunc);
$tmpl->set('config', $config);
return $tmpl->fetch($templateFile);
}
示例10: getNotification
/**
* return array of notification items
*/
public function getNotification($userid, $type = '0', $limit = 10, $since = '')
{
$db = $this->getDBO();
$limit = $limit === 0 ? $this->getState('limit') : $limit;
$limitstart = $this->getState('limitstart');
$sinceWhere = '';
if (empty($limitstart)) {
$limitstart = 0;
}
if (!empty($since)) {
$sinceWhere = ' AND ' . $db->quoteName('created') . ' >= ' . $db->Quote($since);
//rule: if no new notification, load the first 5th latest notification
$query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_notifications') . ' AS a ' . 'WHERE a.' . $db->quoteName('target') . '=' . $db->Quote($userid) . $sinceWhere . ' AND a.' . $db->quoteName('type') . '=' . $db->Quote($type);
$db->setQuery($query);
$total = $db->loadResult();
if ($total == 0) {
$sinceWhere = '';
//$limit = 5;
}
}
if (!CFactory::getConfig()->get('enablepm')) {
$sinceWhere .= ' AND a.' . $db->quoteName('cmd_type') . 'NOT LIKE ' . $db->quote('%inbox%');
}
$date = CTimeHelper::getDate();
//we need to compare where both date with offset so that the day diff correctly.
$query = 'SELECT *,' . ' TO_DAYS(' . $db->Quote($date->format('Y-m-d H:i:s', true, false)) . ') - TO_DAYS( DATE_ADD(a.' . $db->quoteName('created') . ', INTERVAL ' . $date->getOffset() . ' HOUR ) ) as _daydiff' . ' FROM ' . $db->quoteName('#__community_notifications') . ' AS a ' . 'WHERE a.' . $db->quoteName('target') . '=' . $db->Quote($userid) . ' AND a.' . $db->quoteName('type') . '=' . $db->Quote($type) . $sinceWhere . ' ORDER BY a.' . $db->quoteName('created') . ' DESC';
if (!is_null($limit)) {
$query .= ' LIMIT ' . $limitstart . ',' . $limit;
}
$db->setQuery($query);
$result = $db->loadObjectList();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
//Pagination
$query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_notifications') . ' AS a ' . 'WHERE a.' . $db->quoteName('target') . '=' . $db->Quote($userid) . $sinceWhere . ' AND a.' . $db->quoteName('type') . '=' . $db->Quote($type);
$db->setQuery($query);
$total = $db->loadResult();
$this->total = $total;
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new JPagination($total, $limitstart, $limit);
}
return $result;
}
示例11: viewdiscussion
/**
* 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)) {
//.........这里部分代码省略.........
示例12:
<td>
<a class="subject" href="<?php
echo CRoute::_('index.php?option=com_community&view=inbox&task=read&msgid=' . $message->parent);
?>
">
<img src="<?php
echo JURI::root();
?>
components/com_community/templates/default/images/new.gif" style="vertical-align:middle" />
<?php
echo $message->subject;
?>
</a>
<div class="small">
<?php
echo $this->escape($message->from_name);
?>
,
<?php
$postdate = CTimeHelper::getDate($message->posted_on);
echo $postdate->toFormat('%d %b %Y, %I:%M %p');
?>
</div>
</td>
</tr>
</table>
</div>
<?php
}
?>
</div>
示例13:
?>
" />
</a>
</div>
<div class="message-body">
<div class="bubble-arrow">
<div class="bubble-content">
<?php
echo $msg->body;
?>
<div class="message-info" style="margin: 10px 0 0;">
<span class="icon-calendar">
<?php
$postdate = CTimeHelper::getDate($msg->posted_on);
echo $postdate->toFormat('%d %b %Y, %I:%M %p');
?>
</span>
<span class="icon-user">
<a href="<?php
echo $authorLink;
?>
">
<?php
echo $user->getDisplayName();
?>
</a>
</span>
<span class="icon-remove">
<a href="javascript:jax.call('community', 'inbox,ajaxRemoveMessage', <?php
示例14: getTotalMessageSent
function getTotalMessageSent($userId)
{
CFactory::load('helpers', 'time');
$date = CTimeHelper::getDate();
$db =& $this->getDBO();
$query = 'SELECT COUNT(*) FROM ' . $db->nameQuote('#__community_msg') . ' AS a ' . 'WHERE a.from=' . $db->Quote($userId) . ' ' . 'AND TO_DAYS(' . $db->Quote($date->toMySQL(true)) . ') - TO_DAYS( DATE_ADD( a.posted_on , INTERVAL ' . $date->getOffset() . ' HOUR ) ) = 0 ' . 'AND a.parent=a.id';
$db->setQuery($query);
$count = $db->loadResult();
return $count;
}
示例15: ajaxUpdate
/**
* Update the status of current user
*/
public function ajaxUpdate($message = '')
{
$filter = JFilterInput::getInstance();
$message = $filter->clean($message, 'string');
$cache = CFactory::getFastCache();
$cache->clean(array('activities'));
if (!COwnerHelper::isRegisteredUser()) {
return $this->ajaxBlockUnregister();
}
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$objResponse = new JAXResponse();
//@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'));
}
//trim it here so that it wun go into activities stream.
$message = JString::trim($message);
$my = CFactory::getUser();
$status = $this->getModel('status');
// @rule: Spam checks
if ($config->get('antispam_akismet_status')) {
//CFactory::load( 'libraries' , 'spamfilter' );
$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();
}
}
$status->update($my->id, $message);
//set user status for current session.
$today = JFactory::getDate();
$message2 = empty($message) ? ' ' : $message;
$my->set('_status', $message2);
$my->set('_posted_on', $today->toSql());
$profileid = $jinput->get->get('userid', 0, 'INT');
//JRequest::getVar('userid' , 0 , 'GET');
if (COwnerHelper::isMine($my->id, $profileid)) {
$objResponse->addScriptCall("joms.jQuery('#profile-status span#profile-status-message').html('" . addslashes($message) . "');");
}
//CFactory::load( 'helpers' , 'string' );
// $message = CStringHelper::escape( $message );
if (!empty($message)) {
$act = new stdClass();
$act->cmd = 'profile.status.update';
$act->actor = $my->id;
$act->target = $my->id;
//CFactory::load( 'helpers' , 'linkgenerator' );
// @rule: Autolink hyperlinks
$message = CLinkGeneratorHelper::replaceURL($message);
// @rule: Autolink to users profile when message contains @username
$message = CUserHelper::replaceAliasURL($message);
$privacyParams = $my->getParams();
$act->title = $message;
$act->content = '';
$act->app = 'profile';
$act->cid = $my->id;
$act->access = $privacyParams->get('privacyProfileView');
$act->comment_id = CActivities::COMMENT_SELF;
$act->comment_type = 'profile.status';
$act->like_id = CActivities::LIKE_SELF;
$act->like_type = 'profile.status';
//add user points
//CFactory::load( 'libraries' , 'userpoints' );
if (CUserPoints::assignPoint('profile.status.update')) {
//only assign act if user points is set to true
CActivityStream::add($act);
}
//now we need to reload the activities streams (since some report regarding update status from hello me we disabled update the stream, cuz hellome usually called out from jomsocial page)
$friendsModel = CFactory::getModel('friends');
$memberSince = CTimeHelper::getDate($my->registerDate);
$friendIds = $friendsModel->getFriendIds($my->id);
//include_once(JPATH_COMPONENT .'/libraries/activities.php');
$act = new CActivityStream();
$params = $my->getParams();
$limit = !empty($params) ? $params->get('activityLimit', '') : '';
//$html = $act->getHTML($my->id, $friendIds, $memberSince, $limit );
$status = $my->getStatus();
$status = str_replace(array("\r\n", "\n", "\r"), "", $status);
$status = addslashes($status);
// also update hellome module if available
$script = "joms.jQuery('.joms-js--mod-hellome-label').html('" . $status . "');";
$script .= "joms.jQuery('.joms-js--mod-hellome-loading').hide();";
$objResponse->addScriptCall($script);
}
return $objResponse->sendResponse();
}