示例#1
0
    function writeTableRow($Row, $Depth = 1)
    {
        $Children = $Row['Children'];
        $WriteChildren = FALSE;
        if (!empty($Children)) {
            if ($Depth + 1 >= c('Vanilla.Categories.MaxDisplayDepth')) {
                $WriteChildren = 'list';
            } else {
                $WriteChildren = 'rows';
            }
        }
        $H = 'h' . ($Depth + 1);
        ?>
        <tr class="<?php 
        echo CssClass($Row);
        ?>
">
            <td class="CategoryName">
                <div class="Wrap">
                    <?php 
        echo GetOptions($Row);
        echo CategoryPhoto($Row);
        echo "<{$H}>";
        echo anchor(htmlspecialchars($Row['Name']), $Row['Url']);
        Gdn::controller()->EventArguments['Category'] = $Row;
        Gdn::controller()->fireEvent('AfterCategoryTitle');
        echo "</{$H}>";
        ?>
                    <div class="CategoryDescription">
                        <?php 
        echo $Row['Description'];
        ?>
                    </div>
                    <?php 
        if ($WriteChildren === 'list') {
            ?>
                        <div class="ChildCategories">
                            <?php 
            echo wrap(t('Child Categories') . ': ', 'b');
            echo CategoryString($Children, $Depth + 1);
            ?>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </td>
            <td class="BigCount CountDiscussions">
                <div class="Wrap">
                    <?php 
        //            echo "({$Row['CountDiscussions']})";
        echo BigPlural($Row['CountAllDiscussions'], '%s discussion');
        ?>
                </div>
            </td>
            <td class="BigCount CountComments">
                <div class="Wrap">
                    <?php 
        //            echo "({$Row['CountComments']})";
        echo BigPlural($Row['CountAllComments'], '%s comment');
        ?>
                </div>
            </td>
            <td class="BlockColumn LatestPost">
                <div class="Block Wrap">
                    <?php 
        if ($Row['LastTitle']) {
            ?>
                        <?php 
            echo userPhoto($Row, array('Size' => 'Small', 'Px' => 'Last'));
            echo anchor(SliceString(Gdn_Format::text($Row['LastTitle']), 100), $Row['LastUrl'], 'BlockTitle LatestPostTitle', array('title' => html_entity_decode($Row['LastTitle'])));
            ?>
                        <div class="Meta">
                            <?php 
            echo userAnchor($Row, 'UserLink MItem', 'Last');
            ?>
                            <span class="Bullet">•</span>
                            <?php 
            echo anchor(Gdn_Format::date($Row['LastDateInserted'], 'html'), $Row['LastUrl'], 'CommentDate MItem');
            if (isset($Row['LastCategoryID'])) {
                $LastCategory = CategoryModel::categories($Row['LastCategoryID']);
                echo ' <span>', sprintf('in %s', anchor($LastCategory['Name'], CategoryUrl($LastCategory, '', '//'))), '</span>';
            }
            ?>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </td>
        </tr>
        <?php 
        if ($WriteChildren === 'rows') {
            foreach ($Children as $ChildRow) {
                WriteTableRow($ChildRow, $Depth + 1);
            }
        }
    }
示例#2
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 
    }
示例#3
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 
    }
示例#4
0
 function newComments($Discussion)
 {
     if (!Gdn::session()->isValid()) {
         return '';
     }
     if ($Discussion->CountUnreadComments === TRUE) {
         $Title = htmlspecialchars(t("You haven't read this yet."));
         return ' <strong class="HasNew JustNew NewCommentCount" title="' . $Title . '">' . t('new discussion', 'new') . '</strong>';
     } elseif ($Discussion->CountUnreadComments > 0) {
         $Title = htmlspecialchars(Plural($Discussion->CountUnreadComments, "%s new comment since you last read this.", "%s new comments since you last read this."));
         return ' <strong class="HasNew NewCommentCount" title="' . $Title . '">' . plural($Discussion->CountUnreadComments, '%s new', '%s new plural', BigPlural($Discussion->CountUnreadComments, '%s new', '%s new plural')) . '</strong>';
     }
     return '';
 }
