public function ToString() { if (!$this->_Data) { return; } if ($this->_Data->NumRows() == 0) { return; } ob_start(); ?> <div id="SharedFingerprint" class="Box"> <h4><?php echo T("Shared Accounts"); ?> <span class="Count"><?php echo $this->_Data->NumRows(); ?> </span></h4> <ul class="PanelInfo"> <?php foreach ($this->_Data->Result() as $SharedAccount) { echo '<li><strong>' . UserAnchor($SharedAccount) . '</strong><br /></li>'; } ?> </ul> </div> <?php $String = ob_get_contents(); @ob_end_clean(); return $String; }
public function ToString() { $String = ''; ob_start(); ?> <div class="Box"> <h4><?php echo T('In this Discussion'); ?> </h4> <ul class="PanelInfo"> <?php foreach ($this->_UserData->Result() as $User) { ?> <li> <strong><?php echo UserAnchor($User, 'UserLink'); ?> </strong> <?php echo Gdn_Format::Date($User->DateLastActive); ?> </li> <?php } ?> </ul> </div> <?php $String = ob_get_contents(); @ob_end_clean(); return $String; }
function writeModuleDiscussion($Discussion, $Px = 'Bookmark') { ?> <li id="<?php echo "{$Px}_{$Discussion->DiscussionID}"; ?> " class="<?php echo CssClass($Discussion); ?> "> <span class="Options"> <?php // echo OptionsList($Discussion); echo BookmarkButton($Discussion); ?> </span> <div class="Title"><?php echo anchor(Gdn_Format::text($Discussion->Name, false), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink'); ?> </div> <div class="Meta"> <?php $Last = new stdClass(); $Last->UserID = $Discussion->LastUserID; $Last->Name = $Discussion->LastName; echo NewComments($Discussion); echo '<span class="MItem">' . Gdn_Format::date($Discussion->LastDate, 'html') . UserAnchor($Last) . '</span>'; ?> </div> </li> <?php }
public function renderOrigin($Sender) { $Discussion = $Sender->EventArguments['Discussion']; if ($Discussion !== NULL && $Discussion->LastCommentID != '') { $Creator = UserBuilder($Discussion, 'First'); $CreationDate = $Discussion->DateInserted; echo ' <span class="MItem LastCommentBy">' . sprintf(T('Started by %1$s'), UserAnchor($Creator)) . '</span>'; echo ' <span class="MItem LastCommentDate">' . Gdn_Format::Date($CreationDate, 'html') . '</span>'; } }
public function ToString() { $String = ''; $Session = Gdn::Session(); ob_start(); //Hide the top poster box id there's no post greater than 0 if ($this->_TopPosters->NumRows() > 0) { ?> <div id="TopPosters" class="Box"> <h4><?php echo Gdn::Translate("Top Posters"); ?> </h4> <ul class="PanelInfo"> <?php $i = 1; foreach ($this->_TopPosters->Result() as $User) { ?> <li> <?php echo $User->AllPosted; ?> <?php if (Gdn::Config('TopPosters.Show.Medal') == "both" || Gdn::Config('TopPosters.Show.Medal') == "side") { ?> <img src="<?php echo str_replace("index.php?p=", "", Url('/plugins/TopPosters/badges/' . (file_exists('plugins/TopPosters/badges/' . $i . '.png') ? $i . '.png' : 'medal-icon.png'))); ?> "> <?php } ?> <strong> <?php echo UserAnchor($User); ?> </strong> </li> <?php $i++; } ?> </ul> </div> <?php } $String = ob_get_contents(); @ob_end_clean(); return $String; }
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 }
public function DiscussionsController_AfterCountMeta_Handler(&$Sender) { $Discussion = $Sender->EventArguments['Discussion']; if (C('Plugins.AuthorTimeView.Show_AuthorTime')) { $First = UserBuilder($Discussion, 'First'); $Last = UserBuilder($Discussion, 'Last'); if ($Discussion->LastCommentID != '') { echo '<span class="LastCommentBy">' . sprintf(T(' %1$s'), UserAnchor($First)) . '</span>'; echo '<span class="AuthorDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span>'; echo '<span class="LastCommentBy">' . sprintf(T('| Recent %1$s'), UserAnchor($Last)) . '</span>'; } else { // leave space preceding Started in ' Started by' or it will be removed by locale definitions echo '<span class="LastCommentBy">' . sprintf(T(' Started by %1$s'), UserAnchor($First)) . '</span>'; } } }
public function ToString() { $String = ''; $Session = Gdn::Session(); ob_start(); ?> <div id="WhosOnline" class="Box"> <h4><?php echo T("Who's Online"); ?> (<?php echo $this->_OnlineUsers->NumRows(); ?> )</h4> <ul class="PanelInfo"> <?php if ($this->_OnlineUsers->NumRows() > 0) { foreach ($this->_OnlineUsers->Result() as $User) { ?> <li> <strong <?php echo $User->Invisible == 1 ? 'class="Invisible"' : ''; ?> > <?php echo UserAnchor($User); ?> </strong> <?php echo Gdn_Format::Date($User->Timestamp); ?> </li> <?php } } ?> </ul> </div> <?php $String = ob_get_contents(); @ob_end_clean(); return $String; }
function writeModuleDiscussion($Discussion, $Px = 'Bookmark', $showPhotos = false) { ?> <li id="<?php echo "{$Px}_{$Discussion->DiscussionID}"; ?> " class="<?php echo CssClass($Discussion); ?> "> <?php if ($showPhotos) { $firstUser = userBuilder($Discussion, 'First'); echo userPhoto($firstUser, ['LinkClass' => 'IndexPhoto']); } ?> <span class="Options"> <?php // echo OptionsList($Discussion); echo BookmarkButton($Discussion); ?> </span> <div class="Title"><?php echo anchor(Gdn_Format::text($Discussion->Name, false), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink'); ?> </div> <div class="Meta DiscussionsModuleMeta"> <?php $Last = new stdClass(); $Last->UserID = $Discussion->LastUserID; $Last->Name = $Discussion->LastName; echo NewComments($Discussion); $translation = pluralTranslate($Discussion->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')); echo '<span class="MItem">' . Gdn_Format::date($Discussion->LastDate, 'html') . UserAnchor($Last) . '</span>'; echo '<span class="MItem CountComments Hidden">' . sprintf($translation, $Discussion->CountComments) . '</span>'; ?> </div> </li> <?php }
public function ToString($Results) { $UserIDs = array(); foreach ($Results as $Row) { $UserIDs[] = $Row->{SS_ATTR_USERID}; ///IMPORTANT, this is lowercase since grab results directly from sphinx } // print_r($Return); die; $Sql = clone Gdn::Sql(); $Users = $Sql->Select('Photo, UserID, Name')->From('User')->WhereIn('UserID', $UserIDs)->Get()->ResultObject(); ob_start(); ?> <div id="People" class="Box People"> <h4 class="Header"><?php echo T('People'); ?> </h4> <ul class="PanelInfo PanelDiscussions"> <?php foreach ($Users as $Row) { ?> <li class="Item"> <?php $User = UserBuilder($Row); ?> <?php echo UserPhoto($User); echo UserAnchor($User); ?> </li> <?php } ?> </ul> </div> <?php $String = ob_get_contents(); @ob_end_clean(); return $String; }
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="Author Photo"><?php echo $PhotoAnchor; ?> </div> <?php } ?> <div class="ItemContent ActivityComment"> <?php echo UserAnchor($Author, 'Title Name'); ?> <div class="Excerpt"><?php echo Gdn_Format::Display($Comment->Story); ?> </div> <div class="Meta"> <span class="DateCreated"><?php echo Gdn_Format::Date($Comment->DateInserted); ?> </span> <?php if ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete')) { echo Anchor(T('Delete'), 'dashboard/activity/delete/' . $Comment->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'DeleteComment'); } ?> </div> </div> </li> <?php }
echo 'Discussion_' . $Discussion->DiscussionID; ?> " class="<?php echo $CssClass; ?> "> <div class="Discussion"> <div class="Item-Header DiscussionHeader"> <div class="AuthorWrap"> <span class="Author"> <?php if ($UserPhotoFirst) { echo UserPhoto($Author); echo UserAnchor($Author, 'Username'); } else { echo UserAnchor($Author, 'Username'); echo UserPhoto($Author); } echo FormatMeAction($Discussion); ?> </span> <span class="AuthorInfo"> <?php echo WrapIf(htmlspecialchars(GetValue('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle')); echo WrapIf(htmlspecialchars(GetValue('Location', $Author)), 'span', array('class' => 'MItem AuthorLocation')); $this->FireEvent('AuthorInfo'); ?> </span> </div> <div class="Meta DiscussionMeta"> <span class="MItem DateCreated">
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>
$Format = empty($Message->Format) ? 'Display' : $Message->Format; $Author = UserBuilder($Message, 'Insert'); ?> <li id="<?php echo $Message->MessageID; ?> "<?php echo $Class == '' ? '' : ' class="' . $Class . '"'; ?> > <div class="ConversationMessage"> <div class="Meta"> <span class="Author"> <?php echo UserPhoto($Author, 'Photo'); echo UserAnchor($Author, 'Name'); ?> </span> <span class="DateCreated"><?php echo Format::Date($Message->DateInserted); ?> </span> <span class="ItemLink"><a name="Item_<?php echo $CurrentOffset; ?> " class="Item"></a></span> </div> <div class="Message"><?php echo Format::To($Message->Body, $Format); ?> </div>
<dt class="Label LastActive"><?php echo T('Last Active'); ?> <dt> <dd class="Value LastActive"><?php echo Gdn_Format::Date($this->User->DateLastActive); ?> </dd> <dt class="Label Roles"><?php echo T('Roles'); ?> <dt> <dd class="Value Roles"><?php echo implode(', ', $this->Roles); ?> </dd> <?php if ($this->User->InviteUserID > 0) { $Inviter = new stdClass(); $Inviter->UserID = $this->User->InviteUserID; $Inviter->Name = $this->User->InviteName; echo '<dt class="Label InvitedBy">' . T('Invited by') . '</dt> <dd class="Value InvitedBy">' . UserAnchor($Inviter) . '</dd>'; } $this->FireEvent('OnBasicInfo'); ?> </dl> </div> <?php } $this->FireEvent('AfterInfo');
public function DiscussionController_CommentInfo_Handler($Sender, $Args) { if (!isset($Args['Comment'])) { return; } $Comment = $Args['Comment']; if (!GetValue('Type', $Comment) == 'Whisper') { return; } $Participants = GetValue('Participants', $Comment); $ConversationID = GetValue('ConversationID', $Comment); $MessageID = GetValue('MessageID', $Comment); $MessageUrl = "/messages/{$ConversationID}#Message_{$MessageID}"; echo '<div class="Whisper-Info"><b>' . Anchor(T('Private Between'), $MessageUrl) . '</b>: '; $First = TRUE; foreach ($Participants as $UserID => $User) { if ($First) { $First = FALSE; } else { echo ', '; } echo UserAnchor($User); } echo '</div>'; }
function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt) { $CssClass = 'DiscussionRow'; $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' : ''; ?> <li class="<?php echo $CssClass; ?> "> <ul class="Discussion"> <?php if ($Sender->ShowOptions) { ?> <li class="Options"> <?php // Build up the options that the user has for each discussion if ($Session->IsValid()) { // Bookmark link echo Anchor('<span>*</span>', '/vanilla/discussion/bookmark/' . $Discussion->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'Bookmark' . ($Discussion->Bookmarked == '1' ? ' Bookmarked' : ''), array('title' => Gdn::Translate($Discussion->Bookmarked == '1' ? 'Unbookmark' : 'Bookmark'))); $Sender->Options = ''; // Dismiss an announcement if ($Discussion->Announce == '1' && $Discussion->Dismissed != '1') { $Sender->Options .= '<li>' . Anchor('Dismiss', 'vanilla/discussion/dismissannouncement/' . $Discussion->DiscussionID . '/' . $Session->TransientKey(), 'DismissAnnouncement') . '</li>'; } // Edit discussion if ($Discussion->FirstUserID == $Session->UserID || $Session->CheckPermission('Vanilla.Discussions.Edit', $Discussion->CategoryID)) { $Sender->Options .= '<li>' . Anchor('Edit', 'vanilla/post/editdiscussion/' . $Discussion->DiscussionID, 'EditDiscussion') . '</li>'; } // Announce discussion if ($Session->CheckPermission('Vanilla.Discussions.Announce', $Discussion->CategoryID)) { $Sender->Options .= '<li>' . Anchor($Discussion->Announce == '1' ? 'Unannounce' : 'Announce', 'vanilla/discussion/announce/' . $Discussion->DiscussionID . '/' . $Session->TransientKey(), 'AnnounceDiscussion') . '</li>'; } // Sink discussion if ($Session->CheckPermission('Vanilla.Discussions.Sink', $Discussion->CategoryID)) { $Sender->Options .= '<li>' . Anchor($Discussion->Sink == '1' ? 'Unsink' : 'Sink', 'vanilla/discussion/sink/' . $Discussion->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'SinkDiscussion') . '</li>'; } // Close discussion if ($Session->CheckPermission('Vanilla.Discussions.Close', $Discussion->CategoryID)) { $Sender->Options .= '<li>' . Anchor($Discussion->Closed == '1' ? 'Reopen' : 'Close', 'vanilla/discussion/close/' . $Discussion->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'CloseDiscussion') . '</li>'; } // Delete discussion if ($Session->CheckPermission('Vanilla.Discussions.Delete', $Discussion->CategoryID)) { $Sender->Options .= '<li>' . Anchor('Delete', 'vanilla/discussion/delete/' . $Discussion->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'DeleteDiscussion') . '</li>'; } // Allow plugins to add options $Sender->FireEvent('DiscussionOptions'); if ($Sender->Options != '') { ?> <ul class="Options"> <li><strong><?php echo Gdn::Translate('Options'); ?> </strong> <ul> <?php echo $Sender->Options; ?> </ul> </li> </ul> <?php } } ?> </li> <?php } ?> <li class="Title"> <strong><?php echo Anchor(Format::Text($Discussion->Name), '/discussion/' . $Discussion->DiscussionID . '/' . Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink'); ?> </strong> </li> <li class="Meta"> <?php echo '<span>'; echo sprintf(Plural($Discussion->CountComments, '%s comment', '%s comments'), $Discussion->CountComments); echo '</span>'; if ($CountUnreadComments > 0 && $Session->IsValid()) { echo '<strong>', sprintf(Gdn::Translate('%s new'), $CountUnreadComments), '</strong>'; } echo '<span>'; printf(Gdn::Translate('Most recent by %1$s %2$s'), UserAnchor($Discussion->LastName), Format::Date($Discussion->LastDate)); echo '</span>'; echo Anchor($Discussion->Category, '/categories/' . urlencode($Discussion->Category), 'Category'); $Sender->FireEvent('DiscussionMeta'); ?> </li> </ul> </li> <?php }
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(T('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 Gdn_Format::Date($Sender->CurrentReply->DateInserted); ?> </li> <li class="Permalink"><?php echo Anchor(T('Permalink'), '/discussion/comment/' . (isset($Sender->CurrentComment) ? $Sender->CurrentComment->CommentID : $Sender->ReplyCommentID) . '/#Comment_' . $Sender->CurrentReply->CommentID, T('Permalink')); ?> </li> </ul> <div class="Body"><?php echo Gdn_Format::To($Sender->CurrentReply->Body, $Sender->CurrentReply->Format); ?> </div> </li> <?php }
?> "> <h2 class="H"><?php echo T($Editing ? 'Edit Comment' : 'Leave a Comment'); ?> </h2> <div class="CommentFormWrap"> <div class="Form-HeaderWrap"> <div class="Form-Header"> <span class="Author"> <?php if (C('Vanilla.Comment.UserPhotoFirst', TRUE)) { echo UserPhoto($Session->User); echo UserAnchor($Session->User, 'Username'); } else { echo UserAnchor($Session->User, 'Username'); echo UserPhoto($Session->User); } ?> </span> </div> </div> <div class="Form-BodyWrap"> <div class="Form-Body"> <div class="FormWrapper FormWrapper-Condensed"> <?php echo $this->Form->Open(); echo $this->Form->Errors(); // $CommentOptions = array('MultiLine' => TRUE, 'format' => GetValueR('Comment.Format', $this)); $this->FireEvent('BeforeBodyField'); echo $this->Form->BodyBox('Body', array('Table' => 'Comment', 'tabindex' => 1));
/** * Gets a nice title to represent the participants in a conversation. * * @param array|object $Conversation * @param array|object $Participants * @return string Returns a title for the conversation. */ public static function ParticipantTitle($Conversation, $Html = TRUE, $Max = 3) { $Participants = GetValue('Participants', $Conversation); $Total = GetValue('CountParticipants', $Conversation); $MyID = Gdn::Session()->UserID; $FoundMe = FALSE; // Try getting people that haven't left the conversation and aren't you. $Users = array(); $i = 0; foreach ($Participants as $Row) { if (GetValue('UserID', $Row) == $MyID) { $FoundMe = TRUE; continue; } if (GetValue('Deleted', $Row)) { continue; } if ($Html) { $Users[] = UserAnchor($Row); } else { $Users[] = GetValue('Name', $Row); } $i++; if ($i > $Max || $Total > $Max && $i === $Max) { break; } } $Count = count($Users); if ($Count === 0) { if ($FoundMe) { $Result = T('Just you'); } elseif ($Total) { $Result = Plural($Total, '%s person', '%s people'); } else { $Result = T('Nobody'); } } else { $Px = implode(', ', $Users); if ($Count + 1 === $Total && $FoundMe) { $Result = $Px; } elseif ($Total === $Count + 1) { $Result = sprintf(T('%s and 1 other'), $Px); } elseif ($Total > $Count) { $Result = sprintf(T('%s and %s others'), $Px, $Total - $Count); } else { $Result = $Px; } } return $Result; }
if (!defined('APPLICATION')) { exit; } $Alt = FALSE; $Session = Gdn::Session(); $EditUser = $Session->CheckPermission('Garden.Users.Edit'); $DeleteUser = $Session->CheckPermission('Garden.Users.Delete'); foreach ($this->UserData->Format('Text')->Result() as $User) { $Alt = $Alt ? FALSE : TRUE; ?> <tr<?php echo $Alt ? ' class="Alt"' : ''; ?> > <td><strong><?php echo UserAnchor($User); ?> </strong></td> <td class="Alt"><?php echo Gdn_Format::Email($User->Email); ?> </td> <td><?php echo Gdn_Format::Date($User->DateFirstVisit); ?> </td> <td class="Alt"><?php echo Gdn_Format::Date($User->DateLastActive); ?> </td> <?php
<dl> <dt class="Name"><?php echo T('Username'); ?></dt> <dd class="Name"><?php echo $this->User->Name; ?></dd> <?php if ($this->User->ShowEmail == 1 || $Session->CheckPermission('Garden.Registration.Manage')) { echo '<dt class="Email">'.T('Email').'</dt> <dd class="Email">'.Gdn_Format::Email($this->User->Email).'</dd>'; } ?> <dt class="Joined"><?php echo T('Joined'); ?></dt> <dd class="Joined"><?php echo Gdn_Format::Date($this->User->DateFirstVisit); ?></dd> <dt class="Visits"><?php echo T('Visits'); ?></dt> <dd class="Visits"><?php echo number_format($this->User->CountVisits); ?></dd> <dt class="LastActive"><?php echo T('Last Active'); ?></dt> <dd class="LastActive"><?php echo Gdn_Format::Date($this->User->DateLastActive); ?></dd> <dt class="Roles"><?php echo T('Roles'); ?></dt> <dd class="Roles"><?php echo implode(', ', $this->Roles); ?></dd> <?php if ($this->User->InviteUserID > 0) { $Inviter = new stdClass(); $Inviter->UserID = $this->User->InviteUserID; $Inviter->Name = $this->User->InviteName; echo '<dt class="Invited">'.T('Invited by').'</dt> <dd class="Invited">'.UserAnchor($Inviter).'</dd>'; } $this->FireEvent('OnBasicInfo'); ?> </dl> </div> <?php }
<h2><?php // Who is in the conversation? if ($this->RecipientData->NumRows() == 1) { echo Gdn::Translate('Just you!'); } else { if ($this->RecipientData->NumRows() == 2) { foreach ($this->RecipientData->Result() as $User) { if ($User->UserID != $Session->UserID) { echo sprintf(Gdn::Translate('%s and you'), UserAnchor($User)); } } } else { $Users = array(); foreach ($this->RecipientData->Result() as $User) { if ($User->UserID != $Session->UserID) { $Users[] = UserAnchor($User); } } echo sprintf(Gdn::Translate('%s, and you'), implode(', ', $Users)); } } ?> </h2> <?php echo $this->Pager->ToString('less'); ?> <ul id="Conversation"> <?php $MessagesViewLocation = $this->FetchViewLocation('messages'); include $MessagesViewLocation; ?>
/** * Writes a discussion in table row format. */ function WriteDiscussionRow($Discussion, &$Sender, &$Session, $Alt2) { if (!property_exists($Sender, 'CanEditDiscussions')) { $Sender->CanEditDiscussions = GetValue('PermsDiscussionsEdit', CategoryModel::Categories($Discussion->CategoryID)) && C('Vanilla.AdminCheckboxes.Use'); } $CssClass = CssClass($Discussion); $DiscussionUrl = $Discussion->Url; if ($Session->UserID) { $DiscussionUrl .= '#latest'; } $Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl; $Sender->EventArguments['Discussion'] =& $Discussion; $Sender->EventArguments['CssClass'] =& $CssClass; $First = UserBuilder($Discussion, 'First'); if ($Discussion->LastUserID) { $Last = UserBuilder($Discussion, 'Last'); } else { $Last = $First; } // $Sender->EventArguments['FirstUser'] = &$First; // $Sender->EventArguments['LastUser'] = &$Last; // // $Sender->FireEvent('BeforeDiscussionName'); $DiscussionName = $Discussion->Name; if ($DiscussionName == '') { $DiscussionName = T('Blank Discussion Topic'); } $Sender->EventArguments['DiscussionName'] =& $DiscussionName; $Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage); $FirstPageUrl = DiscussionUrl($Discussion, 1); $LastPageUrl = DiscussionUrl($Discussion, FALSE) . '#latest'; ?> <tr id="Discussion_<?php echo $Discussion->DiscussionID; ?> " class="<?php echo $CssClass; ?> "> <?php echo AdminCheck($Discussion, array('<td class="CheckBoxColumn"><div class="Wrap">', '</div></td>')); ?> <td class="DiscussionName"> <div class="Wrap"> <span class="Options"> <?php echo OptionsList($Discussion); echo BookmarkButton($Discussion); ?> </span> <?php echo Anchor($DiscussionName, $DiscussionUrl, 'Title') . ' '; $Sender->FireEvent('AfterDiscussionTitle'); WriteMiniPager($Discussion); echo NewComments($Discussion); if ($Sender->Data('_ShowCategoryLink', TRUE)) { echo CategoryLink($Discussion, ' ' . T('in') . ' '); } // Other stuff that was in the standard view that you may want to display: echo '<div class="Meta Meta-Discussion">'; WriteTags($Discussion); echo '</div>'; // if ($Source = GetValue('Source', $Discussion)) // echo ' '.sprintf(T('via %s'), T($Source.' Source', $Source)); // ?> </div> </td> <td class="BlockColumn BlockColumn-User FirstUser"> <div class="Block Wrap"> <?php echo UserPhoto($First, array('Size' => 'Small')); echo UserAnchor($First, 'UserLink BlockTitle'); echo '<div class="Meta">'; echo Anchor(Gdn_Format::Date($Discussion->FirstDate, 'html'), $FirstPageUrl, 'CommentDate MItem'); echo '</div>'; ?> </div> </td> <td class="BigCount CountComments"> <div class="Wrap"> <?php // Exact Number // echo number_format($Discussion->CountComments); // Round Number echo BigPlural($Discussion->CountComments, '%s comment'); ?> </div> </td> <td class="BigCount CountViews"> <div class="Wrap"> <?php // Exact Number // echo number_format($Discussion->CountViews); // Round Number echo BigPlural($Discussion->CountViews, '%s view'); ?> </div> </td> <td class="BlockColumn BlockColumn-User LastUser"> <div class="Block Wrap"> <?php if ($Last) { echo UserPhoto($Last, array('Size' => 'Small')); echo UserAnchor($Last, 'UserLink BlockTitle'); echo '<div class="Meta">'; echo Anchor(Gdn_Format::Date($Discussion->LastDate, 'html'), $LastPageUrl, 'CommentDate MItem'); echo '</div>'; } else { echo ' '; } ?> </div> </td> </tr> <?php }
<tr id="<?php echo "UserID_{$User->UserID}"; ?> "<?php echo $Alt ? ' class="Alt"' : ''; ?> data-userid="<?php echo $User->UserID; ?> "> <!-- <td class="CheckboxCell"><input type="checkbox" name="LogID[]" value="<?php echo $User->UserID; ?> " /></td>--> <td><strong><?php echo UserAnchor($User, 'Username'); ?> </strong></td> <?php if ($ViewPersonalInfo) { ?> <td class="Alt"><?php echo Gdn_Format::Email($User->Email); ?> </td> <?php } ?> <td style="max-width: 200px;"> <?php $Roles = GetValue('Roles', $User, array());
<?php if (!defined('APPLICATION')) { exit; } ?> <div class="Box"> <h4><?php echo T('In this Conversation'); ?> </h4> <ul class="PanelInfo"> <?php foreach ($this->_UserData->Result() as $User) { ?> <li> <strong><?php echo UserAnchor($User, 'UserLink'); ?> </strong> <?php echo Format::Date($User->DateLastActive); ?> </li> <?php } ?> </ul> </div>
function _FormatStringCallback($Match, $SetArgs = FALSE) { static $Args = array(); if ($SetArgs) { $Args = $Match; return; } $Match = $Match[1]; if ($Match == '{') { return $Match; } // Parse out the field and format. $Parts = explode(',', $Match); $Field = trim($Parts[0]); $Format = trim(GetValue(1, $Parts, '')); $SubFormat = strtolower(trim(GetValue(2, $Parts, ''))); $FormatArgs = GetValue(3, $Parts, ''); if (in_array($Format, array('currency', 'integer', 'percent'))) { $FormatArgs = $SubFormat; $SubFormat = $Format; $Format = 'number'; } elseif (is_numeric($SubFormat)) { $FormatArgs = $SubFormat; $SubFormat = ''; } $Value = GetValueR($Field, $Args, ''); if ($Value == '' && !in_array($Format, array('url', 'exurl'))) { $Result = ''; } else { switch (strtolower($Format)) { case 'date': switch ($SubFormat) { case 'short': $Result = Gdn_Format::Date($Value, '%d/%m/%Y'); break; case 'medium': $Result = Gdn_Format::Date($Value, '%e %b %Y'); break; case 'long': $Result = Gdn_Format::Date($Value, '%e %B %Y'); break; default: $Result = Gdn_Format::Date($Value); break; } break; case 'html': case 'htmlspecialchars': $Result = htmlspecialchars($Value); break; case 'number': if (!is_numeric($Value)) { $Result = $Value; } else { switch ($SubFormat) { case 'currency': $Result = '$' . number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 2); case 'integer': $Result = (string) round($Value); if (is_numeric($FormatArgs) && strlen($Result) < $FormatArgs) { $Result = str_repeat('0', $FormatArgs - strlen($Result)) . $Result; } break; case 'percent': $Result = round($Value * 100, is_numeric($FormatArgs) ? $FormatArgs : 0); break; default: $Result = number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 0); break; } } break; case 'plural': if (is_array($Value)) { $Value = count($Value); } elseif (StringEndsWith($Field, 'UserID', TRUE)) { $Value = 1; } if (!is_numeric($Value)) { $Result = $Value; } else { if (!$SubFormat) { $SubFormat = rtrim("%s {$Field}", 's'); } if (!$FormatArgs) { $FormatArgs = $SubFormat . 's'; } $Result = Plural($Value, $SubFormat, $FormatArgs); } break; case 'rawurlencode': $Result = rawurlencode($Value); break; case 'text': $Result = Gdn_Format::Text($Value, FALSE); break; case 'time': $Result = Gdn_Format::Date($Value, '%l:%M%p'); break; case 'url': if (strpos($Field, '/') !== FALSE) { $Value = $Field; } $Result = Url($Value, $SubFormat == 'domain'); break; case 'exurl': if (strpos($Field, '/') !== FALSE) { $Value = $Field; } $Result = ExternalUrl($Value); break; case 'urlencode': $Result = urlencode($Value); break; case 'gender': // Format in the form of FieldName,gender,male,female,unknown if (is_array($Value) && count($Value) == 1) { $Value = array_shift($Value); } $Gender = 'u'; if (!is_array($Value)) { $User = Gdn::UserModel()->GetID($Value); if ($User) { $Gender = $User->Gender; } } switch ($Gender) { case 'm': $Result = $SubFormat; break; case 'f': $Result = $FormatArgs; break; default: $Result = GetValue(4, $Parts); } break; case 'user': case 'you': case 'his': case 'her': case 'your': $Result = print_r($Value, TRUE); $ArgsBak = $Args; if (is_array($Value) && count($Value) == 1) { $Value = array_shift($Value); } if (is_array($Value)) { $Max = C('Garden.FormatUsername.Max', 5); $Count = count($Value); $Result = ''; for ($i = 0; $i < $Count; $i++) { if ($i >= $Max && $Count > $Max + 1) { $Others = $Count - $i; $Result .= ' ' . T('sep and', 'and') . ' ' . Plural($Others, '%s other', '%s others'); break; } $ID = $Value[$i]; if (is_array($ID)) { continue; } if ($i == $Count - 1) { $Result .= ' ' . T('sep and', 'and') . ' '; } elseif ($i > 0) { $Result .= ', '; } $Special = array(-1 => T('everyone'), -2 => T('moderators'), -3 => T('administrators')); if (isset($Special[$ID])) { $Result .= $Special[$ID]; } else { $User = Gdn::UserModel()->GetID($ID); $User->Name = FormatUsername($User, $Format, Gdn::Session()->UserID); $Result .= UserAnchor($User); } } } else { $User = Gdn::UserModel()->GetID($Value); $User->Name = FormatUsername($User, $Format, Gdn::Session()->UserID); $Result = UserAnchor($User); } $Args = $ArgsBak; break; default: $Result = $Value; break; } } return $Result; }
function WriteComment($Comment, $Sender, $Session, $CurrentOffset) { static $UserPhotoFirst = NULL; if ($UserPhotoFirst === NULL) { $UserPhotoFirst = C('Vanilla.Comment.UserPhotoFirst', TRUE); } $Author = Gdn::UserModel()->GetID($Comment->InsertUserID); //UserBuilder($Comment, 'Insert'); $Permalink = GetValue('Url', $Comment, '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID); // Set CanEditComments (whether to show checkboxes) if (!property_exists($Sender, 'CanEditComments')) { $Sender->CanEditComments = $Session->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use'); } // Prep event args $CssClass = CssClass($Comment, $CurrentOffset); $Sender->EventArguments['Comment'] =& $Comment; $Sender->EventArguments['Author'] =& $Author; $Sender->EventArguments['CssClass'] =& $CssClass; // DEPRECATED ARGUMENTS (as of 2.1) $Sender->EventArguments['Object'] =& $Comment; $Sender->EventArguments['Type'] = 'Comment'; // First comment template event $Sender->FireEvent('BeforeCommentDisplay'); ?> <li class="<?php echo $CssClass; ?> " id="<?php echo 'Comment_' . $Comment->CommentID; ?> "> <div class="Comment"> <?php // Write a stub for the latest comment so it's easy to link to it from outside. if ($CurrentOffset == Gdn::Controller()->Data('_LatestItem')) { echo '<span id="latest"></span>'; } ?> <div class="Options"> <?php WriteCommentOptions($Comment); ?> </div> <?php $Sender->FireEvent('BeforeCommentMeta'); ?> <div class="Item-Header CommentHeader"> <div class="AuthorWrap"> <span class="Author"> <?php if ($UserPhotoFirst) { echo UserPhoto($Author); echo UserAnchor($Author, 'Username'); } else { echo UserAnchor($Author, 'Username'); echo UserPhoto($Author); } echo FormatMeAction($Comment); ?> </span> <span class="AuthorInfo"> <?php echo ' ' . WrapIf(htmlspecialchars(GetValue('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle')); $Sender->FireEvent('AuthorInfo'); ?> </span> </div> <div class="Meta CommentMeta CommentInfo"> <span class="MItem DateCreated"> <?php echo Anchor(Gdn_Format::Date($Comment->DateInserted, 'html'), $Permalink, 'Permalink', array('name' => 'Item_' . $CurrentOffset, 'rel' => 'nofollow')); ?> </span> <?php // Include source if one was set if ($Source = GetValue('Source', $Comment)) { echo Wrap(sprintf(T('via %s'), T($Source . ' Source', $Source)), 'span', array('class' => 'MItem Source')); } $Sender->FireEvent('CommentInfo'); $Sender->FireEvent('InsideCommentMeta'); // DEPRECATED $Sender->FireEvent('AfterCommentMeta'); // DEPRECATED // Include IP Address if we have permission if ($Session->CheckPermission('Garden.Moderation.Manage')) { echo Wrap(IPAnchor($Comment->InsertIPAddress), 'span', array('class' => 'MItem IPAddress')); } ?> </div> </div> <div class="Item-BodyWrap"> <div class="Item-Body"> <div class="Message"> <?php echo FormatBody($Comment); ?> </div> <?php $Sender->FireEvent('AfterCommentBody'); WriteReactions($Comment); ?> </div> </div> </div> </li> <?php $Sender->FireEvent('AfterComment'); }
<?php if (!defined('APPLICATION')) { exit; } ?> <div class="Box Moderators"> <?php echo panelHeading(t('Moderators')); ?> <ul class="PanelInfo"> <?php foreach ($this->ModeratorData[0]->Moderators as $Mod) { $Mod = UserBuilder($Mod); echo '<li>' . UserPhoto($Mod, 'Small') . ' ' . UserAnchor($Mod) . '</li>'; } ?> </ul> </div>
echo 'Bookmark_' . $Discussion->DiscussionID; ?> "> <strong><?php echo Anchor($Discussion->Name, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_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; // Logic for incomplete comment count. if ($Discussion->CountCommentWatch == 0 && ($DateLastViewed = GetValue('DateLastViewed', $Discussion))) { if (Gdn_Format::ToTimestamp($DateLastViewed) >= Gdn_Format::ToTimestamp($Discussion->LastDate)) { $CountUnreadComments = 0; $Discussion->CountCommentWatch = $Discussion->CountComments; } else { $CountUnreadComments = ''; } } if ($CountUnreadComments > 0 || $CountUnreadComments === '') { echo '<strong>' . trim(sprintf('%s new', $CountUnreadComments)) . '</strong>'; } $Last = new stdClass(); $Last->UserID = $Discussion->LastUserID; $Last->Name = $Discussion->LastName; echo '<span>' . Gdn_Format::Date($Discussion->LastDate) . ' ' . UserAnchor($Last) . '</span>'; ?> </div> </li>