19 declare(strict_types=1);
47 bool $is_moderator =
false,
48 int $overview_setting = 0
52 $this->
lng = $DIC->language();
54 $this->
user = $DIC->user();
57 $this->parent_cmd = $a_parent_cmd;
63 $id =
'frm_tt_' . substr(md5($this->parent_cmd), 0, 3) .
'_' . $this->
getRefId();
72 $this->
mainTemplate->addCss(
'./Modules/Forum/css/forum_table.css');
76 public function init(): void
78 if ($this->parent_cmd ===
'mergeThreads') {
87 if ($this->parent_cmd ===
"showThreads") {
89 $this->
addColumn(
'',
'check',
'1px',
true);
91 $this->
addColumn(
'',
'check',
'10px',
true);
94 $this->
addColumn($this->
lng->txt(
'forums_thread'),
'thr_subject');
95 $this->
addColumn($this->
lng->txt(
'forums_created_by'),
'');
96 $this->
addColumn($this->
lng->txt(
'forums_articles'),
'num_posts');
97 $this->
addColumn($this->
lng->txt(
'visits'),
'num_visit');
99 if ($this->is_post_draft_allowed) {
103 $this->
addColumn($this->
lng->txt(
'forums_last_post'),
'post_date');
104 if (
'showThreads' === $this->parent_cmd && $this->parent_obj->objProperties->isIsThreadRatingEnabled()) {
105 $this->
addColumn($this->
lng->txt(
'frm_rating'),
'rating');
108 $this->
setFormAction($this->
ctrl->getFormAction($this->getParentObject(),
'showThreads'));
109 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
111 if ($this->parent_cmd ===
'sortThreads') {
115 if ($this->
settings->get(
'forum_notification') > 0 && !$this->
user->isAnonymous()) {
116 $this->
addMultiCommand(
'enable_notifications', $this->
lng->txt(
'forums_enable_notification'));
117 $this->
addMultiCommand(
'disable_notifications', $this->
lng->txt(
'forums_disable_notification'));
139 $this->
addColumn(
'',
'check',
'1px',
true);
140 $this->
addColumn($this->
lng->txt(
'forums_thread'),
'th_title');
141 $this->
addColumn($this->
lng->txt(
'forums_created_by'),
'author');
142 $this->
addColumn($this->
lng->txt(
'forums_articles'),
'num_posts');
143 $this->
addColumn($this->
lng->txt(
'visits'),
'num_visit');
144 if ($this->is_post_draft_allowed) {
147 $this->
addColumn($this->
lng->txt(
'forums_last_post'),
'lp_date');
150 $this->
setFormAction($this->
ctrl->getFormAction($this->getParentObject(),
'confirmMergeThreads'));
151 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
153 $this->
mainTemplate->setOnScreenMessage(
'info', $this->
lng->txt(
'please_choose_target'));
163 protected function fillRow(array $a_set):
void 166 $thread = $a_set[
'thread'];
171 if ($DIC->http()->wrapper()->post()->has(
'thread_ids')) {
172 $thread_ids = $DIC->http()->wrapper()->post()->retrieve(
174 $DIC->refinery()->kindlyTo()->listOf($DIC->refinery()->kindlyTo()->int())
178 if (
'mergeThreads' === $this->parent_cmd) {
179 $checked = $this->max_count === 1 || (isset($thread_ids) && in_array($thread->getId(), $thread_ids,
true));
180 $this->tpl->setVariable(
185 (
string) $thread->getId()
188 } elseif (
'showThreads' === $this->parent_cmd) {
189 $this->tpl->setVariable(
192 (isset($thread_ids) && in_array($thread->getId(), $thread_ids,
true)),
194 (string) $thread->getId()
198 if ($this->parent_obj->objProperties->isIsThreadRatingEnabled()) {
201 $this->parent_obj->getObject()->getId(),
202 $this->parent_obj->getObject()->getType(),
206 $rating->setUserId($this->
user->getId());
207 $this->tpl->setVariable(
'VAL_RATING', $rating->getHTML());
210 if ($thread->isSticky()) {
211 $this->tpl->setVariable(
'VAL_SORTING_NAME',
'thread_sorting[' . $thread->getId() .
']');
212 $this->tpl->setVariable(
'VAL_SORTING', $this->position * 10);
214 $this->tpl->setVariable(
'VAL_CHECK',
'');
220 if ($thread->isSticky()) {
221 $subject .=
'<span class="light">[' . $this->
lng->txt(
'sticky') .
']</span> ';
223 if ($thread->isClosed()) {
224 $subject .=
'<span class="light">[' . $this->
lng->txt(
'topic_close') .
']</span> ';
227 if (!$this->
user->isAnonymous() &&
228 (
int) $this->
settings->get(
'forum_notification',
'0') !== 0 &&
229 $thread->isUserNotificationEnabled()
231 $subject .=
'<span class="light">[' . $this->
lng->txt(
'forums_notification_enabled') .
']</span> ';
234 $num_posts = $thread->getNumPosts();
235 $num_unread = $thread->getNumUnreadPosts();
236 $num_new = $thread->getNumNewPosts();
239 $subject =
'<div><a href="' . $this->
ctrl->getLinkTarget(
242 ) .
'">' . $thread->getSubject() .
'</a></div>' . $subject;
244 $this->tpl->setVariable(
'VAL_SUBJECT', $subject);
246 $this->
ctrl->setParameter(
249 urlencode($this->
ctrl->getLinkTargetByClass(
"ilrepositorygui",
""))
254 $thread->getThrAuthorId(),
255 $thread->getDisplayUserId(),
256 (string) $thread->getUserAlias(),
257 (string) $thread->getImportName(),
259 'class' =>
'il_ItemProperty',
263 $this->tpl->setVariable(
'VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
265 $topicStats = $num_posts;
266 if (!$this->
user->isAnonymous()) {
267 if ($num_unread > 0) {
268 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->
lng->txt(
'unread') .
': ' . $num_unread .
'</span>';
271 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->
lng->txt(
'new') .
': ' . $num_new .
'</span>';
275 $this->tpl->setVariable(
'VAL_ARTICLE_STATS', $topicStats);
276 $this->tpl->setVariable(
'VAL_NUM_VISIT', $thread->getVisits());
277 if ($this->is_post_draft_allowed) {
279 $this->tpl->setVariable(
281 (
int) isset($draft_statistics[$thread->getId()]) ? $draft_statistics[$thread->getId()] : 0
285 if ($num_posts > 0 && $thread->getLastPostForThreadOverview() instanceof
ilForumPost) {
286 $objLastPost = $thread->getLastPostForThreadOverview();
288 $this->
ctrl->setParameter($this->
getParentObject(),
'user', $objLastPost->getDisplayUserId());
290 $objLastPost->getPosAuthorId(),
291 $objLastPost->getDisplayUserId(),
292 (string) $objLastPost->getUserAlias(),
293 (string) $objLastPost->getImportName(),
299 $this->tpl->setVariable(
302 $objLastPost->getCreateDate(),
305 '<div class="ilWhiteSpaceNowrap">' . $this->
lng->txt(
'from') .
' ' . $authorinfo->getLinkedAuthorName() .
'</div>' 310 if ($thread->isSticky()) {
313 $this->tpl->setVariable(
'CSS_ROW',
$css_row);
325 if ($this->parent_cmd ===
'mergeThreads' &&
332 'excluded_ids' => $excluded_ids,
338 $this->topicData->getTopPk(),
346 $this->topicData->getTopPk(),
354 $this->
setData(array_map(
static function (ilForumTopic $thread): array {
355 return [
'thread' => $thread];
360 foreach (
$data[
'items'] as $thread) {
362 $thread_ids[] = $thread->getId();
363 if ($thread->getDisplayUserId() > 0) {
364 $user_ids[$thread->getDisplayUserId()] = $thread->getDisplayUserId();
368 $user_ids = array_merge(
435 $this->merge_thread_obj = $thread_obj;
Class Forum core functions for forum.
setFormAction(string $a_form_action, bool $a_multipart=false)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
static getUserIdsOfLastPostsByRefIdAndThreadIds(int $ref_id, array $thread_ids)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setIsModerator(bool $is_moderator)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
setSelectedThread(ilForumTopic $thread_obj)
Class ilForumTopicTableGUI.
resetOffset(bool $a_in_determination=false)
setExternalSorting(bool $a_val)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
fillRow(array $a_set)
Standard Version of Fill Row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDefaultOrderField(string $a_defaultorderfield)
static getDraftsStatisticsByRefId(int $ref_id)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
static isSavePostDraftAllowed()
setMapper(ilForum $mapper)
const FORUM_OVERVIEW_WITH_NEW_POSTS
bool $is_post_draft_allowed
ilForumTopic $merge_thread_obj
setRowSelectorLabel(string $row_selector_label)
__construct(Container $dic, ilPlugin $plugin)
initTopicsOverviewTable()
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)
setTopicData(ForumDto $topicData)
__construct(ilObjForumGUI $a_parent_obj, string $a_parent_cmd, int $ref_id, ForumDto $topicData, bool $is_moderator=false, int $overview_setting=0)
addMultiCommand(string $a_cmd, string $a_text)
determineOffsetAndOrder(bool $a_omit_offset=false)
setMaxCount(int $a_max_count)
set max.
setOverviewSetting(int $overview_setting)
ilGlobalTemplateInterface $mainTemplate
setExternalSegmentation(bool $a_val)