本文整理汇总了PHP中UserBuilder函数的典型用法代码示例。如果您正苦于以下问题:PHP UserBuilder函数的具体用法?PHP UserBuilder怎么用?PHP UserBuilder使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UserBuilder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderOrigin
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>';
}
}
示例2: WriteDiscussion
function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
$CssClass = 'Item';
$CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
$CssClass .= $Alt . ' ';
$CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
$CssClass .= $Discussion->Closed == '1' ? ' Closed' : '';
$CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
$CssClass .= $Discussion->CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
$Sender->EventArguments['Discussion'] =& $Discussion;
$Sender->FireEvent('BeforeDiscussionName');
$DiscussionName = Gdn_Format::Text($Discussion->Name);
if ($DiscussionName == '') {
$DiscussionName = T('Blank Discussion Topic');
}
static $FirstDiscussion = TRUE;
if (!$FirstDiscussion) {
$Sender->FireEvent('BetweenDiscussion');
} else {
$FirstDiscussion = FALSE;
}
?>
<li class="<?php
echo $CssClass;
?>
">
<?php
echo UserPhoto(UserBuilder($Discussion, 'First'));
?>
<div class="ItemContent Discussion">
<?php
echo Anchor($DiscussionName, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 && C('Vanilla.Comments.AutoOffset') ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
?>
<?php
$Sender->FireEvent('AfterDiscussionTitle');
?>
<div class="Meta">
<span class="Author"><?php
echo $Discussion->FirstName;
?>
</span>
<?php
echo '<span class="Counts' . ($Discussion->CountUnreadComments > 0 ? ' NewCounts' : '') . '">' . ($Discussion->CountUnreadComments > 0 ? $Discussion->CountUnreadComments . '/' : '') . $Discussion->CountComments . '</span>';
if ($Discussion->LastCommentID != '') {
echo '<span class="LastCommentBy">' . sprintf(T('Latest %1$s'), $Discussion->LastName) . '</span> ';
}
echo '<span class="LastCommentDate">' . Gdn_Format::Date($Discussion->LastDate) . '</span> ';
?>
</div>
</div>
</li>
<?php
}
示例3: 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
}
示例4: DiscussionsController_AfterCountMeta_Handler
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>';
}
}
}
示例5: ToString
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;
}
示例6: 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
}
示例7: trim
$CurrentOffset++;
$Alt = $Alt == TRUE ? FALSE : TRUE;
$Class = 'Item';
$Class .= $Alt ? ' Alt' : '';
if ($this->Conversation->DateLastViewed < $Message->DateInserted) {
$Class .= ' New';
}
if ($Message->InsertUserID == $Session->UserID) {
$Class .= ' Mine';
}
if ($Message->InsertPhoto != '') {
$Class .= ' HasPhoto';
}
$Class = trim($Class);
$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');
?>
示例8: foreach
<?php
foreach ($this->Data('Conversations') as $Row) {
$Subject = '';
if ($Row['Subject']) {
$Subject = Gdn_Format::Text($Row['Subject']);
} else {
$Subject = '';
foreach ($Row['Participants'] as $User) {
if (!isset($PhotoUser)) {
$PhotoUser = $User;
}
$Subject = ConcatSep(', ', $Subject, FormatUsername($User, 'You'));
}
}
if (!isset($PhotoUser)) {
$PhotoUser = UserBuilder($Row, 'LastMessage');
}
?>
<li class="Item" rel="<?php
echo Url("/messages/{$Row['ConversationID']}#latest");
?>
">
<div class="Author Photo"><?php
echo UserPhoto($PhotoUser);
?>
</div>
<div class="ItemContent">
<b class="Subject"><?php
echo Anchor($Subject, "/messages/{$Row['ConversationID']}#latest");
?>
</b>
示例9: 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(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
}
示例10: writeDiscussion
function writeDiscussion($Discussion, &$Sender, &$Session)
{
$CssClass = CssClass($Discussion);
$DiscussionUrl = $Discussion->Url;
$Category = CategoryModel::categories($Discussion->CategoryID);
if ($Session->UserID) {
$DiscussionUrl .= '#latest';
}
$Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl;
$Sender->EventArguments['Discussion'] =& $Discussion;
$Sender->EventArguments['CssClass'] =& $CssClass;
$First = UserBuilder($Discussion, 'First');
$Last = UserBuilder($Discussion, 'Last');
$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;
static $FirstDiscussion = TRUE;
if (!$FirstDiscussion) {
$Sender->fireEvent('BetweenDiscussion');
} else {
$FirstDiscussion = FALSE;
}
$Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage);
?>
<li id="Discussion_<?php
echo $Discussion->DiscussionID;
?>
" class="<?php
echo $CssClass;
?>
">
<?php
if (!property_exists($Sender, 'CanEditDiscussions')) {
$Sender->CanEditDiscussions = val('PermsDiscussionsEdit', CategoryModel::categories($Discussion->CategoryID)) && c('Vanilla.AdminCheckboxes.Use');
}
$Sender->fireEvent('BeforeDiscussionContent');
// WriteOptions($Discussion, $Sender, $Session);
?>
<span class="Options">
<?php
echo OptionsList($Discussion);
echo BookmarkButton($Discussion);
?>
</span>
<div class="ItemContent Discussion">
<div class="Title">
<?php
echo AdminCheck($Discussion, array('', ' ')) . anchor($DiscussionName, $DiscussionUrl);
$Sender->fireEvent('AfterDiscussionTitle');
?>
</div>
<div class="Meta Meta-Discussion">
<?php
WriteTags($Discussion);
?>
<span class="MItem MCount ViewCount"><?php
printf(PluralTranslate($Discussion->CountViews, '%s view html', '%s views html', t('%s view'), t('%s views')), BigPlural($Discussion->CountViews, '%s view'));
?>
</span>
<span class="MItem MCount CommentCount"><?php
printf(PluralTranslate($Discussion->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), BigPlural($Discussion->CountComments, '%s comment'));
?>
</span>
<span class="MItem MCount DiscussionScore Hidden"><?php
$Score = $Discussion->Score;
if ($Score == '') {
$Score = 0;
}
printf(Plural($Score, '%s point', '%s points', BigPlural($Score, '%s point')));
?>
</span>
<?php
echo NewComments($Discussion);
$Sender->fireEvent('AfterCountMeta');
if ($Discussion->LastCommentID != '') {
echo ' <span class="MItem LastCommentBy">' . sprintf(t('Most recent by %1$s'), userAnchor($Last)) . '</span> ';
echo ' <span class="MItem LastCommentDate">' . Gdn_Format::date($Discussion->LastDate, 'html') . '</span>';
} else {
echo ' <span class="MItem LastCommentBy">' . sprintf(t('Started by %1$s'), userAnchor($First)) . '</span> ';
echo ' <span class="MItem LastCommentDate">' . Gdn_Format::date($Discussion->FirstDate, 'html');
if ($Source = val('Source', $Discussion)) {
echo ' ' . sprintf(t('via %s'), t($Source . ' Source', $Source));
}
echo '</span> ';
}
if ($Sender->data('_ShowCategoryLink', true) && c('Vanilla.Categories.Use') && $Category) {
echo wrap(Anchor(htmlspecialchars($Discussion->Category), CategoryUrl($Discussion->CategoryUrlCode)), 'span', array('class' => 'MItem Category ' . $Category['CssClass']));
}
$Sender->fireEvent('DiscussionMeta');
?>
</div>
</div>
<?php
$Sender->fireEvent('AfterDiscussionContent');
//.........这里部分代码省略.........
示例11: foreach
?>
</h4>
<ul class="PanelActivity">
<?php
$Data = $this->ActivityData;
foreach ($Data->Result() as $Activity) {
echo '<li class="Activity ' . $Activity->ActivityType . '">';
// 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 ' ' . Gdn_Format::Display($Activity->Story) . ' ';
echo '<em>' . Gdn_Format::Date($Activity->DateInserted) . '</em>';
} else {
echo Gdn_Format::ActivityHeadline($Activity);
echo '<em>' . Gdn_Format::Date($Activity->DateInserted) . '</em>';
if ($Activity->Story != '') {
echo '<div class="Story">';
echo $Activity->Story;
echo '</div>';
}
}
echo '</li>';
}
示例12: WriteComment
/**
* $Object is either a Comment or the original Discussion.
*/
function WriteComment($Object, $Sender, $Session, $CurrentOffset) {
$Alt = ($CurrentOffset % 2) != 0;
$Author = UserBuilder($Object, 'Insert');
$Type = property_exists($Object, 'CommentID') ? 'Comment' : 'Discussion';
$Sender->EventArguments['Object'] = $Object;
$Sender->EventArguments['Type'] = $Type;
$Sender->EventArguments['Author'] = $Author;
$CssClass = 'Item Comment';
$Permalink = GetValue('Url', $Object, FALSE);
if ($Type == 'Comment') {
$Sender->EventArguments['Comment'] = $Object;
$Id = 'Comment_'.$Object->CommentID;
if ($Permalink === FALSE)
$Permalink = '/discussion/comment/'.$Object->CommentID.'/#Comment_'.$Object->CommentID;
} else {
$Sender->EventArguments['Discussion'] = $Object;
$CssClass .= ' FirstComment';
$Id = 'Discussion_'.$Object->DiscussionID;
if ($Permalink === FALSE)
$Permalink = '/discussion/'.$Object->DiscussionID.'/'.Gdn_Format::Url($Object->Name).'/p1';
}
$Sender->EventArguments['CssClass'] = &$CssClass;
$Sender->Options = '';
$CssClass .= $Object->InsertUserID == $Session->UserID ? ' Mine' : '';
if ($Alt)
$CssClass .= ' Alt';
$Alt = !$Alt;
if (!property_exists($Sender, 'CanEditComments'))
$Sender->CanEditComments = $Session->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use');
$Sender->FireEvent('BeforeCommentDisplay');
?>
<li class="<?php echo $CssClass; ?>" id="<?php echo $Id; ?>">
<div class="Comment">
<div class="Meta">
<?php $Sender->FireEvent('BeforeCommentMeta'); ?>
<span class="Author">
<?php
echo UserPhoto($Author);
echo UserAnchor($Author);
?>
</span>
<span class="DateCreated">
<?php
echo Anchor(Gdn_Format::Date($Object->DateInserted), $Permalink, 'Permalink', array('name' => 'Item_'.($CurrentOffset+1), 'rel' => 'nofollow'));
?>
</span>
<?php
WriteOptionList($Object, $Sender, $Session);
if ($Type == 'Comment' && $Sender->CanEditComments) {
if (!property_exists($Sender, 'CheckedComments'))
$Sender->CheckedComments = $Session->GetAttribute('CheckedComments', array());
$ItemSelected = InSubArray($Id, $Sender->CheckedComments);
echo '<div class="Administration"><input type="checkbox" name="'.$Type.'ID[]" value="'.$Id.'"'.($ItemSelected?' checked="checked"':'').' /></div>';
}
?>
<div class="CommentInfo">
<?php $Sender->FireEvent('CommentInfo'); ?>
</div>
<?php $Sender->FireEvent('AfterCommentMeta'); ?>
</div>
<div class="Message">
<?php
$Sender->FireEvent('BeforeCommentBody');
$Object->FormatBody = Gdn_Format::To($Object->Body, $Object->Format);
$Sender->FireEvent('AfterCommentFormat');
$Object = $Sender->EventArguments['Object'];
echo $Object->FormatBody;
?>
</div>
<?php $Sender->FireEvent('AfterCommentBody'); ?>
</div>
</li>
<?php
$Sender->FireEvent('AfterComment');
}
示例13: foreach
</th>
</tr>
</thead>
-->
<tbody>
<?php
$Alt = '';
foreach ($this->ActiveUserData as $User) {
?>
<tr<?php
$Alt = $Alt == '' ? ' class="Alt"' : '';
echo $Alt;
?>
>
<th><?php
$PhotoUser = UserBuilder($User);
echo userPhoto($PhotoUser);
echo userAnchor($User);
?>
</th>
<td class="Alt"><?php
echo Gdn_Format::date($User->DateLastActive, 'html');
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
示例14: DisplayPhoto
/**
* Display user photo for first user in each discussion.
*/
protected function DisplayPhoto($Sender)
{
// Build user object & output photo
$FirstUser = UserBuilder($Sender->EventArguments['Discussion'], 'First');
echo UserPhoto($FirstUser);
}
示例15: t
<?php
if (!defined('APPLICATION')) {
exit;
}
?>
<div class="Box RecentUsers">
<h4><?php
echo t('Recently Active Users');
?>
</h4>
<div class="Icons">
<?php
$Data = $this->_Sender->RecentUserData;
foreach ($Data->result() as $User) {
$Visitor = UserBuilder($User);
echo userPhoto($Visitor);
}
?>
</div>
</div>