/**
  * @see	\wcf\system\moderation\queue\activation\IModerationQueueActivationHandler::enableContent()
  */
 public function enableContent(ModerationQueue $queue)
 {
     if ($this->isValid($queue->objectID) && !$this->getViewableNews($queue->objectID)->isActive) {
         $newsAction = new NewsAction(array($this->getViewableNews($queue->objectID)), 'enable');
         $newsAction->executeAction();
     }
 }
 /**
  * @see	wcf\system\cronjob\ICronjob::execute()
  */
 public function execute(Cronjob $cronjob)
 {
     parent::execute($cronjob);
     // get delayed news
     $newsList = new NewsList();
     $newsList->getConditionBuilder()->add('news.isPublished = 0');
     $newsList->getConditionBuilder()->add('news.publicationDate <= ?', array(TIME_NOW));
     $newsList->readObjects();
     if (count($newsList->getObjects())) {
         // publish news
         $action = new NewsAction($newsList->getObjects(), 'publish');
         $action->executeAction();
     }
     // get outdated news
     $newsList = new NewsList();
     $newsList->getConditionBuilder()->add('news.isArchived = 0');
     $newsList->getConditionBuilder()->add('news.archivingDate != 0 AND news.archivingDate <= ?', array(TIME_NOW));
     $newsList->readObjects();
     if (count($newsList->getObjects())) {
         // archivate news
         $action = new NewsAction($newsList->getObjects(), 'archive');
         $action->executeAction();
     }
 }
 /**
  * @see	\wcf\system\moderation\queue\IModerationQueueHandler::removeContent()
  */
 public function removeContent(ModerationQueue $queue, $message)
 {
     if ($this->isValid($queue->objectID)) {
         // remove news from moderation center
         $action = new NewsAction(array($this->getViewableNews($queue->objectID)), 'delete');
         $action->executeAction();
     }
 }
 /**
  * Publishes news entries.
  */
 public function publish()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     $newsIDs = array();
     foreach ($this->objects as $news) {
         $newsIDs[] = $news->newsID;
         $news->update(array('isPublished' => 1, 'time' => $news->publicationDate, 'publicationDate' => 0));
     }
     // trigger publication
     if (!empty($newsIDs)) {
         $action = new NewsAction($newsIDs, 'triggerPublication');
         $action->executeAction();
     }
 }
 /**
  * @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));
 }