4 require_once
'Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Services/Calendar/classes/class.ilDatePresentation.php';
6 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
7 require_once
'Modules/Forum/classes/class.ilForumAuthorInformationCache.php';
87 $tpl->addCss(
'./Modules/Forum/css/forum_table.css');
90 $this->
addColumn(
'',
'check',
'1px',
true);
91 $this->
addColumn($this->lng->txt(
'forums_thread'),
'th_title');
92 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'author');
93 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
94 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
95 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'lp_date');
102 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'showThreads'));
105 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
109 if($this->ilias->getSetting(
'forum_notification') == 1 && !$ilUser->isAnonymous())
111 $this->
addMultiCommand(
'enable_notifications', $this->lng->txt(
'forums_enable_notification'));
112 $this->
addMultiCommand(
'disable_notifications', $this->lng->txt(
'forums_disable_notification'));
116 $this->
addMultiCommand(
'makesticky', $this->lng->txt(
'make_topics_sticky'));
117 $this->
addMultiCommand(
'unmakesticky', $this->lng->txt(
'make_topics_non_sticky'));
118 $this->
addMultiCommand(
'editThread', $this->lng->txt(
'frm_edit_title'));
126 $this->
addMultiCommand(
'confirmDeleteThreads', $this->lng->txt(
'delete'));
146 (isset(
$_POST[
'thread_ids']) && in_array($thread->
getId(),
$_POST[
'thread_ids']) ?
true :
false),
'thread_ids[]', $thread->
getId()
153 $subject .=
'<span class="light">[' . $this->lng->txt(
'sticky') .
']</span> ';
157 $subject .=
'<span class="light">[' . $this->lng->txt(
'topic_close') .
']</span> ';
160 if($ilUser->getId() != ANONYMOUS_USER_ID &&
161 $this->ilias->getSetting(
'forum_notification') != 0 &&
165 $subject .=
'<span class="light">[' . $this->lng->txt(
'forums_notification_enabled') .
']</span> ';
174 $subject =
'<div><a href="' . $this->ctrl->getLinkTarget($this->
getParentObject(),
'viewThread') .
'">' . $thread->
getSubject() .
'</a></div>' . $subject;
180 $this->tpl->setVariable(
'VAL_SUBJECT', $subject);
184 urlencode($this->ctrl->getLinkTargetByClass(
"ilrepositorygui",
"")));
192 'class' =>
'il_ItemProperty',
193 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'showUser')
196 $this->tpl->setVariable(
'VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
198 $topicStats = $num_posts;
199 if($ilUser->getId() != ANONYMOUS_USER_ID)
203 $topicStats .=
'<br /><span class="alert" style="white-space:nowrap">' . $this->lng->txt(
'unread') .
': ' . $num_unread .
'</span>';
207 $topicStats .=
'<br /><span class="alert" style="white-space:nowrap">' . $this->lng->txt(
'new') .
': ' . $num_new .
'</span>';
211 $this->tpl->setVariable(
'VAL_ARTICLE_STATS', $topicStats);
212 $this->tpl->setVariable(
'VAL_NUM_VISIT', $thread->
getVisits());
228 if(is_object($objLastPost))
231 $this->ctrl->setParameter($this->
getParentObject(),
'thr_pk', $objLastPost->getThreadId());
234 $objLastPost->getUserId(),
235 $objLastPost->getUserAlias(),
236 $objLastPost->getImportName(),
238 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'viewThread') .
'#' . $objLastPost->getId()
243 '<div style="white-space:nowrap">' . $this->lng->txt(
'from') .
' ' . $authorinfo->getLinkedAuthorName() .
'</div>'
251 $css_row = $this->css_row;
254 $css_row = $css_row ==
'tblrow1' ?
'tblstickyrow1' :
'tblstickyrow2';
256 $this->tpl->setVariable(
'CSS_ROW', $css_row);
283 public function fetchData()
300 $thread_ids = array();
302 foreach(
$data[
'items'] as $thread)
307 $thread_ids[] = (int)$thread->getId();
308 if($thread->getUserId() > 0)
310 $user_ids[$thread->getUserId()] = (int)$thread->getUserId();
314 $user_ids = array_merge(
315 ilObjForum::getUserIdsOfLastPostsByRefIdAndThreadIds($this->
getRefId(), $thread_ids),
319 ilForumAuthorInformationCache::preloadUserObjects(array_unique($user_ids));