/**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     $this->entryList = new AccessibleEntryList();
     $this->entryList->getConditionBuilder()->add("news_entry.isArchived = ?", array(0));
     $this->entryList->sqlLimit = CMS_DASHBOARD_LATEST_NEWSENTRIES;
     $this->entryList->readObjects();
     $this->fetched();
 }
 /**
  * Creates a new UnreadNewsList object.
  */
 public function __construct()
 {
     parent::__construct();
     $this->getConditionBuilder()->add("news_entry.time > ?", array(VisitTracker::getInstance()->getVisitTime('de.incendium.cms.news.entry')));
     $this->getConditionBuilder()->add("tracked_visit.visitTime IS NULL");
     $this->sqlConditionJoins = "LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit ON (tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('de.incendium.cms.news.entry') . " AND tracked_visit.objectID = news_entry.entryID AND tracked_visit.userID = " . WCF::getUser()->userID . ")";
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // add breadcrumbs
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news'), LinkHandler::getInstance()->getLink('NewsOverview', array('application' => 'cms'))));
     if ($this->entry->isArchived) {
         WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news.archive'), LinkHandler::getInstance()->getLink('NewsArchive', array('application' => 'cms'))));
     }
     $categories = array();
     $leafCategories = $this->entry->getLeafCategories();
     $category = reset($leafCategories);
     while ($category !== null) {
         $categories[] = $category;
         $category = $category->getParentCategory();
     }
     foreach (array_reverse($categories) as $parentCategory) {
         WCF::getBreadcrumbs()->add($parentCategory->getBreadcrumb());
     }
     // update news view count
     $this->entry->updateVisits();
     // update news visit
     if ($this->entry->isNew()) {
         $entryAction = new EntryAction(array($this->entry->getDecoratedObject()), 'markAsRead', array('viewableEntry' => $this->entry));
         $entryAction->executeAction();
     }
     // fetch news likes
     if (MODULE_LIKE) {
         $objectType = LikeHandler::getInstance()->getObjectType('de.incendium.cms.like.likeableNews');
         LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->entryID));
         $this->entryLikeData = LikeHandler::getInstance()->getLikeObjects($objectType);
     }
     // get news tags
     if (MODULE_TAGGING) {
         $this->tags = TagEngine::getInstance()->getObjectTags('de.incendium.cms.news.entry', $this->entry->entryID, array($this->entry->languageID === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : ""));
     }
     // get news comments
     if ($this->commentManager === null) {
         $this->objectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.incendium.cms.news.comment');
         $objectType = CommentHandler::getInstance()->getObjectType($this->objectTypeID);
         $this->commentManager = $objectType->getProcessor();
     }
     $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->objectTypeID, $this->entryID);
     // more news from this category
     $this->moreEntryList = new AccessibleEntryList();
     $this->moreEntryList->getConditionBuilder()->add("news_entry.entryID IN (SELECT entryID FROM cms" . WCF_N . "_news_entry_to_category WHERE entryID != ? AND categoryID IN (?))", array($this->entryID, $this->entry->getCategoryIDs()));
     $this->moreEntryList->sqlLimit = CMS_DASHBOARD_SIDEBAR_NEWSENTRIES;
     $this->moreEntryList->readObjects();
     // meta tags
     MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->entry->subject . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true);
     MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('NewsEntry', array('application' => 'cms', 'object' => $this->entry)), true);
     MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true);
     MetaTagHandler::getInstance()->addTag('og:description', 'og:description', StringUtil::decodeHTML(StringUtil::stripHTML($this->entry->getExcerpt())), true);
     // add tags as keywords
     if (!empty($this->tags)) {
         $keywords = '';
         foreach ($this->tags as $tag) {
             if (!empty($keywords)) {
                 $keywords .= ', ';
             }
             $keywords .= $tag->name;
         }
         MetaTagHandler::getInstance()->addTag('keywords', 'keywords', $keywords);
     }
     // quotes
     MessageQuoteManager::getInstance()->initObjects('de.incendium.cms.news.entry', array($this->entry->entryID));
 }