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();
163 global $ilNavigationHistory, $ilAccess,
$ilCtrl, $ilTabs;
165 $next_class = $this->ctrl->getNextClass($this);
166 $cmd = $this->ctrl->getCmd();
168 $exclude_cmds = array(
169 'viewThread',
'markPostUnread',
'markPostRead',
'showThreadNotification',
170 'cancelPostActivation',
'cancelPostDeactivation',
171 'performPostActivation',
'performPostDeactivation',
'performPostAndChildPostsActivation',
172 'askForPostActivation',
'askForPostDeactivation',
173 'toggleThreadNotification',
'toggleThreadNotificationTab',
174 'toggleStickiness',
'cancelPost',
'savePost',
'quotePost',
'getQuotationHTMLAsynch',
175 'setTreeStateAsynch',
'fetchTreeChildrenAsync' 178 if(!in_array(
$cmd, $exclude_cmds))
184 if(!$this->
getCreationMode() && !$ilCtrl->isAsynch() && $ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']))
186 $ilNavigationHistory->addItem(
$_GET[
'ref_id'],
187 'ilias.php?baseClass=ilRepositoryGUI&cmd=showThreads&ref_id='.
$_GET[
'ref_id'],
'frm');
192 case 'ilpermissiongui':
193 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
195 $this->ctrl->forwardCommand($perm_gui);
198 case 'ilforumexportgui':
199 require_once
'Modules/Forum/classes/class.ilForumExportGUI.php';
201 $this->ctrl->forwardCommand($fex_gui);
205 case 'ilforummoderatorsgui':
206 require_once
'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
208 $this->ctrl->forwardCommand($fm_gui);
211 case 'ilinfoscreengui':
219 case 'ilpublicuserprofilegui':
220 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
222 $add = $this->getUserProfileAdditional((
int)$_GET[
'ref_id'], (
int)$_GET[
'user']);
223 $profile_gui->setAdditional($add);
224 $ret = $this->ctrl->forwardCommand($profile_gui);
225 $this->tpl->setContent(
$ret);
228 case 'ilobjectcopygui':
229 include_once
'Services/Object/classes/class.ilObjectCopyGUI.php';
232 $this->ctrl->forwardCommand($cp);
236 $ilTabs->setTabActive(
'export');
237 include_once
'Services/Export/classes/class.ilExportGUI.php';
239 $exp->addFormat(
'xml');
240 $this->ctrl->forwardCommand($exp);
243 case 'ilcommonactiondispatchergui':
244 include_once
'Services/Object/classes/class.ilCommonActionDispatcherGUI.php';
246 $this->ctrl->forwardCommand($gui);
258 if(isset(
$_POST[
'select_cmd2']))
263 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] != null)
265 $member_cmd = array(
'enableAdminForceNoti',
'disableAdminForceNoti',
'enableHideUserToggleNoti',
'disableHideUserToggleNoti');
266 in_array(
$_POST[
'selected_cmd'], $member_cmd) ?
$cmd =
$_POST[
'selected_cmd'] :
$cmd =
'performThreadsAction';
270 $cmd =
'showThreads';
280 if(
$cmd !=
'viewThreadObject' &&
$cmd !=
'showUserObject')
293 $this->settingsTabs();
298 $rg_thr->addOption(
new ilRadioOption($this->lng->txt(
'sorting_manual_sticky'),
'1'));
300 $rg_thr->setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
307 $rg_pro->addOption($rg_sort_by_date);
312 $view_direction_group_gui->addOption($view_desc);
313 $view_direction_group_gui->addOption($view_asc);
315 $rg_sort_by_date->
addSubItem($view_direction_group_gui);
318 if($ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
320 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
322 $cb_prop->setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
326 if($ilSetting->get(
'enable_fora_statistics',
false))
328 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
330 $cb_prop->setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
334 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
336 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
339 $frm_subject =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_subject_setting'),
'subject_setting');
341 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'add_re_to_subject'),
'add_re_to_subject'));
342 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'empty_subject'),
'empty_subject'));
344 $a_form->
addItem($frm_subject);
346 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'mark_moderator_posts'),
'mark_mod_posts');
348 $cb_prop->setInfo($this->lng->txt(
'mark_moderator_posts_desc'));
354 $a_values[
"desc"] = $this->
object->getLongDescription();
355 $a_values[
'default_view'] = $this->objProperties->getDefaultView();
356 $a_values[
'anonymized'] = $this->objProperties->isAnonymized();
357 $a_values[
'statistics_enabled'] = $this->objProperties->isStatisticEnabled();
358 $a_values[
'post_activation'] = $this->objProperties->isPostActivationEnabled();
359 $a_values[
'subject_setting'] = $this->objProperties->getSubjectSetting();
360 $a_values[
'mark_mod_posts'] = $this->objProperties->getMarkModeratorPosts();
361 $a_values[
'thread_sorting'] = $this->objProperties->getThreadSorting();
367 $a_values[
'default_view'] = $default_view;
369 $default_view_sort_dir =
371 ? (
int)$this->objProperties->getDefaultView()
374 $a_values[
'default_view_sort_dir'] = $default_view_sort_dir;
384 $view = (int)
$_POST[
'default_view'];
393 $this->objProperties->setDefaultView($view);
401 if($ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
403 $this->objProperties->setAnonymisation((
int) $a_form->
getInput(
'anonymized'));
405 if($ilSetting->get(
'enable_fora_statistics',
false))
407 $this->objProperties->setStatisticsStatus((
int) $a_form->
getInput(
'statistics_enabled'));
409 $this->objProperties->setPostActivation((
int) $a_form->
getInput(
'post_activation'));
410 $this->objProperties->setSubjectSetting( $a_form->
getInput(
'subject_setting'));
411 $this->objProperties->setMarkModeratorPosts((
int) $a_form->
getInput(
'mark_mod_posts'));
412 $this->objProperties->setThreadSorting((
int)$a_form->
getInput(
'thread_sorting'));
414 $this->objProperties->update();
424 $this->ctrl->setParameter($this,
'thr_pk', $a_thread_id);
425 $form->setFormAction($this->ctrl->getFormAction($this,
'updateThread'));
429 $ti_prop->setMaxLength(255);
430 $ti_prop->setSize(50);
431 $form->addItem($ti_prop);
433 $form->addCommandButton(
'updateThread', $this->lng->txt(
'save'));
434 $form->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
450 if(!$this->is_moderator)
452 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
455 $ilTabs->setTabActive(
'forums_threads');
460 $form->setValuesByArray(array(
465 $this->tpl->setContent($form->getHTML());
473 if(!$this->is_moderator)
475 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
478 if(!$this->objCurrentTopic->getId())
485 if($this->objCurrentTopic->getForumId() != $forum_id)
487 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
491 if(!$form->checkInput())
493 $form->setValuesByPost();
494 $this->editThreadObject($this->objCurrentTopic->getId(), $form);
498 $this->objCurrentTopic->setSubject($form->getInput(
'title'));
499 $this->objCurrentTopic->updateThreadTitle();
505 public function markAllReadObject()
512 $this->
object->markAllThreadsRead($ilUser->getId());
539 $ilTabs->addSubTabTarget(
'show', $this->ctrl->getLinkTarget($this,
'showThreads'),
'showThreads', get_class($this),
'', $subtab==
'showThreads'? true : false );
540 $ilTabs->addSubTabTarget(
'sorting_header', $this->ctrl->getLinkTarget($this,
'sortThreads'),
'sortThreads', get_class($this),
'', $subtab==
'sortThreads'? true : false );
543 public function getContent()
553 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
555 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
558 $cmd = $this->ctrl->getCmd();
559 $frm = $this->
object->Forum;
560 $frm->setForumId($this->object->getId());
561 $frm->setForumRefId($this->object->getRefId());
562 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
564 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
566 if((
int)strlen($this->confirmation_gui_html))
568 $this->tpl->setVariable(
'CONFIRMATION_GUI', $this->confirmation_gui_html);
572 if($ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()) && !$this->
hideToolbar())
574 $ilToolbar->addButton($this->lng->txt(
'forums_new_thread'), $this->ctrl->getLinkTarget($this,
'createThread'));
578 include_once
'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
579 if($ilUser->getId() != ANONYMOUS_USER_ID && !(int)strlen($this->confirmation_gui_html))
581 $ilToolbar->addButton(
582 $this->lng->txt(
'forums_mark_read'),
583 $this->ctrl->getLinkTarget($this,
'markAllRead'),
587 $this->ctrl->clearParameters($this);
591 $topicData = $frm->getOneTopic();
595 $frm->setDbTable(
'frm_data');
596 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
597 $frm->updateVisits($topicData[
'top_pk']);
599 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
600 if(!in_array(
$cmd, array(
'showThreads',
'sortThreads') ))
602 $cmd =
'showThreads';
605 $tbl->setMapper($frm)->fetchData();
607 $this->tpl->setVariable(
'THREADS_TABLE', $tbl->getHTML());
611 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
613 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
622 $this->create_form_gui->setTableWidth(
'600px');
624 $this->create_form_gui->setTitle($this->lng->txt(
'frm_new'));
628 $this->ctrl->setParameter($this,
'new_type', $object_type);
629 $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
632 $title_gui =
new ilTextInputGUI($this->lng->txt(
'title'),
'title');
635 $this->create_form_gui->addItem($title_gui);
640 $description_gui->setRows(2);
641 $this->create_form_gui->addItem($description_gui);
644 $sorting_threads_gui =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_sorting_threads'),
'thread_sorting');
645 $sort_dat =
new ilRadioOption($this->lng->txt(
'order_by').
' '.$this->lng->txt(
'date'), 0);
646 $sorting_threads_gui->addOption($sort_dat);
648 $sort_man =
new ilRadioOption($this->lng->txt(
'sorting_manual_sticky'), 1);
649 $sorting_threads_gui->addOption($sort_man);
650 $sorting_threads_gui->
setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
651 $this->create_form_gui->addItem($sorting_threads_gui);
656 $view_group_gui->addOption($view_hir);
658 $view_group_gui->addOption($view_dat);
659 $this->create_form_gui->addItem($view_group_gui);
662 $view_direction_group_gui->addOption($view_desc);
664 $view_direction_group_gui->addOption($view_asc);
665 $view_dat->
addSubItem($view_direction_group_gui);
668 $anonymize_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
669 $anonymize_gui->
setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
670 $anonymize_gui->setValue(1);
672 if($this->
ilias->getSetting(
'enable_anonymous_fora',
false))
673 $anonymize_gui->setDisabled(
true);
674 $this->create_form_gui->addItem($anonymize_gui);
677 $statistics_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
678 $statistics_gui->
setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
679 $statistics_gui->setValue(1);
680 if(!$this->
ilias->getSetting(
'enable_fora_statistics',
false))
681 $statistics_gui->setDisabled(
true);
682 $this->create_form_gui->addItem($statistics_gui);
684 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
686 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
687 $this->create_form_gui->addItem($cb_prop);
689 $this->create_form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
690 $this->create_form_gui->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
707 $this->objProperties->setObjId($forumObj->
getId());
708 $this->objProperties->setDefaultView(1);
709 $this->objProperties->setAnonymisation(0);
710 $this->objProperties->setStatisticsStatus(0);
711 $this->objProperties->setPostActivation(0);
712 $this->objProperties->setThreadSorting(0);
713 $this->objProperties->insert();
719 $roles[0] = ilObjForum::_lookupModeratorRole($forumObj->
getRefId());
721 $rbacadmin->assignUser($roles[0], $forumObj->
getOwner(),
'n');
724 $forumObj->saveData($roles);
729 $this->ctrl->setParameter($this,
'ref_id', $forumObj->
getRefId());
730 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'createThread',
'',
false,
false));
740 global $ilAccess, $ilHelp,
$ilCtrl;
742 $ilHelp->setScreenIdComponent(
"frm");
744 $this->ctrl->setParameter($this,
'ref_id', $this->ref_id);
746 include_once
'Services/Repository/classes/class.ilRepositoryExplorer.php';
748 '',
'showThreads',
'view',
'markAllRead',
749 'enableForumNotification',
'disableForumNotification',
'moveThreads',
'performMoveThreads',
750 'cancelMoveThreads',
'performThreadsAction',
'createThread',
'addThread',
751 'showUser',
'confirmDeleteThreads',
752 'merge',
'mergeThreads',
'cancelMergeThreads',
'performMergeThreads' 755 (in_array($ilCtrl->getCmd(), $active)) ? $force_active = true : $force_active =
false;
756 $tabs_gui->
addTarget(
'forums_threads', $this->ctrl->getLinkTarget($this,
'showThreads'), $ilCtrl->getCmd(), get_class($this),
'', $force_active);
759 if($ilAccess->checkAccess(
'visible',
'', $this->ref_id))
761 $force_active = ($this->ctrl->getNextClass() ==
'ilinfoscreengui' || strtolower(
$_GET[
'cmdClass']) ==
'ilnotegui') ?
true :
false;
763 $this->ctrl->getLinkTargetByClass(
764 array(
'ilobjforumgui',
'ilinfoscreengui'),
'showSummary'),
765 array(
'showSummary',
'infoScreen'),
766 '',
'', $force_active);
769 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
771 $force_active = ($ilCtrl->getCmd() ==
'edit') ?
true :
false;
772 $tabs_gui->
addTarget(
'settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'', $force_active);
775 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
777 $tabs_gui->
addTarget(
'frm_moderators', $this->ctrl->getLinkTargetByClass(
'ilForumModeratorsGUI',
'showModerators'),
'showModerators', get_class($this));
780 if($this->
ilias->getSetting(
'enable_fora_statistics',
false) &&
781 ($this->objProperties->isStatisticEnabled() || $ilAccess->checkAccess(
'write',
'', $this->ref_id)))
783 $force_active = ($ilCtrl->getCmd() ==
'showStatistics') ?
true :
false;
784 $tabs_gui->
addTarget(
'frm_statistics', $this->ctrl->getLinkTarget($this,
'showStatistics'),
'showStatistics', get_class($this),
'', $force_active);
787 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
789 $tabs_gui->
addTarget(
'export', $this->ctrl->getLinkTargetByClass(
'ilexportgui',
''),
'',
'ilexportgui');
792 if($ilAccess->checkAccess(
'edit_permission',
'', $this->ref_id))
794 $tabs_gui->
addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'), array(
'perm',
'info',
'owner'),
'ilpermissiongui');
798 public function settingsTabs()
805 global $ilTabs, $ilAccess,
$tree;
807 $ilTabs->setTabActive(
'settings');
808 $ilTabs->addSubTabTarget(
'basic_settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'',
$_GET[
'cmd']==
'edit'? true : false );
811 if($this->
ilias->getSetting(
'forum_notification') > 0)
814 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
815 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
817 if((
int)$grp_ref_id > 0 || (int)$crs_ref_id > 0 )
819 #show member-tab for notification if forum-notification is enabled in administration 820 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
822 $mem_active = array(
'showMembers',
'forums_notification_settings');
823 (in_array(
$_GET[
'cmd'],$mem_active)) ? $force_mem_active =
true : $force_mem_active =
false;
825 $ilTabs->addSubTabTarget(
'notifications', $this->ctrl->getLinkTarget($this,
'showMembers'),
$_GET[
'cmd'], get_class($this),
'', $force_mem_active);
832 public function showStatisticsObject()
840 if(!$this->
ilias->getSetting(
'enable_fora_statistics',
false))
842 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
846 if(!$ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']))
848 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
852 if(!$ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']) && !$this->objProperties->isStatisticEnabled())
854 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
858 if($ilAccess->checkAccess(
'write',
'',
$_GET[
'ref_id']) &&
859 !$this->objProperties->isStatisticEnabled())
861 ilUtil::sendInfo($this->lng->txt(
'frm_statistics_disabled_for_participants'));
864 $this->
object->Forum->setForumId($this->object->getId());
866 require_once
'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
869 $tbl->setId(
'il_frm_statistic_table_'.(
int)
$_GET[
'ref_id']);
870 $tbl->setTitle($this->lng->txt(
'statistic'),
'icon_usr_b.png', $this->lng->txt(
'obj_'.$this->object->getType()));
872 $data = $this->
object->Forum->getUserStatistic($this->is_moderator);
877 $result[$counter][
'ranking'] = $row[0];
878 $result[$counter][
'login'] = $row[1];
879 $result[$counter][
'lastname'] = $row[2];
880 $result[$counter][
'firstname'] = $row[3];
886 $this->tpl->setContent($tbl->getHTML());
889 public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
898 if($ilAccess->checkAccess(
'read',
'', $a_target))
903 if ($objTopic->getFrmObjId() &&
909 if($ilAccess->checkAccess(
'read',
'', $ref_id))
916 if (isset($new_ref_id) && $new_ref_id != $a_target)
918 ilUtil::redirect(ILIAS_HTTP_PATH.
"/goto.php?target=frm_".$new_ref_id.
"_".$a_thread.
"_".$a_posting);
922 $_GET[
'ref_id'] = $a_target;
923 $_GET[
'pos_pk'] = $a_posting;
924 $_GET[
'thr_pk'] = $a_thread;
925 $_GET[
'anchor'] = $a_posting;
926 $_GET[
'cmdClass'] =
'ilObjForumGUI';
927 $_GET[
'cmd'] =
'viewThread';
928 $_GET[
'baseClass'] =
'ilRepositoryGUI';
930 include_once(
'ilias.php');
936 $_GET[
'ref_id'] = $a_target;
937 $_GET[
'baseClass'] =
'ilRepositoryGUI';
938 include_once(
'ilias.php');
942 else if($ilAccess->checkAccess(
'read',
'', ROOT_FOLDER_ID))
944 $_GET[
'target'] =
'';
945 $_GET[
'ref_id'] = ROOT_FOLDER_ID;
948 $_GET[
'baseClass'] =
'ilRepositoryGUI';
949 include(
'ilias.php');
953 $ilErr->raiseError($lng->txt(
'msg_no_perm_read'), $ilErr->FATAL);
956 public function performDeleteThreadsObject()
963 if(!$this->is_moderator)
965 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
969 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']))
975 require_once
'Modules/Forum/classes/class.ilForum.php';
976 require_once
'Modules/Forum/classes/class.ilObjForum.php';
980 $this->objProperties->setObjId($forumObj->
getId());
983 foreach(
$_POST[
'thread_ids'] as $topic_id)
985 $frm->setForumId($forumObj->
getId());
986 $frm->setForumRefId($forumObj->
getRefId());
988 $first_node = $frm->getFirstPostNode($topic_id);
989 if((
int)$first_node[
'pos_pk'])
991 $frm->deletePost($first_node[
'pos_pk']);
996 $this->ctrl->redirect($this,
'showThreads');
999 public function confirmDeleteThreads()
1006 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']))
1012 if(!$this->is_moderator)
1014 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1018 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
1021 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteThreads'));
1022 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_delete_threads'));
1023 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
1024 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteThreads');
1026 foreach((array)
$_POST[
'thread_ids'] as $thread_id)
1031 $this->confirmation_gui_html = $c_gui->getHTML();
1035 return $this->tpl->setContent($c_gui->getHTML());
1038 public function prepareThreadScreen(
ilObjForum $a_forum_obj)
1046 global
$tpl,
$lng, $ilTabs, $ilHelp;
1048 $ilHelp->setScreenIdComponent(
"frm");
1050 $tpl->getStandardTemplate();
1056 $ilTabs->setBackTarget($lng->txt(
'all_topics'),
1057 'ilias.php?baseClass=ilRepositoryGUI&ref_id='.$_GET[
'ref_id']);
1060 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1061 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1064 $ilTabs->addTarget(
'sort_by_posts', $this->ctrl->getLinkTarget($this,
'viewThread'));
1069 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1070 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1071 $ilTabs->addTarget(
'order_by_date', $this->ctrl->getLinkTarget($this,
'viewThread'));
1072 $this->ctrl->clearParameters($this);
1077 $ilTabs->setTabActive(
'order_by_date');
1081 $ilTabs->setTabActive(
'sort_by_posts');
1087 $frm = $a_forum_obj->Forum;
1088 $frm->setForumId($a_forum_obj->
getId());
1093 if($this->is_moderator)
1095 $this->objCurrentPost->activatePostAndChildPosts();
1096 ilUtil::sendInfo($this->lng->txt(
'forums_post_and_children_were_activated'),
true);
1099 $this->viewThreadObject();
1104 if($this->is_moderator)
1106 $this->objCurrentPost->activatePost();
1110 $this->viewThreadObject();
1115 $this->viewThreadObject();
1120 if($this->is_moderator)
1125 $this->viewThreadObject();
1130 $this->display_confirm_post_activation = $status;
1138 public function toggleThreadNotificationObject()
1145 if($this->objCurrentTopic->isNotificationEnabled($ilUser->getId()))
1147 $this->objCurrentTopic->disableNotification($ilUser->getId());
1152 $this->objCurrentTopic->enableNotification($ilUser->getId());
1156 $this->viewThreadObject();
1161 if($this->is_moderator)
1163 if($this->objCurrentTopic->isSticky())
1165 $this->objCurrentTopic->unmakeSticky();
1169 $this->objCurrentTopic->makeSticky();
1173 $this->viewThreadObject();
1178 $_GET[
'action'] =
'';
1180 $this->viewThreadObject();
1183 public function getDeleteFormHTML()
1191 $form_tpl =
new ilTemplate(
'tpl.frm_delete_post_form.html',
true,
true,
'Modules/Forum');
1193 $form_tpl->setVariable(
'ANKER', $this->objCurrentPost->getId());
1194 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1195 $form_tpl->setVariable(
'TXT_DELETE', $lng->txt(
'forums_info_delete_post'));
1196 $this->ctrl->setParameter($this,
'action',
'ready_delete');
1197 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1198 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1199 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1200 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1201 $this->ctrl->clearParameters($this);
1202 $form_tpl->setVariable(
'CANCEL_BUTTON', $lng->txt(
'cancel'));
1203 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'confirm'));
1205 return $form_tpl->get();
1208 public function getActivationFormHTML()
1215 $form_tpl =
new ilTemplate(
'tpl.frm_activation_post_form.html',
true,
true,
'Modules/Forum');
1217 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1218 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1219 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1220 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this,
'performPostActivation'));
1221 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1222 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1223 $form_tpl->setVariable(
'TXT_ACT', $lng->txt(
'activate_post_txt'));
1224 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'activate_only_current'));
1225 $form_tpl->setVariable(
'CMD_CONFIRM',
'performPostActivation');
1226 $form_tpl->setVariable(
'CONFIRM_BRANCH_BUTTON', $lng->txt(
'activate_current_and_childs'));
1227 $form_tpl->setVariable(
'CMD_CONFIRM_BRANCH',
'performPostAndChildPostsActivation');
1228 $form_tpl->setVariable(
'CANCEL_BUTTON',$lng->txt(
'cancel'));
1229 $form_tpl->setVariable(
'CMD_CANCEL',
'cancelPostActivation');
1230 $this->ctrl->clearParameters($this);
1232 return $form_tpl->get();
1235 public function getDeactivationFormHTML()
1242 $form_tpl =
new ilTemplate(
'tpl.frm_deactivation_post_form.html',
true,
true,
'Modules/Forum');
1244 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1245 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1246 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1247 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this,
'performPostDeactivation'));
1248 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1249 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1250 $form_tpl->setVariable(
'TXT_DEACT', $lng->txt(
'deactivate_post_txt'));
1251 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'deactivate_current_and_childs'));
1252 $form_tpl->setVariable(
'CMD_CONFIRM',
'performPostDeactivation');
1253 $form_tpl->setVariable(
'CANCEL_BUTTON',$lng->txt(
'cancel'));
1254 $form_tpl->setVariable(
'CMD_CANCEL',
'cancelPostDeactivation');
1255 $this->ctrl->clearParameters($this);
1257 return $form_tpl->get();
1260 public function getCensorshipFormHTML()
1268 $form_tpl =
new ilTemplate(
'tpl.frm_censorship_post_form.html',
true,
true,
'Modules/Forum');
1270 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1271 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1272 $this->ctrl->setParameter($this,
'action',
'ready_censor');
1273 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1274 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1275 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1276 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1277 $this->ctrl->clearParameters($this);
1278 $form_tpl->setVariable(
'TXT_CENS_MESSAGE', $lng->txt(
'forums_the_post'));
1279 $form_tpl->setVariable(
'TXT_CENS_COMMENT', $lng->txt(
'forums_censor_comment').
':');
1280 $form_tpl->setVariable(
'CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1283 if($this->objCurrentPost->isCensored())
1285 $form_tpl->setVariable(
'TXT_CENS', $lng->txt(
'forums_info_censor2_post'));
1286 $form_tpl->setVariable(
'YES_BUTTON', $lng->txt(
'yes'));
1287 $form_tpl->setVariable(
'NO_BUTTON', $lng->txt(
'no'));
1291 $form_tpl->setVariable(
'TXT_CENS', $lng->txt(
'forums_info_censor_post'));
1292 $form_tpl->setVariable(
'CANCEL_BUTTON', $lng->txt(
'cancel'));
1293 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'confirm'));
1296 return $form_tpl->get();
1299 private function initReplyEditForm()
1313 $frm = $oForumObjects[
'frm'];
1317 $oFDForum = $oForumObjects[
'file_obj'];
1319 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1321 $this->replyEditForm->setTableWidth(
'100%');
1324 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply')
1326 $this->ctrl->setParameter($this,
'action',
'ready_showreply');
1330 $this->ctrl->setParameter($this,
'action',
'ready_showedit');
1334 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1335 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1336 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
1337 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
1338 $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this,
'savePost', $this->objCurrentPost->getId()));
1339 $this->ctrl->clearParameters($this);
1341 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1343 $this->replyEditForm->setTitle($this->lng->txt(
'forums_your_reply'));
1347 $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_post'));
1351 if($this->objProperties->isAnonymized() &&
1352 in_array($_GET[
'action'], array(
'showreply',
'ready_showreply')))
1354 $oAnonymousNameGUI =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
1356 $oAnonymousNameGUI->setInfo($this->lng->txt(
'forums_use_alias'));
1358 $this->replyEditForm->addItem($oAnonymousNameGUI);
1362 $oSubjectGUI =
new ilTextInputGUI($this->lng->txt(
'forums_subject'),
'subject');
1364 $oSubjectGUI->setRequired(
true);
1366 if($this->objProperties->getSubjectSetting() ==
'empty_subject')
1367 $oSubjectGUI->setInfo($this->lng->txt(
'enter_new_subject'));
1369 $this->replyEditForm->addItem($oSubjectGUI);
1373 $_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply' ? $this->lng->txt(
'forums_your_reply') : $this->lng->txt(
'forums_edit_post'),
1377 $oPostGUI->setCols(50);
1378 $oPostGUI->setRows(15);
1379 $oPostGUI->setUseRte(
true);
1380 $oPostGUI->addPlugin(
'latex');
1381 $oPostGUI->addButton(
'latex');
1382 $oPostGUI->addButton(
'pastelatex');
1383 $oPostGUI->addPlugin(
'ilfrmquote');
1386 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1388 $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
1390 $oPostGUI->removePlugin(
'advlink');
1391 $oPostGUI->setRTERootBlockElement(
'');
1392 $oPostGUI->usePurifier(
true);
1393 $oPostGUI->disableButtons(array(
1410 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1412 $oPostGUI->setRTESupport($ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.4.7');
1416 $oPostGUI->setRTESupport($this->objCurrentPost->getId(),
'frm',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.4.7');
1419 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
1422 $this->replyEditForm->addItem($oPostGUI);
1425 include_once
'Services/Mail/classes/class.ilMail.php';
1426 $umail =
new ilMail($ilUser->getId());
1427 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
1428 !$frm->isThreadNotificationEnabled($ilUser->getId(), $this->objCurrentPost->getThreadId()) &&
1429 !$this->objProperties->isAnonymized())
1432 $oNotificationGUI->setInfo($this->lng->txt(
'forum_notify_me'));
1434 $this->replyEditForm->addItem($oNotificationGUI);
1438 $oFileUploadGUI =
new ilFileWizardInputGUI($this->lng->txt(
'forums_attachments_add'),
'userfile');
1440 $this->replyEditForm->addItem($oFileUploadGUI);
1442 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
1444 $ilUser->isAnonymous() &&
1445 !$ilUser->isCaptchaVerified() &&
1446 ilCaptchaUtil::isActiveForForum()
1449 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
1450 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
1452 $this->replyEditForm->addItem($captcha);
1456 if(count($oFDForum->getFilesOfPost()) && ($_GET[
'action'] ==
'showedit' || $_GET[
'action'] ==
'ready_showedit'))
1460 foreach($oFDForum->getFilesOfPost() as
$file)
1463 $oAttachmentGUI->setValue(
$file[
'md5']);
1464 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
1466 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
1470 $this->replyEditForm->addCommandButton(
'savePost', $this->lng->txt(
'create'));
1471 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1473 include_once
'Services/RTE/classes/class.ilRTE.php';
1476 if(array_key_exists(
'show_rte',
$_POST))
1483 $this->replyEditForm->addCommandButton(
'quotePost', $this->lng->txt(
'forum_add_quote'));
1486 $this->replyEditForm->addCommandButton(
'cancelPost', $this->lng->txt(
'cancel'));
1491 if(null === $this->replyEditForm)
1493 $this->initReplyEditForm();
1499 public function savePostObject()
1508 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
1510 if($this->objCurrentTopic->isClosed())
1512 $_GET[
'action'] =
'';
1513 return $this->viewThreadObject();
1517 if($oReplyEditForm->checkInput())
1519 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
1521 $ilUser->isAnonymous() &&
1522 !$ilUser->isCaptchaVerified() &&
1523 ilCaptchaUtil::isActiveForForum()
1526 $ilUser->setCaptchaVerified(
true);
1534 $forumObj = $oForumObjects[
'forumObj'];
1538 $frm = $oForumObjects[
'frm'];
1539 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
1540 $topicData = $frm->getOneTopic();
1543 if(
$_GET[
'action'] ==
'ready_showreply')
1545 if(!$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
1547 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1552 $send_activation_mail = 0;
1554 if($this->objProperties->isPostActivationEnabled())
1556 if(!$this->is_moderator)
1559 $send_activation_mail = 1;
1561 else if($this->objCurrentPost->isAnyParentDeactivated())
1567 if($this->objProperties->isAnonymized())
1569 if(!strlen($oReplyEditForm->getInput(
'alias')))
1571 $user_alias = $this->lng->txt(
'forums_anonymous');
1575 $user_alias = $oReplyEditForm->getInput(
'alias');
1580 $user_alias = $ilUser->getLogin();
1583 $newPost = $frm->generatePost(
1584 $topicData[
'top_pk'],
1585 $this->objCurrentTopic->getId(),
1586 ($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()),
1588 $this->objCurrentPost->getId(),
1589 (int)$oReplyEditForm->getInput(
'notify'),
1594 $send_activation_mail
1598 $this->
object->markPostRead($ilUser->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
1601 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
1604 foreach($mediaObjects as $mob)
1606 foreach($myMediaObjects as $myMob)
1619 $file = $_FILES[
'userfile'];
1620 if(is_array($file) && !empty($file))
1622 $oFDForum->storeUploadedFile($file);
1626 if ($this->
ilias->getSetting(
"forum_notification") == 1 && (int)$status )
1628 $objPost =
new ilForumPost((
int)$newPost, $this->is_moderator);
1630 $post_data = array();
1631 $post_data = $objPost->getDataAsArray();
1633 $post_data[
"top_name"] = $titles[0];
1634 $post_data[
"ref_id"] = $this->
object->getRefId();
1636 $frm->__sendMessage($objPost->getParentId(), $post_data);
1638 $frm->sendForumNotifications($post_data);
1639 $frm->sendThreadNotifications($post_data);
1643 if(!$this->is_moderator && !$status)
1645 $message .= $lng->txt(
'forums_post_needs_to_be_activated');
1649 $message .= $lng->txt(
'forums_post_new_entry');
1652 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$this->objCurrentPost->getId();
1655 $this->ctrl->setParameter($this,
'pos_pk', $newPost);
1656 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1657 $this->ctrl->redirect($this,
'viewThread');
1661 if((!$this->is_moderator &&
1662 !$this->objCurrentPost->isOwner($ilUser->getId())) || $this->objCurrentPost->isCensored() ||
1663 $ilUser->getId() == ANONYMOUS_USER_ID)
1665 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1669 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
1672 foreach($oldMediaObjects as $oldMob)
1675 foreach($curMediaObjects as $curMob)
1677 if($oldMob == $curMob)
1696 $send_activation_mail = 0;
1698 if($this->objProperties->isPostActivationEnabled())
1700 if(!$this->is_moderator)
1703 $send_activation_mail = 1;
1705 else if($this->objCurrentPost->isAnyParentDeactivated())
1710 $this->objCurrentPost->setStatus($status);
1712 $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
1714 $this->objCurrentPost->setNotification((
int)$oReplyEditForm->getInput(
'notify'));
1715 $this->objCurrentPost->setChangeDate(date(
'Y-m-d H:i:s'));
1716 $this->objCurrentPost->setUpdateUserId($ilUser->getId());
1719 if($this->objCurrentPost->update())
1721 $this->objCurrentPost->reload();
1724 include_once
'Services/News/classes/class.ilNewsItem.php';
1727 'frm', $this->objCurrentPost->getId(),
'pos');
1731 $news_item->setTitle($this->objCurrentPost->getSubject());
1733 $this->objCurrentPost->getMessage(), 0), 1)
1735 $news_item->update();
1739 $oFDForum = $oForumObjects[
'file_obj'];
1741 $file = $_FILES[
'userfile'];
1744 $oFDForum->storeUploadedFile(
$file);
1747 $file2delete = $oReplyEditForm->getInput(
'del_file');
1748 if(is_array($file2delete) && count($file2delete))
1750 $oFDForum->unlinkFilesByMD5Filenames($file2delete);
1754 if (!$status && $send_activation_mail)
1756 $pos_data = $this->objCurrentPost->getDataAsArray();
1757 $pos_data[
"top_name"] = $this->
object->getTitle();
1758 $frm->sendPostActivationNotification($pos_data);
1762 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1763 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1764 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
1765 $this->ctrl->redirect($this,
'viewThread');
1770 $_GET[
'action'] = substr(
$_GET[
'action'], 6);
1772 return $this->viewThreadObject();
1777 if(null === $a_flag)
1788 if(!is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
1790 if($this->objCurrentTopic->isClosed())
1792 $_GET[
'action'] =
'';
1793 return $this->viewThreadObject();
1799 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
1800 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
1802 $oReplyEditForm->checkInput();
1805 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
1806 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
1808 $_GET[
'action'] =
'showreply';
1810 $this->viewThreadObject();
1813 public function getQuotationHTMLAsynchObject()
1819 $frm = $oForumObjects[
'frm'];
1821 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
1823 $this->objCurrentPost->getUserId(),
1824 $this->objCurrentPost->getUserAlias(),
1825 $this->objCurrentPost->getImportName()
1835 if(null === $this->forumObjects)
1839 $frm = $forumObj->Forum;
1840 $frm->setForumId($forumObj->
getId());
1841 $frm->setForumRefId($forumObj->
getRefId());
1843 $this->forumObjects[
'forumObj'] = $forumObj;
1844 $this->forumObjects[
'frm'] = $frm;
1845 $this->forumObjects[
'file_obj'] = $file_obj;
1853 include_once
'Modules/Forum/classes/class.ilForumExplorer.php';
1857 $this->objCurrentTopic,
1858 $this->objProperties
1861 return $explorer->render()->getHtml();
1866 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
1867 include_once
'Modules/Forum/classes/class.ilForumExplorer.php';
1869 $response =
new stdClass();
1870 $response->success =
false;
1872 if(
$_GET[
'nodeId'] )
1874 $response->success =
true;
1875 $response->children = array();
1877 $key = array_search((
int)
$_GET[
'nodeId'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
1878 if(
false === $key )
1880 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$_GET[
'nodeId'];
1883 $children = $this->objCurrentTopic->getNestedSetPostChildren(
1884 (
int)$_GET[
'nodeId'],
1885 (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']
1889 $pageHits = $frm->getPageHits();
1891 $fetchedNodes = array();
1893 foreach( $children as $child )
1895 if($child[
'parent_pos'] != (
int)$_GET[
'nodeId'] &&
1896 !in_array($child[
'parent_pos'], $fetchedNodes))
1901 $fetchedNodes[] = $child[
'pos_pk'];
1903 $this->ctrl->setParameter($this,
'thr_pk', (
int)$_GET[
'thr_pk']);
1911 $responseChild =
new stdClass();
1912 $responseChild->nodeId = $child[
'pos_pk'];
1913 $responseChild->parentId = $child[
'parent_pos'];
1914 $responseChild->hasChildren = ($child[
'children'] >= 1);
1915 $responseChild->fetchedWithChildren = in_array((
int)$child[
'pos_pk'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
1916 $responseChild->html = $html;
1918 $response->children[] = $responseChild;
1928 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
1930 $response =
new stdClass();
1931 $response->success =
true;
1933 if(
$_GET[
'nodeId'] )
1935 if(
$_GET[
'nodeId'] > 0 )
1937 $key = array_search((
int)
$_GET[
'nodeId'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
1938 if(
false === $key )
1940 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$_GET[
'nodeId'];
1945 $key = array_search((
int)abs(
$_GET[
'nodeId']), (array)
$_SESSION[
'frm'][(
int)
$_GET[
'thr_pk']][
'openTreeNodes']);
1946 if(
false !== $key )
1948 unset(
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes'][$key]);
1954 shuffle(
$_SESSION[
'frm'][(
int)
$_GET[
'thr_pk']][
'openTreeNodes']);
1958 public function viewThreadObject()
1970 global
$tpl,
$lng,
$ilUser, $ilAccess, $rbacreview, $ilNavigationHistory,
$ilCtrl, $frm, $ilToolbar, $ilLocator;
1972 $tpl->addCss(
'./Modules/Forum/css/forum_tree.css');
1975 $_SESSION[
'viewmode'] = $this->objProperties->getDefaultView();
1979 if(!isset(
$_SESSION[
'thread_control'][
'old']))
2005 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
2007 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2015 $forumObj = $oForumObjects[
'forumObj'];
2019 $frm = $oForumObjects[
'frm'];
2023 $file_obj = $oForumObjects[
'file_obj'];
2028 if(!
$path = $file_obj->getFileDataByMD5Filename(
$_GET[
'file']))
2038 if(!$this->objCurrentTopic->getId())
2040 $ilCtrl->redirect($this,
'showThreads');
2044 $append =
'_'.$this->objCurrentTopic->getId().
2045 ($this->objCurrentPost->getId() ?
'_'.$this->objCurrentPost->getId() :
'');
2046 $tpl->setLoginTargetPar(
'frm_'.
$_GET[
'ref_id'].$append);
2049 if(
$_GET[
'action'] !=
'showreply' &&
$_GET[
'action'] !=
'showedit')
2053 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
2055 foreach(
$mobs as $mob)
2070 require_once
'./Modules/Forum/classes/class.ilObjForum.php';
2071 require_once
'./Modules/Forum/classes/class.ilFileDataForum.php';
2073 $lng->loadLanguageModule(
'forum');
2077 $ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
2079 $ilCtrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2080 $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this,
'showThreads'),
'frm');
2084 $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId());
2086 $this->prepareThreadScreen($forumObj);
2088 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_view.html',
'Modules/Forum');
2090 if(isset(
$_GET[
'anchor']))
2092 $tpl->setVariable(
'JUMP2ANCHOR_ID', (
int)
$_GET[
'anchor']);
2098 $orderField =
'frm_posts_tree.fpt_date';
2099 $this->objCurrentTopic->setOrderDirection(
2106 $orderField =
'frm_posts_tree.rgt';
2107 $this->objCurrentTopic->setOrderDirection(
'DESC');
2111 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2113 if(is_array($topicData = $frm->getOneTopic()))
2116 $this->objCurrentTopic->updateVisits();
2118 $tpl->setTitle($lng->txt(
'forums_thread').
" \"".$this->objCurrentTopic->getSubject().
"\"");
2122 $ilLocator->addRepositoryItems();
2123 $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this,
""),
"_top");
2129 $menutpl =
new ilTemplate(
'tpl.forums_threads_menu.html',
true,
true,
'Modules/Forum');
2131 include_once(
"./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
2134 if($ilUser->getId() != ANONYMOUS_USER_ID &&
2135 $forumObj->getCountUnread($ilUser->getId(), (int) $this->objCurrentTopic->getId()))
2137 $this->ctrl->setParameter($this,
'mark_read',
'1');
2138 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2139 $ilToolbar->addButton(
2140 $this->lng->txt(
'forums_mark_read'),
2141 $this->ctrl->getLinkTarget($this,
'viewThread'),
2145 $this->ctrl->clearParameters($this);
2149 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_thread', $this->objCurrentTopic->getId());
2150 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_top_fk', $this->objCurrentTopic->getForumId());
2151 $ilToolbar->addButton($this->lng->txt(
'forums_print_thread'),
2152 $this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printThread')
2154 $this->ctrl->clearParametersByClass(
'ilforumexportgui');
2158 if(
$_GET[
'mark_read'])
2160 $forumObj->markThreadRead($ilUser->getId(), (int)$this->objCurrentTopic->getId());
2165 require_once
'./Modules/Forum/classes/class.ilForum.php';
2167 if (
$_GET[
'action'] ==
'ready_delete' &&
$_POST[
'confirm'] !=
'')
2169 if(!$this->objCurrentTopic->isClosed() &&
2170 ($this->is_moderator ||
2171 ($this->objCurrentPost->isOwner($ilUser->getId()) && !$this->objCurrentPost->hasReplies())) &&
2172 $ilUser->getId() != ANONYMOUS_USER_ID)
2176 $frm->setForumId($forumObj->
getId());
2177 $frm->setForumRefId($forumObj->
getRefId());
2179 $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
2182 if ($dead_thr == $this->objCurrentTopic->getId())
2185 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($forumObj->
getId()));
2187 $topicData = $frm->getOneTopic();
2191 if ($topicData[
'top_num_threads'] > 0)
2193 $this->ctrl->redirect($this,
'showThreads');
2197 $this->ctrl->redirect($this,
'createThread');
2205 if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'ready_censor')
2207 if((
$_POST[
'confirm'] !=
'' ||
$_POST[
'no_cs_change'] !=
'') &&
$_GET[
'action'] ==
'ready_censor')
2209 $frm->postCensorship($this->
handleFormInput(
$_POST[
'formData'][
'cens_message']), $this->objCurrentPost->getId(), 1);
2211 else if((
$_POST[
'cancel'] !=
'' ||
$_POST[
'yes_cs_change'] !=
'') &&
$_GET[
'action'] ==
'ready_censor')
2213 $frm->postCensorship($this->
handleFormInput(
$_POST[
'formData'][
'cens_message']), $this->objCurrentPost->getId());
2218 $first_node = $this->objCurrentTopic->getFirstPostNode();
2219 $this->objCurrentTopic->setOrderField($orderField);
2220 $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
2223 if (!$posNum = count($subtree_nodes))
2228 $pageHits = $frm->getPageHits();
2233 if ($posNum > $pageHits)
2236 'ref_id' =>
$_GET[
'ref_id'],
2237 'thr_pk' => $this->objCurrentTopic->getId(),
2238 'orderby' =>
$_GET[
'orderby']
2241 if (!
$_GET[
'offset'])
2247 $Start =
$_GET[
'offset'];
2250 $linkbar =
ilUtil::Linkbar($ilCtrl->getLinkTarget($this,
'viewThread'), $posNum, $pageHits, $Start, $params);
2254 $menutpl->setCurrentBlock(
'linkbar');
2255 $menutpl->setVariable(
'LINKBAR', $linkbar);
2256 $menutpl->parseCurrentBlock();
2260 $tpl->setVariable(
'THREAD_MENU', $menutpl->get());
2266 foreach($subtree_nodes as $node)
2272 $this->ctrl->clearParameters($this);
2274 if($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId())
2279 if ($posNum > $pageHits && $z >= ($Start + $pageHits))
2282 if ($this->objCurrentPost->getId() && $jump < 1)
2284 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2285 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2286 $this->ctrl->setParameter($this,
'offset', ($Start + $pageHits));
2287 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
2288 $this->ctrl->redirect($this,
'viewThread', $this->objCurrentPost->getId());
2297 if(($posNum > $pageHits && $z >= $Start) || $posNum <= $pageHits)
2299 if($this->objCurrentPost->getId() == $node->getId())
2301 # actions for "active" post 2302 if($this->is_moderator || $node->isActivated())
2305 if(!$this->objCurrentTopic->isClosed() && (
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'showedit'))
2307 if(
$_GET[
'action'] ==
'showedit' &&
2308 ((!$this->is_moderator &&
2309 !$node->isOwner($ilUser->getId()) || $ilUser->getId() == ANONYMOUS_USER_ID) || $node->isCensored()))
2311 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2313 else if(
$_GET[
'action'] ==
'showreply' && !$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
2315 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2318 $tpl->setVariable(
'REPLY_ANKER', $this->objCurrentPost->getId());
2321 switch($this->objProperties->getSubjectSetting())
2323 case 'add_re_to_subject':
2327 case 'preset_subject':
2328 $subject = $this->objCurrentPost->getSubject();
2331 case 'empty_subject':
2337 switch($_GET[
'action'])
2340 if($this->ctrl->getCmd() ==
'savePost')
2342 $oEditReplyForm->setValuesByPost();
2344 else if($this->ctrl->getCmd() ==
'quotePost')
2346 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2349 $node->getUserAlias(),
2350 $node->getImportName()
2353 $oEditReplyForm->setValuesByPost();
2354 $oEditReplyForm->getItemByPostVar(
'message')->setValue(
2356 $frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()).
"\n".$oEditReplyForm->getInput(
'message'), 1
2362 $oEditReplyForm->setValuesByArray(array(
2364 'subject' => $subject,
2368 'del_file' => array()
2372 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2373 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2375 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum/');
2376 $jsTpl->setVariable(
'IL_FRM_QUOTE_CALLBACK_SRC',
2377 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true));
2378 $this->ctrl->clearParameters($this);
2379 $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
2382 if($this->ctrl->getCmd() ==
'savePost')
2384 $oEditReplyForm->setValuesByPost();
2388 $oEditReplyForm->setValuesByArray(array(
2390 'subject' => $this->objCurrentPost->getSubject(),
2392 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true :
false,
2394 'del_file' => array()
2399 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2400 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2401 $this->ctrl->setParameter($this,
'offset', (
int)$_GET[
'offset']);
2402 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2403 $this->ctrl->setParameter($this,
'action', $_GET[
'action']);
2404 $tpl->setVariable(
'FORM', $oEditReplyForm->getHTML());
2405 $this->ctrl->clearParameters($this);
2408 else if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'delete')
2410 if($this->is_moderator ||
2411 ($node->isOwner($ilUser->getId()) && !$node->hasReplies()) &&
2412 $ilUser->getId() != ANONYMOUS_USER_ID)
2415 $tpl->setVariable(
'FORM', $this->getDeleteFormHTML());
2418 else if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'censor')
2420 if($this->is_moderator)
2423 $tpl->setVariable(
'FORM', $this->getCensorshipFormHTML());
2428 if ($this->is_moderator)
2431 $tpl->setVariable(
'FORM', $this->getActivationFormHTML());
2437 if ($this->objCurrentPost->getId() != $node->getId() ||
2438 (
$_GET[
'action'] !=
'showreply' &&
2439 $_GET[
'action'] !=
'showedit' &&
2440 $_GET[
'action'] !=
'censor' &&
2441 $_GET[
'action'] !=
'delete' &&
2442 #!$this->displayConfirmPostDeactivation() && 2446 if($this->is_moderator || $node->isActivated())
2449 if(!$this->objCurrentTopic->isClosed() &&
2450 $ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']) &&
2451 !$node->isCensored()
2454 $tpl->setCurrentBlock(
'commands');
2455 $this->ctrl->setParameter($this,
'action',
'showreply');
2456 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2457 $this->ctrl->setParameter($this,
'offset', $Start);
2458 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2459 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2460 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2461 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'reply'));
2462 $this->ctrl->clearParameters($this);
2463 $tpl->parseCurrentBlock();
2467 if (!$this->objCurrentTopic->isClosed() &&
2468 ($node->isOwner($ilUser->getId()) || $this->is_moderator) &&
2469 !$node->isCensored() &&
2470 $ilUser->getId() != ANONYMOUS_USER_ID)
2472 $tpl->setCurrentBlock(
'commands');
2473 $this->ctrl->setParameter($this,
'action',
'showedit');
2474 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2475 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2476 $this->ctrl->setParameter($this,
'offset', $Start);
2477 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2478 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2479 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'edit'));
2480 $this->ctrl->clearParameters($this);
2481 $tpl->parseCurrentBlock();
2485 if (!$node->isCensored())
2487 $tpl->setCurrentBlock(
'commands');
2488 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_post', $node->getId());
2489 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'top_pk', $node->getForumId());
2490 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_pk', $node->getThreadId());
2491 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printPost'));
2492 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'print'));
2493 $this->ctrl->clearParameters($this);
2494 $tpl->parseCurrentBlock();
2497 # buttons for every post except the "active" 2498 if (!$this->objCurrentTopic->isClosed() &&
2499 ($this->is_moderator ||
2500 ($node->isOwner($ilUser->getId()) && !$node->hasReplies())) &&
2501 $ilUser->getId() != ANONYMOUS_USER_ID)
2504 $tpl->setCurrentBlock(
'commands');
2505 $this->ctrl->setParameter($this,
'action',
'delete');
2506 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2507 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2508 $this->ctrl->setParameter($this,
'offset', $Start);
2509 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2510 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2511 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'delete'));
2512 $this->ctrl->clearParameters($this);
2513 $tpl->parseCurrentBlock();
2519 $tpl->setCurrentBlock(
'commands');
2520 $this->ctrl->setParameter($this,
'action',
'censor');
2521 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2522 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2523 $this->ctrl->setParameter($this,
'offset', $Start);
2524 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2525 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2526 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'censorship'));
2527 $this->ctrl->clearParameters($this);
2528 $tpl->parseCurrentBlock();
2531 $tpl->setCurrentBlock(
'commands');
2532 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2533 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2534 $this->ctrl->setParameter($this,
'offset', $Start);
2535 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2537 if (!$node->isActivated())
2539 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'askForPostActivation', $node->getId()));
2540 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'activate_post'));
2542 $this->ctrl->clearParameters($this);
2543 $tpl->parseCurrentBlock();
2547 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2548 !$node->isPostRead())
2550 $tpl->setCurrentBlock(
'commands');
2551 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2552 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2553 $this->ctrl->setParameter($this,
'offset', $Start);
2554 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2555 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2556 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'markPostRead', $node->getId()));
2557 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'is_read'));
2558 $this->ctrl->clearParameters($this);
2559 $tpl->parseCurrentBlock();
2563 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2564 $node->isPostRead())
2566 $tpl->setCurrentBlock(
'commands');
2567 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2568 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2569 $this->ctrl->setParameter($this,
'offset', $Start);
2570 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2571 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2572 $tpl->setVariable(
'COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this,
'markPostUnread', $node->getId()));
2573 $tpl->setVariable(
'COMMANDS_TXT', $lng->txt(
'unread'));
2574 $this->ctrl->clearParameters($this);
2575 $tpl->parseCurrentBlock();
2582 if (count($tmp_file_obj->getFilesOfPost()))
2584 if ($node->getId() != $this->objCurrentPost->getId() ||
$_GET[
'action'] !=
'showedit')
2586 foreach ($tmp_file_obj->getFilesOfPost() as
$file)
2588 $tpl->setCurrentBlock(
'attachment_download_row');
2589 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2590 $this->ctrl->setParameter($this,
'file',
$file[
'md5']);
2591 $tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this,
'viewThread'));
2592 $tpl->setVariable(
'TXT_FILENAME',
$file[
'name']);
2593 $this->ctrl->clearParameters($this);
2594 $tpl->parseCurrentBlock();
2596 $tpl->setCurrentBlock(
'attachments');
2597 $tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD',$lng->txt(
'forums_attachments'));
2599 $tpl->setVariable(
'TXT_DOWNLOAD_ATTACHMENT', $lng->txt(
'forums_download_attachment'));
2600 $tpl->parseCurrentBlock();
2604 $tpl->setCurrentBlock(
'posts_row');
2607 $tpl->setVariable(
'POST_ANKER', $node->getId());
2611 $tpl->setVariable(
'TXT_PERMA_LINK', $lng->txt(
'perma_link'));
2612 $tpl->setVariable(
'PERMA_TARGET',
'_top');
2614 if($this->objProperties->getMarkModeratorPosts() == 1)
2619 $rowCol =
'ilModeratorPosting';
2624 if ((
$_GET[
'action'] !=
'delete' &&
$_GET[
'action'] !=
'censor' &&
2625 #!$this->displayConfirmPostDeactivation() &&
2628 || $this->objCurrentPost->getId() != $node->getId())
2630 $tpl->setVariable(
'ROWCOL',
' '.$rowCol);
2635 $rowCol =
'tblrowmarked';
2639 if ($node->isCensored())
2642 if (
$_GET[
'action'] !=
'censor')
2644 $tpl->setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
2648 $rowCol =
'tblrowmarked';
2652 $tpl->setVariable(
'ROWCOL',
' '.$rowCol);
2654 if(!$node->isActivated() && $node->isOwner($ilUser->getId()))
2656 $tpl->setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
2660 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2661 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2662 $backurl = urlencode($this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2663 $this->ctrl->clearParameters($this);
2665 $this->ctrl->setParameter($this,
'backurl', $backurl);
2666 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2667 $this->ctrl->setParameter($this,
'user', $node->getUserId());
2669 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2672 $node->getUserAlias(),
2673 $node->getImportName(),
2675 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
2679 $this->ctrl->clearParameters($this);
2681 $tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
2682 if($authorinfo->getAuthorName(
true))
2684 $tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
2687 $tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
2690 if($authorinfo->getAuthor()->getGender() ==
'f')
2692 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
2694 else if($authorinfo->getAuthor()->getGender() ==
'm')
2696 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
2701 if ($node->getUpdateUserId() > 0)
2706 $posMod = $frm->getModeratorFromPost($node->getId());
2708 if (is_array($posMod) && $posMod[
'top_mods'] > 0)
2710 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
2712 if (is_array($MODS))
2714 if (in_array($node->getUpdateUserId(), $MODS))
2715 $spanClass =
'moderator_small';
2719 $node->setChangeDate($node->getChangeDate());
2721 if ($spanClass ==
'') $spanClass =
'small';
2723 $this->ctrl->setParameter($this,
'backurl', $backurl);
2724 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2725 $this->ctrl->setParameter($this,
'user', $node->getUpdateUserId());
2727 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2729 $node->getUpdateUserId(),
2733 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
2737 $this->ctrl->clearParameters($this);
2739 $tpl->setVariable(
'POST_UPDATE_TXT', $lng->txt(
'edited_on').
': '.$frm->convertDate($node->getChangeDate()).
' - '.strtolower($lng->txt(
'by')));
2740 $tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
2741 if($authorinfo->getAuthorName(
true))
2743 $tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
2750 $node->setMessage($frm->prepareText($node->getMessage()));
2752 if($ilUser->getId() == ANONYMOUS_USER_ID ||
2753 $node->isPostRead())
2755 $tpl->setVariable(
'SUBJECT', $node->getSubject());
2759 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2760 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2761 $this->ctrl->setParameter($this,
'offset', $Start);
2762 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2763 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2764 $mark_post_target = $this->ctrl->getLinkTarget($this,
'markPostRead', $node->getId());
2766 $tpl->setVariable(
'SUBJECT',
"<a href=\"".$mark_post_target.
"\"><b>".$node->getSubject().
"</b></a>");
2770 $tpl->setVariable(
'POST_DATE', $frm->convertDate($node->getCreateDate()));
2772 if (!$node->isCensored() ||
2773 ($this->objCurrentPost->getId() == $node->getId() && $_GET[
'action'] ==
'censor'))
2776 $modAuthor = $frm->getModeratorFromPost($node->getId());
2780 if (is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
2784 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
2786 if (is_array($MODS))
2788 if (in_array($node->getUserId(), $MODS))
2789 $spanClass =
'moderator';
2794 if($node->getMessage() == strip_tags($node->getMessage()))
2797 $node->setMessage(nl2br($node->getMessage()));
2800 if ($spanClass !=
"")
2811 $tpl->setVariable(
'POST',
"<span class=\"moderator\">".nl2br($node->getCensorshipComment()).
"</span>");
2814 $tpl->parseCurrentBlock();
2822 $tpl->setCurrentBlock(
'posts_no');
2823 $tpl->setVariable(
'TXT_MSG_NO_POSTS_AVAILABLE', $lng->txt(
'forums_posts_not_available'));
2824 $tpl->parseCurrentBlock();
2827 $oThreadToolbar = clone $ilToolbar;
2828 $oThreadToolbar->addSeparator();
2829 $oThreadToolbar->addButton($this->lng->txt(
'top_of_page'),
'#frm_page_top');
2830 $tpl->setVariable(
'THREAD_TOOLBAR', $oThreadToolbar->getHTML());
2832 $tpl->setVariable(
'TPLPATH', $tpl->vars[
'TPLPATH']);
2835 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
2836 $permalink =
new ilPermanentLinkGUI(
'frm', $this->object->getRefId(),
'_'.$this->objCurrentTopic->getId());
2837 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
2851 $subject = $this->objCurrentPost->getSubject();
2852 $re_txt = $this->lng->txt(
'post_reply');
2854 $re_txt_with_num = str_replace(
':',
'(',$re_txt);
2855 $search_length = strlen($re_txt_with_num);
2856 $comp = substr_compare($re_txt_with_num, substr($subject, 0 , $search_length), 0, $search_length);
2860 $modified_subject = $subject;
2861 if($on_reply ==
true)
2864 $str_pos_start = strpos($subject,
'(');
2865 $str_pos_end = strpos($subject,
')');
2867 $length = ((int)$str_pos_end - (
int)$str_pos_start);
2869 $txt_number = substr($subject, $str_pos_start, $length - 1);
2871 if(is_numeric($txt_number))
2873 $re_count = (int)$txt_number + 1;
2874 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
2880 $re_count = substr_count($subject, $re_txt);
2881 if($re_count >= 1 && $on_reply ==
true)
2883 $subject = str_replace($re_txt,
'', $subject);
2887 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
2889 else if($re_count >= 1 && $on_reply ==
false)
2893 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
2895 else if($re_count == 0)
2898 $modified_subject = $this->lng->txt(
'post_reply').
' '. $this->objCurrentPost->getSubject();
2901 return $modified_subject;
2904 public function showUserObject()
2915 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
2917 $add = $this->getUserProfileAdditional(
$_GET[
'ref_id'],
$_GET[
'user']);
2918 $profile_gui->setAdditional($add);
2919 $profile_gui->setBackUrl(
$_GET[
'backurl']);
2920 $tpl->setContent($this->ctrl->getHTML($profile_gui));
2923 protected function getUserProfileAdditional($a_forum_ref_id, $a_user_id)
2929 global
$lng, $ilAccess;
2931 if(!$ilAccess->checkAccess(
'read',
'', $a_forum_ref_id))
2933 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2936 require_once
'Modules/Forum/classes/class.ilForum.php';
2938 $lng->loadLanguageModule(
'forum');
2944 if($ref_obj->getType() ==
'frm')
2947 $frm = $forumObj->Forum;
2948 $frm->setForumId($forumObj->
getId());
2949 $frm->setForumRefId($forumObj->
getRefId());
2957 if($ilAccess->checkAccess(
'moderate_frm',
'', $a_forum_ref_id))
2959 $numPosts = $frm->countUserArticles(addslashes($a_user_id));
2963 $numPosts = $frm->countActiveUserArticles(addslashes($a_user_id));
2966 return array($lng->txt(
'forums_posts') => $numPosts);
2969 public function performThreadsActionObject()
2978 if(isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids']))
2980 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] ==
'move')
2982 if($this->is_moderator)
2985 $this->moveThreadsObject();
2988 else if(
$_POST[
'selected_cmd'] ==
'enable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
2990 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
2993 $tmp_obj->enableNotification($ilUser->getId());
2997 $this->ctrl->redirect($this,
'showThreads');
2999 else if(
$_POST[
'selected_cmd'] ==
'disable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
3001 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3004 $tmp_obj->disableNotification($ilUser->getId());
3008 $this->ctrl->redirect($this,
'showThreads');
3011 else if(
$_POST[
'selected_cmd'] ==
'close')
3013 if($this->is_moderator)
3015 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3023 $this->ctrl->redirect($this,
'showThreads');
3025 else if(
$_POST[
'selected_cmd'] ==
'reopen')
3027 if($this->is_moderator)
3029 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3037 $this->ctrl->redirect($this,
'showThreads');
3039 else if(
$_POST[
'selected_cmd'] ==
'makesticky')
3041 if($this->is_moderator)
3043 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3046 $tmp_obj->makeSticky();
3051 $this->ctrl->redirect($this,
'showThreads');
3053 else if(
$_POST[
'selected_cmd'] ==
'unmakesticky')
3055 if($this->is_moderator)
3057 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3060 $tmp_obj->unmakeSticky();
3065 $this->ctrl->redirect($this,
'showThreads');
3067 else if(
$_POST[
'selected_cmd'] ==
'editThread')
3069 if($this->is_moderator)
3071 $count = count(
$_POST[
'thread_ids']);
3075 $this->ctrl->redirect($this,
'showThreads');
3079 foreach(
$_POST[
'thread_ids'] as $thread_id)
3081 return $this->editThreadObject($thread_id, null);
3086 $this->ctrl->redirect($this,
'showThreads');
3088 else if(
$_POST[
'selected_cmd'] ==
'html')
3090 $this->ctrl->setCmd(
'exportHTML');
3091 $this->ctrl->setCmdClass(
'ilForumExportGUI');
3094 else if(
$_POST[
'selected_cmd'] ==
'confirmDeleteThreads')
3096 $this->confirmDeleteThreads();
3098 else if(
$_POST[
'selected_cmd'] ==
'merge')
3104 ilUtil::sendInfo($this->lng->txt(
'topics_please_select_one_action'),
true);
3105 $this->ctrl->redirect($this,
'showThreads');
3111 $this->ctrl->redirect($this,
'showThreads');
3115 public function performMoveThreadsObject()
3121 global
$lng, $ilObjDataCache;
3123 if(!$this->is_moderator)
3125 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3128 if(isset(
$_POST[
'frm_ref_id']) && (int)
$_POST[
'frm_ref_id'])
3130 $this->
object->Forum->moveThreads((array)
$_SESSION[
'threads2move'], $this->object->getRefId(), $ilObjDataCache->lookupObjId($_POST[
'frm_ref_id']));
3132 unset($_SESSION[
'threads2move']);
3134 $this->ctrl->redirect($this,
'showThreads');
3139 $this->moveThreadsObject();
3143 public function cancelMoveThreadsObject()
3150 if(!$this->is_moderator)
3152 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3157 $this->ctrl->redirect($this,
'showThreads');
3160 public function moveThreadsObject()
3169 if(!$this->is_moderator)
3171 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3174 $threads2move =
$_SESSION[
'threads2move'];
3175 if(!count($threads2move))
3178 $this->ctrl->redirect($this,
'showThreads');
3181 require_once
'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php';
3183 $exp->setPathOpen($this->object->getRefId());
3184 $exp->setNodeSelected(isset(
$_POST[
'frm_ref_id']) && (
int)
$_POST[
'frm_ref_id'] ? (
int)
$_POST[
'frm_ref_id'] : 0);
3185 $exp->setCurrentFrmRefId($this->object->getRefId());
3186 $exp->setHighlightedNode($this->object->getRefId());
3187 if(!$exp->handleCommand())
3189 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_move.html',
'Modules/Forum');
3192 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this));
3195 $tblThr->setId(
'il_frm_thread_move_table_'.$this->object->getRefId());
3196 $tblThr->setTitle($this->lng->txt(
'move_chosen_topics'));
3197 $tblThr->addColumn($this->lng->txt(
'subject'),
'top_name',
'100%');
3198 $tblThr->disable(
'header');
3199 $tblThr->disable(
'footer');
3200 $tblThr->disable(
'linkbar');
3201 $tblThr->disable(
'sort');
3202 $tblThr->disable(
'linkbar');
3203 $tblThr->setLimit(PHP_INT_MAX);
3204 $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html',
'Modules/Forum');
3205 $tblThr->setDefaultOrderField(
'is_sticky');
3208 foreach($threads2move as $thr_pk)
3212 $result[$counter][
'num'] = $counter + 1;
3219 $this->tpl->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
3221 $this->tpl->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
3222 $this->tpl->setVariable(
'CMD_SUBMIT',
'performMoveThreads');
3223 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'move'));
3224 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this,
'performMoveThreads'));
3230 private function initTopicCreateForm()
3242 $this->create_topic_form_gui->setTitle($this->lng->txt(
'forums_new_thread'));
3244 $this->create_topic_form_gui->setTableWidth(
'100%');
3247 $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this,
'addThread'));
3249 if($this->objProperties->isAnonymized() == 1)
3251 $alias_gui =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
3252 $alias_gui->
setInfo($this->lng->txt(
'forums_use_alias'));
3253 $alias_gui->setMaxLength(255);
3254 $alias_gui->setSize(50);
3255 $this->create_topic_form_gui->addItem($alias_gui);
3260 $alias_gui->
setValue($ilUser->getLogin());
3261 $this->create_topic_form_gui->addItem($alias_gui);
3265 $subject_gui =
new ilTextInputGUI($this->lng->txt(
'forums_thread'),
'subject');
3267 $subject_gui->setSize(50);
3268 $subject_gui->setRequired(
true);
3269 $this->create_topic_form_gui->addItem($subject_gui);
3274 $post_gui->setRows(15);
3275 $post_gui->setRequired(
true);
3276 $post_gui->setUseRte(
true);
3277 $post_gui->addPlugin(
'latex');
3278 $post_gui->addButton(
'latex');
3279 $post_gui->addButton(
'pastelatex');
3280 $post_gui->addPlugin(
'ilfrmquote');
3282 $post_gui->removePlugin(
'advlink');
3283 $post_gui->usePurifier(
true);
3284 $post_gui->setRTERootBlockElement(
'');
3285 $post_gui->setRTESupport($ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.4.7');
3286 $post_gui->disableButtons(array(
3304 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
3306 $this->create_topic_form_gui->addItem($post_gui);
3311 $this->create_topic_form_gui->addItem($fi);
3313 include_once
'Services/Mail/classes/class.ilMail.php';
3314 $umail =
new ilMail($ilUser->getId());
3316 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
3317 !$this->objProperties->isAnonymized())
3320 $dir_notification_gui =
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'),
'notify');
3321 $dir_notification_gui->
setInfo($this->lng->txt(
'forum_notify_me_directly'));
3322 $dir_notification_gui->setValue(1);
3323 $this->create_topic_form_gui->addItem($dir_notification_gui);
3325 if($ilias->getSetting(
'forum_notification') != 0)
3328 $gen_notification_gui =
new ilCheckboxInputGUI($this->lng->txt(
'forum_general_notification'),
'notify_posts');
3329 $gen_notification_gui->
setInfo($this->lng->txt(
'forum_notify_me_generally'));
3330 $gen_notification_gui->setValue(1);
3331 $this->create_topic_form_gui->addItem($gen_notification_gui);
3335 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
3337 $ilUser->isAnonymous() &&
3338 !$ilUser->isCaptchaVerified() &&
3339 ilCaptchaUtil::isActiveForForum()
3342 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
3343 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
3345 $this->create_topic_form_gui->addItem($captcha);
3347 $this->create_topic_form_gui->addCommandButton(
'addThread', $this->lng->txt(
'create'));
3348 $this->create_topic_form_gui->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
3353 $this->create_topic_form_gui->setValuesByArray(array(
3362 public function createThreadObject()
3368 global $ilAccess,
$lng;
3370 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
3372 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3375 $this->initTopicCreateForm();
3378 $create_form =
new ilTemplate(
'tpl.create_thread_form.html',
true,
true,
'Modules/Forum');
3379 $create_form->setVariable(
'CREATE_FORM',$this->create_topic_form_gui->getHTML());
3380 $create_form->parseCurrentBlock();
3382 $this->tpl->setContent($create_form->get());
3385 public function addThreadObject($a_prevent_redirect =
false)
3394 $frm = $this->
object->Forum;
3395 $frm->setForumId($this->object->getId());
3396 $frm->setForumRefId($this->object->getRefId());
3398 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
3400 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3403 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
3405 $topicData = $frm->getOneTopic();
3407 $this->initTopicCreateForm();
3408 if($this->create_topic_form_gui->checkInput())
3410 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
3412 $ilUser->isAnonymous() &&
3413 !$ilUser->isCaptchaVerified() &&
3414 ilCaptchaUtil::isActiveForForum()
3417 $ilUser->setCaptchaVerified(
true);
3420 if($this->objProperties->isAnonymized())
3422 if(!strlen($this->create_topic_form_gui->getInput(
'alias')))
3424 $user_alias = $this->lng->txt(
'forums_anonymous');
3428 $user_alias = $this->create_topic_form_gui->getInput(
'alias');
3433 $user_alias = $ilUser->getLogin();
3438 $this->objProperties->isPostActivationEnabled() &&
3439 !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
3446 $newPost = $frm->generateThread(
3447 $topicData[
'top_pk'],
3448 ($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()),
3449 $this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'),
false),
3451 $this->create_topic_form_gui->getItemByPostVar(
'notify') ? (int)$this->create_topic_form_gui->getInput(
'notify') : 0,
3452 $this->create_topic_form_gui->getItemByPostVar(
'notify_posts') ? (int)$this->create_topic_form_gui->getInput(
'notify_posts') : 0,
3458 $file = $_FILES[
'userfile'];
3463 $tmp_file_obj =
new ilFileDataForum($this->object->getId(), $newPost);
3468 $frm->setDbTable(
'frm_data');
3469 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
3470 $frm->updateVisits($topicData[
'top_pk']);
3472 $frm->setMDB2WhereCondition(
'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
3473 array(
'integer',
'text'), array($topicData[
'top_pk'], $this->create_topic_form_gui->getInput(
'subject')));
3476 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
3478 foreach($mediaObjects as $mob)
3487 if($this->
ilias->getSetting(
'forum_notification') == 1)
3490 $objPost =
new ilForumPost((
int)$newPost, $this->is_moderator);
3491 $post_data = array();
3492 $post_data = $objPost->getDataAsArray();
3494 $post_data[
"top_name"] = $titles[0];
3495 $post_data[
"ref_id"] =$this->
object->getRefId();
3497 $frm->sendForumNotifications($post_data);
3499 if(!$a_prevent_redirect)
3502 $this->ctrl->redirect($this);
3511 $this->create_topic_form_gui->setValuesByPost();
3513 if(!$this->objProperties->isAnonymized())
3515 $this->create_topic_form_gui->getItemByPostVar(
'alias')->setValue($ilUser->getLogin());
3518 return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
3522 public function enableForumNotificationObject()
3529 $frm = $this->
object->Forum;
3530 $frm->setForumId($this->object->getId());
3531 $frm->enableForumNotification($ilUser->getId());
3533 if(!$this->objCurrentTopic->getId())
3540 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3541 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_enabled'),
true);
3542 $this->ctrl->redirect($this,
'viewThread');
3546 public function disableForumNotificationObject()
3553 $frm = $this->
object->Forum;
3554 $frm->setForumId($this->object->getId());
3555 $frm->disableForumNotification($ilUser->getId());
3557 if(!$this->objCurrentTopic->getId())
3564 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3565 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_disabled'),
true);
3566 $this->ctrl->redirect($this,
'viewThread');
3581 global
$lng, $ilAccess;
3583 $column_gui->
setBlockProperty(
'news',
'title', $lng->txt(
'frm_latest_postings'));
3587 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
3590 $enable_internal_rss = $news_set->get(
'enable_rss_for_internal');
3591 if($enable_internal_rss)
3594 $column_gui->
setBlockProperty(
'news',
'public_notifications_option',
true);
3602 global $ilObjDataCache;
3604 if (!
$_POST[
'clone_source'])
3607 if (isset(
$_SESSION[
'wizard_search_title']))
3609 $this->searchCloneSourceObject();
3617 $source_id =
$_POST[
'clone_source'];
3620 $this->ctrl->setParameter($this,
'clone_source', (
int)
$_POST[
'clone_source']);
3621 $this->ctrl->setParameter($this,
'new_type', $new_type);
3623 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.frm_wizard_page.html',
'Modules/Forum');
3624 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this));
3626 $this->tpl->setVariable(
'ALT_IMG', $this->lng->txt(
'obj_'.$new_type));
3627 $this->tpl->setVariable(
'TXT_DUPLICATE', $this->lng->txt(
'frm_wizard_page'));
3628 $this->tpl->setVariable(
'INFO_THREADS', $this->lng->txt(
'fmr_copy_threads_info'));
3629 $this->tpl->setVariable(
'THREADS', $this->lng->txt(
'forums_threads'));
3631 $forum_id = $ilObjDataCache->lookupObjId((
int) $_POST[
'clone_source']);
3632 include_once(
'Modules/Forum/classes/class.ilForum.php');
3634 foreach ($threads as $thread_id => $title)
3636 $this->tpl->setCurrentBlock(
'thread_row');
3637 $this->tpl->setVariable(
'CHECK_THREAD',
ilUtil::formCheckbox(0,
'cp_options['.$source_id.
'][threads][]', $thread_id));
3638 $this->tpl->setVariable(
'NAME_THREAD', $title);
3639 $this->tpl->parseCurrentBlock();
3641 $this->tpl->setVariable(
'SELECT_ALL', $this->lng->txt(
'select_all'));
3642 $this->tpl->setVariable(
'JS_FIELD',
'cp_options['.$source_id.
'][threads]');
3643 $this->tpl->setVariable(
'BTN_COPY', $this->lng->txt(
'obj_'.$new_type.
'_duplicate'));
3644 if (isset(
$_SESSION[
'wizard_search_title']))
3646 $this->tpl->setVariable(
'BACK_CMD',
'searchCloneSource');
3650 $this->tpl->setVariable(
'BACK_CMD',
'create');
3652 $this->tpl->setVariable(
'BTN_BACK', $this->lng->txt(
'btn_back'));
3661 if($this->
object instanceof
ilObject)
3663 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
''),
'', $this->
object->getRefId());
3669 $a_text = str_replace(
"<",
"<", $a_text);
3670 $a_text = str_replace(
">",
">", $a_text);
3679 $a_text = str_replace(
"<",
"<", $a_text);
3680 $a_text = str_replace(
">",
">", $a_text);
3692 $this->ctrl->setCmd(
'showSummary');
3693 $this->ctrl->setCmdClass(
'ilinfoscreengui');
3694 $this->infoScreen();
3697 public function infoScreen()
3704 if(!$ilAccess->checkAccess(
'visible',
'', $this->object->getRefId()))
3706 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->
ilias->error_obj->MESSAGE);
3709 include_once
'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
3712 $info->enablePrivateNotes();
3715 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
3718 $this->ctrl->forwardCommand($info);
3721 public function updateNotificationSettingsObject()
3727 global $ilAccess,
$ilErr;
3728 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
3730 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
3737 if($this->notificationSettingsForm->checkInput())
3739 if(isset(
$_POST[
'notification_type']) &&
$_POST[
'notification_type']==
'all_users')
3742 $this->objProperties->setAdminForceNoti(1);
3743 $this->objProperties->setUserToggleNoti((
int) $this->notificationSettingsForm->getInput(
'usr_toggle'));
3744 $this->objProperties->setNotificationType(
'all_users');
3747 else if(
$_POST[
'notification_type']==
'per_user')
3749 $this->objProperties->setNotificationType(
'per_user');
3750 $this->objProperties->setAdminForceNoti(1);
3751 $this->objProperties->setUserToggleNoti(0);
3756 $this->objProperties->setNotificationType(
'default');
3757 $this->objProperties->setAdminForceNoti(0);
3758 $this->objProperties->setUserToggleNoti(0);
3759 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3764 $this->objProperties->update();
3769 $this->notificationSettingsForm->setValuesByPost();
3771 return $this->showMembersObject();
3776 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3778 $oParticipants = $this->getParticipantsObject();
3781 $moderator_ids = $frm_noti->
_getModerators($this->object->getRefId());
3783 $admin_ids = $oParticipants->getAdmins();
3784 $member_ids = $oParticipants->getMembers();
3785 $tutor_ids = $oParticipants->getTutors();
3787 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
3788 $all_forum_users= array_unique($all_forum_users);
3790 $all_notis = $frm_noti->read();
3792 foreach($all_forum_users as $user_id)
3794 $frm_noti->setUserId($user_id);
3796 $frm_noti->setAdminForce(1);
3797 $frm_noti->setUserToggle($this->objProperties->isUserToggleNoti());
3799 if(array_key_exists($user_id, $all_notis) && $update_all_users)
3801 $frm_noti->update();
3803 else if($frm_noti->existsNotification() ==
false)
3805 $frm_noti->insertAdminForce();
3812 if(null === $this->notificationSettingsForm)
3815 $form->setFormAction($this->ctrl->getFormAction($this,
'updateNotificationSettings'));
3816 $form->setTitle($this->lng->txt(
'forums_notification_settings'));
3819 $radio_grp->setValue(
'default');
3821 $opt_default =
new ilRadioOption($this->lng->txt(
"user_decides_notification"),
'default');
3822 $opt_0 =
new ilRadioOption($this->lng->txt(
"settings_for_all_members"),
'all_users');
3823 $opt_1 =
new ilRadioOption($this->lng->txt(
"settings_per_users"),
'per_user');
3825 $radio_grp->addOption($opt_default,
'default');
3826 $radio_grp->addOption($opt_0,
'all_users');
3827 $radio_grp->addOption($opt_1,
'per_user');
3833 $form->addItem($radio_grp);
3835 $form->addCommandButton(
'updateNotificationSettings', $this->lng->txt(
'save'));
3837 $this->notificationSettingsForm = $form;
3847 $icon = $user_toggle_noti
3848 ?
"<img src=\"".ilUtil::getImagePath(
"icon_ok.png").
"\" alt=\"".$this->lng->txt(
"enabled").
"\" title=\"".$this->lng->txt(
"enabled").
"\" border=\"0\" vspace=\"0\"/>" 3849 :
"<img src=\"".ilUtil::getImagePath(
"icon_not_ok.png").
"\" alt=\"".$this->lng->txt(
"disabled").
"\" title=\"".$this->lng->txt(
"disabled").
"\" border=\"0\" vspace=\"0\"/>";
3853 public function showMembersObject()
3864 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
3866 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
3869 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_members_list.html',
'Modules/Forum');
3871 $ilTabs->setTabActive(
'settings');
3872 $this->settingsTabs();
3878 $this->notificationSettingsForm->setValuesByArray(array(
3879 'notification_type' => $this->objProperties->getNotificationType(),
3880 'adm_force' => (bool) $this->objProperties->isAdminForceNoti(),
3881 'usr_toggle' => (bool) $this->objProperties->isUserToggleNoti()
3886 $tpl->setVariable(
'NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
3888 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3889 include_once
'Modules/Forum/classes/class.ilObjForum.php';
3892 $oParticipants = $this->getParticipantsObject();
3894 $moderator_ids = $frm_noti->_getModerators($this->object->getRefId());
3896 $admin_ids = $oParticipants->getAdmins();
3897 $member_ids = $oParticipants->getMembers();
3898 $tutor_ids = $oParticipants->getTutors();
3900 if($this->objProperties->getNotificationType() ==
'default')
3903 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
3905 $forum_noti->
setAdminForce($this->objProperties->isAdminForceNoti());
3906 $forum_noti->setUserToggle($this->objProperties->isUserToggleNoti());
3907 $forum_noti->setForumId($this->objProperties->getObjId());
3909 else if($this->objProperties->getNotificationType() ==
'per_user')
3916 $this->__showMembersTable($moderators, $admins, $members, $tutors);
3924 foreach($user_ids as $user_id)
3928 $icon_ok = $this->
getIcon(!$user_toggle_noti);
3933 $users[$counter][
'firstname'] = $name[
'firstname'];
3934 $users[$counter][
'lastname'] = $name[
'lastname'];
3935 $users[$counter][
'user_toggle_noti'] = $icon_ok;
3941 private function __showMembersTable($moderators, $admins, $members, $tutors)
3953 $tbl_mod->setId(
'tbl_id_mod');
3954 $tbl_mod->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
3955 $tbl_mod->setTitle($lng->txt(
'moderators'));
3957 $tbl_mod->addColumn(
'',
'',
'1%',
true);
3958 $tbl_mod->addColumn($lng->txt(
'login'),
'',
'10%');
3959 $tbl_mod->addColumn($lng->txt(
'firstname'),
'',
'10%');
3960 $tbl_mod->addColumn($lng->txt(
'lastname'),
'',
'10%');
3961 $tbl_mod->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
3962 $tbl_mod->setSelectAllCheckbox(
'user_id');
3964 $tbl_mod->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
3965 $tbl_mod->setData($moderators);
3967 $tbl_mod->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
3968 $tbl_mod->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
3970 $tpl->setCurrentBlock(
'moderators_table');
3971 $tpl->setVariable(
'MODERATORS',$tbl_mod->getHTML());
3977 $tbl_adm->setId(
'tbl_id_adm');
3978 $tbl_adm->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
3979 $tbl_adm->setTitle($lng->txt(
'administrator'));
3981 $tbl_adm->addColumn(
'',
'',
'1%',
true);
3982 $tbl_adm->addColumn($lng->txt(
'login'),
'',
'10%');
3983 $tbl_adm->addColumn($lng->txt(
'firstname'),
'',
'10%');
3984 $tbl_adm->addColumn($lng->txt(
'lastname'),
'',
'10%');
3985 $tbl_adm->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
3986 $tbl_adm->setSelectAllCheckbox(
'user_id');
3987 $tbl_adm->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
3989 $tbl_adm->setData($admins);
3990 $tbl_adm->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
3991 $tbl_adm->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
3993 $tpl->setCurrentBlock(
'admins_table');
3994 $tpl->setVariable(
'ADMINS',$tbl_adm->getHTML());
4000 $tbl_mem->setId(
'tbl_id_mem');
4001 $tbl_mem->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4002 $tbl_mem->setTitle($lng->txt(
'members'));
4004 $tbl_mem->addColumn(
'',
'',
'1%',
true);
4005 $tbl_mem->addColumn($lng->txt(
'login'),
'',
'10%');
4006 $tbl_mem->addColumn($lng->txt(
'firstname'),
'',
'10%');
4007 $tbl_mem->addColumn($lng->txt(
'lastname'),
'',
'10%');
4008 $tbl_mem->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4009 $tbl_mem->setSelectAllCheckbox(
'user_id');
4010 $tbl_mem->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4011 $tbl_mem->setData($members);
4013 $tbl_mem->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4014 $tbl_mem->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4016 $tpl->setCurrentBlock(
'members_table');
4017 $tpl->setVariable(
'MEMBERS',$tbl_mem->getHTML());
4023 $tbl_tut->setId(
'tbl_id_tut');
4024 $tbl_tut->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4025 $tbl_tut->setTitle($lng->txt(
'tutors'));
4027 $tbl_tut->addColumn(
'',
'',
'1%',
true);
4028 $tbl_tut->addColumn($lng->txt(
'login'),
'',
'10%');
4029 $tbl_tut->addColumn($lng->txt(
'firstname'),
'',
'10%');
4030 $tbl_tut->addColumn($lng->txt(
'lastname'),
'',
'10%');
4031 $tbl_tut->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4032 $tbl_tut->setSelectAllCheckbox(
'user_id');
4033 $tbl_tut->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4034 $tbl_tut->setData($tutors);
4036 $tbl_tut->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4037 $tbl_tut->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4039 $tpl->setCurrentBlock(
'tutors_table');
4040 $tpl->setVariable(
'TUTORS',$tbl_tut->getHTML());
4044 public function enableAdminForceNotiObject()
4050 global $ilAccess,
$ilErr;
4051 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4053 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4056 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4062 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4065 foreach(
$_POST[
'user_id'] as $user_id)
4068 $is_enabled = $frm_noti->isAdminForceNotification();
4070 $frm_noti->setUserToggle(0);
4073 $frm_noti->setAdminForce(1);
4074 $frm_noti->insertAdminForce();
4081 $this->showMembersObject();
4084 public function disableAdminForceNotiObject()
4090 global $ilAccess,
$ilErr;
4091 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4093 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4096 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4102 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4105 foreach(
$_POST[
'user_id'] as $user_id)
4108 $is_enabled = $frm_noti->isAdminForceNotification();
4112 $frm_noti->deleteAdminForce();
4119 $this->showMembersObject();
4122 public function enableHideUserToggleNotiObject()
4128 global $ilAccess,
$ilErr;
4129 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4131 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4133 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4139 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4142 foreach(
$_POST[
'user_id'] as $user_id)
4145 $is_enabled = $frm_noti->isAdminForceNotification();
4146 $frm_noti->setUserToggle(1);
4150 $frm_noti->setAdminForce(1);
4151 $frm_noti->insertAdminForce();
4155 $frm_noti->updateUserToggle();
4162 $this->showMembersObject();
4165 public function disableHideUserToggleNotiObject()
4171 global $ilAccess,
$ilErr;
4172 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4174 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4177 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4183 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4186 foreach(
$_POST[
'user_id'] as $user_id)
4189 $is_enabled = $frm_noti->isAdminForceNotification();
4190 $frm_noti->setUserToggle(0);
4193 $frm_noti->updateUserToggle();
4197 $frm_noti->setAdminForce(1);
4198 $frm_noti->insertAdminForce();
4205 $this->showMembersObject();
4208 public function markPostUnreadObject()
4215 if(isset(
$_GET[
'pos_pk']))
4217 $this->
object->markPostUnread($ilUser->getId(), (int)
$_GET[
'pos_pk']);
4220 $this->viewThreadObject();
4223 public function markPostReadObject()
4230 $this->
object->markPostRead($ilUser->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
4231 $this->viewThreadObject();
4241 $lg = parent::initHeaderAction();
4244 if($this->objCurrentTopic->getId())
4246 $container_obj = null;
4247 $lg->setContainerObject($container_obj);
4252 if($ilUser->getId() != ANONYMOUS_USER_ID && $this->
ilias->getSetting(
'forum_notification') != 0 )
4256 $frm = $this->
object->Forum;
4257 $frm->setForumId($this->object->getId());
4258 $frm->setForumRefId($this->object->getRefId());
4259 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4260 $frm_notificiation_enabled = $frm->isForumNotificationEnabled($ilUser->getId());
4262 if($this->objCurrentTopic->getId())
4264 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
4271 $frm_notificiation_enabled &&
4272 $is_user_allowed_to_deactivate_notification
4275 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
4279 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
4284 if($frm_notificiation_enabled)
4286 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
4290 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
4294 $topic_notification_enabled =
false;
4295 if($this->objCurrentTopic->getId())
4297 $topic_notification_enabled = $this->objCurrentTopic->isNotificationEnabled($ilUser->getId());
4298 if($topic_notification_enabled)
4300 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_disable_notification");
4304 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_enable_notification");
4307 $this->ctrl->setParameter($this,
'thr_pk',
'');
4309 if($frm_notificiation_enabled || $topic_notification_enabled)
4314 $this->lng->txt(
"frm_notification_activated")
4322 $this->lng->txt(
"frm_notification_deactivated")
4333 if($this->objProperties->getNotificationType() ==
'default')
4338 if($this->objProperties->isUserToggleNoti() == 0)
4347 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4350 $frm_noti->setUserId($ilUser->getId());
4352 $user_toggle = (int)$frm_noti->isUserToggleNotification();
4353 if($user_toggle == 0)
4367 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
4368 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
4370 if($grp_ref_id == 0 && $crs_ref_id == 0)
4380 public function getParticipantsObject()
4384 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
4385 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
4389 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'), $ilErr->MESSAGE);
4395 $oParticipants = null;
4400 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
4402 return $oParticipants;
4404 else if($crs_ref_id > 0)
4408 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
4410 return $oParticipants;
4413 return $oParticipants;
4427 if((
int)$ilSetting->get(
'disable_my_offers'))
4433 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4446 if((
int)$ilSetting->get(
'disable_my_offers'))
4452 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4460 $_POST[
'thread_sorting'] ? $thread_sorting =
$_POST[
'thread_sorting'] :$thread_sorting = array();
4462 foreach($thread_sorting as $thr_pk=>$sorting_value)
4464 $sorting_value = str_replace(
',',
'.',$sorting_value);
4465 $sorting_value = (float)$sorting_value * 100;
4466 $this->
object->setThreadSorting($thr_pk,$sorting_value);
4478 if(!$this->is_moderator)
4480 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4483 $selected_thread_id = 0;
4484 if(isset(
$_GET[
'merge_thread_id']) && (int)
$_GET[
'merge_thread_id'])
4486 $selected_thread_id = (int)$_GET[
'merge_thread_id'];
4488 else if(isset(
$_POST[
'thread_ids']) && count((array)
$_POST[
'thread_ids']) == 1)
4490 $selected_thread_id = (int)current($_POST[
'thread_ids']);
4499 if($selected_thread_id)
4501 $frm = $this->
object->Forum;
4502 $frm->setForumId($this->object->getId());
4503 $frm->setForumRefId($this->object->getRefId());
4505 $selected_thread_obj =
new ilForumTopic($selected_thread_id);
4514 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4516 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
4518 $topicData = $frm->getOneTopic();
4521 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
4522 $this->ctrl->setParameter($this,
'merge_thread_id', $selected_thread_id);
4523 $tbl =
new ilForumTopicTableGUI($this,
'mergeThreads',
'', (
int)$_GET[
'ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
4524 $tbl->setSelectedThread($selected_thread_obj);
4525 $tbl->setMapper($frm)->fetchData();
4527 $this->tpl->setVariable(
'THREADS_TABLE', $tbl->getHTML());
4543 if(!$this->is_moderator)
4545 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4548 if(!isset(
$_GET[
'merge_thread_id']) || !(int)
$_GET[
'merge_thread_id'] || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 1)
4555 $source_thread_id = (int)
$_GET[
'merge_thread_id'];
4556 $target_thread_id = (int)current(
$_POST[
'thread_ids']);
4558 if($source_thread_id == $target_thread_id)
4568 $this->ctrl->clearParameters($this);
4578 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
4581 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performMergeThreads'));
4582 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_merge_threads'));
4583 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
4584 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performMergeThreads');
4586 $c_gui->addItem(
'thread_ids[]', $source_thread_id, sprintf($this->lng->txt(
'frm_merge_src'),
ilForumTopic::_lookupTitle($source_thread_id)));
4587 $c_gui->addItem(
'thread_ids[]', $target_thread_id, sprintf($this->lng->txt(
'frm_merge_target'),
ilForumTopic::_lookupTitle($target_thread_id)));
4589 $this->tpl->setContent($c_gui->getHTML());
4596 public function performMergeThreadsObject()
4603 if(!$this->is_moderator)
4605 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4608 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 2)
4615 if((
int)
$_POST[
'thread_ids'][0] == (
int)
$_POST[
'thread_ids'][1])
4624 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
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)
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.
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()
performPostAndChildPostsActivationObject()
createObject()
create new object form
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
Class ilForumNotification.
addTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
getOwner()
get object owner
static addToDesktop()
Add desktop item public.
setInfo($a_info)
Set Info.
setTreeStateAsynchObject()
initForumCreateForm($object_type)
confirmMergeThreadsObject()
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
cancelPostActivationObject()
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
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 _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
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.