/** * @see \wcf\system\dashboard\box\IDashboardBox::init() */ public function init(DashboardBox $box, IPage $page) { parent::init($box, $page); $this->vooliaNewsList = new AccessibleNewsList(); $this->vooliaNewsList->getConditionBuilder()->add("news.isArchived = ?", array(0)); $this->vooliaNewsList->sqlLimit = NEWS_DASHBOARD_SIDEBAR_ENTRIES; $this->vooliaNewsList->readObjects(); $this->fetched(); }
/** * Creates a new UnreadNewsList object. */ public function __construct() { parent::__construct(); $this->getConditionBuilder()->add("news.time > ?", array(VisitTracker::getInstance()->getVisitTime('de.voolia.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.voolia.news.entry') . " AND tracked_visit.objectID = news.newsID AND tracked_visit.userID = " . WCF::getUser()->userID . ")"; }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); // add breadcrumbs NEWSCore::getInstance()->setBreadcrumbs(); if ($this->news->isArchived) { WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('news.header.menu.news.archive'), LinkHandler::getInstance()->getLink('NewsArchive', array('application' => 'news')))); } // update news view count $this->news->updateVisits(); // update news visit if ($this->news->isNew()) { $entryAction = new NewsAction(array($this->news->getDecoratedObject()), 'markAsRead', array('viewableNews' => $this->news)); $entryAction->executeAction(); } // fetch news likes if (MODULE_LIKE) { $objectType = LikeHandler::getInstance()->getObjectType('de.voolia.news.likeableNews'); LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->newsID)); $this->newsLikeData = LikeHandler::getInstance()->getLikeObjects($objectType); } // get news tags if (MODULE_TAGGING) { $this->tags = TagEngine::getInstance()->getObjectTags('de.voolia.news.entry', $this->news->newsID, array($this->news->languageID === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : "")); } // get news comments if ($this->commentManager === null) { $this->objectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.voolia.news.comment'); $objectType = CommentHandler::getInstance()->getObjectType($this->objectTypeID); $this->commentManager = $objectType->getProcessor(); } $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->objectTypeID, $this->newsID); // more news from this category $this->moreNewsList = new AccessibleNewsList(); $this->moreNewsList->getConditionBuilder()->add("news.newsID IN (SELECT newsID FROM news" . WCF_N . "_news_to_category WHERE categoryID IN (?))", array($this->news->getCategoryIDs())); $this->moreNewsList->sqlLimit = NEWS_DASHBOARD_SIDEBAR_ENTRIES; $this->moreNewsList->readObjects(); // meta tags MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->news->subject . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true); MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('News', array('application' => 'news', 'object' => $this->news)), true); MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true); MetaTagHandler::getInstance()->addTag('og:description', 'og:description', StringUtil::decodeHTML(StringUtil::stripHTML($this->news->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.voolia.news.entry', array($this->news->newsID)); }