本文整理汇总了PHP中CTimeHelper::getFormattedTime方法的典型用法代码示例。如果您正苦于以下问题:PHP CTimeHelper::getFormattedTime方法的具体用法?PHP CTimeHelper::getFormattedTime怎么用?PHP CTimeHelper::getFormattedTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTimeHelper
的用法示例。
在下文中一共展示了CTimeHelper::getFormattedTime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<article>
<a href="<?php
echo $this->event->getLink();
?>
"> <i class="joms-icon-calendar-empty portrait-phone-only"></i> <?php
echo JHTML::_('string.truncate', $this->event->title, $truncateVal, true, false);
?>
</a>
<div class="separator"></div>
<p><?php
echo JHTML::_('string.truncate', $this->event->description, $truncateVal, true, false);
?>
</p>
<ul class="list-unstyled content-details">
<li><i class="joms-icon-calendar"></i><?php
echo CTimeHelper::getFormattedTime($this->event->startdate, $format);
?>
</li>
<li><i class="joms-icon-map-marker"></i><?php
echo CActivities::format($activity->get('location'));
?>
</li>
</ul>
</article>
</div>
<?php
$this->load('activities.actions');
?>
</div>
示例2:
"><strong><?php
echo $this->escape($event->title);
?>
</strong></a>
</h3>
<div class="cIndex-Status">
<div class="cIndex-Date"><b><?php
echo CEventHelper::formatStartDate($event, $config->get('eventdateformat'));
?>
</b></div>
<i class="cIndex-Location"><?php
echo $this->escape($event->location);
?>
</i>
<div class="cIndex-Time"><?php
echo JText::sprintf('COM_COMMUNITY_EVENTS_DURATION', CTimeHelper::getFormattedTime($event->startdate, $timeFormat), CTimeHelper::getFormattedTime($event->enddate, $timeFormat));
?>
</div>
</div>
<div class="cIndex-Actions">
<div class="action">
<?php
if ($isExpired || CEventHelper::isPast($event)) {
?>
<a href="<?php
echo $event->getGuestLink(COMMUNITY_EVENT_STATUS_ATTEND);
?>
"><?php
echo JText::sprintf(CStringHelper::isPlural($event->confirmedcount) ? 'COM_COMMUNITY_EVENTS_COUNT_MANY_PAST' : 'COM_COMMUNITY_EVENTS_COUNT_PAST', $event->confirmedcount);
?>
</a>
示例3: viewevent
//.........这里部分代码省略.........
$editEvent = $jinput->get->get('edit', false, 'NONE');
$editEvent = $editEvent == 1 ? true : false;
// Am I invited in this event?
$isInvited = false;
$join = '';
$friendsCount = 0;
$isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id);
// If I was invited, I want to know my invitation informations
if ($isInvited) {
$invitor = CFactory::getUser($isInvited[0]->invited_by);
$join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>';
// Get users friends in this group
$friendsCount = $eventModel->getFriendsCount($my->id, $event->id);
}
// Get like
$likes = new CLike();
$isUserLiked = false;
if ($isLikeEnabled = $likes->enabled('events')) {
$isUserLiked = $likes->userLiked('events', $event->id, $my->id);
}
$totalLikes = $likes->getLikeCount('events', $event->id);
// Is this event is a past event?
$now = new JDate();
$isPastEvent = $event->getEndDate(false)->toSql() < $now->toSql(true) ? true : false;
// Get the formated date & time
$format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR');
$startDate = $event->getStartDate(false);
$endDate = $event->getEndDate(false);
$allday = false;
if ($startDate->format('%Y-%m-%d') == $endDate->format('%Y-%m-%d') && $startDate->format('%H:%M:%S') == '00:00:00' && $endDate->format('%H:%M:%S') == '23:59:59') {
$format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1');
$allday = true;
}
$event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format);
$event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format);
if (!isset($event->params)) {
$event->params = '';
}
$params = new CParameter($event->params);
$event->defaultCover = $event->isDefaultCover();
// Cover position.
$event->coverPostion = $params->get('coverPosition', '');
if (strpos($event->coverPostion, '%') === false) {
$event->coverPostion = 0;
}
// Find cover album and photo.
$event->coverAlbum = false;
$event->coverPhoto = false;
$album = JTable::getInstance('Album', 'CTable');
$albumId = $album->isCoverExist('event', $event->id);
if ($albumId) {
$album->load($albumId);
$event->coverAlbum = $albumId;
$event->coverPhoto = $album->photoid;
}
$inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL);
$status = new CUserStatus($event->id, 'events');
$tmpl = new CTemplate();
$creator = new CUserStatusCreator('message');
$creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE');
$creator->html = $tmpl->fetch('status.message');
$status->addCreator($creator);
// Upgrade wall to stream @since 2.5
$event->upgradeWallToStream();
// Add custom stream
$streamHTML = $eventLib->getStreamHTML($event);
示例4: _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;
}
示例5:
</p>
<?php
$format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_12H') : JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_24H');
?>
<ul class="joms-list">
<li class="joms-list__item">
<svg viewBox="0 0 16 18" class="joms-icon">
<use xlink:href="<?php
echo CRoute::getURI();
?>
#joms-icon-calendar"></use>
</svg>
<?php
echo CTimeHelper::getFormattedTime($attachment->message->startdate, $format, false);
?>
</li>
<li class="joms-list__item">
<svg viewBox="0 0 16 16" class="joms-icon">
<use xlink:href="<?php
echo CRoute::getURI();
?>
#joms-icon-location"></use>
</svg>
<?php
echo $attachment->message->location;
?>
</li>
</ul>
</div>
示例6: getRepeatEnd
/**
* Retrieve the repeat end date
*
* @return date repeat end date
* */
public function getRepeatEnd()
{
if (empty($this->_repeatend)) {
$this->_getRule();
if (isset($this->_rule['until'])) {
//$repeatend = substr($this->_rule['until'], 0, strpos($this->_rule['until'], 't'));
$repeatend = $this->_rule['until'] . ' ';
// to convert it to string.
$date = JFactory::getDate($repeatend);
$this->_repeatend = $date->toSql();
$this->_repeatend = CTimeHelper::getFormattedTime($this->_repeatend, '%Y-%m-%d');
}
}
return $this->_repeatend;
}
示例7: getEndDateHTML
/**
* @since 2.6.1
*
* This method use to get event end date in html string
* */
public function getEndDateHTML()
{
$format = $this->get('format', $this->_getDateTimeFormat());
return CTimeHelper::getFormattedTime($this->enddate, $format);
}
示例8: ajaxShowEventFeatured
/**
* Ajax retreive Featured Events Information
* @since 2.4
*/
public function ajaxShowEventFeatured($eventId, $allday)
{
$my = CFactory::getUser();
$objResponse = new JAXResponse();
//CFactory::load( 'models' , 'events' );
$event = JTable::getInstance('Event', 'CTable');
$event->load($eventId);
// Get event link
// Get Avatar
$avatar = $event->getAvatar('avatar');
/// Event date
$config = CFactory::getConfig();
$format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR');
$startDate = $event->getStartDate(false);
$endDate = $event->getEndDate(false);
$allday = false;
if ($startDate->format('%Y-%m-%d') == $endDate->format('%Y-%m-%d') && $startDate->format('%H:%M:%S') == '00:00:00' && $endDate->format('%H:%M:%S') == '23:59:59') {
$format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1');
$allday = true;
}
if ($allday) {
$eventDate = JText::sprintf('COM_COMMUNITY_EVENTS_ALLDAY_DATE', CTimeHelper::getFormattedTime($event->startdate, $format));
} else {
$eventDate = JText::sprintf('COM_COMMUNITY_EVENTS_DURATION', CTimeHelper::getFormattedTime($event->startdate, $format), CTimeHelper::getFormattedTime($event->enddate, $format));
}
// Get event link
$eventLink = CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
//CFactory::load( 'helpers' , 'event' );
$handler = CEventHelper::getHandler($event);
$now = new JDate();
$isPastEvent = $event->getEndDate(false)->toSql() < $now->toSql() ? true : false;
// Get RSVP
$rsvp = '';
if ($my->id != 0) {
if ($handler->isAllowed() && !$isPastEvent) {
$rsvp = '<div class="selector focus" id="jomSelect-undefined">';
/* Fix missing select style */
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) {
$rsvp .= '<span class="attend">' . JText::_('COM_COMMUNITY_EVENTS_RSVP_ATTEND') . '</span>';
} elseif ($event->getMemberStatus($my->id) >= COMMUNITY_EVENT_STATUS_WONTATTEND) {
$rsvp .= '<span class="notAttend">' . JText::_('COM_COMMUNITY_EVENTS_RSVP_NOT_ATTEND') . '</span>';
} else {
$rsvp .= '<span class="noResponse">' . JText::_('COM_COMMUNITY_GROUPS_INVITATION_RESPONSE') . '</span>';
}
$rsvp .= '<select onchange="joms.events.submitRSVP(' . $event->id . ',this)" style="opacity:0;">';
if ($event->getMemberStatus($my->id) == 0) {
$rsvp .= '<option class="noResponse" selected="selected">' . JText::_('COM_COMMUNITY_GROUPS_INVITATION_RESPONSE') . '</option>';
}
$rsvp .= '<option class="attend"';
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) {
$rsvp .= ' selected="selected" ';
}
$rsvp .= 'value="' . COMMUNITY_EVENT_STATUS_ATTEND . '">' . JText::_('COM_COMMUNITY_EVENTS_RSVP_ATTEND') . '</option>';
$rsvp .= '<option class="notAttend"';
if ($event->getMemberStatus($my->id) >= COMMUNITY_EVENT_STATUS_WONTATTEND) {
$rsvp .= 'selected="selected"';
}
$rsvp .= 'value="' . COMMUNITY_EVENT_STATUS_WONTATTEND . '">' . JText::_('COM_COMMUNITY_EVENTS_RSVP_NOT_ATTEND') . '</option>';
$rsvp .= '</select>';
$rsvp .= '</div>';
} else {
$rsvp = JText::_('COM_COMMUNITY_EVENTS_PASSED');
}
}
// Get unfeature icon
$eventUnfeature = '<a class="album-action remove-featured" title="' . JText::_('COM_COMMUNITY_REMOVE_FEATURED') . '" onclick="joms.featured.remove(\'' . $event->id . '\',\'events\');" href="javascript:void(0);">' . JText::_('COM_COMMUNITY_REMOVE_FEATURED') . '</a>';
// Get like
//CFactory::load( 'libraries' , 'like' );
$likes = new CLike();
$likesHTML = $likes->getHTML('events', $eventId, $my->id);
$objResponse->addScriptCall('updateEvent', $eventId, $event->title, JText::_($event->getCategoryName()), $likesHTML, $avatar, $eventDate, $event->location, $event->summary, $eventLink, $rsvp, $eventUnfeature);
$objResponse->sendResponse();
}
示例9: viewevent
//.........这里部分代码省略.........
foreach ($eventMembers as $uid) {
$userids[] = $uid->id;
}
CFactory::loadUsers($userids);
for ($i = 0; $i < count($eventMembers); $i++) {
$row =& $eventMembers[$i];
$eventMembers[$i] = CFactory::getUser($row->id);
}
// Pre-load multiple users at once
$waitingApproval = $event->isPendingApproval($my->id);
$waitingRespond = false;
$myStatus = $event->getUserStatus($my->id);
$hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE;
// Get Bookmark HTML
CFactory::load('libraries', 'bookmarks');
$bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id));
$bookmarksHTML = $bookmarks->getHTML();
// Get Reporting HTML
CFactory::load('libraries', 'reporting');
$report = new CReportingLibrary();
$reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_EVENTS_REPORT'), 'events,reportEvent', array($event->id));
// Get the Wall
CFactory::load('libraries', 'wall');
$wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, 10, 0, 'wall.content', 'events,events');
$wallCount = CWallLibrary::getWallCount('events', $event->id);
$viewAllLink = false;
if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
$viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls');
}
$wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
$wallForm = '';
/*if( !$config->get('lockeventwalls')
|| ($config->get('lockeventwalls') && ($isEventGuest) && !($waitingApproval) && $hasResponded)
|| $isCommunityAdmin )
{
$wallForm = CWallLibrary::getWallInputForm( $event->id , 'events,ajaxSaveWall', 'events,ajaxRemoveWall' );
}*/
// Construct the RVSP radio list
$arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('COM_COMMUNITY_EVENTS_YES')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('COM_COMMUNITY_EVENTS_NO')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('COM_COMMUNITY_EVENTS_MAYBE')));
$status = $event->getMemberStatus($my->id);
$radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false);
$unapprovedCount = $event->inviteRequestCount();
//...
$editEvent = JRequest::getVar('edit', false, 'GET');
$editEvent = $editEvent == 1 ? true : false;
// Am I invited in this event?
$isInvited = false;
$join = '';
$friendsCount = 0;
$isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id);
// If I was invited, I want to know my invitation informations
if ($isInvited) {
$invitor = CFactory::getUser($isInvited[0]->invited_by);
$join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>';
// Get users friends in this group
$friendsCount = $eventModel->getFriendsCount($my->id, $event->id);
}
// Get like
CFactory::load('libraries', 'like');
$likes = new CLike();
$likesHTML = $likes->getHTML('events', $event->id, $my->id);
// Is this event is a past event?
$now = new JDate();
$isPastEvent = $event->getEndDate(false)->toMySQL() < $now->toMySQL(true) ? true : false;
// Get the formated date & time
$format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR');
$startDate = $event->getStartDate(false);
$endDate = $event->getEndDate(false);
$allday = false;
if ($startDate->toFormat('%Y-%m-%d') == $endDate->toFormat('%Y-%m-%d') && $startDate->toFormat('%H:%M:%S') == '00:00:00' && $endDate->toFormat('%H:%M:%S') == '23:59:59') {
$format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1');
$allday = true;
}
$event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format);
$event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format);
CFactory::load('libraries', 'invitation');
$inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL);
CFactory::load('libraries', 'userstatus');
$status = new CUserStatus($event->id, 'events');
$tmpl = new CTemplate();
$creator = new CUserStatusCreator('message');
$creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE');
$creator->html = $tmpl->fetch('status.message');
$status->addCreator($creator);
// Upgrade wall to stream @since 2.5
$event->upgradeWallToStream();
// Add custom stream
$streamHTML = $eventLib->getStreamHTML($event);
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE');
} else {
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_WONTATTEND) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE');
} else {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_RESPOND_RSVP_MESSAGE');
}
}
// Output to template
echo $tmpl->setMetaTags('event', $event)->set('status', $status)->set('streamHTML', $streamHTML)->set('timezone', CTimeHelper::getTimezone($event->offset))->set('handler', $handler)->set('likesHTML', $likesHTML)->set('inviteHTML', $inviteHTML)->set('guestStatus', $event->getUserStatus($my->id))->set('event', $event)->set('radioList', $radioList)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('isEventGuest', $isEventGuest)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isCommunityAdmin', $isCommunityAdmin)->set('unapproved', $unapprovedCount)->set('waitingApproval', $waitingApproval)->set('wallContent', $wallContent)->set('eventMembers', $eventMembers)->set('eventMembersCount', $eventMembersCount)->set('editEvent', $editEvent)->set('my', $my)->set('memberStatus', $myStatus)->set('waitingRespond', $waitingRespond)->set('isInvited', $isInvited)->set('join', $join)->set('friendsCount', $friendsCount)->set('isPastEvent', $isPastEvent)->set('adminsList', $adminsList)->set('RSVPmessage', $RSVPmessage)->set('allday', $allday)->fetch('events.viewevent');
}