Example #1
0
    public function writeCategory(StreamInterface $stream, Category $category)
    {
        $text = $this->text;
        $stream->write("\n\n" . '<article class="article_teaser">');
        // Title
        $titleHtml = $text->e($category->getName());
        $stream->write("<header>");
        $stream->write("<h3>" . $this->encloseInCategoryLink($category, $titleHtml) . "</h3>");
        $stream->write("</header>");
        // Intro
        $stream->write($this->encloseInCategoryLink($category, $category->getDescriptionHtml()));
        $stream->write('<footer class="article_teaser_links"><p>');
        // Edit and delete links
        $stream->write('<a class="arrow" href="' . $text->url("category", $category->getId()) . '">' . $text->t('categories.view_articles') . '</a>');
        if ($this->editLinks) {
            $deleteClass = $category->isStandardCategory() ? "arrow-disabled" : "arrow";
            $stream->write(<<<HTML
                <a class="arrow" href="{$text->url("edit_article", 0, ["article_category" => $category->getId()])}">
                    {$text->t('articles.create')}
                </a>
                <a class="arrow" href="{$text->url("edit_category", $category->getId())}">
                    {$text->t('categories.edit')}
                </a>
                <a class="{$deleteClass}" href="{$text->url("delete_category", $category->getId())}">
                    {$text->t('categories.delete')}
                </a>
HTML
);
        }
        $stream->write("</p></footer>");
        $stream->write('<p style="clear:both"></p>');
        $stream->write("</article>");
    }