/**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $objectIDs = array();
     foreach ($events as $event) {
         $objectIDs[] = $event->objectID;
     }
     // fetch entrys
     $entryList = new EntryList();
     $entryList->setObjectIDs($objectIDs);
     $entryList->readObjects();
     $entries = $entryList->getObjects();
     // set message
     foreach ($events as $event) {
         if (isset($entries[$event->objectID])) {
             if (!$entries[$event->objectID]->canRead()) {
                 continue;
             }
             $event->setIsAccessible();
             // title
             $text = WCF::getLanguage()->getDynamicVariable('filebase.recentActivity.entry', array('entry' => $entries[$event->objectID]));
             $event->setTitle($text);
             // description
             $event->setDescription($entries[$event->objectID]->getExcerpt());
         } else {
             $event->setIsOrphaned();
         }
     }
 }
 /**
  * Returns the file with the given id.
  * 
  * @param	integer		$entryID
  * @return	\array<\filebase\data\entry\Entry>
  */
 public function getEntry($entryID)
 {
     if (!empty($this->entryIDs)) {
         $this->entryIDs = array_diff($this->entryIDs, array_keys($this->entrys));
         if (!empty($this->entryIDs)) {
             $entryList = new EntryList();
             $entryList->enableCategoryLoading(false);
             $entryList->setObjectIDs($this->entryIDs);
             $entryList->readObjects();
             $this->entrys += $entryList->getObjects();
             $this->entryIDs = array();
         }
     }
     if (isset($this->entrys[$entryID])) {
         return $this->entrys[$entryID];
     }
     return null;
 }
 /**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $comentIDs = array();
     foreach ($events as $event) {
         $comentIDs[] = $event->objectID;
     }
     // fetch comments
     $commentList = new CommentList();
     $commentList->setObjectIDs($comentIDs);
     $commentList->readObjects();
     $comments = $commentList->getObjects();
     // fetch entries
     $entryIDs = $entries = array();
     foreach ($comments as $comment) {
         $entryIDs[] = $comment->objectID;
     }
     if (!empty($entryIDs)) {
         $entryList = new EntryList();
         $entryList->setObjectIDs($entryIDs);
         $entryList->readObjects();
         $entries = $entryList->getObjects();
     }
     // set message
     foreach ($events as $event) {
         if (isset($comments[$event->objectID])) {
             $comment = $comments[$event->objectID];
             if (isset($entries[$comment->objectID])) {
                 $entry = $entries[$comment->objectID];
                 // check permissions
                 if (!$entry->canRead()) {
                     continue;
                 }
                 $event->setIsAccessible();
                 // add title
                 $text = WCF::getLanguage()->getDynamicVariable('filebase.recentActivity.entryComment', array('entry' => $entry));
                 $event->setTitle($text);
                 // add text
                 $event->setDescription($comment->getExcerpt());
                 continue;
             }
         }
         $event->setIsOrphaned();
     }
 }
 /**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $responseIDs = array();
     foreach ($events as $event) {
         $responseIDs[] = $event->objectID;
     }
     // fetch responses
     $responseList = new CommentResponseList();
     $responseList->setObjectIDs($responseIDs);
     $responseList->readObjects();
     $responses = $responseList->getObjects();
     // fetch comments
     $commentIDs = $comments = array();
     foreach ($responses as $response) {
         $commentIDs[] = $response->commentID;
     }
     if (!empty($commentIDs)) {
         $commentList = new CommentList();
         $commentList->setObjectIDs($commentIDs);
         $commentList->readObjects();
         $comments = $commentList->getObjects();
     }
     // fetch entries
     $entryIDs = $entries = array();
     foreach ($comments as $comment) {
         $entryIDs[] = $comment->objectID;
     }
     if (!empty($entryIDs)) {
         $entryList = new EntryList();
         $entryList->setObjectIDs($entryIDs);
         $entryList->readObjects();
         $entries = $entryList->getObjects();
     }
     // fetch users
     $userIDs = $user = array();
     foreach ($comments as $comment) {
         $userIDs[] = $comment->userID;
     }
     if (!empty($userIDs)) {
         $userList = new UserList();
         $userList->setObjectIDs($userIDs);
         $userList->readObjects();
         $users = $userList->getObjects();
     }
     // set message
     foreach ($events as $event) {
         if (isset($responses[$event->objectID])) {
             $response = $responses[$event->objectID];
             $comment = $comments[$response->commentID];
             if (isset($entries[$comment->objectID]) && isset($users[$comment->userID])) {
                 $entry = $entries[$comment->objectID];
                 // check permissions
                 if (!$entry->canRead()) {
                     continue;
                 }
                 $event->setIsAccessible();
                 // title
                 $text = WCF::getLanguage()->getDynamicVariable('filebase.recentActivity.entryCommentResponse', array('commentAuthor' => $users[$comment->userID], 'entry' => $entry));
                 $event->setTitle($text);
                 // description
                 $event->setDescription($response->getExcerpt());
                 continue;
             }
         }
         $event->setIsOrphaned();
     }
 }
 /**
  * @see	\wcf\data\DatabaseObjectList::readObjects()
  */
 public function readObjects()
 {
     parent::readObjects();
     if ($this->loadDeleteNote) {
         $objectIDs = array();
         foreach ($this->objects as $object) {
             if ($object->isDeleted) {
                 $objectIDs[] = $object->entryID;
             }
         }
         // load deletion data
         if (!empty($objectIDs)) {
             $this->logList = new EntryListModificationLogList();
             $this->logList->setEntryData($objectIDs, 'trash');
             $this->logList->readObjects();
             foreach ($this->logList as $logEntry) {
                 foreach ($this->objects as $object) {
                     if ($object->entryID == $logEntry->objectID) {
                         $object->setLogEntry($logEntry);
                     }
                 }
             }
         }
     }
 }
 /**
  * Prepares moderation of files.
  */
 protected function prepareObjects()
 {
     if (empty($this->objects)) {
         $this->readObjects();
         if (empty($this->objects)) {
             throw new UserInputException('objectIDs');
         }
     }
     // load entries
     $entriesIDs = array();
     foreach ($this->objects as $file) {
         $entryIDs[] = $file->entryID;
     }
     $entryList = new EntryList();
     $entryList->getConditionBuilder()->add("entry.entryID IN (?)", array($entryIDs));
     $entryList->readObjects();
     $entries = $entryList->getObjects();
     // assign files
     foreach ($this->objects as $file) {
         if (isset($entries[$file->entryID])) {
             $file->setEntry($entries[$file->entryID]);
         }
     }
 }
 /**
  * @see	\wcf\system\moderation\queue\IModerationQueueHandler::populate()
  */
 public function populate(array $queues)
 {
     $objectIDs = array();
     foreach ($queues as $object) {
         $objectIDs[] = $object->objectID;
     }
     // fetch entries
     $entryList = new EntryList();
     $entryList->enableCategoryLoading(false);
     $entryList->setObjectIDs($objectIDs);
     $entryList->readObjects();
     $entries = $entryList->getObjects();
     foreach ($queues as $object) {
         if (isset($entries[$object->objectID])) {
             $object->setAffectedObject($entries[$object->objectID]);
         } else {
             $object->setIsOrphaned();
         }
     }
 }
 /**
  * @see	\wcf\system\attachment\IAttachmentObjectType::cacheObjects()
  */
 public function cacheObjects(array $objectIDs)
 {
     $entryList = new EntryList();
     $entryList->setObjectIDs($objectIDs);
     $entryList->readObjects();
     $this->cachedObjects = $entryList->getObjects();
 }