/**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // stats
     if (FILEBASE_ENABLE_STATISTICS) {
         $this->stats = array_merge(StatsCacheBuilder::getInstance()->getData(), UserStatsCacheBuilder::getInstance()->getData());
     }
     // get categories
     $categoryTree = new FilebaseCategoryNodeTree('de.incendium.filebase.category');
     $this->categoryList = $categoryTree->getIterator();
     $this->categoryList->setMaxDepth(0);
     // get featured entries
     $this->featuredEntryList = new AccessibleEntryList();
     $this->featuredEntryList->getConditionBuilder()->add('entry.isFeatured = ?', array(1));
     $this->featuredEntryList->sqlLimit = 10;
     $this->featuredEntryList->sqlOrderBy = 'RAND()';
     $this->featuredEntryList->readObjects();
     // remove default breadcrumb entry and set current page as 'website'
     if (WCF::isLandingPage()) {
         MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('FilebaseOverview', array('application' => 'filebase')), true);
         MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'website', true);
         MetaTagHandler::getInstance()->addTag('og:title', 'og:title', WCF::getLanguage()->get(PAGE_TITLE), true);
         MetaTagHandler::getInstance()->addTag('og:description', 'og:description', WCF::getLanguage()->get(PAGE_DESCRIPTION), true);
     }
 }
 /**
  * @inheritDoc
  */
 public function lookup($searchString)
 {
     $entryList = new ViewableEntryList();
     $entryList->sqlLimit = 10;
     $entryList->sqlOrderBy = 'title';
     $entryList->readObjects();
     $results = [];
     foreach ($entryList->getObjects() as $entry) {
         $results[] = ['description' => $entry->getFormattedTeaser(), 'link' => $entry->getLink(), 'objectID' => $entry->entryID, 'title' => $entry->getTitle()];
     }
     return $results;
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // update entry visit
     if ($this->entry->isNew()) {
         $entryAction = new EntryAction(array($this->entry->getDecoratedObject()), 'markAsRead', array('viewableEntry' => $this->entry));
         $entryAction->executeAction();
     }
     // get author's user profile
     $this->userProfile = $this->entry->getUserProfile();
     // get comments
     $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.incendium.filebase.entryComment');
     $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
     $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->entryID);
     // get file history
     $this->fileList = new AccessibleEntryFileList();
     $this->fileList->getConditionBuilder()->add('file.entryID = ?', array($this->entryID));
     $this->fileList->sqlOrderBy = 'file.uploadTime DESC';
     $this->fileList->sqlLimit = 5;
     $this->fileList->readObjects();
     foreach ($this->fileList as $file) {
         $file->setEntry($this->entry->getDecoratedObject());
     }
     // get other entries by this author
     $this->userEntryList = new AccessibleEntryList();
     $this->userEntryList->enableCategoryLoading(false);
     $this->userEntryList->getConditionBuilder()->add('entry.userID = ?', array($this->entry->userID));
     $this->userEntryList->getConditionBuilder()->add('entry.entryID <> ?', array($this->entry->entryID));
     $this->userEntryList->sqlLimit = 5;
     $this->userEntryList->readObjects();
     // get tags
     if (MODULE_TAGGING) {
         $this->tags = TagEngine::getInstance()->getObjectTags('de.incendium.filebase.entry', $this->entry->entryID, array($this->entry->languageID === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : ""));
     }
     // fetch likes
     if (MODULE_LIKE) {
         $objectType = LikeHandler::getInstance()->getObjectType('de.incendium.filebase.likeableEntry');
         LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->entryID));
         $this->entryLikeData = LikeHandler::getInstance()->getLikeObjects($objectType);
     }
     // add breadcrumbs
     $leafCategories = $this->entry->getLeafCategories();
     $category = reset($leafCategories);
     FILEBASECore::getInstance()->setLocation($category->getParentCategories(), $category);
     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('Entry', array('application' => 'filebase', 'object' => $this->entry)), true);
     MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true);
     MetaTagHandler::getInstance()->addTag('og:description', 'og:description', $this->entry->teaser, 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);
     }
 }
 /**
  * @see	\wcf\data\DatabaseObjectList::readObjects()
  */
 public function readObjects()
 {
     if ($this->objectIDs === null) {
         $this->readObjectIDs();
     }
     parent::readObjects();
 }
 /**
  * Creates a new DeletedFileList object.
  */
 public function __construct()
 {
     parent::__construct();
     // categories
     $accessibleCategoryIDs = FilebaseCategory::getAccessibleCategoryIDs();
     if (!empty($accessibleCategoryIDs)) {
         $this->getConditionBuilder()->add('entry.entryID IN (SELECT entryID FROM filebase' . WCF_N . '_entry_to_category WHERE categoryID IN (?))', array($accessibleCategoryIDs));
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     $this->getConditionBuilder()->add('entry.isDeleted = ?', array(1));
 }
 /**
  * Returns the viewable entry object with the given id.
  * 
  * @param	integer		$entryID
  * @return	\filebase\data\entry\ViewableEntry
  */
 public static function getEntry($entryID)
 {
     $list = new ViewableEntryList();
     $list->setObjectIDs(array($entryID));
     $list->readObjects();
     return $list->search($entryID);
 }