コード例 #1
0
ファイル: AccountPage.php プロジェクト: rutgerkok/rCMS
 /** Returns the HTML of the articles of the user, including the header */
 public function get_articles_html(Website $website)
 {
     $oArticles = new ArticleRepository($website);
     $articles = $oArticles->getArticlesDataUser($this->user->getId());
     $loggedInStaff = $website->isLoggedInAsStaff();
     $oArticleTemplate = new ArticleListTemplate($website->getText(), $articles, 0, true, false, $loggedInStaff);
     if (count($articles) > 0) {
         $returnValue = '<h3 class="notable">' . $website->t("main.articles") . "</h3>\n";
         $returnValue .= $oArticleTemplate->getText();
         return $returnValue;
     } else {
         return "";
     }
 }
コード例 #2
0
ファイル: main.php プロジェクト: rutgerkok/rCMS
 public function writeText(StreamInterface $stream, Website $website, $id, $data)
 {
     // Check variables
     if (!isset($data["title"]) || !isset($data["count"]) || !isset($data["display_type"]) || !isset($data["categories"])) {
         // The order variable is not checked, as older configurations may
         // not have it. The default value will be used instead.
         return;
     }
     // Title
     if (strLen($data["title"]) > 0) {
         $stream->write("<h2>" . htmlSpecialChars($data["title"]) . "</h2>");
     }
     // Get options
     $categories = $data["categories"];
     $articlesCount = (int) $data["count"];
     $displayType = (int) $data["display_type"];
     // Sorting
     $oldestTop = false;
     if (isset($data["order"]) && $data["order"] == self::SORT_OLDEST_TOP) {
         $oldestTop = true;
     }
     // Archive link
     $showArchiveLink = false;
     if (!isset($data["archive"]) || $data["archive"] == true) {
         $showArchiveLink = true;
     }
     $oArticles = new ArticleRepository($website);
     $articles = $oArticles->getArticlesData($categories, $articlesCount, $oldestTop);
     if ($displayType >= self::TYPE_LIST) {
         // Small <ul> list
         $oArticlesTemplate = new ArticleSmallListTemplate($website->getText(), $articles, $website->isLoggedInAsStaff(), $categories[0], $displayType == self::TYPE_LIST_WITH_IMAGES, $showArchiveLink);
     } else {
         // Real paragraphs
         $oArticlesTemplate = new ArticleListTemplate($website->getText(), $articles, $categories[0], $displayType == self::TYPE_WITH_METADATA, $showArchiveLink, $website->isLoggedInAsStaff());
     }
     $oArticlesTemplate->writeText($stream);
 }
コード例 #3
0
 public function writeText(StreamInterface $stream)
 {
     $text = $this->text;
     $resultcount = $this->totalNumberOfArticles;
     if (count($this->articles) > 0) {
         // Display result count
         if ($resultcount == 1) {
             $stream->write("<p>" . $text->t('articles.search.result_found') . "</p>");
         } else {
             $stream->write("<p>" . $text->tReplaced('articles.search.results_found', $resultcount) . "</p>");
         }
         // Display articles
         $stream->write($this->getMenuBar());
         parent::writeText($stream);
         $stream->write($this->getMenuBar());
     } else {
         $stream->write('<p><em>' . $text->t('articles.search.no_results_found') . '</em></p>');
     }
 }