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';
8 require_once
'Services/Rating/classes/class.ilRatingGUI.php';
78 $this->parent_cmd = $a_parent_cmd;
85 $this->
setId(
'frm_tt_' . substr(md5($this->parent_cmd), 0, 3) .
'_'. $this->
getRefId());
93 parent::__construct($a_parent_obj, $a_parent_cmd, $template_context);
96 $tpl->addCss(
'./Modules/Forum/css/forum_table.css');
101 if($this->parent_cmd ==
'mergeThreads')
107 $this->initTopicsOverviewTable();
114 public function initTopicsOverviewTable()
121 if($this->parent_cmd ==
"showThreads")
124 $this->
addColumn(
'',
'check',
'1px',
true);
128 $this->
addColumn(
'',
'check',
'10px',
true);
131 $this->
addColumn($this->lng->txt(
'forums_thread'),
'');
132 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'');
133 $this->
addColumn($this->lng->txt(
'forums_articles'),
'');
134 $this->
addColumn($this->lng->txt(
'visits'),
'');
135 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'post_date');
136 if(
'showThreads' == $this->parent_cmd && $this->parent_obj->objProperties->isIsThreadRatingEnabled())
138 $this->
addColumn($this->lng->txt(
'frm_rating'),
'rating');
142 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'showThreads'));
145 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
147 if($this->parent_cmd ==
'sortThreads')
155 if($this->
ilias->getSetting(
'forum_notification') > 0 && !$ilUser->isAnonymous())
157 $this->
addMultiCommand(
'enable_notifications', $this->lng->txt(
'forums_enable_notification'));
158 $this->
addMultiCommand(
'disable_notifications', $this->lng->txt(
'forums_disable_notification'));
162 $this->
addMultiCommand(
'makesticky', $this->lng->txt(
'make_topics_sticky'));
163 $this->
addMultiCommand(
'unmakesticky', $this->lng->txt(
'make_topics_non_sticky'));
164 $this->
addMultiCommand(
'editThread', $this->lng->txt(
'frm_edit_title'));
167 $this->
addMultiCommand(
'move', $this->lng->txt(
'move_thread_to_forum'));
172 $this->
addMultiCommand(
'confirmDeleteThreads', $this->lng->txt(
'delete'));
173 $this->
addMultiCommand(
'merge', $this->lng->txt(
'merge_posts_into_thread'));
183 $this->
addColumn(
'',
'check',
'1px',
true);
184 $this->
addColumn($this->lng->txt(
'forums_thread'),
'th_title');
185 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'author');
186 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
187 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
188 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'lp_date');
194 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'confirmMergeThreads'));
197 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
220 if(
'mergeThreads' == $this->parent_cmd)
222 $checked = $this->max_count == 1 || (isset(
$_POST[
'thread_ids']) && in_array($thread->
getId(),
$_POST[
'thread_ids']));
224 $checked,
'thread_ids[]', $thread->
getId()
227 else if(
'showThreads' == $this->parent_cmd)
230 (isset(
$_POST[
'thread_ids']) && in_array($thread->
getId(),
$_POST[
'thread_ids']) ?
true :
false),
'thread_ids[]', $thread->
getId()
233 if($this->parent_obj->objProperties->isIsThreadRatingEnabled())
236 $rating->setObject($this->parent_obj->object->getId(), $this->parent_obj->object->getType(), $thread->
getId(),
'thread');
237 $rating->setUserId($ilUser->getId());
238 $this->tpl->setVariable(
'VAL_RATING', $rating->getHTML());
245 $this->tpl->setVariable(
'VAL_SORTING_NAME',
'thread_sorting['.$thread->
getId().
']' );
246 $this->tpl->setVariable(
'VAL_SORTING', (
int)$this->position * 10 );
250 $this->tpl->setVariable(
'VAL_CHECK',
'');
258 $subject .=
'<span class="light">[' . $this->lng->txt(
'sticky') .
']</span> ';
262 $subject .=
'<span class="light">[' . $this->lng->txt(
'topic_close') .
']</span> ';
265 if(!$ilUser->isAnonymous() &&
266 $this->
ilias->getSetting(
'forum_notification') != 0 &&
270 $subject .=
'<span class="light">[' . $this->lng->txt(
'forums_notification_enabled') .
']</span> ';
279 $subject =
'<div><a href="' . $this->ctrl->getLinkTarget($this->
getParentObject(),
'viewThread') .
'">' . $thread->
getSubject() .
'</a></div>' . $subject;
285 $this->tpl->setVariable(
'VAL_SUBJECT', $subject);
288 $this->ctrl->setParameter($this->
getParentObject(),
'backurl', urlencode($this->ctrl->getLinkTargetByClass(
"ilrepositorygui",
"")));
297 'class' =>
'il_ItemProperty',
298 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'showUser')
301 $this->tpl->setVariable(
'VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
303 $topicStats = $num_posts;
304 if(!$ilUser->isAnonymous())
308 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'unread') .
': ' . $num_unread .
'</span>';
312 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'new') .
': ' . $num_new .
'</span>';
316 $this->tpl->setVariable(
'VAL_ARTICLE_STATS', $topicStats);
317 $this->tpl->setVariable(
'VAL_NUM_VISIT', $thread->
getVisits());
331 if(is_object($objLastPost))
334 $objLastPost->getPosAuthorId(),
335 $objLastPost->getDisplayUserId(),
336 $objLastPost->getUserAlias(),
337 $objLastPost->getImportName(),
339 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'viewThread') .
'#' . $objLastPost->getId()
344 '<div class="ilWhiteSpaceNowrap">' . $this->lng->txt(
'from') .
' ' . $authorinfo->getLinkedAuthorName() .
'</div>' 350 $css_row = $this->css_row;
353 $css_row = $css_row ==
'tblrow1' ?
'tblstickyrow1' :
'tblstickyrow2';
355 $this->tpl->setVariable(
'CSS_ROW', $css_row);
386 public function fetchData()
390 $excluded_ids = array();
391 if($this->parent_cmd ==
'mergeThreads' &&
399 'excluded_ids' => $excluded_ids,
415 $thread_ids = array();
417 foreach(
$data[
'items'] as $thread)
422 $thread_ids[] = (int)$thread->getId();
423 if($thread->getDisplayUserId() > 0)
425 $user_ids[$thread->getDisplayUserId()] = (int)$thread->getDisplayUserId();
429 $user_ids = array_merge(
430 ilObjForum::getUserIdsOfLastPostsByRefIdAndThreadIds($this->
getRefId(), $thread_ids),
434 ilForumAuthorInformationCache::preloadUserObjects(array_unique($user_ids));
534 $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)
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)
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.
getUserNotificationEnabled()
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.
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)
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