コード例 #1
0
 /** Returns a single article enclosed in li tags */
 public function getArticleTextListEntry(Article $article, $displayImage = false)
 {
     $text = $this->text;
     $returnValue = '<li><a href="' . $text->e($text->getUrlPage("article", $article->getId())) . '"';
     $returnValue .= 'title="' . htmlSpecialChars($article->getIntro()) . '">';
     if ($displayImage && !empty($article->featuredImage)) {
         $returnValue .= '<div class="linklist_icon_image"><img src="' . htmlSpecialChars($article->featuredImage) . '" alt="' . htmlSpecialChars($article->getTitle()) . '" /></div>';
     }
     $returnValue .= "<span>" . htmlSpecialChars($article->getTitle()) . "</span></a></li>\n";
     return $returnValue;
 }
コード例 #2
0
 public function writeArticleTextSmall(StreamInterface $stream, Article $article, $show_metainfo, $show_edit_delete_links)
 {
     $text = $this->text;
     $stream->write("\n\n" . '<article class="article_teaser ');
     if (!empty($article->featuredImage)) {
         $stream->write("with_featured_image");
     }
     $stream->write('">');
     // Title
     $titleHtml = $text->e($article->getTitle());
     $stream->write("<header>");
     $stream->write("<h3>" . $this->encloseInArticleLink($article, $titleHtml) . "</h3>");
     if ($show_metainfo) {
         $stream->write('<p class="meta">');
         // Created and last edited
         $stream->write($text->t('articles.created') . " " . $text->formatDateTime($article->getDateCreated()) . ' - ');
         if ($article->getDateLastEdited()) {
             $stream->write(lcFirst($text->t('articles.last_edited')) . " " . $text->formatDateTime($article->getDateLastEdited()) . '<br />');
         }
         // Category
         $stream->write($text->t('main.category') . ": ");
         $stream->write('<a href="' . $text->e($text->getUrlPage("category", $article->categoryId)) . '">');
         $stream->write($text->e($article->category) . '</a>');
         // Author
         $stream->write(" - " . $text->t('articles.author') . ": ");
         $stream->write('<a href="' . $text->e($text->getUrlPage("account", $article->authorId)) . '">');
         $stream->write($text->e($article->author) . "</a>");
         // Pinned
         if ($article->pinned) {
             $stream->write(" - " . $text->t('articles.pinned'));
         }
         // Hidden
         if ($article->isHidden()) {
             $stream->write(" - " . $text->t('articles.hidden'));
         }
         $stream->write('</p>');
     }
     $stream->write("</header>");
     // Featured image
     if (!empty($article->featuredImage)) {
         $imageHtml = '<img src="' . htmlSpecialChars($article->featuredImage) . '" alt="' . htmlSpecialChars($article->getTitle()) . '" />';
         $stream->write($this->encloseInArticleLink($article, $imageHtml));
     }
     // Intro
     $stream->write('<p class="article_teaser_text">');
     $stream->write($this->encloseInArticleLink($article, htmlSpecialChars($article->getIntro())));
     $stream->write('</p>');
     $stream->write('<footer class="article_teaser_links"><p>');
     // Edit and delete links
     $stream->write('<a class="arrow" href="' . $text->e($text->getUrlPage("article", $article->getId())) . '">' . $text->t('main.read') . '</a>');
     if ($show_edit_delete_links) {
         $stream->write('<a class="arrow" href="' . $text->e($text->getUrlPage("edit_article", $article->getId())) . '">' . $text->t('main.edit') . '</a>' . '<a class="arrow" href="' . $text->e($text->getUrlPage("delete_article", $article->getId())) . '">' . $text->t('main.delete') . '</a>');
     }
     $stream->write("</p></footer>");
     $stream->write('<p style="clear:both"></p>');
     $stream->write("</article>");
 }
コード例 #3
0
 /**
  * Gets the markup for a single row in the table, from &lt;tr&gt;
  * to &lt;.tr&gt;.
  * @param Article $article The article to display in the row.
  * @param boolean $loggedIn True if edit/delete column must be shown,
  * false otherwise.
  * @return string The markup for the row.
  */
 protected function getTableRow(Article $article, $loggedIn)
 {
     $text = $this->text;
     $textToDisplay = '<tr><td><a href="' . $text->e($text->getUrlPage("article", $article->getId()));
     $textToDisplay .= '">' . htmlSpecialChars($article->getTitle()) . "</a>";
     if ($loggedIn) {
         // Display edit links in new cell
         $textToDisplay .= '</td><td style="width:20%">';
         $textToDisplay .= '<a class="arrow" href="' . $text->e($text->getUrlPage("edit_article", $article->getId()));
         $textToDisplay .= '">' . $text->t("main.edit") . "</a>";
         $textToDisplay .= ' <a class="arrow" href="' . $text->e($text->getUrlPage("delete_article", $article->getId()));
         $textToDisplay .= '">' . $text->t("main.delete") . "</a>";
     }
     $textToDisplay .= "</td></tr>\n";
     return $textToDisplay;
 }
