예제 #1
0
    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 
    }
예제 #2
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 
    }
예제 #3
0
    /**
     * Writes a discussion in table row format.
     */
    function writeDiscussionRow($Discussion, $Sender, $Session)
    {
        if (!property_exists($Sender, 'CanEditDiscussions')) {
            $Sender->CanEditDiscussions = val('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 there are no word character detected in the title treat it as if it is blank.
        if (!preg_match('/\\w/u', $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);
        $FirstPageUrl = DiscussionUrl($Discussion, 1);
        $LastPageUrl = DiscussionUrl($Discussion, val('CountPages', $Discussion)) . '#latest';
        ?>
        <tr id="Discussion_<?php 
        echo $Discussion->DiscussionID;
        ?>
" class="<?php 
        echo $CssClass;
        ?>
">
            <?php 
        $Sender->fireEvent('BeforeDiscussionContent');
        ?>
            <?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 
        $Sender->fireEvent('BeforeDiscussionTitle');
        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 = val('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 '&nbsp;';
        }
        ?>
                </div>
            </td>
        </tr>
    <?php 
    }
예제 #4
0
    /**
     * 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 '&nbsp;';
        }
        ?>
		</div>
	</td>
</tr>
<?php 
    }
예제 #5
0
    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');
        ?>
        </li>
    <?php 
    }