コード例 #1
0
ファイル: helper_functions.php プロジェクト: vanilla/vanilla
    function writeCategoryTable($categories, $depth = 1, $inTable = false)
    {
        foreach ($categories as $category) {
            $displayAs = val('DisplayAs', $category);
            $urlCode = $category['UrlCode'];
            $class = val('CssClass', $category);
            $name = htmlspecialchars($category['Name']);
            if ($displayAs === 'Heading') {
                if ($inTable) {
                    echo '</tbody></table></div>';
                    $inTable = false;
                }
                ?>
                <div id="CategoryGroup-<?php 
                echo $urlCode;
                ?>
" class="CategoryGroup <?php 
                echo $class;
                ?>
">
                    <h2 class="H"><?php 
                echo $name;
                ?>
</h2>
                    <?php 
                writeCategoryTable($category['Children'], $depth + 1, $inTable);
                ?>
                </div>
                <?php 
            } else {
                if (!$inTable) {
                    ?>
                    <div class="DataTableWrap">
                        <table class="DataTable CategoryTable">
                            <thead>
                            <?php 
                    writeTableHead();
                    ?>
                            </thead>
                            <tbody>
                    <?php 
                    $inTable = true;
                }
                writeTableRow($category, $depth);
            }
        }
        if ($inTable) {
            echo '</tbody></table></div>';
        }
    }
コード例 #2
0
ファイル: flat_table.php プロジェクト: vanilla/vanilla
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
    <h1 class="H HomepageTitle"><?php 
echo $this->data('Title');
?>
</h1>
    <div class="P PageDescription"><?php 
echo $this->description();
?>
</div>
<?php 
$this->fireEvent('AfterDescription');
$this->fireEvent('AfterPageTitle');
$categories = $this->data('CategoryTree');
writeCategoryTable($categories, 1);
?>
<div class="PageControls Bottom">
    <?php 
PagerModule::write();
?>
</div>
コード例 #3
0
ファイル: flatcategory.php プロジェクト: vanilla/vanilla
        <input name="CategoryID" type="hidden" value="<?php 
echo htmlspecialchars($this->data('ParentCategory.CategoryID'));
?>
" />
        <input name="Limit" type="hidden" value="<?php 
echo $this->getLimit();
?>
" />
    </div>

    <div class="FlatCategoryResult">
        <?php 
if ($this->data('Layout') === 'table') {
    ?>
            <?php 
    writeCategoryTable($this->data('Categories', []), 1);
    ?>
        <?php 
} else {
    ?>
        <ul class="DataList CategoryList">
            <?php 
    foreach ($this->data('Categories') as $category) {
        writeListItem($category);
    }
    ?>
        </ul>
        <?php 
}
?>
コード例 #4
0
ファイル: subtree.php プロジェクト: vanilla/vanilla
<?php

if (!defined('APPLICATION')) {
    exit;
}
// This view is deprecated as of 2016-09-30.
deprecated('vanilla/categories/subtree view');
if (isset($this->CategoryModel) && $this->CategoryModel instanceof CategoryModel) {
    $childCategories = $this->data('CategoryTree', []);
    $this->CategoryModel->joinRecent($childCategories);
    if ($childCategories) {
        include $this->fetchViewLocation('helper_functions', 'categories', 'vanilla');
        if (c('Vanilla.Categories.Layout') === 'table') {
            writeCategoryTable($childCategories);
        } else {
            writeCategoryList($childCategories);
        }
    }
}