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';
83 $this->lng = $DIC->language();
84 $this->ctrl = $DIC->ctrl();
85 $this->mainTemplate = $DIC->ui()->mainTemplate();
86 $this->
user = $DIC->user();
89 $this->parent_cmd = $a_parent_cmd;
96 $id =
'frm_tt_' . substr(md5($this->parent_cmd), 0, 3) .
'_' . $this->
getRefId();
105 parent::__construct($a_parent_obj, $a_parent_cmd, $template_context);
108 $this->mainTemplate->addCss(
'./Modules/Forum/css/forum_table.css');
115 if ($this->parent_cmd ==
'mergeThreads') {
127 if ($this->parent_cmd ==
"showThreads") {
129 $this->
addColumn(
'',
'check',
'1px',
true);
131 $this->
addColumn(
'',
'check',
'10px',
true);
134 $this->
addColumn($this->lng->txt(
'forums_thread'),
'thr_subject');
135 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'');
136 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
137 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
139 if ($this->is_post_draft_allowed) {
140 $this->
addColumn($this->lng->txt(
'drafts',
''));
143 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'post_date');
144 if (
'showThreads' == $this->parent_cmd && $this->parent_obj->objProperties->isIsThreadRatingEnabled()) {
145 $this->
addColumn($this->lng->txt(
'frm_rating'),
'rating');
149 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'showThreads'));
152 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
154 if ($this->parent_cmd ==
'sortThreads') {
159 if ($this->
settings->get(
'forum_notification') > 0 && !$this->
user->isAnonymous()) {
160 $this->
addMultiCommand(
'enable_notifications', $this->lng->txt(
'forums_enable_notification'));
161 $this->
addMultiCommand(
'disable_notifications', $this->lng->txt(
'forums_disable_notification'));
164 $this->
addMultiCommand(
'makesticky', $this->lng->txt(
'make_topics_sticky'));
165 $this->
addMultiCommand(
'unmakesticky', $this->lng->txt(
'make_topics_non_sticky'));
166 $this->
addMultiCommand(
'editThread', $this->lng->txt(
'frm_edit_title'));
169 $this->
addMultiCommand(
'move', $this->lng->txt(
'move_thread_to_forum'));
173 $this->
addMultiCommand(
'confirmDeleteThreads', $this->lng->txt(
'delete'));
174 $this->
addMultiCommand(
'merge', $this->lng->txt(
'merge_posts_into_thread'));
184 $this->
addColumn(
'',
'check',
'1px',
true);
185 $this->
addColumn($this->lng->txt(
'forums_thread'),
'th_title');
186 $this->
addColumn($this->lng->txt(
'forums_created_by'),
'author');
187 $this->
addColumn($this->lng->txt(
'forums_articles'),
'num_posts');
188 $this->
addColumn($this->lng->txt(
'visits'),
'num_visit');
189 if ($this->is_post_draft_allowed) {
190 $this->
addColumn($this->lng->txt(
'drafts',
''));
192 $this->
addColumn($this->lng->txt(
'forums_last_post'),
'lp_date');
198 $this->
setFormAction($this->ctrl->getFormAction($this->getParentObject(),
'confirmMergeThreads'));
201 $this->
setRowTemplate(
'tpl.forums_threads_table.html',
'Modules/Forum');
218 $this->ctrl->setParameter($this->
getParentObject(),
'thr_pk', $thread->getId());
219 if (
'mergeThreads' == $this->parent_cmd) {
220 $checked = $this->max_count == 1 || (isset(
$_POST[
'thread_ids']) && in_array($thread->getId(),
$_POST[
'thread_ids']));
226 } elseif (
'showThreads' == $this->parent_cmd) {
228 (isset(
$_POST[
'thread_ids']) && in_array($thread->getId(),
$_POST[
'thread_ids']) ?
true :
false),
233 if ($this->parent_obj->objProperties->isIsThreadRatingEnabled()) {
235 $rating->setObject($this->parent_obj->object->getId(), $this->parent_obj->object->getType(), $thread->getId(),
'thread');
236 $rating->setUserId($this->
user->getId());
237 $this->tpl->setVariable(
'VAL_RATING', $rating->getHTML());
240 if ($thread->isSticky()) {
241 $this->tpl->setVariable(
'VAL_SORTING_NAME',
'thread_sorting[' . $thread->getId() .
']');
242 $this->tpl->setVariable(
'VAL_SORTING', (
int) $this->position * 10);
244 $this->tpl->setVariable(
'VAL_CHECK',
'');
250 if ($thread->isSticky()) {
251 $subject .=
'<span class="light">[' . $this->lng->txt(
'sticky') .
']</span> ';
253 if ($thread->isClosed()) {
254 $subject .=
'<span class="light">[' . $this->lng->txt(
'topic_close') .
']</span> ';
257 if (!$this->
user->isAnonymous() &&
258 $this->
settings->get(
'forum_notification') != 0 &&
259 $thread->getUserNotificationEnabled()
261 $subject .=
'<span class="light">[' . $this->lng->txt(
'forums_notification_enabled') .
']</span> ';
264 $num_posts = $thread->getNumPosts();
265 $num_unread = $thread->getNumUnreadPosts();
266 $num_new = $thread->getNumNewPosts();
268 if ($num_posts > 0) {
269 $subject =
'<div><a href="' . $this->ctrl->getLinkTarget($this->
getParentObject(),
'viewThread') .
'">' . $thread->getSubject() .
'</a></div>' . $subject;
271 $subject = $thread->getSubject() . $subject;
273 $this->tpl->setVariable(
'VAL_SUBJECT', $subject);
276 $this->ctrl->setParameter($this->
getParentObject(),
'backurl', urlencode($this->ctrl->getLinkTargetByClass(
"ilrepositorygui",
"")));
277 $this->ctrl->setParameter($this->
getParentObject(),
'user', $thread->getDisplayUserId());
280 $thread->getThrAuthorId(),
281 $thread->getDisplayUserId(),
282 $thread->getUserAlias(),
283 $thread->getImportName(),
285 'class' =>
'il_ItemProperty',
286 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'showUser')
289 $this->tpl->setVariable(
'VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
291 $topicStats = $num_posts;
292 if (!$this->
user->isAnonymous()) {
293 if ($num_unread > 0) {
294 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'unread') .
': ' . $num_unread .
'</span>';
297 $topicStats .=
'<br /><span class="ilAlert ilWhiteSpaceNowrap">' . $this->lng->txt(
'new') .
': ' . $num_new .
'</span>';
301 $this->tpl->setVariable(
'VAL_ARTICLE_STATS', $topicStats);
302 $this->tpl->setVariable(
'VAL_NUM_VISIT', $thread->getVisits());
303 if ($this->is_post_draft_allowed) {
305 $this->tpl->setVariable(
'VAL_DRAFTS', (
int) $draft_statistics[$thread->getId()]);
308 if ($num_posts > 0) {
309 if ($thread->getLastPostForThreadOverview() instanceof
ilForumPost) {
310 $objLastPost = $thread->getLastPostForThreadOverview();
313 $objLastPost->getPosAuthorId(),
314 $objLastPost->getDisplayUserId(),
315 $objLastPost->getUserAlias(),
316 $objLastPost->getImportName(),
318 'href' => $this->ctrl->getLinkTarget($this->getParentObject(),
'viewThread') .
'#' . $objLastPost->getId()
322 $this->tpl->setVariable(
325 '<div class="ilWhiteSpaceNowrap">' . $this->lng->txt(
'from') .
' ' . $authorinfo->getLinkedAuthorName() .
'</div>' 331 $css_row = $this->css_row;
332 if ($thread->isSticky()) {
333 $css_row = $css_row ==
'tblrow1' ?
'tblstickyrow1' :
'tblstickyrow2';
335 $this->tpl->setVariable(
'CSS_ROW', $css_row);
366 public function fetchData()
370 $excluded_ids =
array();
371 if ($this->parent_cmd ==
'mergeThreads' &&
378 'excluded_ids' => $excluded_ids,
393 $thread_ids =
array();
395 foreach (
$data[
'items'] as $thread) {
399 $thread_ids[] = (int) $thread->getId();
400 if ($thread->getDisplayUserId() > 0) {
401 $user_ids[$thread->getDisplayUserId()] = (int) $thread->getDisplayUserId();
405 $user_ids = array_merge(
510 $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.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
__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.
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.
numericOrdering($column)
Currently not used because of external segmentation and sorting.
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
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.
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 getUserIdsOfLastPostsByRefIdAndThreadIds($ref_id, array $thread_ids)
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
static getDraftsStatisticsByRefId($ref_id)