Ejemplo n.º 1
0
    function writeListItem($Row, $Depth = 1)
    {
        $Children = $Row['Children'];
        $WriteChildren = FALSE;
        if (!empty($Children)) {
            if ($Depth + 1 >= c('Vanilla.Categories.MaxDisplayDepth')) {
                $WriteChildren = 'list';
            } else {
                $WriteChildren = 'items';
            }
        }
        $H = 'h' . ($Depth + 1);
        ?>
        <li id="Category_<?php 
        echo $Row['CategoryID'];
        ?>
" class="<?php 
        echo CssClass($Row);
        ?>
">
            <div class="ItemContent Category">
                <?php 
        echo GetOptions($Row);
        echo '<' . $H . ' class="CategoryName TitleWrap">';
        echo CategoryPhoto($Row);
        echo anchor(htmlspecialchars($Row['Name']), $Row['Url'], 'Title');
        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 class="Meta">
            <span class="MItem RSS"><?php 
        echo anchor(' ', '/categories/' . rawurlencode($Row['UrlCode']) . '/feed.rss', 'SpRSS');
        ?>
</span>

            <span class="MItem MItem-Count DiscussionCount"><?php 
        printf(PluralTranslate($Row['CountAllDiscussions'], '%s discussion html', '%s discussions html', t('%s discussion'), t('%s discussions')), BigPlural($Row['CountAllDiscussions'], '%s discussion'));
        ?>
</span>

            <span class="MItem MItem-Count CommentCount"><?php 
        printf(PluralTranslate($Row['CountAllComments'], '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), BigPlural($Row['CountAllComments'], '%s comment'));
        ?>
</span>

            <span class="MItem LastestPost LastDiscussionTitle"><?php 
        echo MostRecentString($Row);
        ?>
</span>
                </div>
            </div>
        </li>
        <?php 
        if ($WriteChildren === 'items') {
            foreach ($Children as $ChildRow) {
                WriteListItem($ChildRow, $Depth + 1);
            }
        }
    }
Ejemplo n.º 2
0
Archivo: all.php Proyecto: 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>';
            }
        }
    }
}
Ejemplo n.º 3
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 
    }
Ejemplo n.º 4
0
    function WriteListItem($Row, $Depth = 1)
    {
        $Children = $Row['Children'];
        $WriteChildren = FALSE;
        if (!empty($Children)) {
            if ($Depth + 1 >= C('Vanilla.Categories.MaxDisplayDepth')) {
                $WriteChildren = 'list';
            } else {
                $WriteChildren = 'items';
            }
        }
        $H = 'h' . ($Depth + 1);
        ?>
   <li id="Category_<?php 
        echo $Row['CategoryID'];
        ?>
" class="<?php 
        echo CssClass($Row);
        ?>
">
      <div class="ItemContent Category">
         <?php 
        echo GetOptions($Row);
        ?>
         
         <?php 
        echo Wrap(Anchor($Row['Name'], $Row['Url'], 'Title'), $H, array('class' => 'CategoryName TitleWrap'));
        ?>
         
         <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 class="Meta">
            <span class="MItem RSS"><?php 
        echo Anchor(' ', '/categories/' . rawurlencode($Row['UrlCode']) . '/feed.rss', 'SpRSS');
        ?>
</span>
            
            <span class="MItem MItem-Count DiscussionCount"><?php 
        printf(PluralTranslate($Row['CountDiscussions'], '%s discussion html', '%s discussions html', '%s discussion', '%s discussions'), BigPlural($Row['CountDiscussions'], '%s discussion'));
        ?>
</span>
            
            <span class="MItem MItem-Count CommentCount"><?php 
        printf(PluralTranslate($Row['CountComments'], '%s comment html', '%s comments html', '%s comment', '%s comments'), BigPlural($Row['CountComments'], '%s comment'));
        ?>
</span>
            
            <span class="MItem LastestPost LastDiscussionTitle"><?php 
        echo MostRecentString($Row);
        ?>
</span>
         </div>
      </div>
   </li>
   <?php 
        if ($WriteChildren === 'items') {
            foreach ($Children as $ChildRow) {
                WriteListItem($ChildRow, $Depth + 1);
            }
        }
    }