コード例 #4
0
    private function getArticleTextListEntry(Article $article)
    {
        $text = $this->text;
        if ($article->onCalendar === null) {
            return "";
        }
        $computerDateTime = $article->onCalendar->format("c");
        return <<<ARTICLE
            <li>
                <a href="{$text->e($text->getUrlPage("article", $article->getId()))}" class="date disguised_link">
                    <time datetime="{$text->e($computerDateTime)}">
                        {$text->formatEventDateTime($article->onCalendar, '<br />')}
                    </time>
                </a>
                <span class="title">
                    <a href="{$text->e($text->getUrlPage("article", $article->getId()))}">
                        {$text->e($article->getTitle())}
                    </a>
                    {$this->getArticleEditLinks($article)}
                </span>
            </li>
ARTICLE;
    }
コード例 #5
0
ファイル: ArticleTemplate.php プロジェクト: rutgerkok/rCMS
 private function writeArticleTextFull(StreamInterface $stream, Article $article, array $comments)
 {
     // Store some variables for later use
     $text = $this->text;
     $id = $article->getId();
     $loggedIn = $this->editLink;
     // Echo the sidebar
     $stream->write('<div id="sidebar_page_sidebar">');
     // Featured image
     if (!empty($article->featuredImage)) {
         $stream->write('<p><img src="' . htmlSpecialChars($article->featuredImage) . '" alt="' . htmlSpecialChars($article->getTitle()) . '" /></p>');
     }
     $stream->write('<p class="meta">');
     // Created and last edited
     $stream->write($text->t('articles.created') . " <br />&nbsp;&nbsp;&nbsp;" . $text->formatDateTime($article->getDateCreated()));
     if ($article->getDateLastEdited()) {
         $stream->write(" <br />  " . $text->t('articles.last_edited') . " <br />&nbsp;&nbsp;&nbsp;" . $text->formatDateTime($article->getDateLastEdited()));
     }
     // Category
     $stream->write(" <br /> " . $text->t('main.category') . ': ');
     $stream->write('<a href="' . $text->e($text->getUrlPage("category", $article->categoryId)) . '">');
     $stream->write($text->e($article->category) . '</a>');
     // Author
     $stream->write(" <br /> " . $text->t('articles.author') . ': ');
     $stream->write('<a href="' . $text->e($text->getUrlPage("account", $article->authorId)) . '">');
     $stream->write($text->e($article->author) . '</a>');
     // Pinned, hidden, comments
     if ($article->pinned) {
         $stream->write("<br />" . $text->t('articles.pinned') . " ");
     }
     if ($article->isHidden()) {
         $stream->write("<br />" . $text->t('articles.hidden'));
     }
     if ($loggedIn && $article->showComments) {
         $stream->write("<br />" . $text->t('comments.allowed'));
     }
     // Edit, delete
     $stream->write('</p>');
     if ($loggedIn) {
         $stream->write("<p style=\"clear:both\">");
         $stream->write('&nbsp;&nbsp;&nbsp;<a class="arrow" href="' . $text->e($text->getUrlPage("edit_article", $id)) . '">' . $text->t('main.edit') . '</a>&nbsp;&nbsp;' . '<a class="arrow" href="' . $text->e($text->getUrlPage("delete_article", $id)) . '">' . $text->t('main.delete') . '</a>');
         $stream->write("</p>");
     }
     $stream->write('</div>');
     // Article
     $stream->write('<div id="sidebar_page_content">');
     if ($loggedIn && $article->isHidden()) {
         $stream->write('<p class="meta">' . $text->t('articles.is_hidden') . "<br /> \n" . $text->t('articles.hidden.explained') . '</p>');
     }
     $stream->write('<p class="intro">' . $text->e($article->getIntro()) . '</p>');
     $stream->write($article->getBody());
     // Comments
     if ($article->showComments) {
         $commentCount = count($comments);
         // Title
         $stream->write('<h3 class="notable">' . $text->t("comments.comments"));
         if ($commentCount > 0) {
             $stream->write(' (' . $commentCount . ')');
         }
         $stream->write("</h3>\n\n");
         // "No comments found" if needed
         if ($commentCount == 0) {
             $stream->write('<p><em>' . $text->t("comments.no_comments_found") . '</em></p>');
         }
         // Comment add link
         $stream->write('<p><a class="button primary_button" href="' . $text->e($text->getUrlPage("add_comment", $id)) . '">' . $text->t("comments.add") . "</a></p>");
         // Show comments
         $commentTreeTemplate = new CommentsTreeTemplate($text, $comments, false, $this->userTemplateingComments);
         $commentTreeTemplate->writeText($stream);
     }
     $stream->write('</div>');
 }