本文整理汇总了PHP中Format::Date方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::Date方法的具体用法?PHP Format::Date怎么用?PHP Format::Date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::Date方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ToString
public function ToString()
{
$String = '';
ob_start();
?>
<div class="Box">
<h4><?php
echo Gdn::Translate('In this Discussion');
?>
</h4>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<strong><?php
echo Anchor($User->Name, '/profile/' . urlencode($User->Name), 'UserLink');
?>
</strong>
<?php
echo Format::Date($User->DateLastActive);
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
示例2: WriteComment
function WriteComment($Comment, &$Sender, &$Session, $CurrentOffset)
{
$Author = UserBuilder($Comment, 'Insert');
$Sender->EventArguments['Comment'] =& $Comment;
$Sender->Options = '';
$CssClass = 'Item Comment';
$CssClass .= $Comment->InsertUserID == $Session->UserID ? ' Mine' : '';
?>
<li class="<?php
echo $CssClass;
?>
" id="Comment_<?php
echo $Comment->CommentID;
?>
">
<?php
WriteOptions($Comment, $Sender, $Session);
?>
<div class="Comment">
<div class="Meta">
<span class="Author">
<?php
echo UserPhoto($Author);
echo UserAnchor($Author);
?>
</span>
<span class="DateCreated">
<?php
echo Format::Date($Comment->DateInserted);
?>
</span>
<span class="Permalink">
<?php
echo Anchor(T('Permalink'), '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID, 'Permalink', array('name' => 'Item_' . $CurrentOffset));
?>
</span>
<?php
$Sender->FireEvent('AfterCommentMeta');
?>
</div>
<div class="Message"><?php
echo Format::To($Comment->Body, $Comment->Format);
?>
</div>
<?php
$Sender->FireEvent('AfterCommentBody');
?>
</div>
</li>
<?php
}
示例3: WriteReply
public static function WriteReply(&$Sender, &$Session)
{
?>
<li class="Reply" id="Comment_<?php
echo $Sender->CurrentReply->CommentID;
?>
">
<?php
// Delete comment
if ($Session->CheckPermission('Vanilla.Comments.Delete', $Sender->Discussion->CategoryID)) {
echo Anchor(Gdn::Translate('Delete'), 'vanilla/discussion/deletecomment/' . $Sender->CurrentReply->CommentID . '/' . $Session->TransientKey(), 'DeleteReply');
}
?>
<ul class="Info<?php
echo $Sender->CurrentReply->InsertUserID == $Session->UserID ? ' Author' : '';
?>
">
<li class="Author"><?php
$Author = UserBuilder($Sender->CurrentReply, 'Insert');
echo UserPhoto($Author);
echo UserAnchor($Author);
?>
</li>
<li class="Created"><?php
echo Format::Date($Sender->CurrentReply->DateInserted);
?>
</li>
<li class="Permalink"><?php
echo Anchor(Gdn::Translate('Permalink'), '/discussion/comment/' . (isset($Sender->CurrentComment) ? $Sender->CurrentComment->CommentID : $Sender->ReplyCommentID) . '/#Comment_' . $Sender->CurrentReply->CommentID, Gdn::Translate('Permalink'));
?>
</li>
</ul>
<div class="Body"><?php
echo Format::To($Sender->CurrentReply->Body, $Sender->CurrentReply->Format);
?>
</div>
</li>
<?php
}
示例4: GetInvitationCount
public function GetInvitationCount($UserID)
{
// If this user is master admin, they should have unlimited invites.
if ($this->SQL->Select('UserID')->From('User')->Where('UserID', $UserID)->Where('Admin', '1')->Get()->NumRows() > 0) {
return -1;
}
// Get the Registration.InviteRoles settings:
$InviteRoles = Gdn::Config('Garden.Registration.InviteRoles', array());
if (!is_array($InviteRoles) || count($InviteRoles) == 0) {
return 0;
}
// Build an array of roles that can send invitations
$CanInviteRoles = array();
foreach ($InviteRoles as $RoleID => $Invites) {
if ($Invites > 0 || $Invites == -1) {
$CanInviteRoles[] = $RoleID;
}
}
if (count($CanInviteRoles) == 0) {
return 0;
}
// See which matching roles the user has
$UserRoleData = $this->SQL->Select('RoleID')->From('UserRole')->Where('UserID', $UserID)->WhereIn('RoleID', $CanInviteRoles)->Get();
if ($UserRoleData->NumRows() == 0) {
return 0;
}
// Define the maximum number of invites the user is allowed to send
$InviteCount = 0;
foreach ($UserRoleData->Result() as $UserRole) {
$Count = $InviteRoles[$UserRole->RoleID];
if ($Count == -1) {
$InviteCount = -1;
} else {
if ($InviteCount != -1 && $Count > $InviteCount) {
$InviteCount = $Count;
}
}
}
// If the user has unlimited invitations, return that value
if ($InviteCount == -1) {
return -1;
}
// Get the user's current invitation settings from their profile
$User = $this->SQL->Select('CountInvitations, DateSetInvitations')->From('User')->Where('UserID', $UserID)->Get()->FirstRow();
// If CountInvitations is null (ie. never been set before) or it is a new month since the DateSetInvitations
if ($User->CountInvitations == '' || is_null($User->DateSetInvitations) || Format::Date($User->DateSetInvitations, 'n Y') != Format::Date('', 'n Y')) {
// Reset CountInvitations and DateSetInvitations
$this->SQL->Put($this->Name, array('CountInvitations' => $InviteCount, 'DateSetInvitations' => Format::Date('', 'Y-m-01')), array('UserID' => $UserID));
return $InviteCount;
} else {
// Otherwise return CountInvitations
return $User->CountInvitations;
}
}
示例5: explode
// If this was a status update or a wall comment, don't bother with activity strings
$ActivityType = explode(' ', $Activity->ActivityType);
// Make sure you strip out any extra css classes munged in here
$ActivityType = $ActivityType[0];
$Author = UserBuilder($Activity, 'Activity');
if (in_array($ActivityType, array('WallComment', 'AboutUpdate'))) {
echo UserAnchor($Author, 'Name');
if ($Activity->ActivityType == 'WallComment' && $Activity->RegardingUserID > 0) {
$Author = UserBuilder($Activity, 'Regarding');
echo '<span>→</span>' . UserAnchor($Author, 'Name');
}
echo Format::Display($Activity->Story);
echo '<em>' . Format::Date($Activity->DateInserted) . '</em>';
} else {
echo Format::ActivityHeadline($Activity);
echo '<em>' . Format::Date($Activity->DateInserted) . '</em>';
if ($Activity->Story != '') {
echo '<div class="Story">';
echo $Activity->Story;
echo '</div>';
}
}
echo '</li>';
}
?>
<li class="ShowAll"><?php
echo Anchor(T('↳ Show All'), 'activity');
?>
</li>
</ul>
</div>
示例6: Anchor
?>
<li class="Item">
<div class="ItemContent">
<?php
echo Anchor(Format::Text($Row->Title), $Row->Url, 'Title');
?>
<div class="Excerpt"><?php
echo Anchor(Format::Text(SliceString($Row->Summary, 250)), $Row->Url);
?>
</div>
<div class="Meta">
<span><?php
printf(T('Comment by %s'), UserAnchor($Row));
?>
</span>
<span><?php
echo Format::Date($Row->DateInserted);
?>
</span>
<span><?php
echo Anchor(T('permalink'), $Row->Url);
?>
</span>
</div>
</div>
</li>
<?php
}
}
?>
</ul>
示例7: UserPhoto
if (!defined('APPLICATION')) {
exit;
}
if (property_exists($this, 'Discussion')) {
?>
<h2><?php
echo Format::Text($this->Discussion->Name);
?>
</h2>
<?php
}
?>
<ul class="Discussion Preview">
<li class="Comment">
<ul class="Info">
<li class="Author"><?php
echo UserPhoto($this->Comment->InsertName, $this->Comment->InsertPhoto);
echo UserAnchor($this->Comment->InsertName);
?>
</li>
<li class="Created"><?php
echo Format::Date($this->Comment->DateInserted);
?>
</li>
</ul>
<div class="Body"><?php
echo Format::To($this->Comment->Body, Gdn::Config('Garden.InputFormatter'));
?>
</div>
</li>
</ul>
示例8: count
<li class="five"><a href="../post/discussion">Start your first discussion</a></li>
</ul>
*/
?>
<h3><?php
echo Gdn::Translate("What's the Buzz?");
?>
</h3>
<dl>
<?php
$Count = count($this->BuzzData);
foreach ($this->BuzzData as $Name => $Value) {
echo '<dt>' . $Value . '</dt>
<dd>' . $Name . '</dd>';
}
?>
</dl>
<h3><?php
echo Gdn::Translate('Recently Active Users');
?>
</h3>
<ul class="DataList RecentUsers">
<?php
$i = 0;
foreach ($this->ActiveUserData as $User) {
$Css = $User->Photo != '' ? 'HasPhoto' : '';
echo '<li' . ($Css != '' ? ' class="' . $Css . '"' : '') . '>', UserPhoto($User->Name, $User->Photo), UserAnchor($User->Name), sprintf(Gdn::Translate('Last active %s'), Format::Date($User->DateLastActive)), '</li>';
}
?>
</ul>
示例9: WriteActivityComment
function WriteActivityComment($Comment, &$Sender, &$Session)
{
?>
<li id="Activity_<?php
echo $Comment->ActivityID;
?>
" class="<?php
echo $Comment->ActivityType;
?>
"><?php
if ($Comment->ActivityPhoto != '') {
if ($Comment->InsertUserID == $Session->UserID) {
echo '<a href="' . Url('/garden/profile/' . urlencode($Comment->ActivityName)) . '">' . $Sender->Html->Image('uploads/n' . $Comment->ActivityPhoto) . '</a>';
} else {
echo $Sender->Html->Image('uploads/n' . $Comment->ActivityPhoto);
}
}
?>
<h3><?php
echo $Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete') ? Anchor('Delete', 'garden/activity/delete/' . $Comment->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'Delete') : '';
?>
<strong><?php
echo Format::ActivityHeadline($Comment, $Sender->ProfileUserID);
?>
<em><?php
echo Format::Date($Comment->DateInserted);
?>
</em></strong></h3>
<blockquote><?php
echo Format::Display($Comment->Story);
?>
</blockquote>
</li>
<?php
}
示例10: WriteActivityComment
function WriteActivityComment($Comment, &$Sender, &$Session)
{
$Author = UserBuilder($Comment, 'Activity');
$PhotoAnchor = UserPhoto($Author, 'Photo');
$CssClass = 'Item ActivityComment Condensed ' . $Comment->ActivityType;
if ($PhotoAnchor != '') {
$CssClass .= ' HasPhoto';
}
?>
<li id="Activity_<?php
echo $Comment->ActivityID;
?>
" class="<?php
echo $CssClass;
?>
">
<?php
if ($PhotoAnchor != '') {
?>
<div class="Photo"><?php
echo $PhotoAnchor;
?>
</div>
<?php
}
?>
<div class="ItemContent ActivityComment">
<?php
echo UserAnchor($Author, 'Title Name');
?>
<div class="Excerpt"><?php
echo Format::Display($Comment->Story);
?>
</div>
<div class="Meta">
<span class="DateCreated"><?php
echo Format::Date($Comment->DateInserted);
?>
</span>
<?php
if ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete')) {
echo Anchor(T('Delete'), 'garden/activity/delete/' . $Comment->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'DeleteComment');
}
?>
</div>
</div>
</li>
<?php
}
示例11: WriteDiscussion
function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
$CssClass = 'Item';
$CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
$CssClass .= $Alt . ' ';
$CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
$CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
$CountUnreadComments = $Discussion->CountComments - $Discussion->CountCommentWatch;
$CssClass .= $CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
$Sender->EventArguments['Discussion'] =& $Discussion;
$Last = UserBuilder($Discussion, 'Last');
?>
<li class="<?php
echo $CssClass;
?>
">
<?php
WriteOptions($Discussion, $Sender, $Session);
?>
<div class="ItemContent Discussion">
<?php
echo Anchor(Format::Text($Discussion->Name), '/discussion/' . $Discussion->DiscussionID . '/' . Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
?>
<?php
$Sender->FireEvent('AfterDiscussionTitle');
?>
<div class="Meta">
<?php
if ($Discussion->Announce == '1') {
?>
<span class="Announcement"><?php
echo T('Announcement');
?>
</span>
<?php
}
?>
<span><?php
printf(Plural($Discussion->CountComments, '%s comment', '%s comments'), $Discussion->CountComments);
?>
</span>
<?php
if ($CountUnreadComments > 0 && $Session->IsValid()) {
echo '<strong>', sprintf(T('%s new'), $CountUnreadComments), '</strong>';
}
?>
<span><?php
printf(T('Most recent by %1$s %2$s'), UserAnchor($Last), Format::Date($Discussion->LastDate));
?>
</span>
<span><?php
echo Anchor($Discussion->Category, '/categories/' . $Discussion->CategoryUrlCode, 'Category');
?>
</span>
<?php
$Sender->FireEvent('DiscussionMeta');
?>
</div>
</div>
</li>
<?php
}
示例12: foreach
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->UserData->Result('Text') as $User) {
?>
<tr>
<td><?php
echo $this->Form->CheckBox('Applicants[]', '', array('value' => $User->UserID));
?>
</td>
<td class="Alt">
<?php
printf(Gdn::Translate('<strong>%1$s</strong> (%2$s) %3$s'), $User->Name, Format::Email($User->Email), Format::Date($User->DateInserted));
echo '<blockquote>' . $User->DiscoveryText . '</blockquote>';
?>
</td>
<td><?php
echo Anchor('Approve', '/user/approve/' . $User->UserID . '/' . $Session->TransientKey()) . ', ' . Anchor('Decline', '/user/decline/' . $User->UserID . '/' . $Session->TransientKey());
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
echo $this->Form->Button('Approve', array('name' => $this->Form->EscapeFieldName('Submit'), 'class' => 'SmallButton'));
示例13: WriteComment
function WriteComment($Comment, &$Sender, &$Session, $CurrentOffset)
{
?>
<li class="Comment<?php
echo $Comment->InsertUserID == $Session->UserID ? ' Mine' : '';
?>
" id="Comment_<?php
echo $Comment->CommentID;
?>
">
<?php
$Sender->EventArguments['Comment'] =& $Comment;
$Sender->Options = '';
$IsFirstComment = $Comment->CommentID == $Sender->Discussion->FirstCommentID;
if ($IsFirstComment && ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Vanilla.Discussions.Edit', $Sender->Discussion->CategoryID))) {
// User can edit the discussion topic/first comment
$Sender->Options .= '<li>' . Anchor('Edit', '/vanilla/post/editdiscussion/' . $Comment->DiscussionID, 'EditDiscussion') . '</li>';
} else {
if ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Vanilla.Comments.Edit', $Sender->Discussion->CategoryID)) {
// User can edit the comment
$Sender->Options .= '<li>' . Anchor('Edit', '/vanilla/post/editcomment/' . $Comment->CommentID, 'EditComment') . '</li>';
}
}
if ($IsFirstComment) {
// Announce discussion
if ($Session->CheckPermission('Vanilla.Discussions.Announce', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor($Sender->Discussion->Announce == '1' ? 'Unannounce' : 'Announce', 'vanilla/discussion/announce/' . $Comment->DiscussionID . '/' . $Session->TransientKey(), 'AnnounceDiscussion') . '</li>';
}
// Sink discussion
if ($Session->CheckPermission('Vanilla.Discussions.Sink', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor($Sender->Discussion->Sink == '1' ? 'Unsink' : 'Sink', 'vanilla/discussion/sink/' . $Comment->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'SinkDiscussion') . '</li>';
}
// Close discussion
if ($Session->CheckPermission('Vanilla.Discussions.Close', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor($Sender->Discussion->Closed == '1' ? 'Reopen' : 'Close', 'vanilla/discussion/close/' . $Comment->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'CloseDiscussion') . '</li>';
}
// Delete discussion
if ($Session->CheckPermission('Vanilla.Discussions.Delete', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor('Delete Discussion', 'vanilla/discussion/delete/' . $Comment->DiscussionID . '/' . $Session->TransientKey(), 'DeleteDiscussion') . '</li>';
}
} else {
// Delete comment
if ($Session->CheckPermission('Vanilla.Comments.Delete', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor('Delete', 'vanilla/discussion/deletecomment/' . $Comment->CommentID . '/' . $Session->TransientKey() . '/?Target=' . urlencode($Sender->SelfUrl), 'DeleteComment') . '</li>';
}
}
// Allow plugins to add options
$Sender->FireEvent('CommentOptions');
if ($Sender->Options != '') {
?>
<ul class="Options">
<li><strong><?php
echo Gdn::Translate('Options');
?>
</strong>
<ul>
<?php
echo $Sender->Options;
?>
</ul>
</li>
</ul>
<?php
}
?>
<ul class="Info">
<li class="Author">
<?php
$Author = UserBuilder($Comment, 'Insert');
echo UserPhoto($Author);
echo UserAnchor($Author);
?>
</li>
<li class="Created">
<?php
echo Format::Date($Comment->DateInserted);
?>
</li>
<li class="Permalink">
<?php
echo Anchor(Gdn::Translate('Permalink'), '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID, 'Permalink', array('name' => 'Item_' . $CurrentOffset));
?>
</li>
<?php
$Sender->FireEvent('AfterCommentMeta');
?>
</ul>
<div class="Body"><?php
echo Format::To($Comment->Body, $Comment->Format);
?>
</div>
<?php
$Sender->FireEvent('AfterCommentBody');
?>
</li>
<?php
}
示例14: Anchor
<?php
if (!defined('APPLICATION')) {
exit;
}
// An individual discussion record for all panel modules to use when rendering a discussion list.
?>
<li id="<?php
echo 'Bookmark_' . $Discussion->DiscussionID;
?>
">
<strong><?php
echo Anchor($Discussion->Name, '/discussion/' . $Discussion->DiscussionID . '/' . Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink');
?>
</strong>
<div class="Meta">
<?php
echo '<span>' . $Discussion->CountComments . '</span>';
$CountUnreadComments = $Discussion->CountComments - $Discussion->CountCommentWatch;
if ($CountUnreadComments > 0) {
echo '<strong>' . sprintf('%s new', $CountUnreadComments) . '</strong>';
}
$Last = new stdClass();
$Last->UserID = $Discussion->LastUserID;
$Last->Name = $Discussion->LastName;
echo '<span>' . Format::Date($Discussion->LastDate) . ' ' . UserAnchor($Last) . '</span>';
?>
</div>
</li>
示例15: WriteActivityComment
function WriteActivityComment($Comment, &$Sender, &$Session)
{
?>
<li id="Activity_<?php
echo $Comment->ActivityID;
?>
" class="<?php
echo $Comment->ActivityType;
if ($Comment->ActivityPhoto != '') {
echo ' HasPhoto';
}
?>
"><?php
if ($Comment->ActivityPhoto != '') {
echo '<a href="' . Url('/garden/profile/' . urlencode($Comment->ActivityName)) . '" class="Photo">' . $Sender->Html->Image('uploads/n' . $Comment->ActivityPhoto) . '</a>';
}
echo '<div>';
echo UserAnchor($Comment->ActivityName, 'Name');
echo Format::Display($Comment->Story);
echo '<div class="Meta">';
echo Format::Date($Comment->DateInserted);
echo $Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete') ? '<span>•</span>' . Anchor('Delete', 'garden/activity/delete/' . $Comment->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request())) : '';
echo '</div>';
echo '</div>';
?>
</li>
<?php
}