コード例 #1
0
 function writeCategoryTable($Categories, $Depth = 1)
 {
     ?>
     <div class="DataTableWrap">
         <table class="DataTable CategoryTable">
             <thead>
             <?php 
     WriteTableHead();
     ?>
             </thead>
             <tbody>
             <?php 
     foreach ($Categories as $Category) {
         WriteTableRow($Category, $Depth);
     }
     ?>
             </tbody>
         </table>
     </div>
 <?php 
 }
コード例 #2
0
ファイル: helper_functions.php プロジェクト: vanilla/vanilla
    function writeTableRow($Row, $Depth = 1)
    {
        $Children = $Row['Children'];
        $WriteChildren = FALSE;
        $maxDisplayDepth = c('Vanilla.Categories.MaxDisplayDepth');
        if (!empty($Children)) {
            if ($maxDisplayDepth > 0 && $Depth + 1 >= $maxDisplayDepth) {
                $WriteChildren = 'list';
            } else {
                $WriteChildren = 'rows';
            }
        }
        $H = 'h' . ($Depth + 1);
        ?>
        <tr class="<?php 
        echo CssClass($Row);
        ?>
">
            <td class="CategoryName">
                <div class="Wrap">
                    <?php 
        echo '<div class="Options">' . getOptions($Row) . '</div>';
        echo CategoryPhoto($Row);
        echo "<{$H}>";
        $safeName = htmlspecialchars($Row['Name']);
        echo $Row['DisplayAs'] === 'Heading' ? $safeName : anchor($safeName, $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);
            }
        }
    }