/** * @param ilForumTopic $thread */ public function fillRow(ilForumTopic $thread) { /** * @var $ilUser ilObjUser */ global $ilUser; $this->ctrl->setParameter($this->getParentObject(), 'thr_pk', $thread->getId()); $this->tpl->setVariable('VAL_CHECK', ilUtil::formCheckbox(isset($_POST['thread_ids']) && in_array($thread->getId(), $_POST['thread_ids']) ? true : false, 'thread_ids[]', $thread->getId())); $subject = ''; if ($thread->isSticky()) { $subject .= '<span class="light">[' . $this->lng->txt('sticky') . ']</span> '; } if ($thread->isClosed()) { $subject .= '<span class="light">[' . $this->lng->txt('topic_close') . ']</span> '; } if ($ilUser->getId() != ANONYMOUS_USER_ID && $this->ilias->getSetting('forum_notification') != 0 && $thread->getUserNotificationEnabled()) { $subject .= '<span class="light">[' . $this->lng->txt('forums_notification_enabled') . ']</span> '; } $num_posts = $thread->getNumPosts(); $num_unread = $thread->getNumUnreadPosts(); $num_new = $thread->getNumNewPosts(); if ($num_posts > 0) { $subject = '<div><a href="' . $this->ctrl->getLinkTarget($this->getParentObject(), 'viewThread') . '">' . $thread->getSubject() . '</a></div>' . $subject; } else { $subject = $thread->getSubject() . $subject; } $this->tpl->setVariable('VAL_SUBJECT', $subject); // Author $this->ctrl->setParameter($this->getParentObject(), 'backurl', urlencode($this->ctrl->getLinkTargetByClass("ilrepositorygui", ""))); $this->ctrl->setParameter($this->getParentObject(), 'user', $thread->getUserId()); $authorinfo = new ilForumAuthorInformation($thread->getUserId(), $thread->getUserAlias(), $thread->getImportName(), array('class' => 'il_ItemProperty', 'href' => $this->ctrl->getLinkTarget($this->getParentObject(), 'showUser'))); $this->tpl->setVariable('VAL_AUTHOR', $authorinfo->getLinkedAuthorName()); $topicStats = $num_posts; if ($ilUser->getId() != ANONYMOUS_USER_ID) { if ($num_unread > 0) { $topicStats .= '<br /><span class="alert" style="white-space:nowrap">' . $this->lng->txt('unread') . ': ' . $num_unread . '</span>'; } if ($num_new > 0 && $this->getOverviewSetting() == 0) { $topicStats .= '<br /><span class="alert" style="white-space:nowrap">' . $this->lng->txt('new') . ': ' . $num_new . '</span>'; } } $this->tpl->setVariable('VAL_ARTICLE_STATS', $topicStats); $this->tpl->setVariable('VAL_NUM_VISIT', $thread->getVisits()); $this->ctrl->clearParameters($this->getParentObject()); // Last posting if ($num_posts > 0) { if ($this->getIsModerator()) { $objLastPost = $thread->getLastPost(); } else { $objLastPost = $thread->getLastActivePost(); } if (is_object($objLastPost)) { $this->ctrl->setParameter($this->getParentObject(), 'thr_pk', $thread->getId()); $this->ctrl->setParameter($this->getParentObject(), 'thr_pk', $objLastPost->getThreadId()); $authorinfo = new ilForumAuthorInformation($objLastPost->getUserId(), $objLastPost->getUserAlias(), $objLastPost->getImportName(), array('href' => $this->ctrl->getLinkTarget($this->getParentObject(), 'viewThread') . '#' . $objLastPost->getId())); $this->tpl->setVariable('VAL_LP_DATE', '<div style="white-space:nowrap">' . ilDatePresentation::formatDate(new ilDateTime($objLastPost->getCreateDate(), IL_CAL_DATETIME)) . '</div>' . '<div style="white-space:nowrap">' . $this->lng->txt('from') . ' ' . $authorinfo->getLinkedAuthorName() . '</div>'); $this->ctrl->clearParameters($this->getParentObject()); } } // Row style $css_row = $this->css_row; if ($thread->isSticky()) { $css_row = $css_row == 'tblrow1' ? 'tblstickyrow1' : 'tblstickyrow2'; } $this->tpl->setVariable('CSS_ROW', $css_row); }