/** * @return ilForumTopicTableGUI */ public function fetchData() { $this->determineOffsetAndOrder(); $excluded_ids = array(); if ($this->parent_cmd == 'mergeThreads' && $this->getSelectedThread() instanceof ilForumTopic) { $excluded_ids[] = $this->getSelectedThread()->getId(); } $params = array('is_moderator' => $this->getIsModerator(), 'excluded_ids' => $excluded_ids); $data = $this->getMapper()->getAllThreads($this->topicData['top_pk'], $params, (int) $this->getLimit(), (int) $this->getOffset()); if (!count($data['items']) && $this->getOffset() > 0) { $this->resetOffset(); $data = $this->getMapper()->getAllThreads($this->topicData['top_pk'], $params, (int) $this->getLimit(), (int) $this->getOffset()); } $this->setMaxCount($data['cnt']); $this->setData($data['items']); // Collect user ids for preloading user objects $thread_ids = array(); $user_ids = array(); foreach ($data['items'] as $thread) { /** * @var $thread ilForumTopic */ $thread_ids[] = (int) $thread->getId(); if ($thread->getUserId() > 0) { $user_ids[$thread->getUserId()] = (int) $thread->getUserId(); } } $user_ids = array_merge(ilObjForum::getUserIdsOfLastPostsByRefIdAndThreadIds($this->getRefId(), $thread_ids), $user_ids); ilForumAuthorInformationCache::preloadUserObjects(array_unique($user_ids)); return $this; }