示例#1
0
    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 
    }
 /**
  * Takes a user object, and writes out an anchor of the user's icon to the user's profile.
  *
  * @param object|array $User A user object or array.
  * @param array $Options
  */
 function userPhoto($User, $Options = array())
 {
     if (is_string($Options)) {
         $Options = array('LinkClass' => $Options);
     }
     if ($Px = val('Px', $Options)) {
         $User = userBuilder($User, $Px);
     } else {
         $User = (object) $User;
     }
     $LinkClass = concatSep(' ', val('LinkClass', $Options, ''), 'PhotoWrap');
     $ImgClass = val('ImageClass', $Options, 'ProfilePhoto');
     $Size = val('Size', $Options);
     if ($Size) {
         $LinkClass .= " PhotoWrap{$Size}";
         $ImgClass .= " {$ImgClass}{$Size}";
     } else {
         $ImgClass .= " {$ImgClass}Medium";
         // backwards compat
     }
     $FullUser = Gdn::userModel()->getID(val('UserID', $User), DATASET_TYPE_ARRAY);
     $UserCssClass = val('_CssClass', $FullUser);
     if ($UserCssClass) {
         $LinkClass .= ' ' . $UserCssClass;
     }
     $LinkClass = $LinkClass == '' ? '' : ' class="' . $LinkClass . '"';
     $Photo = val('Photo', $User, val('PhotoUrl', $User));
     $Name = val('Name', $User);
     $Title = htmlspecialchars(val('Title', $Options, $Name));
     $Href = url(userUrl($User));
     if ($FullUser && $FullUser['Banned']) {
         $Photo = c('Garden.BannedPhoto', 'https://c3409409.ssl.cf0.rackcdn.com/images/banned_large.png');
         $Title .= ' (' . t('Banned') . ')';
     }
     if ($Photo) {
         if (!isUrl($Photo)) {
             $PhotoUrl = Gdn_Upload::url(changeBasename($Photo, 'n%s'));
         } else {
             $PhotoUrl = $Photo;
         }
     } else {
         $PhotoUrl = UserModel::getDefaultAvatarUrl($User, 'thumbnail');
     }
     return '<a title="' . $Title . '" href="' . $Href . '"' . $LinkClass . '>' . img($PhotoUrl, array('alt' => $Name, 'class' => $ImgClass)) . '</a>';
 }
 /**
  * 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, array('LinkClass' => 'IndexPhoto'));
 }
示例#4
0
}
echo wrap(t('Inbox'), 'strong');
?>
    </li>
    <?php 
if (count($this->data('Conversations'))) {
    ?>
        <?php 
    foreach ($this->data('Conversations') as $Row) {
        $Subject = '';
        if ($Row['Subject']) {
            $Subject = Gdn_Format::text($Row['Subject']);
        } else {
            $Subject = ConversationModel::participantTitle($Row, false);
        }
        $PhotoUser = userBuilder($Row, 'LastInsert');
        ?>
            <li class="Item" rel="<?php 
        echo url("/messages/{$Row['ConversationID']}#Message_{$Row['LastMessageID']}");
        ?>
">
                <div class="Author Photo"><?php 
        echo userPhoto($PhotoUser);
        ?>
</div>
                <div class="ItemContent">
                    <b class="Subject"><?php 
        echo anchor($Subject, "/messages/{$Row['ConversationID']}#Message_{$Row['LastMessageID']}");
        ?>
</b>
                    <?php 
示例#5
0
文件: table.php 项目: vanilla/vanilla
            <th class="PostTypeCell column-md"><?php 
echo t('Posted By', 'Posted By');
?>
</th>
            <th class="options column-checkbox"></th>
        </tr>
        </thead>
        <tbody>
        <?php 
foreach ($this->data('Log') as $Row) {
    $RecordLabel = valr('Data.Type', $Row);
    if (!$RecordLabel) {
        $RecordLabel = $Row['RecordType'];
    }
    $RecordLabel = Gdn_Form::LabelCode($RecordLabel);
    $user = userBuilder($Row, 'Insert');
    $user = Gdn::userModel()->getByUsername(val('Name', $user));
    $viewPersonalInfo = gdn::session()->checkPermission('Garden.PersonalInfo.View');
    $userBlock = new MediaItemModule(val('Name', $user), userUrl($user));
    $userBlock->setView('media-sm')->setImage(userPhotoUrl($user))->addMetaIf($viewPersonalInfo, Gdn_Format::Email($user->Email));
    $Url = FALSE;
    if (in_array($Row['Operation'], array('Edit', 'Moderate'))) {
        switch (strtolower($Row['RecordType'])) {
            case 'discussion':
                $Url = "/discussion/{$Row['RecordID']}/x/p1";
                break;
            case 'comment':
                $Url = "/discussion/comment/{$Row['RecordID']}#Comment_{$Row['RecordID']}";
        }
    } elseif ($Row['Operation'] === 'Delete') {
        switch (strtolower($Row['RecordType'])) {