/**
  * Creates the AccessibleEntryList object.
  */
 public function __construct()
 {
     parent::__construct();
     // accessible news categories
     $accessibleCategoryIDs = NewsCategory::getAccessibleCategoryIDs();
     if (!empty($accessibleCategoryIDs)) {
         $this->getConditionBuilder()->add('news_entry.entryID IN (SELECT entryID FROM cms' . WCF_N . '_news_entry_to_category WHERE categoryID IN (?))', array($accessibleCategoryIDs));
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     // default conditions
     if (!WCF::getSession()->getPermission('mod.news.canModerateEntry')) {
         $this->getConditionBuilder()->add('news_entry.isDisabled = 0');
     }
     if (!WCF::getSession()->getPermission('mod.news.canViewDeletedEntry')) {
         $this->getConditionBuilder()->add('news_entry.isDeleted = 0');
     }
     if (WCF::getUser()->userID) {
         $this->getConditionBuilder()->add('(news_entry.isPublished = 1 OR news_entry.userID = ?)', array(WCF::getUser()->userID));
     } else {
         $this->getConditionBuilder()->add('news_entry.isPublished = 1');
     }
     // apply language filter
     if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $this->getConditionBuilder()->add('(news_entry.languageID IN (?) OR news_entry.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
 }
 /**
  * Creates a new DeletedEntryList object.
  */
 public function __construct()
 {
     parent::__construct();
     // accessible news categories
     $accessibleCategoryIDs = NewsCategory::getAccessibleCategoryIDs();
     if (!empty($accessibleCategoryIDs)) {
         $this->getConditionBuilder()->add('news_entry.entryID IN (SELECT entryID FROM cms' . WCF_N . '_news_entry_to_category WHERE categoryID IN (?))', array($accessibleCategoryIDs));
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     // load only deleted news
     $this->getConditionBuilder()->add('news_entry.isDeleted = ?', array(1));
 }
 /**
  * Creates a new TaggedNewsList object.
  * 
  * @param	\wcf\data\tag\Tag	$tag
  */
 public function __construct(Tag $tag)
 {
     ViewableEntryList::__construct();
     $this->getConditionBuilder()->add('tag_to_object.objectTypeID = ? AND tag_to_object.languageID = ? AND tag_to_object.tagID = ?', array(TagEngine::getInstance()->getObjectTypeID('de.incendium.cms.news.entry'), $tag->languageID, $tag->tagID));
     $this->getConditionBuilder()->add('news_entry.entryID = tag_to_object.objectID');
     // accessible news categories
     $accessibleCategoryIDs = NewsCategory::getAccessibleCategoryIDs();
     if (!empty($accessibleCategoryIDs)) {
         $this->getConditionBuilder()->add('news_entry.entryID IN (SELECT entryID FROM cms' . WCF_N . '_news_entry_to_category WHERE categoryID IN (?))', array(NewsCategory::getAccessibleCategoryIDs()));
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
 }