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';
77 $this->parent_cmd = $a_parent_cmd;
84 $this->
setId(
'frm_tt_' . substr(md5($this->parent_cmd), 0, 3) .
'_'. $this->
getRefId());
92 parent::__construct($a_parent_obj, $a_parent_cmd, $template_context);
95 $tpl->addCss(
'./Modules/Forum/css/forum_table.css');
100 if($this->parent_cmd ==
'mergeThreads')
106 $this->initTopicsOverviewTable();
113 public function initTopicsOverviewTable()
120 if($this->parent_cmd ==
"showThreads")
123 $this->
addColumn(
'',
'check',
'1px',
true);
127 $this->
addColumn(
'',
'check',
'10px',
true);
130 $this->
addColumn($this->lng->txt(
'forums_thread'),
'th_title');
131 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'author');
132 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
133 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
134 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'lp_date');
140 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'showThreads'));
143 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
145 if($this->parent_cmd ==
'sortThreads')
153 if($this->
ilias->getSetting(
'forum_notification') > 0 && !$ilUser->isAnonymous())
155 $this->
addMultiCommand(
'enable_notifications', $this->lng->txt(
'forums_enable_notification'));
156 $this->
addMultiCommand(
'disable_notifications', $this->lng->txt(
'forums_disable_notification'));
160 $this->
addMultiCommand(
'makesticky', $this->lng->txt(
'make_topics_sticky'));
161 $this->
addMultiCommand(
'unmakesticky', $this->lng->txt(
'make_topics_non_sticky'));
162 $this->
addMultiCommand(
'editThread', $this->lng->txt(
'frm_edit_title'));
165 $this->
addMultiCommand(
'move', $this->lng->txt(
'move_thread_to_forum'));
170 $this->
addMultiCommand(
'confirmDeleteThreads', $this->lng->txt(
'delete'));
171 $this->
addMultiCommand(
'merge', $this->lng->txt(
'merge_posts_into_thread'));
181 $this->
addColumn(
'',
'check',
'1px',
true);
182 $this->
addColumn($this->lng->txt(
'forums_thread'),
'th_title');
183 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'author');
184 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
185 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
186 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'lp_date');
192 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'confirmMergeThreads'));
195 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
218 if(
'mergeThreads' == $this->parent_cmd)
220 $checked = $this->max_count == 1 || (isset(
$_POST[
'thread_ids']) && in_array($thread->
getId(),
$_POST[
'thread_ids']));
222 $checked,
'thread_ids[]', $thread->
getId()
225 else if(
'showThreads' == $this->parent_cmd)
228 (isset(
$_POST[
'thread_ids']) && in_array($thread->
getId(),
$_POST[
'thread_ids']) ?
true :
false),
'thread_ids[]', $thread->
getId()
235 $this->tpl->setVariable(
'VAL_SORTING_NAME',
'thread_sorting['.$thread->
getId().
']' );
236 $this->tpl->setVariable(
'VAL_SORTING', (
int)$this->position * 10 );
240 $this->tpl->setVariable(
'VAL_CHECK',
'');
248 $subject .=
'<span class="light">[' . $this->lng->txt(
'sticky') .
']</span> ';
252 $subject .=
'<span class="light">[' . $this->lng->txt(
'topic_close') .
']</span> ';
255 if(!$ilUser->isAnonymous() &&
256 $this->
ilias->getSetting(
'forum_notification') != 0 &&
260 $subject .=
'<span class="light">[' . $this->lng->txt(
'forums_notification_enabled') .
']</span> ';
269 $subject =
'<div><a href="' . $this->ctrl->getLinkTarget($this->
getParentObject(),
'viewThread') .
'">' . $thread->
getSubject() .
'</a></div>' . $subject;
275 $this->tpl->setVariable(
'VAL_SUBJECT', $subject);
278 $this->ctrl->setParameter($this->
getParentObject(),
'backurl', urlencode($this->ctrl->getLinkTargetByClass(
"ilrepositorygui",
"")));
286 'class' =>
'il_ItemProperty',
287 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'showUser')
290 $this->tpl->setVariable(
'VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
292 $topicStats = $num_posts;
293 if(!$ilUser->isAnonymous())
297 $topicStats .=
'<br /><span class="alert ilWhiteSpaceNowrap">' . $this->lng->txt(
'unread') .
': ' . $num_unread .
'</span>';
301 $topicStats .=
'<br /><span class="alert ilWhiteSpaceNowrap">' . $this->lng->txt(
'new') .
': ' . $num_new .
'</span>';
305 $this->tpl->setVariable(
'VAL_ARTICLE_STATS', $topicStats);
306 $this->tpl->setVariable(
'VAL_NUM_VISIT', $thread->
getVisits());
320 if(is_object($objLastPost))
323 $objLastPost->getUserId(),
324 $objLastPost->getUserAlias(),
325 $objLastPost->getImportName(),
327 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'viewThread') .
'#' . $objLastPost->getId()
332 '<div class="ilWhiteSpaceNowrap">' . $this->lng->txt(
'from') .
' ' . $authorinfo->getLinkedAuthorName() .
'</div>' 338 $css_row = $this->css_row;
341 $css_row = $css_row ==
'tblrow1' ?
'tblstickyrow1' :
'tblstickyrow2';
343 $this->tpl->setVariable(
'CSS_ROW', $css_row);
374 public function fetchData()
378 $excluded_ids = array();
379 if($this->parent_cmd ==
'mergeThreads' &&
387 'excluded_ids' => $excluded_ids
401 $thread_ids = array();
403 foreach(
$data[
'items'] as $thread)
408 $thread_ids[] = (int)$thread->getId();
409 if($thread->getUserId() > 0)
411 $user_ids[$thread->getUserId()] = (int)$thread->getUserId();
415 $user_ids = array_merge(
416 ilObjForum::getUserIdsOfLastPostsByRefIdAndThreadIds($this->
getRefId(), $thread_ids),
420 ilForumAuthorInformationCache::preloadUserObjects(array_unique($user_ids));
520 $this->merge_thread_obj = $thread_obj;
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)
getLastActivePost()
Fetches and returns an object of the last active post in the current topic.
setExternalSegmentation($a_val)
Set external segmentation.
resetOffset($a_in_determination=false)
Reset offset.
setIsModerator($is_moderator)
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.
getUserNotificationEnabled()
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
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) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="")
Add Command button.
setOverviewSetting($overview_setting)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? public
getLastPost()
Fetches and returns an object of the last post in the current topic.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setMapper(ilForum $mapper)
disable($a_module_name)
diesables particular modules of table
setFormAction($a_form_action)
Set Form action parameter.
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.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public