示例#5
0
文件: all.php 项目: R-J/vanilla
            if ($Category->DisplayAs === 'Heading') {
                $CatList .= '<li id="Category_' . $CategoryID . '" class="CategoryHeading ' . $CssClass . '">
               <div class="ItemContent Category"><div class="Options">' . getOptions($Category, $this) . '</div>' . Gdn_Format::text($Category->Name) . '</div>
            </li>';
                $Alt = FALSE;
            } else {
                $LastComment = UserBuilder($Category, 'Last');
                $AltCss = $Alt ? ' Alt' : '';
                $Alt = !$Alt;
                $CatList .= '<li id="Category_' . $CategoryID . '" class="' . $CssClass . '">
               <div class="ItemContent Category">' . '<div class="Options">' . getOptions($Category, $this) . '</div>' . CategoryPhoto($Category) . '<div class="TitleWrap">' . anchor(Gdn_Format::text($Category->Name), CategoryUrl($Category), 'Title') . '</div>
                  <div class="CategoryDescription">' . $Category->Description . '</div>
                  <div class="Meta">
                     <span class="MItem RSS">' . anchor(img('applications/dashboard/design/images/rss.gif', array('alt' => T('RSS Feed'))), '/categories/' . $Category->UrlCode . '/feed.rss', '', array('title' => T('RSS Feed'))) . '</span>
                     <span class="MItem DiscussionCount">' . sprintf(PluralTranslate($Category->CountDiscussions, '%s discussion html', '%s discussions html', t('%s discussion'), t('%s discussions')), BigPlural($Category->CountDiscussions, '%s discussion')) . '</span>
                     <span class="MItem CommentCount">' . sprintf(PluralTranslate($Category->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), BigPlural($Category->CountComments, '%s comment')) . '</span>';
                if ($Category->LastTitle != '') {
                    $CatList .= '<span class="MItem LastDiscussionTitle">' . sprintf(t('Most recent: %1$s by %2$s'), anchor(Gdn_Format::text(sliceString($Category->LastTitle, 40)), $Category->LastUrl), userAnchor($LastComment)) . '</span>' . '<span class="MItem LastCommentDate">' . Gdn_Format::date($Category->LastDateInserted) . '</span>';
                }
                // If this category is one level above the max display depth, and it
                // has children, add a replacement string for them.
                if ($MaxDisplayDepth > 0 && $Category->Depth == $MaxDisplayDepth - 1 && $Category->TreeRight - $Category->TreeLeft > 1) {
                    $CatList .= '{ChildCategories}';
                }
                $CatList .= '</div>
               </div>
            </li>';
            }
        }
    }
}
示例#6
0
   <h4><?php 
    echo T('Categories');
    ?>
</h4>
   <ul class="PanelInfo PanelCategories">
   <?php 
    echo '<li' . ($OnCategories ? ' class="Active"' : '') . '>' . Wrap(Anchor(Gdn_Format::Text(T('All Categories')), '/categories'), 'strong') . ' <span class="Aside"><span class="Count">' . BigPlural($CountDiscussions, '%s discussion') . '</span></span></li>';
    $MaxDepth = C('Vanilla.Categories.MaxDisplayDepth');
    $DoHeadings = C('Vanilla.Categories.DoHeadings');
    foreach ($this->Data->Result() as $Category) {
        if ($Category->CategoryID < 0 || $MaxDepth > 0 && $Category->Depth > $MaxDepth) {
            continue;
        }
        if ($DoHeadings && $Category->Depth == 1) {
            $CssClass = 'Heading';
        } else {
            $CssClass = 'Depth' . $Category->Depth . ($CategoryID == $Category->CategoryID ? ' Active' : '');
        }
        echo '<li class="ClearFix ' . $CssClass . '">';
        if ($DoHeadings && $Category->Depth == 1) {
            echo Gdn_Format::Text($Category->Name);
        } else {
            echo Wrap(Anchor(Gdn_Format::Text($Category->Name), CategoryUrl($Category)), 'strong') . ' <span class="Aside"><span class="Count">' . BigPlural($Category->CountAllDiscussions, '%s discussion') . '</span></span>';
        }
        echo "</li>\n";
    }
    ?>
   </ul>
</div>
   <?php 
}
示例#7
0
    echo T('Categories');
    ?>
</h4>
   <ul class="PanelInfo PanelCategories">
   <?php 
    echo '<li' . ($OnCategories ? ' class="Active"' : '') . '>' . Anchor(T('All Categories') . ' <span class="Aside"><span class="Count">' . BigPlural($CountDiscussions, '%s discussion') . '</span></span>', '/categories', 'ItemLink') . '</li>';
    $MaxDepth = C('Vanilla.Categories.MaxDisplayDepth');
    $DoHeadings = C('Vanilla.Categories.DoHeadings');
    foreach ($this->Data->Result() as $Category) {
        if ($Category->CategoryID < 0 || $MaxDepth > 0 && $Category->Depth > $MaxDepth) {
            continue;
        }
        if ($DoHeadings && $Category->Depth == 1) {
            $CssClass = 'Heading ' . $Category->CssClass;
        } else {
            $CssClass = 'Depth' . $Category->Depth . ($CategoryID == $Category->CategoryID ? ' Active' : '') . ' ' . $Category->CssClass;
        }
        echo '<li class="ClearFix ' . $CssClass . '">';
        if ($DoHeadings && $Category->Depth == 1) {
            echo htmlspecialchars($Category->Name) . ' <span class="Aside"><span class="Count Hidden">' . BigPlural($Category->CountAllDiscussions, '%s discussion') . '</span></span>';
        } else {
            $CountText = ' <span class="Aside"><span class="Count">' . BigPlural($Category->CountAllDiscussions, '%s discussion') . '</span></span>';
            echo Anchor(htmlspecialchars($Category->Name) . $CountText, CategoryUrl($Category), 'ItemLink');
        }
        echo "</li>\n";
    }
    ?>
   </ul>
</div>
   <?php 
}