78 $this->lng = $DIC->language();
79 $this->ctrl = $DIC->ctrl();
80 $this->mainTemplate = $DIC->ui()->mainTemplate();
81 $this->
user = $DIC->user();
84 $this->parent_cmd = $a_parent_cmd;
91 $id =
'frm_tt_' . substr(md5($this->parent_cmd), 0, 3) .
'_' . $this->
getRefId();
100 parent::__construct($a_parent_obj, $a_parent_cmd, $template_context);
103 $this->mainTemplate->addCss(
'./Modules/Forum/css/forum_table.css');
110 if ($this->parent_cmd ==
'mergeThreads') {
122 if ($this->parent_cmd ==
"showThreads") {
124 $this->
addColumn(
'',
'check',
'1px',
true);
126 $this->
addColumn(
'',
'check',
'10px',
true);
129 $this->
addColumn($this->lng->txt(
'forums_thread'),
'thr_subject');
130 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'');
131 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
132 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
134 if ($this->is_post_draft_allowed) {
135 $this->
addColumn($this->lng->txt(
'drafts',
''));
138 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'post_date');
139 if (
'showThreads' == $this->parent_cmd && $this->parent_obj->objProperties->isIsThreadRatingEnabled()) {
140 $this->
addColumn($this->lng->txt(
'frm_rating'),
'rating');
144 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'showThreads'));
147 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
149 if ($this->parent_cmd ==
'sortThreads') {
154 if ($this->
settings->get(
'forum_notification') > 0 && !$this->
user->isAnonymous()) {
155 $this->
addMultiCommand(
'enable_notifications', $this->lng->txt(
'forums_enable_notification'));
156 $this->
addMultiCommand(
'disable_notifications', $this->lng->txt(
'forums_disable_notification'));
159 $this->
addMultiCommand(
'makesticky', $this->lng->txt(
'make_topics_sticky'));
160 $this->
addMultiCommand(
'unmakesticky', $this->lng->txt(
'make_topics_non_sticky'));
161 $this->
addMultiCommand(
'editThread', $this->lng->txt(
'frm_edit_title'));
164 $this->
addMultiCommand(
'move', $this->lng->txt(
'move_thread_to_forum'));
168 $this->
addMultiCommand(
'confirmDeleteThreads', $this->lng->txt(
'delete'));
169 $this->
addMultiCommand(
'merge', $this->lng->txt(
'merge_posts_into_thread'));
179 $this->
addColumn(
'',
'check',
'1px',
true);
180 $this->
addColumn($this->lng->txt(
'forums_thread'),
'th_title');
181 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'author');
182 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
183 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
184 if ($this->is_post_draft_allowed) {
185 $this->
addColumn($this->lng->txt(
'drafts',
''));
187 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'lp_date');
193 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'confirmMergeThreads'));
196 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
213 $this->ctrl->setParameter($this->
getParentObject(),
'thr_pk', $thread->getId());
214 if (
'mergeThreads' == $this->parent_cmd) {
215 $checked = $this->max_count == 1 || (isset(
$_POST[
'thread_ids']) && in_array($thread->getId(),
$_POST[
'thread_ids']));
221 } elseif (
'showThreads' == $this->parent_cmd) {
223 (isset(
$_POST[
'thread_ids']) && in_array($thread->getId(),
$_POST[
'thread_ids']) ?
true :
false),
228 if ($this->parent_obj->objProperties->isIsThreadRatingEnabled()) {
230 $rating->setObject($this->parent_obj->object->getId(), $this->parent_obj->object->getType(), $thread->getId(),
'thread');
231 $rating->setUserId($this->
user->getId());
232 $this->tpl->setVariable(
'VAL_RATING', $rating->getHTML());
235 if ($thread->isSticky()) {
236 $this->tpl->setVariable(
'VAL_SORTING_NAME',
'thread_sorting[' . $thread->getId() .
']');
237 $this->tpl->setVariable(
'VAL_SORTING', (
int) $this->position * 10);
239 $this->tpl->setVariable(
'VAL_CHECK',
'');
245 if ($thread->isSticky()) {
246 $subject .=
'<span class="light">[' . $this->lng->txt(
'sticky') .
']</span> ';
248 if ($thread->isClosed()) {
249 $subject .=
'<span class="light">[' . $this->lng->txt(
'topic_close') .
']</span> ';
252 if (!$this->
user->isAnonymous() &&
253 $this->
settings->get(
'forum_notification') != 0 &&
254 $thread->getUserNotificationEnabled()
256 $subject .=
'<span class="light">[' . $this->lng->txt(
'forums_notification_enabled') .
']</span> ';
259 $num_posts = $thread->getNumPosts();
260 $num_unread = $thread->getNumUnreadPosts();
261 $num_new = $thread->getNumNewPosts();
263 $subject =
'<div><a href="' . $this->ctrl->getLinkTarget($this->
getParentObject(),
'viewThread') .
'">' . $thread->getSubject() .
'</a></div>' . $subject;
264 $this->tpl->setVariable(
'VAL_SUBJECT', $subject);
267 $this->ctrl->setParameter($this->
getParentObject(),
'backurl', urlencode($this->ctrl->getLinkTargetByClass(
"ilrepositorygui",
"")));
268 $this->ctrl->setParameter($this->
getParentObject(),
'user', $thread->getDisplayUserId());
271 $thread->getThrAuthorId(),
272 $thread->getDisplayUserId(),
273 $thread->getUserAlias(),
274 $thread->getImportName(),
276 'class' =>
'il_ItemProperty',
277 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'showUser')
280 $this->tpl->setVariable(
'VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
282 $topicStats = $num_posts;
283 if (!$this->
user->isAnonymous()) {
284 if ($num_unread > 0) {
285 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'unread') .
': ' . $num_unread .
'</span>';
288 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'new') .
': ' . $num_new .
'</span>';
292 $this->tpl->setVariable(
'VAL_ARTICLE_STATS', $topicStats);
293 $this->tpl->setVariable(
'VAL_NUM_VISIT', $thread->getVisits());
294 if ($this->is_post_draft_allowed) {
296 $this->tpl->setVariable(
'VAL_DRAFTS', (
int) $draft_statistics[$thread->getId()]);
299 if ($num_posts > 0) {
300 if ($thread->getLastPostForThreadOverview() instanceof
ilForumPost) {
301 $objLastPost = $thread->getLastPostForThreadOverview();
303 $objLastPost->getPosAuthorId(),
304 $objLastPost->getDisplayUserId(),
305 $objLastPost->getUserAlias(),
306 $objLastPost->getImportName(),
308 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'viewThread') .
'#' . $objLastPost->getId()
312 $this->tpl->setVariable(
315 '<div class="ilWhiteSpaceNowrap">' . $this->lng->txt(
'from') .
' ' . $authorinfo->getLinkedAuthorName() .
'</div>' 321 $css_row = $this->css_row;
322 if ($thread->isSticky()) {
323 $css_row = $css_row ==
'tblrow1' ?
'tblstickyrow1' :
'tblstickyrow2';
325 $this->tpl->setVariable(
'CSS_ROW', $css_row);
356 public function fetchData()
360 $excluded_ids = array();
361 if ($this->parent_cmd ==
'mergeThreads' &&
368 'excluded_ids' => $excluded_ids,
383 $thread_ids = array();
385 foreach (
$data[
'items'] as $thread) {
389 $thread_ids[] = (int) $thread->getId();
390 if ($thread->getDisplayUserId() > 0) {
391 $user_ids[$thread->getDisplayUserId()] = (int) $thread->getDisplayUserId();
395 $user_ids = array_merge(
500 $this->merge_thread_obj = $thread_obj;
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setRowSelectorLabel($row_selector_label)
setExternalSorting($a_val)
Set external sorting.
Class Forum core functions for forum.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
formatCellValue($cell, $value)
setExternalSegmentation($a_val)
Set external segmentation.
__construct($a_parent_obj, $a_parent_cmd='', $template_context='', $ref_id=0, $topicData=array(), $is_moderator=false, $overview_setting='')
resetOffset($a_in_determination=false)
Reset offset.
if(!array_key_exists('StateId', $_REQUEST)) $id
setIsModerator($is_moderator)
getOrderDirection()
Get order direction.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getParentObject()
Get parent object.
setSelectedThread(ilForumTopic $thread_obj)
Class ilForumTopicTableGUI.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
addMultiCommand($a_cmd, $a_text)
Add Command button.
numericOrdering($column)
Currently not used because of external segmentation and sorting.
setOverviewSetting($overview_setting)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? public
static isSavePostDraftAllowed()
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setMapper(ilForum $mapper)
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
initTopicsOverviewTable()
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setMaxCount($a_max_count)
set max.
static getUserIdsOfLastPostsByRefIdAndThreadIds($ref_id, array $thread_ids)
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
static getDraftsStatisticsByRefId($ref_id)