/**
  * Creates a new ViewableEntryList object.
  */
 public function __construct()
 {
     parent::__construct();
     // get last file
     if (!empty($this->sqlSelects)) {
         $this->sqlSelects .= ',';
     }
     $this->sqlSelects .= 'file.*';
     $this->sqlJoins .= " LEFT JOIN filebase" . WCF_N . "_file file ON (file.fileID = entry.lastFileID)";
     if (WCF::getUser()->userID != 0) {
         // last visit time
         if (!empty($this->sqlSelects)) {
             $this->sqlSelects .= ',';
         }
         $this->sqlSelects .= 'tracked_visit.visitTime';
         $this->sqlJoins .= " LEFT JOIN wcf" . WCF_N . "_tracked_visit tracked_visit ON (tracked_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('de.incendium.filebase.entry') . " AND tracked_visit.objectID = entry.entryID AND tracked_visit.userID = " . WCF::getUser()->userID . ")";
         // subscriptions
         if (!empty($this->sqlSelects)) {
             $this->sqlSelects .= ',';
         }
         $this->sqlSelects .= 'user_object_watch.watchID, user_object_watch.notification';
         $this->sqlJoins .= " LEFT JOIN wcf" . WCF_N . "_user_object_watch user_object_watch ON (user_object_watch.objectTypeID = " . ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', 'de.incendium.filebase.entry')->objectTypeID . " AND user_object_watch.userID = " . WCF::getUser()->userID . " AND user_object_watch.objectID = entry.entryID)";
     }
     // get avatars
     if (!empty($this->sqlSelects)) {
         $this->sqlSelects .= ',';
     }
     $this->sqlSelects .= "user_avatar.*, user_table.*";
     $this->sqlJoins .= " LEFT JOIN wcf" . WCF_N . "_user user_table ON (user_table.userID = entry.userID)";
     $this->sqlJoins .= " LEFT JOIN wcf" . WCF_N . "_user_avatar user_avatar ON (user_avatar.avatarID = user_table.avatarID)";
     // get like status
     if (!empty($this->sqlSelects)) {
         $this->sqlSelects .= ',';
     }
     $this->sqlSelects .= "like_object.likes, like_object.dislikes";
     $this->sqlJoins .= " LEFT JOIN wcf" . WCF_N . "_like_object like_object ON (like_object.objectTypeID = " . LikeHandler::getInstance()->getObjectType('de.incendium.filebase.likeableEntry')->objectTypeID . " AND like_object.objectID = entry.entryID)";
     // get report status
     if (WCF::getSession()->getPermission('mod.general.canUseModeration')) {
         if (!empty($this->sqlSelects)) {
             $this->sqlSelects .= ',';
         }
         $this->sqlSelects .= "moderation_queue.queueID AS reportQueueID";
         $this->sqlJoins .= " LEFT JOIN wcf" . WCF_N . "_moderation_queue moderation_queue ON (moderation_queue.objectTypeID = " . ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.moderation.report', 'de.incendium.filebase.entry') . " AND moderation_queue.objectID = entry.entryID AND moderation_queue.status <> " . ModerationQueue::STATUS_DONE . " AND moderation_queue.status <> " . ModerationQueue::STATUS_REJECTED . " AND moderation_queue.status <> " . ModerationQueue::STATUS_CONFIRMED . ")";
     }
     if (!WCF::getSession()->getPermission('mod.filebase.canViewDeletedEntry')) {
         $this->loadDeleteNote = false;
     }
 }