本文整理汇总了PHP中CTimeHelper类的典型用法代码示例。如果您正苦于以下问题:PHP CTimeHelper类的具体用法?PHP CTimeHelper怎么用?PHP CTimeHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CTimeHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _getArticleHTML
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;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:32,代码来源:myarticles.php
示例2: 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);
}
}
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:64,代码来源:view.feed.php
示例3: photosWallEdit
public static function photosWallEdit($userid, $asset, $wall_obj)
{
// @rule: We only allow editing of wall in 15 minutes
$viewer = CFactory::getUser($userid);
$now = JFactory::getDate();
$interval = CTimeHelper::timeIntervalDifference($wall_obj->date, $now->toSql());
$interval = abs($interval);
// Only owner and site admin can edit
if (COwnerHelper::isCommunityAdmin() || $viewer->id == $wall_obj->post_by) {
return true;
}
return false;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:13,代码来源:photos.php
示例4: timeLapse
/**
*
* @param JDate $date
*
*/
public static function timeLapse($date)
{
$now = new JDate();
$dateDiff = CTimeHelper::timeDifference($date->toUnix(), $now->toUnix());
if ($dateDiff['days'] > 0) {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['days']) ? 'CC LAPSED DAY MANY' : 'CC LAPSED DAY', $dateDiff['days']);
} elseif ($dateDiff['hours'] > 0) {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['hours']) ? 'CC LAPSED HOUR MANY' : 'CC LAPSED HOUR', $dateDiff['hours']);
} elseif ($dateDiff['minutes'] > 0) {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['minutes']) ? 'CC LAPSED MINUTE MANY' : 'CC LAPSED MINUTE', $dateDiff['minutes']);
} else {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['seconds']) ? 'CC LAPSED SECOND MANY' : 'CC LAPSED SECOND', $dateDiff['seconds']);
}
return $lapse;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:20,代码来源:time.php
示例5: editPhotoWall
public function editPhotoWall($wallId)
{
CFactory::load('helpers', 'owner');
CFactory::load('helpers', 'time');
$my = CFactory::getUser();
$wall =& JTable::getInstance('Wall', 'CTable');
$wall->load($wallId);
// @rule: We only allow editing of wall in 15 minutes
$now = JFactory::getDate();
$interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
$interval = abs($interval);
if ((COwnerHelper::isCommunityAdmin() || $my->id == $wall->post_by) && COMMUNITY_WALLS_EDIT_INTERVAL > $interval) {
return true;
}
return false;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:16,代码来源:photos.php
示例6: 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);
}
}
}
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:36,代码来源:view.feed.php
示例7: array_reverse
$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
?>
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:activities.likes.php
示例8: _getArticleHTML
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;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:58,代码来源:myarticles.php
示例9: isPast
/**
* Return true if the event is past
* A past event, is events that are has passed more than 24 hours from the last date
*/
public static function isPast($event)
{
$endDate = CTimeHelper::getLocaleDate($event->enddate);
$now = CTimeHelper::getLocaleDate();
$nowUnix = $now->toUnix();
$isPast = $endDate->toUnix() < $nowUnix;
return $isPast;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:12,代码来源:event.php
示例10: _getEventsHTML
function _getEventsHTML($createEvents, $rows, $user, $config, $totalEvents, $creatable)
{
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 CStringHelper::escape($event->summary);
?>
">
<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">
<a href="<?php
echo CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
?>
"><?php
echo $event->title;
?>
</a>
<span class="joms-block"><?php
echo $event->location;
?>
</span>
<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_EVENTS_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;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:97,代码来源:events.php
示例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)) {
//.........这里部分代码省略.........
开发者ID:Simarpreet05,项目名称:joomla,代码行数:101,代码来源:view.html.php
示例12: getLastUpdate
/**
* 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;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:24,代码来源:album.php
示例13: 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;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:51,代码来源:notification.php
示例14: 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 <[email protected]>
* @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">
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:registered.php
示例15: 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;
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:11,代码来源:inbox.php
示例16: DateTime
<span><?php
echo JText::_('COM_COMMUNITY_EVENTS_START_TIME');
?>
</span>
<?php
echo CTimeHelper::getFormattedUTC($event->getStartDate(), $offsetValue);
?>
</div>
<div class="joms-form__group">
<span><?php
echo JText::_('COM_COMMUNITY_EVENTS_END_TIME');
?>
</span>
<?php
echo CTimeHelper::getFormattedUTC($event->getEndDate(), $offsetValue);
?>
</div>
<div class="joms-form__group">
<span><?php
echo JText::_('COM_COMMUNITY_TIMEZONE');
?>
</span>
<?php
$time = new DateTime('now', new DateTimeZone($offset));
$time = (int) $time->format('P');
?>
<input class="joms-input" name="event-<?php
echo $i;
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:events.import.php
示例17: getEventChildsCount
/**
* Get event child count
*
* @param int $parent
* @return int total
*
* */
public function getEventChildsCount($parent)
{
$db = $this->getDBO();
$pastDate = CTimeHelper::getLocaleDate();
$query = 'SELECT COUNT(*)
FROM ' . $db->quoteName('#__community_events') . '
WHERE ' . $db->quoteName('parent') . '=' . $db->Quote($parent) . '
AND ' . $db->quoteName('enddate') . ' > ' . $db->Quote($pastDate->toSql(true)) . '
AND ' . $db->quoteName('published') . '=' . $db->Quote(1);
$db->setQuery($query);
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
return $db->loadResult();
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:22,代码来源:events.php
示例18: defined
<?php
/**
* @package JomSocial
* @subpackage Template
* @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved!
* @license GNU/GPL, see LICENSE.php
*
* @param friends array or CUser (all user)
* @param total integer total number of friends
*/
defined('_JEXEC') or die;
$jnow = CTimeHelper::getDate();
?>
<div id="writeMessageContainer">
<form name="jsform-inbox-ajaxcompose" method="post" action="" name="writeMessageForm" id="writeMessageForm">
<table class="cWindowForm">
<tr>
<td class="cWindowFormKey"><label class="label"><?php
echo JText::_('CC COMPOSE TO');
?>
</td>
<td class="cWindowFormVal">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="receiverContainer">
<tr>
<td style="padding: 0; width: 40px;">
<div>
<img src="<?php
echo $user->getThumbAvatar();
?>
开发者ID:bizanto,项目名称:Hooked,代码行数:31,代码来源:inbox.ajaxcompose.php
示例19: getPhotoInfoHeader
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');
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:15,代码来源:photos.php
示例20: 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 = $s
|
请发表评论