4 require_once
'Services/Table/classes/class.ilTable2GUI.php';
5 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
6 require_once
'Modules/Forum/classes/class.ilForumAuthorInformationCache.php';
7 require_once
'Services/Rating/classes/class.ilRatingGUI.php';
82 $this->parent_cmd = $a_parent_cmd;
89 $id =
'frm_tt_' . substr(md5($this->parent_cmd), 0, 3) .
'_'. $this->
getRefId();
98 parent::__construct($a_parent_obj, $a_parent_cmd, $template_context);
101 $tpl->addCss(
'./Modules/Forum/css/forum_table.css');
108 if($this->parent_cmd ==
'mergeThreads')
114 $this->initTopicsOverviewTable();
121 public function initTopicsOverviewTable()
128 if($this->parent_cmd ==
"showThreads")
131 $this->
addColumn(
'',
'check',
'1px',
true);
135 $this->
addColumn(
'',
'check',
'10px',
true);
138 $this->
addColumn($this->lng->txt(
'forums_thread'),
'thr_subject');
139 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'');
140 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
141 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
143 if($this->is_post_draft_allowed)
145 $this->
addColumn($this->lng->txt(
'drafts',
''));
148 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'post_date');
149 if(
'showThreads' == $this->parent_cmd && $this->parent_obj->objProperties->isIsThreadRatingEnabled())
151 $this->
addColumn($this->lng->txt(
'frm_rating'),
'rating');
155 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'showThreads'));
158 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
160 if($this->parent_cmd ==
'sortThreads')
168 if($this->
ilias->getSetting(
'forum_notification') > 0 && !$ilUser->isAnonymous())
170 $this->
addMultiCommand(
'enable_notifications', $this->lng->txt(
'forums_enable_notification'));
171 $this->
addMultiCommand(
'disable_notifications', $this->lng->txt(
'forums_disable_notification'));
175 $this->
addMultiCommand(
'makesticky', $this->lng->txt(
'make_topics_sticky'));
176 $this->
addMultiCommand(
'unmakesticky', $this->lng->txt(
'make_topics_non_sticky'));
177 $this->
addMultiCommand(
'editThread', $this->lng->txt(
'frm_edit_title'));
180 $this->
addMultiCommand(
'move', $this->lng->txt(
'move_thread_to_forum'));
185 $this->
addMultiCommand(
'confirmDeleteThreads', $this->lng->txt(
'delete'));
186 $this->
addMultiCommand(
'merge', $this->lng->txt(
'merge_posts_into_thread'));
196 $this->
addColumn(
'',
'check',
'1px',
true);
197 $this->
addColumn($this->lng->txt(
'forums_thread'),
'th_title');
198 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'author');
199 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
200 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
201 if($this->is_post_draft_allowed)
203 $this->
addColumn($this->lng->txt(
'drafts',
''));
205 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'lp_date');
211 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'confirmMergeThreads'));
214 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
229 public function fillRow($thread)
236 $this->ctrl->setParameter($this->
getParentObject(),
'thr_pk', $thread->getId());
237 if(
'mergeThreads' == $this->parent_cmd)
239 $checked = $this->max_count == 1 || (isset(
$_POST[
'thread_ids']) && in_array($thread->getId(),
$_POST[
'thread_ids']));
241 $checked,
'thread_ids[]', $thread->getId()
244 else if(
'showThreads' == $this->parent_cmd)
247 (isset(
$_POST[
'thread_ids']) && in_array($thread->getId(),
$_POST[
'thread_ids']) ?
true :
false),
'thread_ids[]', $thread->getId()
250 if($this->parent_obj->objProperties->isIsThreadRatingEnabled())
253 $rating->setObject($this->parent_obj->object->getId(), $this->parent_obj->object->getType(), $thread->getId(),
'thread');
254 $rating->setUserId($ilUser->getId());
255 $this->tpl->setVariable(
'VAL_RATING', $rating->getHTML());
260 if($thread->isSticky())
262 $this->tpl->setVariable(
'VAL_SORTING_NAME',
'thread_sorting['.$thread->getId().
']' );
263 $this->tpl->setVariable(
'VAL_SORTING', (
int)$this->position * 10 );
267 $this->tpl->setVariable(
'VAL_CHECK',
'');
273 if($thread->isSticky())
275 $subject .=
'<span class="light">[' . $this->lng->txt(
'sticky') .
']</span> ';
277 if($thread->isClosed())
279 $subject .=
'<span class="light">[' . $this->lng->txt(
'topic_close') .
']</span> ';
282 if(!$ilUser->isAnonymous() &&
283 $this->
ilias->getSetting(
'forum_notification') != 0 &&
284 $thread->getUserNotificationEnabled()
287 $subject .=
'<span class="light">[' . $this->lng->txt(
'forums_notification_enabled') .
']</span> ';
290 $num_posts = $thread->getNumPosts();
291 $num_unread = $thread->getNumUnreadPosts();
292 $num_new = $thread->getNumNewPosts();
296 $subject =
'<div><a href="' . $this->ctrl->getLinkTarget($this->
getParentObject(),
'viewThread') .
'">' . $thread->getSubject() .
'</a></div>' . $subject;
300 $subject = $thread->getSubject() . $subject;
302 $this->tpl->setVariable(
'VAL_SUBJECT', $subject);
305 $this->ctrl->setParameter($this->
getParentObject(),
'backurl', urlencode($this->ctrl->getLinkTargetByClass(
"ilrepositorygui",
"")));
306 $this->ctrl->setParameter($this->
getParentObject(),
'user', $thread->getDisplayUserId());
309 $thread->getThrAuthorId(),
310 $thread->getDisplayUserId(),
311 $thread->getUserAlias(),
312 $thread->getImportName(),
314 'class' =>
'il_ItemProperty',
315 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'showUser')
318 $this->tpl->setVariable(
'VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
320 $topicStats = $num_posts;
321 if(!$ilUser->isAnonymous())
325 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'unread') .
': ' . $num_unread .
'</span>';
329 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'new') .
': ' . $num_new .
'</span>';
333 $this->tpl->setVariable(
'VAL_ARTICLE_STATS', $topicStats);
334 $this->tpl->setVariable(
'VAL_NUM_VISIT', $thread->getVisits());
335 if($this->is_post_draft_allowed)
338 $this->tpl->setVariable(
'VAL_DRAFTS', (
int)$draft_statistics[$thread->getId()]);
345 $objLastPost = $thread->getLastPost();
349 $objLastPost = $thread->getLastActivePost();
352 if(is_object($objLastPost))
355 $objLastPost->getPosAuthorId(),
356 $objLastPost->getDisplayUserId(),
357 $objLastPost->getUserAlias(),
358 $objLastPost->getImportName(),
360 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'viewThread') .
'#' . $objLastPost->getId()
365 '<div class="ilWhiteSpaceNowrap">' . $this->lng->txt(
'from') .
' ' . $authorinfo->getLinkedAuthorName() .
'</div>' 371 $css_row = $this->css_row;
372 if($thread->isSticky())
374 $css_row = $css_row ==
'tblrow1' ?
'tblstickyrow1' :
'tblstickyrow2';
376 $this->tpl->setVariable(
'CSS_ROW', $css_row);
407 public function fetchData()
411 $excluded_ids =
array();
412 if($this->parent_cmd ==
'mergeThreads' &&
420 'excluded_ids' => $excluded_ids,
436 $thread_ids =
array();
438 foreach(
$data[
'items'] as $thread)
443 $thread_ids[] = (int)$thread->getId();
444 if($thread->getDisplayUserId() > 0)
446 $user_ids[$thread->getDisplayUserId()] = (int)$thread->getDisplayUserId();
450 $user_ids = array_merge(
451 ilObjForum::getUserIdsOfLastPostsByRefIdAndThreadIds($this->
getRefId(), $thread_ids),
455 ilForumAuthorInformationCache::preloadUserObjects(array_unique($user_ids));
555 $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.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
Class Forum core functions for forum.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
formatCellValue($cell, $value)
setExternalSegmentation($a_val)
Set external segmentation.
resetOffset($a_in_determination=false)
Reset offset.
setIsModerator($is_moderator)
getOrderDirection()
Get order direction.
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.
addMultiCommand($a_cmd, $a_text)
Add Command button.
static formatDate(ilDateTime $date)
Format a date public.
numericOrdering($column)
Currently not used because of external segmentation and sorting.
redirection script todo: (a better solution should control the processing via a xml file) ...
setOverviewSetting($overview_setting)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
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
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
fillRow($a_set)
Standard Version of Fill Row.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setMaxCount($a_max_count)
set max.
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.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
static getDraftsStatisticsByRefId($ref_id)