4 require_once
'Services/Object/classes/class.ilObjectGUI.php';
5 require_once
'Services/Table/classes/class.ilTable2GUI.php';
6 require_once
'Modules/Forum/classes/class.ilForumProperties.php';
7 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
8 require_once
'Modules/Forum/classes/class.ilForumPost.php';
9 require_once
'Modules/Forum/classes/class.ilForum.php';
10 require_once
'Modules/Forum/classes/class.ilForumTopic.php';
11 require_once
'Services/RTE/classes/class.ilRTE.php';
12 require_once
'Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
104 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
111 global
$ilCtrl, $ilAccess, $ilObjDataCache;
114 $this->ctrl->saveParameter($this, array(
'ref_id',
'cmdClass'));
117 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
119 $this->lng->loadLanguageModule(
'forum');
127 $this->is_moderator = $ilAccess->checkAccess(
'moderate_frm',
'',
$_GET[
'ref_id']);
130 $this->objCurrentTopic =
new ilForumTopic((
int)
$_GET[
'thr_pk'], $this->is_moderator);
133 $this->objCurrentPost =
new ilForumPost((
int) $_GET[
'pos_pk'], $this->is_moderator);
136 $this->forum_overview_setting = $frma_set->get(
'forum_overview');
150 $sess[(int)$_GET[
'thr_fk']] = array();
167 $next_class = $this->ctrl->getNextClass($this);
168 $cmd = $this->ctrl->getCmd();
170 $exclude_cmds = array(
171 'viewThread',
'markPostUnread',
'markPostRead',
'showThreadNotification',
172 'performPostActivation',
173 'askForPostActivation',
'askForPostDeactivation',
174 'toggleThreadNotification',
'toggleThreadNotificationTab',
175 'toggleStickiness',
'cancelPost',
'savePost',
'quotePost',
'getQuotationHTMLAsynch',
176 'setTreeStateAsynch',
'fetchTreeChildrenAsync' 179 if(!in_array(
$cmd, $exclude_cmds))
185 if(!$this->
getCreationMode() && !$ilCtrl->isAsynch() && $ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']))
187 $ilNavigationHistory->addItem(
$_GET[
'ref_id'],
188 'ilias.php?baseClass=ilRepositoryGUI&cmd=showThreads&ref_id='.
$_GET[
'ref_id'],
'frm');
193 case 'ilpermissiongui':
194 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
196 $this->ctrl->forwardCommand($perm_gui);
199 case 'ilforumexportgui':
200 require_once
'Modules/Forum/classes/class.ilForumExportGUI.php';
202 $this->ctrl->forwardCommand($fex_gui);
206 case 'ilforummoderatorsgui':
207 require_once
'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
209 $this->ctrl->forwardCommand($fm_gui);
212 case 'ilinfoscreengui':
220 case 'ilpublicuserprofilegui':
221 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
223 $add = $this->getUserProfileAdditional((
int)$_GET[
'ref_id'], (
int)$_GET[
'user']);
224 $profile_gui->setAdditional($add);
225 $ret = $this->ctrl->forwardCommand($profile_gui);
226 $this->tpl->setContent(
$ret);
229 case 'ilobjectcopygui':
230 include_once
'Services/Object/classes/class.ilObjectCopyGUI.php';
233 $this->ctrl->forwardCommand($cp);
237 $ilTabs->setTabActive(
'export');
238 include_once
'Services/Export/classes/class.ilExportGUI.php';
240 $exp->addFormat(
'xml');
241 $this->ctrl->forwardCommand($exp);
245 if(!$this->objProperties->isIsThreadRatingEnabled() || $ilUser->isAnonymous())
247 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'), $ilErr->MESSAGE);
250 require_once
'Services/Rating/classes/class.ilRatingGUI.php';
252 $rating_gui->setObject($this->object->getId(), $this->
object->getType(), $this->objCurrentTopic->getId(),
'thread');
254 $ilCtrl->setParameter($this,
'thr_pk', (
int)$_GET[
'thr_pk']);
255 $this->ctrl->forwardCommand($rating_gui);
258 $this->objCurrentTopic->setAverageRating($avg[
'avg']);
259 $this->objCurrentTopic->update();
261 $ilCtrl->redirect($this,
"showThreads");
264 case 'ilcommonactiondispatchergui':
265 include_once
'Services/Object/classes/class.ilCommonActionDispatcherGUI.php';
267 $this->ctrl->forwardCommand($gui);
279 if(isset(
$_POST[
'select_cmd2']))
284 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] != null)
286 $member_cmd = array(
'enableAdminForceNoti',
'disableAdminForceNoti',
'enableHideUserToggleNoti',
'disableHideUserToggleNoti');
287 in_array(
$_POST[
'selected_cmd'], $member_cmd) ?
$cmd =
$_POST[
'selected_cmd'] :
$cmd =
'performThreadsAction';
291 $cmd =
'showThreads';
301 if(
$cmd !=
'viewThreadObject' &&
$cmd !=
'showUserObject')
314 $this->settingsTabs();
319 $rg_thr->addOption(
new ilRadioOption($this->lng->txt(
'sorting_manual_sticky'),
'1'));
321 $rg_thr->setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
328 $rg_pro->addOption($rg_sort_by_date);
333 $view_direction_group_gui->addOption($view_desc);
334 $view_direction_group_gui->addOption($view_asc);
336 $rg_sort_by_date->
addSubItem($view_direction_group_gui);
339 if($ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
341 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
343 $cb_prop->setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
347 if($ilSetting->get(
'enable_fora_statistics',
false))
349 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
351 $cb_prop->setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
355 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
357 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
360 $frm_subject =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_subject_setting'),
'subject_setting');
362 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'add_re_to_subject'),
'add_re_to_subject'));
363 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'empty_subject'),
'empty_subject'));
365 $a_form->
addItem($frm_subject);
367 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'mark_moderator_posts'),
'mark_mod_posts');
369 $cb_prop->setInfo($this->lng->txt(
'mark_moderator_posts_desc'));
372 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'enable_thread_ratings'),
'thread_rating');
374 $cb_prop->setInfo($this->lng->txt(
'enable_thread_ratings_info'));
380 $a_values[
"desc"] = $this->
object->getLongDescription();
381 $a_values[
'default_view'] = $this->objProperties->getDefaultView();
382 $a_values[
'anonymized'] = $this->objProperties->isAnonymized();
383 $a_values[
'statistics_enabled'] = $this->objProperties->isStatisticEnabled();
384 $a_values[
'post_activation'] = $this->objProperties->isPostActivationEnabled();
385 $a_values[
'subject_setting'] = $this->objProperties->getSubjectSetting();
386 $a_values[
'mark_mod_posts'] = $this->objProperties->getMarkModeratorPosts();
387 $a_values[
'thread_sorting'] = $this->objProperties->getThreadSorting();
388 $a_values[
'thread_rating'] = $this->objProperties->isIsThreadRatingEnabled();
394 $a_values[
'default_view'] = $default_view;
396 $default_view_sort_dir =
398 ? (
int)$this->objProperties->getDefaultView()
401 $a_values[
'default_view_sort_dir'] = $default_view_sort_dir;
411 $view = (int)
$_POST[
'default_view'];
420 $this->objProperties->setDefaultView($view);
428 if($ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
430 $this->objProperties->setAnonymisation((
int) $a_form->
getInput(
'anonymized'));
432 if($ilSetting->get(
'enable_fora_statistics',
false))
434 $this->objProperties->setStatisticsStatus((
int) $a_form->
getInput(
'statistics_enabled'));
436 $this->objProperties->setPostActivation((
int) $a_form->
getInput(
'post_activation'));
437 $this->objProperties->setSubjectSetting( $a_form->
getInput(
'subject_setting'));
438 $this->objProperties->setMarkModeratorPosts((
int) $a_form->
getInput(
'mark_mod_posts'));
439 $this->objProperties->setThreadSorting((
int)$a_form->
getInput(
'thread_sorting'));
440 $this->objProperties->setIsThreadRatingEnabled((
bool)$a_form->
getInput(
'thread_rating'));
442 $this->objProperties->update();
452 $this->ctrl->setParameter($this,
'thr_pk', $a_thread_id);
453 $form->setFormAction($this->ctrl->getFormAction($this,
'updateThread'));
457 $ti_prop->setMaxLength(255);
458 $ti_prop->setSize(50);
459 $form->addItem($ti_prop);
461 $form->addCommandButton(
'updateThread', $this->lng->txt(
'save'));
462 $form->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
478 if(!$this->is_moderator)
480 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
483 $ilTabs->setTabActive(
'forums_threads');
488 $form->setValuesByArray(array(
493 $this->tpl->setContent($form->getHTML());
501 if(!$this->is_moderator)
503 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
506 if(!$this->objCurrentTopic->getId())
513 if($this->objCurrentTopic->getForumId() != $forum_id)
515 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
519 if(!$form->checkInput())
521 $form->setValuesByPost();
522 $this->editThreadObject($this->objCurrentTopic->getId(), $form);
526 $this->objCurrentTopic->setSubject($form->getInput(
'title'));
527 $this->objCurrentTopic->updateThreadTitle();
533 public function markAllReadObject()
540 $this->
object->markAllThreadsRead($ilUser->getId());
567 $ilTabs->addSubTabTarget(
'show', $this->ctrl->getLinkTarget($this,
'showThreads'),
'showThreads', get_class($this),
'', $subtab==
'showThreads'? true : false );
568 $ilTabs->addSubTabTarget(
'sorting_header', $this->ctrl->getLinkTarget($this,
'sortThreads'),
'sortThreads', get_class($this),
'', $subtab==
'sortThreads'? true : false );
571 public function getContent()
581 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
583 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
586 $cmd = $this->ctrl->getCmd();
587 $frm = $this->
object->Forum;
588 $frm->setForumId($this->object->getId());
589 $frm->setForumRefId($this->object->getRefId());
590 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
592 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
594 if((
int)strlen($this->confirmation_gui_html))
596 $this->tpl->setVariable(
'CONFIRMATION_GUI', $this->confirmation_gui_html);
600 if($ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()) && !$this->
hideToolbar())
602 $ilToolbar->addButton($this->lng->txt(
'forums_new_thread'), $this->ctrl->getLinkTarget($this,
'createThread'));
606 include_once
'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
607 if($ilUser->getId() != ANONYMOUS_USER_ID && !(int)strlen($this->confirmation_gui_html))
609 $ilToolbar->addButton(
610 $this->lng->txt(
'forums_mark_read'),
611 $this->ctrl->getLinkTarget($this,
'markAllRead'),
615 $this->ctrl->clearParameters($this);
619 $topicData = $frm->getOneTopic();
623 $frm->setDbTable(
'frm_data');
624 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
625 $frm->updateVisits($topicData[
'top_pk']);
627 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
628 if(!in_array(
$cmd, array(
'showThreads',
'sortThreads') ))
630 $cmd =
'showThreads';
633 $tbl->setMapper($frm)->fetchData();
635 $this->tpl->setVariable(
'THREADS_TABLE', $tbl->getHTML());
639 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
641 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
650 $this->create_form_gui->setTableWidth(
'600px');
652 $this->create_form_gui->setTitle($this->lng->txt(
'frm_new'));
656 $this->ctrl->setParameter($this,
'new_type', $object_type);
657 $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
660 $title_gui =
new ilTextInputGUI($this->lng->txt(
'title'),
'title');
663 $this->create_form_gui->addItem($title_gui);
668 $description_gui->setRows(2);
669 $this->create_form_gui->addItem($description_gui);
672 $sorting_threads_gui =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_sorting_threads'),
'thread_sorting');
673 $sort_dat =
new ilRadioOption($this->lng->txt(
'order_by').
' '.$this->lng->txt(
'date'), 0);
674 $sorting_threads_gui->addOption($sort_dat);
676 $sort_man =
new ilRadioOption($this->lng->txt(
'sorting_manual_sticky'), 1);
677 $sorting_threads_gui->addOption($sort_man);
678 $sorting_threads_gui->
setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
679 $this->create_form_gui->addItem($sorting_threads_gui);
684 $view_group_gui->addOption($view_hir);
686 $view_group_gui->addOption($view_dat);
687 $this->create_form_gui->addItem($view_group_gui);
690 $view_direction_group_gui->addOption($view_desc);
692 $view_direction_group_gui->addOption($view_asc);
693 $view_dat->
addSubItem($view_direction_group_gui);
696 $anonymize_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
697 $anonymize_gui->
setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
698 $anonymize_gui->setValue(1);
700 if($this->
ilias->getSetting(
'enable_anonymous_fora',
false))
701 $anonymize_gui->setDisabled(
true);
702 $this->create_form_gui->addItem($anonymize_gui);
705 $statistics_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
706 $statistics_gui->
setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
707 $statistics_gui->setValue(1);
708 if(!$this->
ilias->getSetting(
'enable_fora_statistics',
false))
709 $statistics_gui->setDisabled(
true);
710 $this->create_form_gui->addItem($statistics_gui);
712 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
714 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
715 $this->create_form_gui->addItem($cb_prop);
717 $this->create_form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
718 $this->create_form_gui->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
733 $this->ctrl->setParameter($this,
'ref_id', $forumObj->
getRefId());
734 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'createThread',
'',
false,
false));
744 global $ilAccess, $ilHelp,
$ilCtrl;
746 $ilHelp->setScreenIdComponent(
"frm");
748 $this->ctrl->setParameter($this,
'ref_id', $this->ref_id);
750 include_once
'Services/Repository/classes/class.ilRepositoryExplorer.php';
752 '',
'showThreads',
'view',
'markAllRead',
753 'enableForumNotification',
'disableForumNotification',
'moveThreads',
'performMoveThreads',
754 'cancelMoveThreads',
'performThreadsAction',
'createThread',
'addThread',
755 'showUser',
'confirmDeleteThreads',
756 'merge',
'mergeThreads',
'cancelMergeThreads',
'performMergeThreads' 759 (in_array($ilCtrl->getCmd(), $active)) ? $force_active = true : $force_active =
false;
760 $tabs_gui->
addTarget(
'forums_threads', $this->ctrl->getLinkTarget($this,
'showThreads'), $ilCtrl->getCmd(), get_class($this),
'', $force_active);
763 if($ilAccess->checkAccess(
'visible',
'', $this->ref_id))
765 $force_active = ($this->ctrl->getNextClass() ==
'ilinfoscreengui' || strtolower(
$_GET[
'cmdClass']) ==
'ilnotegui') ?
true :
false;
767 $this->ctrl->getLinkTargetByClass(
768 array(
'ilobjforumgui',
'ilinfoscreengui'),
'showSummary'),
769 array(
'showSummary',
'infoScreen'),
770 '',
'', $force_active);
773 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
775 $force_active = ($ilCtrl->getCmd() ==
'edit') ?
true :
false;
776 $tabs_gui->
addTarget(
'settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'', $force_active);
779 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
781 $tabs_gui->
addTarget(
'frm_moderators', $this->ctrl->getLinkTargetByClass(
'ilForumModeratorsGUI',
'showModerators'),
'showModerators', get_class($this));
784 if($this->
ilias->getSetting(
'enable_fora_statistics',
false) &&
785 ($this->objProperties->isStatisticEnabled() || $ilAccess->checkAccess(
'write',
'', $this->ref_id)))
787 $force_active = ($ilCtrl->getCmd() ==
'showStatistics') ?
true :
false;
788 $tabs_gui->
addTarget(
'frm_statistics', $this->ctrl->getLinkTarget($this,
'showStatistics'),
'showStatistics', get_class($this),
'', $force_active);
791 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
793 $tabs_gui->
addTarget(
'export', $this->ctrl->getLinkTargetByClass(
'ilexportgui',
''),
'',
'ilexportgui');
796 if($ilAccess->checkAccess(
'edit_permission',
'', $this->ref_id))
798 $tabs_gui->
addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'), array(
'perm',
'info',
'owner'),
'ilpermissiongui');
802 public function settingsTabs()
809 global $ilTabs, $ilAccess,
$tree;
811 $ilTabs->setTabActive(
'settings');
812 $ilTabs->addSubTabTarget(
'basic_settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'',
$_GET[
'cmd']==
'edit'? true : false );
815 if($this->
ilias->getSetting(
'forum_notification') > 0)
818 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
819 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
821 if((
int)$grp_ref_id > 0 || (int)$crs_ref_id > 0 )
823 #show member-tab for notification if forum-notification is enabled in administration 824 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
826 $mem_active = array(
'showMembers',
'forums_notification_settings');
827 (in_array(
$_GET[
'cmd'],$mem_active)) ? $force_mem_active =
true : $force_mem_active =
false;
829 $ilTabs->addSubTabTarget(
'notifications', $this->ctrl->getLinkTarget($this,
'showMembers'),
$_GET[
'cmd'], get_class($this),
'', $force_mem_active);
836 public function showStatisticsObject()
844 if(!$this->
ilias->getSetting(
'enable_fora_statistics',
false))
846 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
850 if(!$ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']))
852 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
856 if(!$ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']) && !$this->objProperties->isStatisticEnabled())
858 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
862 if($ilAccess->checkAccess(
'write',
'',
$_GET[
'ref_id']) &&
863 !$this->objProperties->isStatisticEnabled())
865 ilUtil::sendInfo($this->lng->txt(
'frm_statistics_disabled_for_participants'));
868 $this->
object->Forum->setForumId($this->object->getId());
870 require_once
'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
873 $tbl->setId(
'il_frm_statistic_table_'.(
int)
$_GET[
'ref_id']);
874 $tbl->setTitle($this->lng->txt(
'statistic'),
'icon_usr.svg', $this->lng->txt(
'obj_'.$this->object->getType()));
876 $data = $this->
object->Forum->getUserStatistic($this->is_moderator);
881 $result[$counter][
'ranking'] = $row[0];
882 $result[$counter][
'login'] = $row[1];
883 $result[$counter][
'lastname'] = $row[2];
884 $result[$counter][
'firstname'] = $row[3];
890 $this->tpl->setContent($tbl->getHTML());
893 public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
902 if($ilAccess->checkAccess(
'read',
'', $a_target))
907 if ($objTopic->getFrmObjId() &&
913 if($ilAccess->checkAccess(
'read',
'', $ref_id))
920 if (isset($new_ref_id) && $new_ref_id != $a_target)
922 ilUtil::redirect(ILIAS_HTTP_PATH.
"/goto.php?target=frm_".$new_ref_id.
"_".$a_thread.
"_".$a_posting);
926 $_GET[
'ref_id'] = $a_target;
927 $_GET[
'pos_pk'] = $a_posting;
928 $_GET[
'thr_pk'] = $a_thread;
929 $_GET[
'anchor'] = $a_posting;
930 $_GET[
'cmdClass'] =
'ilObjForumGUI';
931 $_GET[
'cmd'] =
'viewThread';
932 $_GET[
'baseClass'] =
'ilRepositoryGUI';
934 include_once(
'ilias.php');
940 $_GET[
'ref_id'] = $a_target;
941 $_GET[
'baseClass'] =
'ilRepositoryGUI';
942 include_once(
'ilias.php');
946 else if($ilAccess->checkAccess(
'read',
'', ROOT_FOLDER_ID))
948 $_GET[
'target'] =
'';
949 $_GET[
'ref_id'] = ROOT_FOLDER_ID;
952 $_GET[
'baseClass'] =
'ilRepositoryGUI';
953 include(
'ilias.php');
957 $ilErr->raiseError($lng->txt(
'msg_no_perm_read'), $ilErr->FATAL);
960 public function performDeleteThreadsObject()
967 if(!$this->is_moderator)
969 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
973 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']))
979 require_once
'Modules/Forum/classes/class.ilForum.php';
980 require_once
'Modules/Forum/classes/class.ilObjForum.php';
984 $this->objProperties->setObjId($forumObj->getId());
987 if(count(
$_POST[
'thread_ids']) > 1 )
989 $success_message =
'forums_threads_deleted';
993 $success_message =
'forums_thread_deleted';
996 foreach(
$_POST[
'thread_ids'] as $topic_id)
998 $frm->setForumId($forumObj->getId());
999 $frm->setForumRefId($forumObj->getRefId());
1001 $first_node = $frm->getFirstPostNode($topic_id);
1002 if((
int)$first_node[
'pos_pk'])
1004 $frm->deletePost($first_node[
'pos_pk']);
1008 $this->ctrl->redirect($this,
'showThreads');
1011 public function confirmDeleteThreads()
1018 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']))
1024 if(!$this->is_moderator)
1026 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1030 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
1033 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteThreads'));
1034 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_delete_threads'));
1035 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
1036 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteThreads');
1038 foreach((array)
$_POST[
'thread_ids'] as $thread_id)
1043 $this->confirmation_gui_html = $c_gui->getHTML();
1047 return $this->tpl->setContent($c_gui->getHTML());
1050 public function prepareThreadScreen(
ilObjForum $a_forum_obj)
1058 global
$tpl,
$lng, $ilTabs, $ilHelp;
1060 $ilHelp->setScreenIdComponent(
"frm");
1062 $tpl->getStandardTemplate();
1068 $ilTabs->setBackTarget($lng->txt(
'all_topics'),
1069 'ilias.php?baseClass=ilRepositoryGUI&ref_id='.$_GET[
'ref_id']);
1072 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1073 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1076 $ilTabs->addTarget(
'sort_by_posts', $this->ctrl->getLinkTarget($this,
'viewThread'));
1081 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1082 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1083 $ilTabs->addTarget(
'order_by_date', $this->ctrl->getLinkTarget($this,
'viewThread'));
1084 $this->ctrl->clearParameters($this);
1089 $ilTabs->setTabActive(
'order_by_date');
1093 $ilTabs->setTabActive(
'sort_by_posts');
1099 $frm = $a_forum_obj->Forum;
1100 $frm->setForumId($a_forum_obj->
getId());
1105 if($this->is_moderator)
1107 $this->objCurrentPost->activatePost();
1111 $this->viewThreadObject();
1116 if($this->is_moderator)
1121 $this->viewThreadObject();
1126 $this->display_confirm_post_activation = $status;
1134 public function toggleThreadNotificationObject()
1141 if($this->objCurrentTopic->isNotificationEnabled($ilUser->getId()))
1143 $this->objCurrentTopic->disableNotification($ilUser->getId());
1148 $this->objCurrentTopic->enableNotification($ilUser->getId());
1152 $this->viewThreadObject();
1157 if($this->is_moderator)
1159 if($this->objCurrentTopic->isSticky())
1161 $this->objCurrentTopic->unmakeSticky();
1165 $this->objCurrentTopic->makeSticky();
1169 $this->viewThreadObject();
1174 $_GET[
'action'] =
'';
1176 $this->viewThreadObject();
1179 public function getDeleteFormHTML()
1187 $form_tpl =
new ilTemplate(
'tpl.frm_delete_post_form.html',
true,
true,
'Modules/Forum');
1189 $form_tpl->setVariable(
'ANKER', $this->objCurrentPost->getId());
1190 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1191 $form_tpl->setVariable(
'TXT_DELETE', $lng->txt(
'forums_info_delete_post'));
1192 $this->ctrl->setParameter($this,
'action',
'ready_delete');
1193 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1194 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1195 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1196 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1197 $this->ctrl->clearParameters($this);
1198 $form_tpl->setVariable(
'CANCEL_BUTTON', $lng->txt(
'cancel'));
1199 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'confirm'));
1201 return $form_tpl->get();
1204 public function getActivationFormHTML()
1211 $form_tpl =
new ilTemplate(
'tpl.frm_activation_post_form.html',
true,
true,
'Modules/Forum');
1213 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1214 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1215 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1216 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this,
'performPostActivation'));
1217 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1218 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1219 $form_tpl->setVariable(
'TXT_ACT', $lng->txt(
'activate_post_txt'));
1220 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'activate_only_current'));
1221 $form_tpl->setVariable(
'CMD_CONFIRM',
'performPostActivation');
1222 $this->ctrl->clearParameters($this);
1224 return $form_tpl->get();
1227 public function getCensorshipFormHTML()
1235 $form_tpl =
new ilTemplate(
'tpl.frm_censorship_post_form.html',
true,
true,
'Modules/Forum');
1237 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1238 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1239 $this->ctrl->setParameter($this,
'action',
'ready_censor');
1240 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1241 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1242 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1243 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1244 $this->ctrl->clearParameters($this);
1245 $form_tpl->setVariable(
'TXT_CENS_MESSAGE', $lng->txt(
'forums_the_post'));
1246 $form_tpl->setVariable(
'TXT_CENS_COMMENT', $lng->txt(
'forums_censor_comment').
':');
1247 $form_tpl->setVariable(
'CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1250 if($this->objCurrentPost->isCensored())
1252 $form_tpl->setVariable(
'TXT_CENS', $lng->txt(
'forums_info_censor2_post'));
1253 $form_tpl->setVariable(
'YES_BUTTON', $lng->txt(
'confirm'));
1254 $form_tpl->setVariable(
'NO_BUTTON', $lng->txt(
'cancel'));
1258 $form_tpl->setVariable(
'TXT_CENS', $lng->txt(
'forums_info_censor_post'));
1259 $form_tpl->setVariable(
'CANCEL_BUTTON', $lng->txt(
'cancel'));
1260 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'confirm'));
1263 return $form_tpl->get();
1266 private function initReplyEditForm()
1280 $frm = $oForumObjects[
'frm'];
1284 $oFDForum = $oForumObjects[
'file_obj'];
1286 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1288 $this->replyEditForm->setTableWidth(
'100%');
1291 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply')
1293 $this->ctrl->setParameter($this,
'action',
'ready_showreply');
1297 $this->ctrl->setParameter($this,
'action',
'ready_showedit');
1301 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1302 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1303 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
1304 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
1305 $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this,
'savePost', $this->objCurrentPost->getId()));
1306 $this->ctrl->clearParameters($this);
1308 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1310 $this->replyEditForm->setTitle($this->lng->txt(
'forums_your_reply'));
1314 $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_post'));
1318 if($this->objProperties->isAnonymized() &&
1319 in_array($_GET[
'action'], array(
'showreply',
'ready_showreply')))
1321 $oAnonymousNameGUI =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
1323 $oAnonymousNameGUI->setInfo($this->lng->txt(
'forums_use_alias'));
1325 $this->replyEditForm->addItem($oAnonymousNameGUI);
1329 $oSubjectGUI =
new ilTextInputGUI($this->lng->txt(
'forums_subject'),
'subject');
1331 $oSubjectGUI->setRequired(
true);
1333 if($this->objProperties->getSubjectSetting() ==
'empty_subject')
1334 $oSubjectGUI->setInfo($this->lng->txt(
'enter_new_subject'));
1336 $this->replyEditForm->addItem($oSubjectGUI);
1340 $_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply' ? $this->lng->txt(
'forums_your_reply') : $this->lng->txt(
'forums_edit_post'),
1344 $oPostGUI->setCols(50);
1345 $oPostGUI->setRows(15);
1346 $oPostGUI->setUseRte(
true);
1347 $oPostGUI->addPlugin(
'latex');
1348 $oPostGUI->addButton(
'latex');
1349 $oPostGUI->addButton(
'pastelatex');
1350 $oPostGUI->addPlugin(
'ilfrmquote');
1353 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1355 $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
1357 $oPostGUI->removePlugin(
'advlink');
1358 $oPostGUI->setRTERootBlockElement(
'');
1359 $oPostGUI->usePurifier(
true);
1360 $oPostGUI->disableButtons(array(
1377 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1379 $oPostGUI->setRTESupport($ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.4.7');
1383 $oPostGUI->setRTESupport($this->objCurrentPost->getId(),
'frm',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.4.7');
1386 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
1389 $this->replyEditForm->addItem($oPostGUI);
1392 include_once
'Services/Mail/classes/class.ilMail.php';
1393 $umail =
new ilMail($ilUser->getId());
1394 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
1395 !$frm->isThreadNotificationEnabled($ilUser->getId(), $this->objCurrentPost->getThreadId()) &&
1396 !$this->objProperties->isAnonymized())
1399 $oNotificationGUI->setInfo($this->lng->txt(
'forum_notify_me'));
1401 $this->replyEditForm->addItem($oNotificationGUI);
1405 $oFileUploadGUI =
new ilFileWizardInputGUI($this->lng->txt(
'forums_attachments_add'),
'userfile');
1407 $this->replyEditForm->addItem($oFileUploadGUI);
1409 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
1411 $ilUser->isAnonymous() &&
1412 !$ilUser->isCaptchaVerified() &&
1413 ilCaptchaUtil::isActiveForForum()
1416 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
1417 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
1419 $this->replyEditForm->addItem($captcha);
1422 $attachments_of_node = $oFDForum->getFilesOfPost();
1423 if(count($attachments_of_node) && ($_GET[
'action'] ==
'showedit' || $_GET[
'action'] ==
'ready_showedit'))
1427 foreach($oFDForum->getFilesOfPost() as
$file)
1430 $oAttachmentGUI->setValue(
$file[
'md5']);
1431 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
1433 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
1437 $this->replyEditForm->addCommandButton(
'savePost', $this->lng->txt(
'save'));
1438 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1440 include_once
'Services/RTE/classes/class.ilRTE.php';
1443 if(array_key_exists(
'show_rte',
$_POST))
1450 $this->replyEditForm->addCommandButton(
'quotePost', $this->lng->txt(
'forum_add_quote'));
1453 $this->replyEditForm->addCommandButton(
'cancelPost', $this->lng->txt(
'cancel'));
1458 if(null === $this->replyEditForm)
1460 $this->initReplyEditForm();
1466 public function savePostObject()
1475 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
1477 if($this->objCurrentTopic->isClosed())
1479 $_GET[
'action'] =
'';
1480 return $this->viewThreadObject();
1484 if($oReplyEditForm->checkInput())
1486 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
1488 $ilUser->isAnonymous() &&
1489 !$ilUser->isCaptchaVerified() &&
1490 ilCaptchaUtil::isActiveForForum()
1493 $ilUser->setCaptchaVerified(
true);
1501 $forumObj = $oForumObjects[
'forumObj'];
1505 $frm = $oForumObjects[
'frm'];
1506 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
1507 $topicData = $frm->getOneTopic();
1510 if(
$_GET[
'action'] ==
'ready_showreply')
1512 if(!$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
1514 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1519 $send_activation_mail = 0;
1521 if($this->objProperties->isPostActivationEnabled())
1523 if(!$this->is_moderator)
1526 $send_activation_mail = 1;
1528 else if($this->objCurrentPost->isAnyParentDeactivated())
1534 if($this->objProperties->isAnonymized())
1536 if(!strlen($oReplyEditForm->getInput(
'alias')))
1538 $user_alias = $this->lng->txt(
'forums_anonymous');
1542 $user_alias = $oReplyEditForm->getInput(
'alias');
1547 $user_alias = $ilUser->getLogin();
1550 $newPost = $frm->generatePost(
1551 $topicData[
'top_pk'],
1552 $this->objCurrentTopic->getId(),
1554 ($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()),
1556 $this->objCurrentPost->getId(),
1557 (int)$oReplyEditForm->getInput(
'notify'),
1562 $send_activation_mail
1566 $this->
object->markPostRead($ilUser->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
1569 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
1572 foreach($mediaObjects as $mob)
1574 foreach($myMediaObjects as $myMob)
1587 $file = $_FILES[
'userfile'];
1588 if(is_array($file) && !empty($file))
1590 $oFDForum->storeUploadedFile($file);
1594 if ($this->
ilias->getSetting(
"forum_notification") == 1 && (int)$status )
1596 $objPost =
new ilForumPost((
int)$newPost, $this->is_moderator);
1598 $post_data = array();
1599 $post_data = $objPost->getDataAsArray();
1601 $post_data[
"top_name"] = $titles[0];
1602 $post_data[
"ref_id"] = $this->
object->getRefId();
1604 $frm->__sendMessage($objPost->getParentId(), $post_data);
1606 $frm->sendForumNotifications($post_data);
1607 $frm->sendThreadNotifications($post_data);
1611 if(!$this->is_moderator && !$status)
1613 $message .= $lng->txt(
'forums_post_needs_to_be_activated');
1617 $message .= $lng->txt(
'forums_post_new_entry');
1620 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$this->objCurrentPost->getId();
1623 $this->ctrl->setParameter($this,
'pos_pk', $newPost);
1624 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1625 $this->ctrl->redirect($this,
'viewThread');
1629 if((!$this->is_moderator &&
1630 !$this->objCurrentPost->isOwner($ilUser->getId())) || $this->objCurrentPost->isCensored() ||
1631 $ilUser->getId() == ANONYMOUS_USER_ID)
1633 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1637 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
1640 foreach($oldMediaObjects as $oldMob)
1643 foreach($curMediaObjects as $curMob)
1645 if($oldMob == $curMob)
1664 $send_activation_mail = 0;
1666 if($this->objProperties->isPostActivationEnabled())
1668 if(!$this->is_moderator)
1671 $send_activation_mail = 1;
1673 else if($this->objCurrentPost->isAnyParentDeactivated())
1678 $this->objCurrentPost->setStatus($status);
1680 $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
1682 $this->objCurrentPost->setNotification((
int)$oReplyEditForm->getInput(
'notify'));
1683 $this->objCurrentPost->setChangeDate(date(
'Y-m-d H:i:s'));
1684 $this->objCurrentPost->setUpdateUserId($ilUser->getId());
1687 if($this->objCurrentPost->update())
1689 $this->objCurrentPost->reload();
1692 include_once
'Services/News/classes/class.ilNewsItem.php';
1695 'frm', $this->objCurrentPost->getId(),
'pos');
1699 $news_item->setTitle($this->objCurrentPost->getSubject());
1701 $this->objCurrentPost->getMessage(), 0), 1)
1703 $news_item->update();
1707 $oFDForum = $oForumObjects[
'file_obj'];
1709 $file = $_FILES[
'userfile'];
1712 $oFDForum->storeUploadedFile(
$file);
1715 $file2delete = $oReplyEditForm->getInput(
'del_file');
1716 if(is_array($file2delete) && count($file2delete))
1718 $oFDForum->unlinkFilesByMD5Filenames($file2delete);
1722 if (!$status && $send_activation_mail)
1724 $pos_data = $this->objCurrentPost->getDataAsArray();
1725 $pos_data[
"top_name"] = $this->
object->getTitle();
1726 $frm->sendPostActivationNotification($pos_data);
1730 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1731 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1732 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
1733 $this->ctrl->redirect($this,
'viewThread');
1738 $_GET[
'action'] = substr(
$_GET[
'action'], 6);
1740 return $this->viewThreadObject();
1745 if(null === $a_flag)
1756 if(!is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
1758 if($this->objCurrentTopic->isClosed())
1760 $_GET[
'action'] =
'';
1761 return $this->viewThreadObject();
1767 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
1768 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
1770 $oReplyEditForm->checkInput();
1773 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
1774 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
1776 $_GET[
'action'] =
'showreply';
1778 $this->viewThreadObject();
1781 public function getQuotationHTMLAsynchObject()
1787 $frm = $oForumObjects[
'frm'];
1789 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
1791 $this->objCurrentPost->getPosAuthorId(),
1792 $this->objCurrentPost->getDisplayUserId(),
1793 $this->objCurrentPost->getUserAlias(),
1794 $this->objCurrentPost->getImportName()
1804 if(null === $this->forumObjects)
1807 $file_obj =
new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
1808 $frm = $forumObj->Forum;
1809 $frm->setForumId($forumObj->getId());
1810 $frm->setForumRefId($forumObj->getRefId());
1812 $this->forumObjects[
'forumObj'] = $forumObj;
1813 $this->forumObjects[
'frm'] = $frm;
1814 $this->forumObjects[
'file_obj'] = $file_obj;
1822 include_once
'Modules/Forum/classes/class.ilForumExplorer.php';
1826 $this->objCurrentTopic,
1827 $this->objProperties
1830 return $explorer->render()->getHtml();
1835 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
1836 include_once
'Modules/Forum/classes/class.ilForumExplorer.php';
1838 $response =
new stdClass();
1839 $response->success =
false;
1841 if(
$_GET[
'nodeId'] )
1843 $response->success =
true;
1844 $response->children = array();
1846 $key = array_search((
int)
$_GET[
'nodeId'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
1847 if(
false === $key )
1849 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$_GET[
'nodeId'];
1852 $children = $this->objCurrentTopic->getNestedSetPostChildren(
1853 (
int)$_GET[
'nodeId'],
1854 (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']
1858 $pageHits = $frm->getPageHits();
1860 $fetchedNodes = array();
1862 foreach( $children as $child )
1864 if($child[
'parent_pos'] != (
int)$_GET[
'nodeId'] &&
1865 !in_array($child[
'parent_pos'], $fetchedNodes))
1870 $fetchedNodes[] = $child[
'pos_pk'];
1872 $this->ctrl->setParameter($this,
'thr_pk', (
int)$_GET[
'thr_pk']);
1880 $responseChild =
new stdClass();
1881 $responseChild->nodeId = $child[
'pos_pk'];
1882 $responseChild->parentId = $child[
'parent_pos'];
1883 $responseChild->hasChildren = ($child[
'children'] >= 1);
1884 $responseChild->fetchedWithChildren = in_array((
int)$child[
'pos_pk'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
1885 $responseChild->html = $html;
1887 $response->children[] = $responseChild;
1897 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
1899 $response =
new stdClass();
1900 $response->success =
true;
1902 if(
$_GET[
'nodeId'] )
1904 if(
$_GET[
'nodeId'] > 0 )
1906 $key = array_search((
int)
$_GET[
'nodeId'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
1907 if(
false === $key )
1909 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$_GET[
'nodeId'];
1914 $key = array_search((
int)abs(
$_GET[
'nodeId']), (array)
$_SESSION[
'frm'][(
int)
$_GET[
'thr_pk']][
'openTreeNodes']);
1915 if(
false !== $key )
1917 unset(
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes'][$key]);
1923 shuffle(
$_SESSION[
'frm'][(
int)
$_GET[
'thr_pk']][
'openTreeNodes']);
1927 public function viewThreadObject()
1939 global
$tpl,
$lng,
$ilUser, $ilAccess, $rbacreview, $ilNavigationHistory,
$ilCtrl, $frm, $ilToolbar, $ilLocator;
1941 $tpl->addCss(
'./Modules/Forum/css/forum_tree.css');
1944 $_SESSION[
'viewmode'] = $this->objProperties->getDefaultView();
1948 if(!isset(
$_SESSION[
'thread_control'][
'old']))
1974 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
1976 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1984 $forumObj = $oForumObjects[
'forumObj'];
1988 $frm = $oForumObjects[
'frm'];
1992 $file_obj = $oForumObjects[
'file_obj'];
1997 if(!
$path = $file_obj->getFileDataByMD5Filename(
$_GET[
'file']))
2007 if(!$this->objCurrentTopic->getId())
2009 $ilCtrl->redirect($this,
'showThreads');
2013 $append =
'_'.$this->objCurrentTopic->getId().
2014 ($this->objCurrentPost->getId() ?
'_'.$this->objCurrentPost->getId() :
'');
2015 $tpl->setLoginTargetPar(
'frm_'.
$_GET[
'ref_id'].$append);
2018 if(
$_GET[
'action'] !=
'showreply' &&
$_GET[
'action'] !=
'showedit')
2022 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
2024 foreach(
$mobs as $mob)
2039 require_once
'./Modules/Forum/classes/class.ilObjForum.php';
2040 require_once
'./Modules/Forum/classes/class.ilFileDataForum.php';
2042 $lng->loadLanguageModule(
'forum');
2046 $ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
2048 $ilCtrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2049 $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this,
'showThreads'),
'frm');
2053 $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId());
2055 $this->prepareThreadScreen($forumObj);
2057 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_view.html',
'Modules/Forum');
2059 if(isset(
$_GET[
'anchor']))
2061 $tpl->setVariable(
'JUMP2ANCHOR_ID', (
int)
$_GET[
'anchor']);
2067 $orderField =
'frm_posts_tree.fpt_date';
2068 $this->objCurrentTopic->setOrderDirection(
2075 $orderField =
'frm_posts_tree.rgt';
2076 $this->objCurrentTopic->setOrderDirection(
'DESC');
2080 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2082 if(is_array($topicData = $frm->getOneTopic()))
2085 $this->objCurrentTopic->updateVisits();
2087 $tpl->setTitle($lng->txt(
'forums_thread').
" \"".$this->objCurrentTopic->getSubject().
"\"");
2091 $ilLocator->addRepositoryItems();
2092 $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this,
""),
"_top");
2098 $menutpl =
new ilTemplate(
'tpl.forums_threads_menu.html',
true,
true,
'Modules/Forum');
2100 include_once(
"./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
2103 if($ilUser->getId() != ANONYMOUS_USER_ID &&
2104 $forumObj->getCountUnread($ilUser->getId(), (int) $this->objCurrentTopic->getId()))
2106 $this->ctrl->setParameter($this,
'mark_read',
'1');
2107 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2108 $ilToolbar->addButton(
2109 $this->lng->txt(
'forums_mark_read'),
2110 $this->ctrl->getLinkTarget($this,
'viewThread'),
2114 $this->ctrl->clearParameters($this);
2118 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_thread', $this->objCurrentTopic->getId());
2119 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_top_fk', $this->objCurrentTopic->getForumId());
2120 $ilToolbar->addButton($this->lng->txt(
'forums_print_thread'),
2121 $this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printThread')
2123 $this->ctrl->clearParametersByClass(
'ilforumexportgui');
2127 if(
$_GET[
'mark_read'])
2129 $forumObj->markThreadRead($ilUser->getId(), (int)$this->objCurrentTopic->getId());
2134 require_once
'./Modules/Forum/classes/class.ilForum.php';
2136 if (
$_GET[
'action'] ==
'ready_delete' &&
$_POST[
'confirm'] !=
'')
2138 if(!$this->objCurrentTopic->isClosed() &&
2139 ($this->is_moderator ||
2140 ($this->objCurrentPost->isOwner($ilUser->getId()) && !$this->objCurrentPost->hasReplies())) &&
2141 $ilUser->getId() != ANONYMOUS_USER_ID)
2145 $frm->setForumId($forumObj->getId());
2146 $frm->setForumRefId($forumObj->getRefId());
2148 $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
2151 if ($dead_thr == $this->objCurrentTopic->getId())
2154 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($forumObj->getId()));
2156 $topicData = $frm->getOneTopic();
2160 if ($topicData[
'top_num_threads'] > 0)
2162 $this->ctrl->redirect($this,
'showThreads');
2166 $this->ctrl->redirect($this,
'createThread');
2174 if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'ready_censor')
2176 if((
$_POST[
'confirm'] !=
'' ||
$_POST[
'no_cs_change'] !=
'') &&
$_GET[
'action'] ==
'ready_censor')
2178 $frm->postCensorship($this->
handleFormInput(
$_POST[
'formData'][
'cens_message']), $this->objCurrentPost->getId(), 1);
2181 else if((
$_POST[
'cancel'] !=
'' ||
$_POST[
'yes_cs_change'] !=
'') &&
$_GET[
'action'] ==
'ready_censor')
2183 $frm->postCensorship($this->
handleFormInput(
$_POST[
'formData'][
'cens_message']), $this->objCurrentPost->getId());
2189 $first_node = $this->objCurrentTopic->getFirstPostNode();
2190 $this->objCurrentTopic->setOrderField($orderField);
2191 $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
2194 if (!$posNum = count($subtree_nodes))
2199 $pageHits = $frm->getPageHits();
2204 if ($posNum > $pageHits)
2207 'ref_id' =>
$_GET[
'ref_id'],
2208 'thr_pk' => $this->objCurrentTopic->getId(),
2209 'orderby' =>
$_GET[
'orderby']
2212 if (!
$_GET[
'offset'])
2218 $Start =
$_GET[
'offset'];
2221 $linkbar =
ilUtil::Linkbar($ilCtrl->getLinkTarget($this,
'viewThread'), $posNum, $pageHits, $Start, $params);
2225 $menutpl->setCurrentBlock(
'linkbar');
2226 $menutpl->setVariable(
'LINKBAR', $linkbar);
2227 $menutpl->parseCurrentBlock();
2231 $tpl->setVariable(
'THREAD_MENU', $menutpl->get());
2237 foreach($subtree_nodes as $node)
2243 $this->ctrl->clearParameters($this);
2245 if($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId())
2250 if ($posNum > $pageHits && $z >= ($Start + $pageHits))
2253 if ($this->objCurrentPost->getId() && $jump < 1)
2255 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2256 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2257 $this->ctrl->setParameter($this,
'offset', ($Start + $pageHits));
2258 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
2259 $this->ctrl->redirect($this,
'viewThread', $this->objCurrentPost->getId());
2268 if(($posNum > $pageHits && $z >= $Start) || $posNum <= $pageHits)
2270 if($this->objCurrentPost->getId() == $node->getId())
2272 # actions for "active" post 2273 if($this->is_moderator || $node->isActivated())
2276 if(!$this->objCurrentTopic->isClosed() && (
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'showedit'))
2278 if(
$_GET[
'action'] ==
'showedit' &&
2279 ((!$this->is_moderator &&
2280 !$node->isOwner($ilUser->getId()) || $ilUser->getId() == ANONYMOUS_USER_ID) || $node->isCensored()))
2282 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2284 else if(
$_GET[
'action'] ==
'showreply' && !$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
2286 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2289 $tpl->setVariable(
'REPLY_ANKER', $this->objCurrentPost->getId());
2292 switch($this->objProperties->getSubjectSetting())
2294 case 'add_re_to_subject':
2298 case 'preset_subject':
2299 $subject = $this->objCurrentPost->getSubject();
2302 case 'empty_subject':
2308 switch($_GET[
'action'])
2311 if($this->ctrl->getCmd() ==
'savePost')
2313 $oEditReplyForm->setValuesByPost();
2315 else if($this->ctrl->getCmd() ==
'quotePost')
2317 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2319 $node->getPosAuthorId(),
2320 $node->getDisplayUserId(),
2321 $node->getUserAlias(),
2322 $node->getImportName()
2325 $oEditReplyForm->setValuesByPost();
2326 $oEditReplyForm->getItemByPostVar(
'message')->setValue(
2328 $frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()).
"\n".$oEditReplyForm->getInput(
'message'), 1
2334 $oEditReplyForm->setValuesByArray(array(
2336 'subject' => $subject,
2340 'del_file' => array()
2344 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2345 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2347 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum/');
2348 $jsTpl->setVariable(
'IL_FRM_QUOTE_CALLBACK_SRC',
2349 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true));
2350 $this->ctrl->clearParameters($this);
2351 $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
2354 if($this->ctrl->getCmd() ==
'savePost')
2356 $oEditReplyForm->setValuesByPost();
2360 $oEditReplyForm->setValuesByArray(array(
2362 'subject' => $this->objCurrentPost->getSubject(),
2364 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true :
false,
2366 'del_file' => array()
2371 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2372 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2373 $this->ctrl->setParameter($this,
'offset', (
int)$_GET[
'offset']);
2374 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2375 $this->ctrl->setParameter($this,
'action', $_GET[
'action']);
2376 $tpl->setVariable(
'FORM', $oEditReplyForm->getHTML());
2377 $this->ctrl->clearParameters($this);
2380 else if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'delete')
2382 if($this->is_moderator ||
2383 ($node->isOwner($ilUser->getId()) && !$node->hasReplies()) &&
2384 $ilUser->getId() != ANONYMOUS_USER_ID)
2387 $tpl->setVariable(
'FORM', $this->getDeleteFormHTML());
2390 else if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'censor')
2392 if($this->is_moderator)
2395 $tpl->setVariable(
'FORM', $this->getCensorshipFormHTML());
2400 if ($this->is_moderator)
2403 $tpl->setVariable(
'FORM', $this->getActivationFormHTML());
2409 if ($this->objCurrentPost->getId() != $node->getId() ||
2410 (
$_GET[
'action'] !=
'showreply' &&
2411 $_GET[
'action'] !=
'showedit' &&
2412 $_GET[
'action'] !=
'censor' &&
2413 $_GET[
'action'] !=
'delete' &&
2417 if($this->is_moderator || $node->isActivated())
2420 if(!$this->objCurrentTopic->isClosed() &&
2421 $ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']) &&
2422 !$node->isCensored()
2425 $tpl->setCurrentBlock(
'commands');
2426 $this->ctrl->setParameter($this,
'action',
'showreply');
2427 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2428 $this->ctrl->setParameter($this,
'offset', $Start);
2429 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2430 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2431 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2432 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'reply'));
2433 $this->ctrl->clearParameters($this);
2434 $tpl->parseCurrentBlock();
2438 if (!$this->objCurrentTopic->isClosed() &&
2439 ($node->isOwner($ilUser->getId()) || $this->is_moderator) &&
2440 !$node->isCensored() &&
2441 $ilUser->getId() != ANONYMOUS_USER_ID)
2443 $tpl->setCurrentBlock(
'commands');
2444 $this->ctrl->setParameter($this,
'action',
'showedit');
2445 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2446 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2447 $this->ctrl->setParameter($this,
'offset', $Start);
2448 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2449 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2450 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'edit'));
2451 $this->ctrl->clearParameters($this);
2452 $tpl->parseCurrentBlock();
2456 if (!$node->isCensored())
2458 $tpl->setCurrentBlock(
'commands');
2459 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_post', $node->getId());
2460 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'top_pk', $node->getForumId());
2461 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_pk', $node->getThreadId());
2462 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printPost'));
2463 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'print'));
2464 $this->ctrl->clearParameters($this);
2465 $tpl->parseCurrentBlock();
2468 # buttons for every post except the "active" 2469 if (!$this->objCurrentTopic->isClosed() &&
2470 ($this->is_moderator ||
2471 ($node->isOwner($ilUser->getId()) && !$node->hasReplies())) &&
2472 $ilUser->getId() != ANONYMOUS_USER_ID)
2475 $tpl->setCurrentBlock(
'commands');
2476 $this->ctrl->setParameter($this,
'action',
'delete');
2477 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2478 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2479 $this->ctrl->setParameter($this,
'offset', $Start);
2480 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2481 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2482 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'delete'));
2483 $this->ctrl->clearParameters($this);
2484 $tpl->parseCurrentBlock();
2490 $tpl->setCurrentBlock(
'commands');
2491 $this->ctrl->setParameter($this,
'action',
'censor');
2492 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2493 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2494 $this->ctrl->setParameter($this,
'offset', $Start);
2495 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2496 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2497 if($node->isCensored())
2499 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'frm_revoke_censorship'));
2503 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'frm_censorship'));
2505 $this->ctrl->clearParameters($this);
2506 $tpl->parseCurrentBlock();
2509 $tpl->setCurrentBlock(
'commands');
2510 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2511 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2512 $this->ctrl->setParameter($this,
'offset', $Start);
2513 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2515 if (!$node->isActivated())
2517 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'askForPostActivation', $node->getId()));
2518 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'activate_post'));
2520 $this->ctrl->clearParameters($this);
2521 $tpl->parseCurrentBlock();
2525 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2526 !$node->isPostRead())
2528 $tpl->setCurrentBlock(
'commands');
2529 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2530 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2531 $this->ctrl->setParameter($this,
'offset', $Start);
2532 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2533 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2534 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'markPostRead', $node->getId()));
2535 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'frm_mark_as_read'));
2536 $this->ctrl->clearParameters($this);
2537 $tpl->parseCurrentBlock();
2541 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2542 $node->isPostRead())
2544 $tpl->setCurrentBlock(
'commands');
2545 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2546 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2547 $this->ctrl->setParameter($this,
'offset', $Start);
2548 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2549 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2550 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'markPostUnread', $node->getId()));
2551 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'frm_mark_as_unread'));
2552 $this->ctrl->clearParameters($this);
2553 $tpl->parseCurrentBlock();
2559 $tmp_file_obj =
new ilFileDataForum($forumObj->getId(), $node->getId());
2560 $attachments_of_node = $tmp_file_obj->getFilesOfPost();
2561 if(count($attachments_of_node))
2563 if ($node->getId() != $this->objCurrentPost->getId() ||
$_GET[
'action'] !=
'showedit')
2565 foreach($attachments_of_node as
$file)
2567 $tpl->setCurrentBlock(
'attachment_download_row');
2568 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2569 $this->ctrl->setParameter($this,
'file', $file[
'md5']);
2570 $tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this,
'viewThread'));
2571 $tpl->setVariable(
'TXT_FILENAME', $file[
'name']);
2572 $this->ctrl->clearParameters($this);
2573 $tpl->parseCurrentBlock();
2575 $tpl->setCurrentBlock(
'attachments');
2576 $tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD',$lng->txt(
'forums_attachments'));
2577 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
2579 $tpl->parseCurrentBlock();
2583 $tpl->setCurrentBlock(
'posts_row');
2586 $tpl->setVariable(
'POST_ANKER', $node->getId());
2590 $tpl->setVariable(
'TXT_PERMA_LINK', $lng->txt(
'perma_link'));
2591 $tpl->setVariable(
'PERMA_TARGET',
'_top');
2593 if($this->objProperties->getMarkModeratorPosts() == 1)
2597 $rowCol =
'ilModeratorPosting';
2599 elseif($node->getIsAuthorModerator())
2601 $rowCol =
'ilModeratorPosting';
2606 if ((
$_GET[
'action'] !=
'delete' &&
$_GET[
'action'] !=
'censor' &&
2609 || $this->objCurrentPost->getId() != $node->getId())
2611 $tpl->setVariable(
'ROWCOL',
' '.$rowCol);
2616 $rowCol =
'tblrowmarked';
2620 if ($node->isCensored())
2623 if (
$_GET[
'action'] !=
'censor')
2625 $tpl->setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
2629 $rowCol =
'tblrowmarked';
2633 $tpl->setVariable(
'ROWCOL',
' '.$rowCol);
2635 if(!$node->isActivated() && $node->isOwner($ilUser->getId()))
2637 $tpl->setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
2641 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2642 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2643 $backurl = urlencode($this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2644 $this->ctrl->clearParameters($this);
2646 $this->ctrl->setParameter($this,
'backurl', $backurl);
2647 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2648 $this->ctrl->setParameter($this,
'user', $node->getDisplayUserId());
2650 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2652 $node->getPosAuthorId(),
2653 $node->getDisplayUserId(),
2654 $node->getUserAlias(),
2655 $node->getImportName(),
2657 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
2661 $this->ctrl->clearParameters($this);
2663 if($authorinfo->hasSuffix())
2665 $tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
2666 $tpl->setVariable(
'USR_NAME', $node->getUserAlias());
2670 $tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
2671 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized())
2673 $tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
2677 $tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
2680 if($authorinfo->getAuthor()->getGender() ==
'f')
2682 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
2684 else if($authorinfo->getAuthor()->getGender() ==
'm')
2686 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
2691 if ($node->getUpdateUserId() > 0)
2696 $posMod = $frm->getModeratorFromPost($node->getId());
2698 if (is_array($posMod) && $posMod[
'top_mods'] > 0)
2700 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
2702 if (is_array($MODS))
2704 if (in_array($node->getUpdateUserId(), $MODS))
2705 $spanClass =
'moderator_small';
2709 $node->setChangeDate($node->getChangeDate());
2711 if ($spanClass ==
'') $spanClass =
'small';
2713 $this->ctrl->setParameter($this,
'backurl', $backurl);
2714 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2715 $this->ctrl->setParameter($this,
'user', $node->getUpdateUserId());
2717 $this->ctrl->clearParameters($this);
2719 $tpl->setVariable(
'POST_UPDATE_TXT', $lng->txt(
'edited_on').
': '.$frm->convertDate($node->getChangeDate()).
' - '.strtolower($lng->txt(
'by')));
2720 $tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
2721 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix())
2723 $tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
2730 $node->setMessage($frm->prepareText($node->getMessage()));
2732 if($ilUser->getId() == ANONYMOUS_USER_ID ||
2733 $node->isPostRead())
2735 $tpl->setVariable(
'SUBJECT', $node->getSubject());
2739 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2740 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2741 $this->ctrl->setParameter($this,
'offset', $Start);
2742 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2743 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2744 $mark_post_target = $this->ctrl->getLinkTarget($this,
'markPostRead', $node->getId());
2746 $tpl->setVariable(
'SUBJECT',
"<a href=\"".$mark_post_target.
"\"><b>".$node->getSubject().
"</b></a>");
2750 $tpl->setVariable(
'POST_DATE', $frm->convertDate($node->getCreateDate()));
2752 if (!$node->isCensored() ||
2753 ($this->objCurrentPost->getId() == $node->getId() && $_GET[
'action'] ==
'censor'))
2756 $modAuthor = $frm->getModeratorFromPost($node->getId());
2760 if (is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
2764 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
2766 if (is_array($MODS))
2768 if (in_array($node->getDisplayUserId(), $MODS))
2769 $spanClass =
'moderator';
2774 if($node->getMessage() == strip_tags($node->getMessage()))
2777 $node->setMessage(nl2br($node->getMessage()));
2780 if ($spanClass !=
"")
2791 $tpl->setVariable(
'POST',
"<span class=\"moderator\">".nl2br($node->getCensorshipComment()).
"</span>");
2794 $tpl->parseCurrentBlock();
2802 $tpl->setCurrentBlock(
'posts_no');
2803 $tpl->setVariable(
'TXT_MSG_NO_POSTS_AVAILABLE', $lng->txt(
'forums_posts_not_available'));
2804 $tpl->parseCurrentBlock();
2807 $oThreadToolbar = clone $ilToolbar;
2808 $oThreadToolbar->addSeparator();
2809 $oThreadToolbar->addButton($this->lng->txt(
'top_of_page'),
'#frm_page_top');
2810 $tpl->setVariable(
'THREAD_TOOLBAR', $oThreadToolbar->getHTML());
2812 $tpl->setVariable(
'TPLPATH', $tpl->vars[
'TPLPATH']);
2815 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
2816 $permalink =
new ilPermanentLinkGUI(
'frm', $this->object->getRefId(),
'_'.$this->objCurrentTopic->getId());
2817 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
2831 $subject = $this->objCurrentPost->getSubject();
2832 $re_txt = $this->lng->txt(
'post_reply');
2834 $re_txt_with_num = str_replace(
':',
'(',$re_txt);
2835 $search_length = strlen($re_txt_with_num);
2836 $comp = substr_compare($re_txt_with_num, substr($subject, 0 , $search_length), 0, $search_length);
2840 $modified_subject = $subject;
2841 if($on_reply ==
true)
2844 $str_pos_start = strpos($subject,
'(');
2845 $str_pos_end = strpos($subject,
')');
2847 $length = ((int)$str_pos_end - (
int)$str_pos_start);
2849 $txt_number = substr($subject, $str_pos_start, $length - 1);
2851 if(is_numeric($txt_number))
2853 $re_count = (int)$txt_number + 1;
2854 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
2860 $re_count = substr_count($subject, $re_txt);
2861 if($re_count >= 1 && $on_reply ==
true)
2863 $subject = str_replace($re_txt,
'', $subject);
2867 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
2869 else if($re_count >= 1 && $on_reply ==
false)
2873 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
2875 else if($re_count == 0)
2878 $modified_subject = $this->lng->txt(
'post_reply').
' '. $this->objCurrentPost->getSubject();
2881 return $modified_subject;
2884 public function showUserObject()
2895 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
2897 $add = $this->getUserProfileAdditional(
$_GET[
'ref_id'],
$_GET[
'user']);
2898 $profile_gui->setAdditional($add);
2899 $profile_gui->setBackUrl(
$_GET[
'backurl']);
2900 $tpl->setContent($this->ctrl->getHTML($profile_gui));
2903 protected function getUserProfileAdditional($a_forum_ref_id, $a_user_id)
2909 global
$lng, $ilAccess;
2911 if(!$ilAccess->checkAccess(
'read',
'', $a_forum_ref_id))
2913 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2916 require_once
'Modules/Forum/classes/class.ilForum.php';
2918 $lng->loadLanguageModule(
'forum');
2924 if($ref_obj->getType() ==
'frm')
2927 $frm = $forumObj->Forum;
2928 $frm->setForumId($forumObj->getId());
2929 $frm->setForumRefId($forumObj->getRefId());
2937 if($ilAccess->checkAccess(
'moderate_frm',
'', $a_forum_ref_id))
2939 $numPosts = $frm->countUserArticles(addslashes($a_user_id));
2943 $numPosts = $frm->countActiveUserArticles(addslashes($a_user_id));
2946 return array($lng->txt(
'forums_posts') => $numPosts);
2949 public function performThreadsActionObject()
2958 if(isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids']))
2960 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] ==
'move')
2962 if($this->is_moderator)
2965 $this->moveThreadsObject();
2968 else if(
$_POST[
'selected_cmd'] ==
'enable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
2970 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
2973 $tmp_obj->enableNotification($ilUser->getId());
2977 $this->ctrl->redirect($this,
'showThreads');
2979 else if(
$_POST[
'selected_cmd'] ==
'disable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
2981 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
2984 $tmp_obj->disableNotification($ilUser->getId());
2988 $this->ctrl->redirect($this,
'showThreads');
2991 else if(
$_POST[
'selected_cmd'] ==
'close')
2993 if($this->is_moderator)
2995 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3003 $this->ctrl->redirect($this,
'showThreads');
3005 else if(
$_POST[
'selected_cmd'] ==
'reopen')
3007 if($this->is_moderator)
3009 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3018 $this->ctrl->redirect($this,
'showThreads');
3020 else if(
$_POST[
'selected_cmd'] ==
'makesticky')
3022 if($this->is_moderator)
3024 $message = $this->lng->txt(
'sel_threads_make_sticky');
3026 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3029 $makeSticky = $tmp_obj->makeSticky();
3033 $message = $this->lng->txt(
'sel_threads_already_sticky');
3039 if($message != null)
3043 $this->ctrl->redirect($this,
'showThreads');
3045 else if(
$_POST[
'selected_cmd'] ==
'unmakesticky')
3047 if($this->is_moderator)
3049 $message = $this->lng->txt(
'sel_threads_make_unsticky');
3050 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3053 $unmakeSticky = $tmp_obj->unmakeSticky();
3056 $message = $this->lng->txt(
'sel_threads_already_unsticky');
3063 if($message != null)
3067 $this->ctrl->redirect($this,
'showThreads');
3069 else if(
$_POST[
'selected_cmd'] ==
'editThread')
3071 if($this->is_moderator)
3073 $count = count(
$_POST[
'thread_ids']);
3077 $this->ctrl->redirect($this,
'showThreads');
3081 foreach(
$_POST[
'thread_ids'] as $thread_id)
3083 return $this->editThreadObject($thread_id, null);
3088 $this->ctrl->redirect($this,
'showThreads');
3090 else if(
$_POST[
'selected_cmd'] ==
'html')
3092 $this->ctrl->setCmd(
'exportHTML');
3093 $this->ctrl->setCmdClass(
'ilForumExportGUI');
3096 else if(
$_POST[
'selected_cmd'] ==
'confirmDeleteThreads')
3098 $this->confirmDeleteThreads();
3100 else if(
$_POST[
'selected_cmd'] ==
'merge')
3106 ilUtil::sendInfo($this->lng->txt(
'topics_please_select_one_action'),
true);
3107 $this->ctrl->redirect($this,
'showThreads');
3113 $this->ctrl->redirect($this,
'showThreads');
3117 public function performMoveThreadsObject()
3123 global
$lng, $ilObjDataCache;
3125 if(!$this->is_moderator)
3127 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3130 if(isset(
$_POST[
'frm_ref_id']) && (int)
$_POST[
'frm_ref_id'])
3132 $this->
object->Forum->moveThreads((array)
$_SESSION[
'threads2move'], $this->object->getRefId(), $ilObjDataCache->lookupObjId($_POST[
'frm_ref_id']));
3134 unset($_SESSION[
'threads2move']);
3136 $this->ctrl->redirect($this,
'showThreads');
3141 $this->moveThreadsObject();
3145 public function cancelMoveThreadsObject()
3152 if(!$this->is_moderator)
3154 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3159 $this->ctrl->redirect($this,
'showThreads');
3162 public function moveThreadsObject()
3171 if(!$this->is_moderator)
3173 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3176 $threads2move =
$_SESSION[
'threads2move'];
3177 if(!count($threads2move))
3180 $this->ctrl->redirect($this,
'showThreads');
3183 require_once
'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php';
3185 $exp->setPathOpen($this->object->getRefId());
3186 $exp->setNodeSelected(isset(
$_POST[
'frm_ref_id']) && (
int)
$_POST[
'frm_ref_id'] ? (
int)
$_POST[
'frm_ref_id'] : 0);
3187 $exp->setCurrentFrmRefId($this->object->getRefId());
3188 $exp->setHighlightedNode($this->object->getRefId());
3189 if(!$exp->handleCommand())
3191 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_move.html',
'Modules/Forum');
3194 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this));
3197 $tblThr->setId(
'il_frm_thread_move_table_'.$this->object->getRefId());
3198 $tblThr->setTitle($this->lng->txt(
'move_chosen_topics'));
3199 $tblThr->addColumn($this->lng->txt(
'subject'),
'top_name',
'100%');
3200 $tblThr->disable(
'header');
3201 $tblThr->disable(
'footer');
3202 $tblThr->disable(
'linkbar');
3203 $tblThr->disable(
'sort');
3204 $tblThr->disable(
'linkbar');
3205 $tblThr->setLimit(PHP_INT_MAX);
3206 $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html',
'Modules/Forum');
3207 $tblThr->setDefaultOrderField(
'is_sticky');
3210 foreach($threads2move as $thr_pk)
3214 $result[$counter][
'num'] = $counter + 1;
3221 $this->tpl->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
3223 $this->tpl->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
3224 $this->tpl->setVariable(
'CMD_SUBMIT',
'performMoveThreads');
3225 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'move'));
3226 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this,
'performMoveThreads'));
3232 private function initTopicCreateForm()
3244 $this->create_topic_form_gui->setTitle($this->lng->txt(
'forums_new_thread'));
3246 $this->create_topic_form_gui->setTableWidth(
'100%');
3249 $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this,
'addThread'));
3251 if($this->objProperties->isAnonymized() == 1)
3253 $alias_gui =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
3254 $alias_gui->
setInfo($this->lng->txt(
'forums_use_alias'));
3255 $alias_gui->setMaxLength(255);
3256 $alias_gui->setSize(50);
3257 $this->create_topic_form_gui->addItem($alias_gui);
3262 $alias_gui->
setValue($ilUser->getLogin());
3263 $this->create_topic_form_gui->addItem($alias_gui);
3267 $subject_gui =
new ilTextInputGUI($this->lng->txt(
'forums_thread'),
'subject');
3269 $subject_gui->setSize(50);
3270 $subject_gui->setRequired(
true);
3271 $this->create_topic_form_gui->addItem($subject_gui);
3276 $post_gui->setRows(15);
3277 $post_gui->setRequired(
true);
3278 $post_gui->setUseRte(
true);
3279 $post_gui->addPlugin(
'latex');
3280 $post_gui->addButton(
'latex');
3281 $post_gui->addButton(
'pastelatex');
3282 $post_gui->addPlugin(
'ilfrmquote');
3284 $post_gui->removePlugin(
'advlink');
3285 $post_gui->usePurifier(
true);
3286 $post_gui->setRTERootBlockElement(
'');
3287 $post_gui->setRTESupport($ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.4.7');
3288 $post_gui->disableButtons(array(
3306 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
3308 $this->create_topic_form_gui->addItem($post_gui);
3313 $this->create_topic_form_gui->addItem($fi);
3315 include_once
'Services/Mail/classes/class.ilMail.php';
3316 $umail =
new ilMail($ilUser->getId());
3318 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
3319 !$this->objProperties->isAnonymized())
3322 $dir_notification_gui =
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'),
'notify');
3323 $dir_notification_gui->
setInfo($this->lng->txt(
'forum_notify_me_directly'));
3324 $dir_notification_gui->setValue(1);
3325 $this->create_topic_form_gui->addItem($dir_notification_gui);
3327 if($ilias->getSetting(
'forum_notification') != 0)
3330 $gen_notification_gui =
new ilCheckboxInputGUI($this->lng->txt(
'forum_general_notification'),
'notify_posts');
3331 $gen_notification_gui->
setInfo($this->lng->txt(
'forum_notify_me_generally'));
3332 $gen_notification_gui->setValue(1);
3333 $this->create_topic_form_gui->addItem($gen_notification_gui);
3337 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
3339 $ilUser->isAnonymous() &&
3340 !$ilUser->isCaptchaVerified() &&
3341 ilCaptchaUtil::isActiveForForum()
3344 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
3345 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
3347 $this->create_topic_form_gui->addItem($captcha);
3349 $this->create_topic_form_gui->addCommandButton(
'addThread', $this->lng->txt(
'create'));
3350 $this->create_topic_form_gui->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
3355 $this->create_topic_form_gui->setValuesByArray(array(
3364 public function createThreadObject()
3370 global $ilAccess,
$lng;
3372 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
3374 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3377 $this->initTopicCreateForm();
3380 $create_form =
new ilTemplate(
'tpl.create_thread_form.html',
true,
true,
'Modules/Forum');
3381 $create_form->setVariable(
'CREATE_FORM',$this->create_topic_form_gui->getHTML());
3382 $create_form->parseCurrentBlock();
3384 $this->tpl->setContent($create_form->get());
3387 public function addThreadObject($a_prevent_redirect =
false)
3396 $frm = $this->
object->Forum;
3397 $frm->setForumId($this->object->getId());
3398 $frm->setForumRefId($this->object->getRefId());
3400 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
3402 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3405 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
3407 $topicData = $frm->getOneTopic();
3409 $this->initTopicCreateForm();
3410 if($this->create_topic_form_gui->checkInput())
3412 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
3414 $ilUser->isAnonymous() &&
3415 !$ilUser->isCaptchaVerified() &&
3416 ilCaptchaUtil::isActiveForForum()
3419 $ilUser->setCaptchaVerified(
true);
3422 if($this->objProperties->isAnonymized())
3424 if(!strlen($this->create_topic_form_gui->getInput(
'alias')))
3426 $user_alias = $this->lng->txt(
'forums_anonymous');
3430 $user_alias = $this->create_topic_form_gui->getInput(
'alias');
3435 $user_alias = $ilUser->getLogin();
3440 $this->objProperties->isPostActivationEnabled() &&
3441 !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
3448 $newPost = $frm->generateThread(
3449 $topicData[
'top_pk'],
3451 ($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()),
3452 $this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'),
false),
3454 $this->create_topic_form_gui->getItemByPostVar(
'notify') ? (int)$this->create_topic_form_gui->getInput(
'notify') : 0,
3455 $this->create_topic_form_gui->getItemByPostVar(
'notify_posts') ? (int)$this->create_topic_form_gui->getInput(
'notify_posts') : 0,
3461 $file = $_FILES[
'userfile'];
3466 $tmp_file_obj =
new ilFileDataForum($this->object->getId(), $newPost);
3471 $frm->setDbTable(
'frm_data');
3472 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
3473 $frm->updateVisits($topicData[
'top_pk']);
3475 $frm->setMDB2WhereCondition(
'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
3476 array(
'integer',
'text'), array($topicData[
'top_pk'], $this->create_topic_form_gui->getInput(
'subject')));
3479 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
3481 foreach($mediaObjects as $mob)
3490 if($this->
ilias->getSetting(
'forum_notification') == 1)
3493 $objPost =
new ilForumPost((
int)$newPost, $this->is_moderator);
3494 $post_data = array();
3495 $post_data = $objPost->getDataAsArray();
3497 $post_data[
"top_name"] = $titles[0];
3498 $post_data[
"ref_id"] =$this->
object->getRefId();
3500 $frm->sendForumNotifications($post_data);
3502 if(!$a_prevent_redirect)
3505 $this->ctrl->redirect($this);
3514 $this->create_topic_form_gui->setValuesByPost();
3516 if(!$this->objProperties->isAnonymized())
3518 $this->create_topic_form_gui->getItemByPostVar(
'alias')->setValue($ilUser->getLogin());
3521 return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
3525 public function enableForumNotificationObject()
3532 $frm = $this->
object->Forum;
3533 $frm->setForumId($this->object->getId());
3534 $frm->enableForumNotification($ilUser->getId());
3536 if(!$this->objCurrentTopic->getId())
3543 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3544 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_enabled'),
true);
3545 $this->ctrl->redirect($this,
'viewThread');
3549 public function disableForumNotificationObject()
3556 $frm = $this->
object->Forum;
3557 $frm->setForumId($this->object->getId());
3558 $frm->disableForumNotification($ilUser->getId());
3560 if(!$this->objCurrentTopic->getId())
3567 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3568 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_disabled'),
true);
3569 $this->ctrl->redirect($this,
'viewThread');
3584 global
$lng, $ilAccess;
3586 $column_gui->
setBlockProperty(
'news',
'title', $lng->txt(
'frm_latest_postings'));
3590 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
3593 $enable_internal_rss = $news_set->get(
'enable_rss_for_internal');
3594 if($enable_internal_rss)
3597 $column_gui->
setBlockProperty(
'news',
'public_notifications_option',
true);
3605 global $ilObjDataCache;
3607 if (!
$_POST[
'clone_source'])
3610 if (isset(
$_SESSION[
'wizard_search_title']))
3612 $this->searchCloneSourceObject();
3620 $source_id =
$_POST[
'clone_source'];
3623 $this->ctrl->setParameter($this,
'clone_source', (
int)
$_POST[
'clone_source']);
3624 $this->ctrl->setParameter($this,
'new_type', $new_type);
3626 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.frm_wizard_page.html',
'Modules/Forum');
3627 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this));
3629 $this->tpl->setVariable(
'ALT_IMG', $this->lng->txt(
'obj_'.$new_type));
3630 $this->tpl->setVariable(
'TXT_DUPLICATE', $this->lng->txt(
'frm_wizard_page'));
3631 $this->tpl->setVariable(
'INFO_THREADS', $this->lng->txt(
'fmr_copy_threads_info'));
3632 $this->tpl->setVariable(
'THREADS', $this->lng->txt(
'forums_threads'));
3634 $forum_id = $ilObjDataCache->lookupObjId((
int) $_POST[
'clone_source']);
3635 include_once(
'Modules/Forum/classes/class.ilForum.php');
3637 foreach ($threads as $thread_id => $title)
3639 $this->tpl->setCurrentBlock(
'thread_row');
3640 $this->tpl->setVariable(
'CHECK_THREAD',
ilUtil::formCheckbox(0,
'cp_options['.$source_id.
'][threads][]', $thread_id));
3641 $this->tpl->setVariable(
'NAME_THREAD', $title);
3642 $this->tpl->parseCurrentBlock();
3644 $this->tpl->setVariable(
'SELECT_ALL', $this->lng->txt(
'select_all'));
3645 $this->tpl->setVariable(
'JS_FIELD',
'cp_options['.$source_id.
'][threads]');
3646 $this->tpl->setVariable(
'BTN_COPY', $this->lng->txt(
'obj_'.$new_type.
'_duplicate'));
3647 if (isset(
$_SESSION[
'wizard_search_title']))
3649 $this->tpl->setVariable(
'BACK_CMD',
'searchCloneSource');
3653 $this->tpl->setVariable(
'BACK_CMD',
'create');
3655 $this->tpl->setVariable(
'BTN_BACK', $this->lng->txt(
'btn_back'));
3664 if($this->
object instanceof
ilObject)
3666 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
''),
'', $this->
object->getRefId());
3672 $a_text = str_replace(
"<",
"<", $a_text);
3673 $a_text = str_replace(
">",
">", $a_text);
3682 $a_text = str_replace(
"<",
"<", $a_text);
3683 $a_text = str_replace(
">",
">", $a_text);
3695 $this->ctrl->setCmd(
'showSummary');
3696 $this->ctrl->setCmdClass(
'ilinfoscreengui');
3697 $this->infoScreen();
3700 public function infoScreen()
3707 if(!$ilAccess->checkAccess(
'visible',
'', $this->object->getRefId()))
3709 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->
ilias->error_obj->MESSAGE);
3712 include_once
'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
3715 $info->enablePrivateNotes();
3718 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
3721 $this->ctrl->forwardCommand($info);
3724 public function updateNotificationSettingsObject()
3730 global $ilAccess,
$ilErr;
3731 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
3733 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
3740 if($this->notificationSettingsForm->checkInput())
3742 if(isset(
$_POST[
'notification_type']) &&
$_POST[
'notification_type']==
'all_users')
3745 $this->objProperties->setAdminForceNoti(1);
3746 $this->objProperties->setUserToggleNoti((
int) $this->notificationSettingsForm->getInput(
'usr_toggle'));
3747 $this->objProperties->setNotificationType(
'all_users');
3750 else if(
$_POST[
'notification_type']==
'per_user')
3752 $this->objProperties->setNotificationType(
'per_user');
3753 $this->objProperties->setAdminForceNoti(1);
3754 $this->objProperties->setUserToggleNoti(0);
3759 $this->objProperties->setNotificationType(
'default');
3760 $this->objProperties->setAdminForceNoti(0);
3761 $this->objProperties->setUserToggleNoti(0);
3762 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3767 $this->objProperties->update();
3772 $this->notificationSettingsForm->setValuesByPost();
3774 return $this->showMembersObject();
3779 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3781 $oParticipants = $this->getParticipantsObject();
3784 $moderator_ids = $frm_noti->
_getModerators($this->object->getRefId());
3786 $admin_ids = $oParticipants->getAdmins();
3787 $member_ids = $oParticipants->getMembers();
3788 $tutor_ids = $oParticipants->getTutors();
3790 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
3791 $all_forum_users= array_unique($all_forum_users);
3793 $all_notis = $frm_noti->read();
3795 foreach($all_forum_users as $user_id)
3797 $frm_noti->setUserId($user_id);
3799 $frm_noti->setAdminForce(1);
3800 $frm_noti->setUserToggle($this->objProperties->isUserToggleNoti());
3802 if(array_key_exists($user_id, $all_notis) && $update_all_users)
3804 $frm_noti->update();
3806 else if($frm_noti->existsNotification() ==
false)
3808 $frm_noti->insertAdminForce();
3815 if(null === $this->notificationSettingsForm)
3818 $form->setFormAction($this->ctrl->getFormAction($this,
'updateNotificationSettings'));
3819 $form->setTitle($this->lng->txt(
'forums_notification_settings'));
3822 $radio_grp->setValue(
'default');
3824 $opt_default =
new ilRadioOption($this->lng->txt(
"user_decides_notification"),
'default');
3825 $opt_0 =
new ilRadioOption($this->lng->txt(
"settings_for_all_members"),
'all_users');
3826 $opt_1 =
new ilRadioOption($this->lng->txt(
"settings_per_users"),
'per_user');
3828 $radio_grp->addOption($opt_default,
'default');
3829 $radio_grp->addOption($opt_0,
'all_users');
3830 $radio_grp->addOption($opt_1,
'per_user');
3836 $form->addItem($radio_grp);
3838 $form->addCommandButton(
'updateNotificationSettings', $this->lng->txt(
'save'));
3840 $this->notificationSettingsForm = $form;
3850 $icon = $user_toggle_noti
3851 ?
"<img src=\"".ilUtil::getImagePath(
"icon_ok.svg").
"\" alt=\"".$this->lng->txt(
"enabled").
"\" title=\"".$this->lng->txt(
"enabled").
"\" border=\"0\" vspace=\"0\"/>" 3852 :
"<img src=\"".ilUtil::getImagePath(
"icon_not_ok.svg").
"\" alt=\"".$this->lng->txt(
"disabled").
"\" title=\"".$this->lng->txt(
"disabled").
"\" border=\"0\" vspace=\"0\"/>";
3856 public function showMembersObject()
3867 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
3869 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
3872 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_members_list.html',
'Modules/Forum');
3874 $ilTabs->setTabActive(
'settings');
3875 $this->settingsTabs();
3881 $this->notificationSettingsForm->setValuesByArray(array(
3882 'notification_type' => $this->objProperties->getNotificationType(),
3883 'adm_force' => (bool) $this->objProperties->isAdminForceNoti(),
3884 'usr_toggle' => (bool) $this->objProperties->isUserToggleNoti()
3889 $tpl->setVariable(
'NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
3891 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3892 include_once
'Modules/Forum/classes/class.ilObjForum.php';
3895 $oParticipants = $this->getParticipantsObject();
3897 $moderator_ids = $frm_noti->_getModerators($this->object->getRefId());
3899 $admin_ids = $oParticipants->getAdmins();
3900 $member_ids = $oParticipants->getMembers();
3901 $tutor_ids = $oParticipants->getTutors();
3903 if($this->objProperties->getNotificationType() ==
'default')
3906 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3908 $forum_noti->
setAdminForce($this->objProperties->isAdminForceNoti());
3909 $forum_noti->setUserToggle($this->objProperties->isUserToggleNoti());
3910 $forum_noti->setForumId($this->objProperties->getObjId());
3912 else if($this->objProperties->getNotificationType() ==
'per_user')
3919 $this->__showMembersTable($moderators, $admins, $members, $tutors);
3927 foreach($user_ids as $user_id)
3931 $icon_ok = $this->
getIcon(!$user_toggle_noti);
3936 $users[$counter][
'firstname'] = $name[
'firstname'];
3937 $users[$counter][
'lastname'] = $name[
'lastname'];
3938 $users[$counter][
'user_toggle_noti'] = $icon_ok;
3944 private function __showMembersTable($moderators, $admins, $members, $tutors)
3956 $tbl_mod->setId(
'tbl_id_mod');
3957 $tbl_mod->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
3958 $tbl_mod->setTitle($lng->txt(
'moderators'));
3960 $tbl_mod->addColumn(
'',
'',
'1%',
true);
3961 $tbl_mod->addColumn($lng->txt(
'login'),
'',
'10%');
3962 $tbl_mod->addColumn($lng->txt(
'firstname'),
'',
'10%');
3963 $tbl_mod->addColumn($lng->txt(
'lastname'),
'',
'10%');
3964 $tbl_mod->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
3965 $tbl_mod->setSelectAllCheckbox(
'user_id');
3967 $tbl_mod->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
3968 $tbl_mod->setData($moderators);
3970 $tbl_mod->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
3971 $tbl_mod->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
3973 $tpl->setCurrentBlock(
'moderators_table');
3974 $tpl->setVariable(
'MODERATORS',$tbl_mod->getHTML());
3980 $tbl_adm->setId(
'tbl_id_adm');
3981 $tbl_adm->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
3982 $tbl_adm->setTitle($lng->txt(
'administrator'));
3984 $tbl_adm->addColumn(
'',
'',
'1%',
true);
3985 $tbl_adm->addColumn($lng->txt(
'login'),
'',
'10%');
3986 $tbl_adm->addColumn($lng->txt(
'firstname'),
'',
'10%');
3987 $tbl_adm->addColumn($lng->txt(
'lastname'),
'',
'10%');
3988 $tbl_adm->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
3989 $tbl_adm->setSelectAllCheckbox(
'user_id');
3990 $tbl_adm->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
3992 $tbl_adm->setData($admins);
3993 $tbl_adm->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
3994 $tbl_adm->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
3996 $tpl->setCurrentBlock(
'admins_table');
3997 $tpl->setVariable(
'ADMINS',$tbl_adm->getHTML());
4003 $tbl_mem->setId(
'tbl_id_mem');
4004 $tbl_mem->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4005 $tbl_mem->setTitle($lng->txt(
'members'));
4007 $tbl_mem->addColumn(
'',
'',
'1%',
true);
4008 $tbl_mem->addColumn($lng->txt(
'login'),
'',
'10%');
4009 $tbl_mem->addColumn($lng->txt(
'firstname'),
'',
'10%');
4010 $tbl_mem->addColumn($lng->txt(
'lastname'),
'',
'10%');
4011 $tbl_mem->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4012 $tbl_mem->setSelectAllCheckbox(
'user_id');
4013 $tbl_mem->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4014 $tbl_mem->setData($members);
4016 $tbl_mem->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4017 $tbl_mem->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4019 $tpl->setCurrentBlock(
'members_table');
4020 $tpl->setVariable(
'MEMBERS',$tbl_mem->getHTML());
4026 $tbl_tut->setId(
'tbl_id_tut');
4027 $tbl_tut->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4028 $tbl_tut->setTitle($lng->txt(
'tutors'));
4030 $tbl_tut->addColumn(
'',
'',
'1%',
true);
4031 $tbl_tut->addColumn($lng->txt(
'login'),
'',
'10%');
4032 $tbl_tut->addColumn($lng->txt(
'firstname'),
'',
'10%');
4033 $tbl_tut->addColumn($lng->txt(
'lastname'),
'',
'10%');
4034 $tbl_tut->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4035 $tbl_tut->setSelectAllCheckbox(
'user_id');
4036 $tbl_tut->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4037 $tbl_tut->setData($tutors);
4039 $tbl_tut->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4040 $tbl_tut->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4042 $tpl->setCurrentBlock(
'tutors_table');
4043 $tpl->setVariable(
'TUTORS',$tbl_tut->getHTML());
4047 public function enableAdminForceNotiObject()
4053 global $ilAccess,
$ilErr;
4054 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4056 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4059 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4065 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4068 foreach(
$_POST[
'user_id'] as $user_id)
4071 $is_enabled = $frm_noti->isAdminForceNotification();
4073 $frm_noti->setUserToggle(0);
4076 $frm_noti->setAdminForce(1);
4077 $frm_noti->insertAdminForce();
4084 $this->showMembersObject();
4087 public function disableAdminForceNotiObject()
4093 global $ilAccess,
$ilErr;
4094 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4096 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4099 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4105 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4108 foreach(
$_POST[
'user_id'] as $user_id)
4111 $is_enabled = $frm_noti->isAdminForceNotification();
4115 $frm_noti->deleteAdminForce();
4122 $this->showMembersObject();
4125 public function enableHideUserToggleNotiObject()
4131 global $ilAccess,
$ilErr;
4132 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4134 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4136 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4142 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4145 foreach(
$_POST[
'user_id'] as $user_id)
4148 $is_enabled = $frm_noti->isAdminForceNotification();
4149 $frm_noti->setUserToggle(1);
4153 $frm_noti->setAdminForce(1);
4154 $frm_noti->insertAdminForce();
4158 $frm_noti->updateUserToggle();
4165 $this->showMembersObject();
4168 public function disableHideUserToggleNotiObject()
4174 global $ilAccess,
$ilErr;
4175 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4177 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4180 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4186 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4189 foreach(
$_POST[
'user_id'] as $user_id)
4192 $is_enabled = $frm_noti->isAdminForceNotification();
4193 $frm_noti->setUserToggle(0);
4196 $frm_noti->updateUserToggle();
4200 $frm_noti->setAdminForce(1);
4201 $frm_noti->insertAdminForce();
4208 $this->showMembersObject();
4211 public function markPostUnreadObject()
4218 if(isset(
$_GET[
'pos_pk']))
4220 $this->
object->markPostUnread($ilUser->getId(), (int)
$_GET[
'pos_pk']);
4223 $this->viewThreadObject();
4226 public function markPostReadObject()
4233 $this->
object->markPostRead($ilUser->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
4234 $this->viewThreadObject();
4244 $lg = parent::initHeaderAction();
4247 if($this->objCurrentTopic->getId())
4249 $container_obj = null;
4250 $lg->setContainerObject($container_obj);
4255 if($ilUser->getId() != ANONYMOUS_USER_ID && $this->
ilias->getSetting(
'forum_notification') != 0 )
4259 $frm = $this->
object->Forum;
4260 $frm->setForumId($this->object->getId());
4261 $frm->setForumRefId($this->object->getRefId());
4262 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4263 $frm_notificiation_enabled = $frm->isForumNotificationEnabled($ilUser->getId());
4265 if($this->objCurrentTopic->getId())
4267 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
4274 $frm_notificiation_enabled &&
4275 $is_user_allowed_to_deactivate_notification
4278 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
4282 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
4287 if($frm_notificiation_enabled)
4289 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
4293 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
4297 $topic_notification_enabled =
false;
4298 if($this->objCurrentTopic->getId())
4300 $topic_notification_enabled = $this->objCurrentTopic->isNotificationEnabled($ilUser->getId());
4301 if($topic_notification_enabled)
4303 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_disable_notification");
4307 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_enable_notification");
4310 $this->ctrl->setParameter($this,
'thr_pk',
'');
4312 if($frm_notificiation_enabled || $topic_notification_enabled)
4317 $this->lng->txt(
"frm_notification_activated")
4325 $this->lng->txt(
"frm_notification_deactivated")
4336 if($this->objProperties->getNotificationType() ==
'default')
4341 if($this->objProperties->isUserToggleNoti() == 0)
4350 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4353 $frm_noti->setUserId($ilUser->getId());
4355 $user_toggle = (int)$frm_noti->isUserToggleNotification();
4356 if($user_toggle == 0)
4370 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
4371 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
4373 if($grp_ref_id == 0 && $crs_ref_id == 0)
4383 public function getParticipantsObject()
4387 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
4388 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
4392 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'), $ilErr->MESSAGE);
4398 $oParticipants = null;
4403 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
4405 return $oParticipants;
4407 else if($crs_ref_id > 0)
4411 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
4413 return $oParticipants;
4416 return $oParticipants;
4430 if((
int)$ilSetting->get(
'disable_my_offers'))
4436 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4449 if((
int)$ilSetting->get(
'disable_my_offers'))
4455 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4463 $_POST[
'thread_sorting'] ? $thread_sorting =
$_POST[
'thread_sorting'] :$thread_sorting = array();
4465 foreach($thread_sorting as $thr_pk=>$sorting_value)
4467 $sorting_value = str_replace(
',',
'.',$sorting_value);
4468 $sorting_value = (float)$sorting_value * 100;
4469 $this->
object->setThreadSorting($thr_pk,$sorting_value);
4481 if(!$this->is_moderator)
4483 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4486 $selected_thread_id = 0;
4487 if(isset(
$_GET[
'merge_thread_id']) && (int)
$_GET[
'merge_thread_id'])
4489 $selected_thread_id = (int)$_GET[
'merge_thread_id'];
4491 else if(isset(
$_POST[
'thread_ids']) && count((array)
$_POST[
'thread_ids']) == 1)
4493 $selected_thread_id = (int)current($_POST[
'thread_ids']);
4502 if($selected_thread_id)
4504 $frm = $this->
object->Forum;
4505 $frm->setForumId($this->object->getId());
4506 $frm->setForumRefId($this->object->getRefId());
4508 $selected_thread_obj =
new ilForumTopic($selected_thread_id);
4517 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4519 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
4521 $topicData = $frm->getOneTopic();
4524 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
4525 $this->ctrl->setParameter($this,
'merge_thread_id', $selected_thread_id);
4526 $tbl =
new ilForumTopicTableGUI($this,
'mergeThreads',
'', (
int)$_GET[
'ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
4527 $tbl->setSelectedThread($selected_thread_obj);
4528 $tbl->setMapper($frm)->fetchData();
4530 $this->tpl->setVariable(
'THREADS_TABLE', $tbl->getHTML());
4546 if(!$this->is_moderator)
4548 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4551 if(!isset(
$_GET[
'merge_thread_id']) || !(int)
$_GET[
'merge_thread_id'] || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 1)
4558 $source_thread_id = (int)
$_GET[
'merge_thread_id'];
4559 $target_thread_id = (int)current(
$_POST[
'thread_ids']);
4561 if($source_thread_id == $target_thread_id)
4571 $this->ctrl->clearParameters($this);
4581 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
4584 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performMergeThreads'));
4585 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_merge_threads'));
4586 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
4587 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performMergeThreads');
4589 $c_gui->addItem(
'thread_ids[]', $source_thread_id, sprintf($this->lng->txt(
'frm_merge_src'),
ilForumTopic::_lookupTitle($source_thread_id)));
4590 $c_gui->addItem(
'thread_ids[]', $target_thread_id, sprintf($this->lng->txt(
'frm_merge_target'),
ilForumTopic::_lookupTitle($target_thread_id)));
4592 $this->tpl->setContent($c_gui->getHTML());
4599 public function performMergeThreadsObject()
4606 if(!$this->is_moderator)
4608 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4611 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 2)
4618 if((
int)
$_POST[
'thread_ids'][0] == (
int)
$_POST[
'thread_ids'][1])
4627 ilForum::mergeThreads($this->object->id, (
int)$_POST[
'thread_ids'][0], (
int)$_POST[
'thread_ids'][1]);
Class ilForumStatisticsTableGUI.
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
static _getRTEClassname()
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupName($a_user_id)
lookup user name
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
afterSave(ilObjForum $forumObj)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
setTopicCreateDefaultValues()
static _lookupDate($thread_id)
This class represents an option in a radio group.
_getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
deleteNotificationAllUsers()
static _lookupObjIdForForumId($a_for_id)
Class Forum core functions for forum.
static getTreeNodeHtml($object, ilObjForumGUI $gui, $pageHits)
Returns the html used for a single forum tree node public.
Class ilForumExplorer class for explorer view of forum posts.
Base class for ILIAS Exception handling.
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
fetchTreeChildrenAsyncObject()
setValue($a_value)
Set Value.
setDisplayConfirmPostActivation($status=0)
Class for permanent links.
static lookupForumIdByObjId($obj_id)
getTitlesByRefId($a_ref_ids)
get Titles of objects this method is used for error messages in methods cut/copy/paste ...
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static mergeThreads($obj_id, $source_id, $target_id)
GUI class for the workflow of copying objects.
isUserToggleNotification()
$notificationSettingsForm
getIcon($user_toggle_noti)
const TITLE_LENGTH
max length of object title
static getFirstNewsIdForContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
Class ilObject Basic functions for all objects.
static Linkbar($AScript, $AHits, $ALimit, $AOffset, $AParams=array(), $ALayout=array(), $prefix='')
Linkbar Diese Funktion erzeugt einen typischen Navigationsbalken mit "Previous"- und "Next"-Links und...
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
getSubTabs($subtab='showThreads')
static get($a_var)
Get a value.
static get($a_glyph, $a_text="")
Get glyph html.
setAdminForce($a_admin_force)
static set($a_var, $a_val)
Set a value.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static _lookupTitle($a_id)
lookup object title
saveThreadSortingObject()
createObject()
create new object form
Class ilForumNotification.
addTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
static addToDesktop()
Add desktop item public.
setInfo($a_info)
Set Info.
setTreeStateAsynchObject()
initForumCreateForm($object_type)
confirmMergeThreadsObject()
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _setRichTextEditorUserState($a_state)
Sets the state of the rich text editor visibility for the current user.
initNotificationSettingsForm()
static _getAllReferences($a_id)
get all reference ids of object
Class ilForumTopicTableGUI.
static _lookupObjectId($a_ref_id)
lookup object id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getCenterColumnHTML()
Get center column.
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
Export User Interface Class.
GUI class for public user profile presentation.
static getInstance($a_obj_id=0)
hideToolbar($a_flag=null)
static encode($mixed, $suppress_native=false)
& executeCommand()
execute command
getId()
get object id public
prepareFormOutput($a_text)
Class ilForumModeratorsGUI.
addSubItem($a_item)
Add Subitem.
Forum export to HTML and Print.
Column user interface class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class Mail this class handles base functions for mail handling.
getTabs(&$tabs_gui)
get tabs abstract method.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
special template class to simplify handling of ITX/PEAR
setSize($a_size)
Set Size.
This class represents a text property in a property form.
setCols($a_cols)
Set Cols.
askForPostActivationObject()
static infoPanel($a_keep=true)
redirection script todo: (a better solution should control the processing via a xml file) ...
_lookupLogin($a_user_id)
lookup login
static getOverallRatingForObject($a_obj_id, $a_obj_type, $a_sub_obj_id=null, $a_sub_obj_type=null, $a_category_id=null)
Get overall rating for an object.
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
updateUserNotifications($update_all_users=false)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static _getThreads($a_obj_id, $a_sort_mode=self::SORT_DATE)
Get thread infos of object.
prepareOutput()
prepare output
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getModifiedReOnSubject($on_reply=false)
isUserAllowedToDeactivateNotification()
displayConfirmPostActivation()
static removeFromDesktop()
Remove item from personal desktop public.
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
ilForumMoveTopicsExplorer
getRightColumnHTML()
Display right column.
cancelObject($in_rep=false)
setColumnSettings($column_gui)
May be overwritten in subclasses.
This class represents a non editable value in a property form.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
static _getRichTextEditorUserState()
Gets the state of the rich text editor visibility for the current user.
This class represents a text area property in a property form.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
This class handles all operations on files for the forum object.
addToDeskObject()
Add desktop item public.
getCreationMode()
get creation mode
getRefId()
get reference id public
handleFormInput($a_text, $a_stripslashes=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
$display_confirm_post_activation
static _lookupTitle($a_topic_id)
Looks up the title/subject of a topic/thread.
getEditFormCustomValues(Array &$a_values)
static redirect($a_script)
http redirect to other script
addHeaderAction()
Add header action menu.
getThreadEditingForm($a_thread_id)
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
storeUploadedFile($files)
Store uploaded files in filesystem.
performPostActivationObject()
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
static lookupForumIdByTopicId($a_topic_id)
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded) ...
Confirmation screen class.