/** * @see Page::readData() */ public function readData() { parent::readData(); // show 5 entries on first page, but 20 on the following pages $this->eventmixList->sqlLimit = $this->pageNo <= 1 ? $this->itemsOnLandingpage : $this->itemsPerPage; $this->eventmixList->sqlOffset = $this->pageNo <= 1 ? 0 : ($this->pageNo - 2) * $this->itemsPerPage + $this->itemsOnLandingpage; // fire sql query $this->eventmixList->readObjects(); // get previous entry $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_contest\n\t\t\tWHERE\t\tuserID = " . intval($this->entry->userID) . "\n\t\t\t\t\tAND (\n\t\t\t\t\t\ttime > " . intval($this->entry->time) . "\n\t\t\t\t\t\tOR (time = " . intval($this->entry->time) . " AND contestID < " . intval($this->entry->contestID) . ")\n\t\t\t\t\t)\n\t\t\tORDER BY\ttime ASC, contestID DESC"; $this->previousEntry = new Contest(null, WCF::getDB()->getFirstRow($sql)); if (!$this->previousEntry->contestID) { $this->previousEntry = null; } // get next entry $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_contest\n\t\t\tWHERE\t\tuserID = " . intval($this->entry->userID) . "\n\t\t\t\t\tAND (\n\t\t\t\t\t\ttime < " . intval($this->entry->time) . "\n\t\t\t\t\t\tOR (time = " . intval($this->entry->time) . " AND contestID > " . intval($this->entry->contestID) . ")\n\t\t\t\t\t)\n\t\t\tORDER BY\ttime DESC, contestID ASC"; $this->nextEntry = new Contest(null, WCF::getDB()->getFirstRow($sql)); if (!$this->nextEntry->contestID) { $this->nextEntry = null; } // read attachments if (MODULE_ATTACHMENT == 1 && $this->entry->attachments > 0) { require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php'; $this->attachmentList = new MessageAttachmentList($this->contestID, 'contestEntry', '', WCF::getPackageID('de.easy-coding.wcf.contest')); $this->attachmentList->readObjects(); $this->attachments = $this->attachmentList->getSortedAttachments(WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview')); // set embedded attachments if (WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview')) { require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php'; AttachmentBBCode::setAttachments($this->attachments); } // remove embedded attachments from list if (count($this->attachments) > 0) { MessageAttachmentList::removeEmbeddedAttachments($this->attachments); } } if ($this->entry->isOwner()) { // init todo list require_once WCF_DIR . 'lib/data/contest/owner/todo/ContestOwnerTodoList.class.php'; $this->todoList = new ContestOwnerTodoList(); $this->todoList->sqlConditions .= 'contest.contestID = ' . intval($this->contestID); $this->todoList->readObjects(); } // init sidebar $this->sidebar = new ContestSidebar($this->entry); }
/** * @see Page::readData() */ public function readData() { parent::readData(); $this->eventmixList->sqlLimit = $this->limit; $this->eventmixList->readObjects(); }