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';
13 require_once
'Modules/Forum/classes/class.ilForumMailNotification.php';
14 require_once
'Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
105 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
112 global
$ilCtrl, $ilAccess, $ilObjDataCache;
115 $this->ctrl->saveParameter($this, array(
'ref_id',
'cmdClass'));
118 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
120 $this->lng->loadLanguageModule(
'forum');
128 $this->is_moderator = $ilAccess->checkAccess(
'moderate_frm',
'',
$_GET[
'ref_id']);
131 $this->objCurrentTopic =
new ilForumTopic((
int)
$_GET[
'thr_pk'], $this->is_moderator);
134 $this->objCurrentPost =
new ilForumPost((
int) $_GET[
'pos_pk'], $this->is_moderator);
137 $this->forum_overview_setting = $frma_set->get(
'forum_overview');
151 $sess[(int)$_GET[
'thr_fk']] = array();
176 strtolower($this->ctrl->getCmd()),
177 array_map(
'strtolower', array(
'createToLevelPost',
'quoteTopLevelPost',
'saveTopLevelPost'))
193 $next_class = $this->ctrl->getNextClass($this);
194 $cmd = $this->ctrl->getCmd();
196 $exclude_cmds = array(
197 'viewThread',
'markPostUnread',
'markPostRead',
'showThreadNotification',
198 'performPostActivation',
199 'askForPostActivation',
'askForPostDeactivation',
200 'toggleThreadNotification',
'toggleThreadNotificationTab',
201 'toggleStickiness',
'cancelPost',
'savePost',
'saveTopLevelPost',
'createToLevelPost',
'quoteTopLevelPost',
'quotePost',
'getQuotationHTMLAsynch',
202 'setTreeStateAsynch',
'fetchTreeChildrenAsync' 205 if(!in_array(
$cmd, $exclude_cmds))
211 if(!$this->
getCreationMode() && !$ilCtrl->isAsynch() && $ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']))
213 $ilNavigationHistory->addItem(
$_GET[
'ref_id'],
214 'ilias.php?baseClass=ilRepositoryGUI&cmd=showThreads&ref_id='.
$_GET[
'ref_id'],
'frm');
219 case 'ilrepositoryobjectsearchgui':
222 $ilTabs->setTabActive(
"forums_threads");
223 $ilCtrl->setReturn($this,
'view');
224 include_once
'./Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
226 $this->object->getRefId(),
230 $ilCtrl->forwardCommand($search_gui);
233 case 'ilpermissiongui':
234 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
236 $this->ctrl->forwardCommand($perm_gui);
239 case 'ilforumexportgui':
240 require_once
'Modules/Forum/classes/class.ilForumExportGUI.php';
242 $this->ctrl->forwardCommand($fex_gui);
246 case 'ilforummoderatorsgui':
247 require_once
'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
249 $this->ctrl->forwardCommand($fm_gui);
252 case 'ilinfoscreengui':
260 case 'ilpublicuserprofilegui':
261 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
263 $add = $this->getUserProfileAdditional((
int)$_GET[
'ref_id'], (
int)$_GET[
'user']);
264 $profile_gui->setAdditional($add);
265 $ret = $this->ctrl->forwardCommand($profile_gui);
266 $this->tpl->setContent(
$ret);
269 case 'ilobjectcopygui':
270 include_once
'Services/Object/classes/class.ilObjectCopyGUI.php';
273 $this->ctrl->forwardCommand($cp);
277 $ilTabs->setTabActive(
'export');
278 include_once
'Services/Export/classes/class.ilExportGUI.php';
280 $exp->addFormat(
'xml');
281 $this->ctrl->forwardCommand($exp);
285 if(!$this->objProperties->isIsThreadRatingEnabled() || $ilUser->isAnonymous())
287 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'), $ilErr->MESSAGE);
290 require_once
'Services/Rating/classes/class.ilRatingGUI.php';
292 $rating_gui->setObject($this->object->getId(), $this->
object->getType(), $this->objCurrentTopic->getId(),
'thread');
294 $ilCtrl->setParameter($this,
'thr_pk', (
int)$_GET[
'thr_pk']);
295 $this->ctrl->forwardCommand($rating_gui);
298 $this->objCurrentTopic->setAverageRating($avg[
'avg']);
299 $this->objCurrentTopic->update();
301 $ilCtrl->redirect($this,
"showThreads");
304 case 'ilcommonactiondispatchergui':
305 include_once
'Services/Object/classes/class.ilCommonActionDispatcherGUI.php';
307 $this->ctrl->forwardCommand($gui);
319 if(isset(
$_POST[
'select_cmd2']))
324 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] != null)
326 $member_cmd = array(
'enableAdminForceNoti',
'disableAdminForceNoti',
'enableHideUserToggleNoti',
'disableHideUserToggleNoti');
327 in_array(
$_POST[
'selected_cmd'], $member_cmd) ?
$cmd =
$_POST[
'selected_cmd'] :
$cmd =
'performThreadsAction';
331 $cmd =
'showThreads';
341 if(
$cmd !=
'viewThreadObject' &&
$cmd !=
'showUserObject')
354 $this->settingsTabs();
359 $rg_thr->addOption(
new ilRadioOption($this->lng->txt(
'sorting_manual_sticky'),
'1'));
361 $rg_thr->setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
368 $rg_pro->addOption($rg_sort_by_date);
373 $view_direction_group_gui->addOption($view_desc);
374 $view_direction_group_gui->addOption($view_asc);
376 $rg_sort_by_date->
addSubItem($view_direction_group_gui);
379 if($ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
381 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
383 $cb_prop->setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
387 if($ilSetting->get(
'enable_fora_statistics',
false))
389 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
391 $cb_prop->setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
395 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
397 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
400 $frm_subject =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_subject_setting'),
'subject_setting');
402 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'add_re_to_subject'),
'add_re_to_subject'));
403 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'empty_subject'),
'empty_subject'));
405 $a_form->
addItem($frm_subject);
407 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'mark_moderator_posts'),
'mark_mod_posts');
409 $cb_prop->setInfo($this->lng->txt(
'mark_moderator_posts_desc'));
412 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'enable_thread_ratings'),
'thread_rating');
414 $cb_prop->setInfo($this->lng->txt(
'enable_thread_ratings_info'));
417 if(!ilForumProperties::isFileUploadGloballyAllowed())
419 $frm_upload =
new ilCheckboxInputGUI($this->lng->txt(
'file_upload_allowed'),
'file_upload_allowed');
421 $frm_upload->setInfo($this->lng->txt(
'allow_file_upload_desc'));
428 $a_values[
"desc"] = $this->
object->getLongDescription();
429 $a_values[
'default_view'] = $this->objProperties->getDefaultView();
430 $a_values[
'anonymized'] = $this->objProperties->isAnonymized();
431 $a_values[
'statistics_enabled'] = $this->objProperties->isStatisticEnabled();
432 $a_values[
'post_activation'] = $this->objProperties->isPostActivationEnabled();
433 $a_values[
'subject_setting'] = $this->objProperties->getSubjectSetting();
434 $a_values[
'mark_mod_posts'] = $this->objProperties->getMarkModeratorPosts();
435 $a_values[
'thread_sorting'] = $this->objProperties->getThreadSorting();
436 $a_values[
'thread_rating'] = $this->objProperties->isIsThreadRatingEnabled();
442 $a_values[
'default_view'] = $default_view;
444 $default_view_sort_dir =
446 ? (
int)$this->objProperties->getDefaultView()
449 $a_values[
'default_view_sort_dir'] = $default_view_sort_dir;
450 $a_values[
'file_upload_allowed'] = (bool)$this->objProperties->getFileUploadAllowed();
460 $view = (int)
$_POST[
'default_view'];
469 $this->objProperties->setDefaultView($view);
477 if($ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
479 $this->objProperties->setAnonymisation((
int) $a_form->
getInput(
'anonymized'));
481 if($ilSetting->get(
'enable_fora_statistics',
false))
483 $this->objProperties->setStatisticsStatus((
int) $a_form->
getInput(
'statistics_enabled'));
485 $this->objProperties->setPostActivation((
int) $a_form->
getInput(
'post_activation'));
486 $this->objProperties->setSubjectSetting( $a_form->
getInput(
'subject_setting'));
487 $this->objProperties->setMarkModeratorPosts((
int) $a_form->
getInput(
'mark_mod_posts'));
488 $this->objProperties->setThreadSorting((
int)$a_form->
getInput(
'thread_sorting'));
489 $this->objProperties->setIsThreadRatingEnabled((
bool)$a_form->
getInput(
'thread_rating'));
490 if(!ilForumProperties::isFileUploadGloballyAllowed())
492 $this->objProperties->setFileUploadAllowed((
bool)$a_form->
getInput(
'file_upload_allowed'));
495 $this->objProperties->update();
505 $this->ctrl->setParameter($this,
'thr_pk', $a_thread_id);
506 $form->setFormAction($this->ctrl->getFormAction($this,
'updateThread'));
510 $ti_prop->setMaxLength(255);
511 $ti_prop->setSize(50);
512 $form->addItem($ti_prop);
514 $form->addCommandButton(
'updateThread', $this->lng->txt(
'save'));
515 $form->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
531 if(!$this->is_moderator)
533 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
536 $ilTabs->setTabActive(
'forums_threads');
541 $form->setValuesByArray(array(
546 $this->tpl->setContent($form->getHTML());
554 if(!$this->is_moderator)
556 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
559 if(!$this->objCurrentTopic->getId())
566 if($this->objCurrentTopic->getForumId() != $forum_id)
568 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
572 if(!$form->checkInput())
574 $form->setValuesByPost();
575 $this->editThreadObject($this->objCurrentTopic->getId(), $form);
579 $this->objCurrentTopic->setSubject($form->getInput(
'title'));
580 $this->objCurrentTopic->updateThreadTitle();
586 public function markAllReadObject()
593 $this->
object->markAllThreadsRead($ilUser->getId());
620 $ilTabs->addSubTabTarget(
'show', $this->ctrl->getLinkTarget($this,
'showThreads'),
'showThreads', get_class($this),
'', $subtab==
'showThreads'? true : false );
621 $ilTabs->addSubTabTarget(
'sorting_header', $this->ctrl->getLinkTarget($this,
'sortThreads'),
'sortThreads', get_class($this),
'', $subtab==
'sortThreads'? true : false );
624 public function getContent()
634 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
636 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
639 $cmd = $this->ctrl->getCmd();
640 $frm = $this->
object->Forum;
641 $frm->setForumId($this->object->getId());
642 $frm->setForumRefId($this->object->getRefId());
643 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
645 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
647 if((
int)strlen($this->confirmation_gui_html))
649 $this->tpl->setVariable(
'CONFIRMATION_GUI', $this->confirmation_gui_html);
653 if($ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()) && !$this->
hideToolbar())
655 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
657 $btn->setUrl($this->ctrl->getLinkTarget($this,
'createThread'));
658 $btn->setCaption(
'forums_new_thread');
659 $ilToolbar->addStickyItem($btn);
663 include_once
'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
664 if($ilUser->getId() != ANONYMOUS_USER_ID && !(int)strlen($this->confirmation_gui_html))
666 $ilToolbar->addButton(
667 $this->lng->txt(
'forums_mark_read'),
668 $this->ctrl->getLinkTarget($this,
'markAllRead'),
672 $this->ctrl->clearParameters($this);
676 $topicData = $frm->getOneTopic();
680 $frm->setDbTable(
'frm_data');
681 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
682 $frm->updateVisits($topicData[
'top_pk']);
684 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
685 if(!in_array(
$cmd, array(
'showThreads',
'sortThreads') ))
687 $cmd =
'showThreads';
690 $tbl->setMapper($frm)->fetchData();
692 $this->tpl->setVariable(
'THREADS_TABLE',
$tbl->getHTML());
696 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
698 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
707 $this->create_form_gui->setTableWidth(
'600px');
709 $this->create_form_gui->setTitle($this->lng->txt(
'frm_new'));
713 $this->ctrl->setParameter($this,
'new_type', $object_type);
714 $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
717 $title_gui =
new ilTextInputGUI($this->lng->txt(
'title'),
'title');
720 $this->create_form_gui->addItem($title_gui);
725 $description_gui->setRows(2);
726 $this->create_form_gui->addItem($description_gui);
729 $sorting_threads_gui =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_sorting_threads'),
'thread_sorting');
730 $sort_dat =
new ilRadioOption($this->lng->txt(
'order_by').
' '.$this->lng->txt(
'date'), 0);
731 $sorting_threads_gui->addOption($sort_dat);
733 $sort_man =
new ilRadioOption($this->lng->txt(
'sorting_manual_sticky'), 1);
734 $sorting_threads_gui->addOption($sort_man);
735 $sorting_threads_gui->
setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
736 $this->create_form_gui->addItem($sorting_threads_gui);
741 $view_group_gui->addOption($view_hir);
743 $view_group_gui->addOption($view_dat);
744 $this->create_form_gui->addItem($view_group_gui);
747 $view_direction_group_gui->addOption($view_desc);
749 $view_direction_group_gui->addOption($view_asc);
750 $view_dat->
addSubItem($view_direction_group_gui);
753 $anonymize_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
754 $anonymize_gui->
setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
755 $anonymize_gui->setValue(1);
757 if($this->
ilias->getSetting(
'enable_anonymous_fora',
false))
758 $anonymize_gui->setDisabled(
true);
759 $this->create_form_gui->addItem($anonymize_gui);
762 $statistics_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
763 $statistics_gui->
setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
764 $statistics_gui->setValue(1);
765 if(!$this->
ilias->getSetting(
'enable_fora_statistics',
false))
766 $statistics_gui->setDisabled(
true);
767 $this->create_form_gui->addItem($statistics_gui);
769 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
771 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
772 $this->create_form_gui->addItem($cb_prop);
774 $this->create_form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
775 $this->create_form_gui->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
790 $this->ctrl->setParameter($this,
'ref_id', $forumObj->
getRefId());
791 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'createThread',
'',
false,
false));
801 global $ilAccess, $ilHelp,
$ilCtrl;
803 $ilHelp->setScreenIdComponent(
"frm");
805 $this->ctrl->setParameter($this,
'ref_id', $this->ref_id);
807 include_once
'Services/Repository/classes/class.ilRepositoryExplorer.php';
809 '',
'showThreads',
'view',
'markAllRead',
810 'enableForumNotification',
'disableForumNotification',
'moveThreads',
'performMoveThreads',
811 'cancelMoveThreads',
'performThreadsAction',
'createThread',
'addThread',
812 'showUser',
'confirmDeleteThreads',
813 'merge',
'mergeThreads',
'cancelMergeThreads',
'performMergeThreads' 816 (in_array($ilCtrl->getCmd(), $active)) ? $force_active = true : $force_active =
false;
817 $tabs_gui->
addTarget(
'forums_threads', $this->ctrl->getLinkTarget($this,
'showThreads'), $ilCtrl->getCmd(), get_class($this),
'', $force_active);
820 if($ilAccess->checkAccess(
'visible',
'', $this->ref_id))
822 $force_active = ($this->ctrl->getNextClass() ==
'ilinfoscreengui' || strtolower(
$_GET[
'cmdClass']) ==
'ilnotegui') ?
true :
false;
824 $this->ctrl->getLinkTargetByClass(
825 array(
'ilobjforumgui',
'ilinfoscreengui'),
'showSummary'),
826 array(
'showSummary',
'infoScreen'),
827 '',
'', $force_active);
830 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
832 $force_active = ($ilCtrl->getCmd() ==
'edit') ?
true :
false;
833 $tabs_gui->
addTarget(
'settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'', $force_active);
836 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
838 $tabs_gui->
addTarget(
'frm_moderators', $this->ctrl->getLinkTargetByClass(
'ilForumModeratorsGUI',
'showModerators'),
'showModerators', get_class($this));
841 if($this->
ilias->getSetting(
'enable_fora_statistics',
false) &&
842 ($this->objProperties->isStatisticEnabled() || $ilAccess->checkAccess(
'write',
'', $this->ref_id)))
844 $force_active = ($ilCtrl->getCmd() ==
'showStatistics') ?
true :
false;
845 $tabs_gui->
addTarget(
'frm_statistics', $this->ctrl->getLinkTarget($this,
'showStatistics'),
'showStatistics', get_class($this),
'', $force_active);
848 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
850 $tabs_gui->
addTarget(
'export', $this->ctrl->getLinkTargetByClass(
'ilexportgui',
''),
'',
'ilexportgui');
853 if($ilAccess->checkAccess(
'edit_permission',
'', $this->ref_id))
855 $tabs_gui->
addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'), array(
'perm',
'info',
'owner'),
'ilpermissiongui');
859 public function settingsTabs()
866 global $ilTabs, $ilAccess,
$tree;
868 $ilTabs->setTabActive(
'settings');
869 $ilTabs->addSubTabTarget(
'basic_settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'',
$_GET[
'cmd']==
'edit'? true : false );
872 if($this->
ilias->getSetting(
'forum_notification') > 0)
875 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
876 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
878 if((
int)$grp_ref_id > 0 || (int)$crs_ref_id > 0 )
880 #show member-tab for notification if forum-notification is enabled in administration 881 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
883 $mem_active = array(
'showMembers',
'forums_notification_settings');
884 (in_array(
$_GET[
'cmd'],$mem_active)) ? $force_mem_active =
true : $force_mem_active =
false;
886 $ilTabs->addSubTabTarget(
'notifications', $this->ctrl->getLinkTarget($this,
'showMembers'),
$_GET[
'cmd'], get_class($this),
'', $force_mem_active);
893 public function showStatisticsObject()
901 if(!$this->
ilias->getSetting(
'enable_fora_statistics',
false))
903 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
907 if(!$ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']))
909 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
913 if(!$ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']) && !$this->objProperties->isStatisticEnabled())
915 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
919 if($ilAccess->checkAccess(
'write',
'',
$_GET[
'ref_id']) &&
920 !$this->objProperties->isStatisticEnabled())
922 ilUtil::sendInfo($this->lng->txt(
'frm_statistics_disabled_for_participants'));
925 $this->
object->Forum->setForumId($this->object->getId());
927 require_once
'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
930 $tbl->setId(
'il_frm_statistic_table_'.(
int)
$_GET[
'ref_id']);
931 $tbl->setTitle($this->lng->txt(
'statistic'),
'icon_usr.svg', $this->lng->txt(
'obj_'.$this->object->getType()));
933 $data = $this->
object->Forum->getUserStatistic($this->is_moderator);
938 $result[$counter][
'ranking'] = $row[0];
939 $result[$counter][
'login'] = $row[1];
940 $result[$counter][
'lastname'] = $row[2];
941 $result[$counter][
'firstname'] = $row[3];
947 $this->tpl->setContent(
$tbl->getHTML());
950 public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
959 if($ilAccess->checkAccess(
'read',
'', $a_target))
964 if ($objTopic->getFrmObjId() &&
970 if($ilAccess->checkAccess(
'read',
'', $ref_id))
977 if (isset($new_ref_id) && $new_ref_id != $a_target)
979 ilUtil::redirect(ILIAS_HTTP_PATH.
"/goto.php?target=frm_".$new_ref_id.
"_".$a_thread.
"_".$a_posting);
983 $_GET[
'ref_id'] = $a_target;
984 $_GET[
'pos_pk'] = $a_posting;
985 $_GET[
'thr_pk'] = $a_thread;
986 $_GET[
'anchor'] = $a_posting;
987 $_GET[
'cmdClass'] =
'ilObjForumGUI';
988 $_GET[
'cmd'] =
'viewThread';
989 $_GET[
'baseClass'] =
'ilRepositoryGUI';
991 include_once(
'ilias.php');
997 $_GET[
'ref_id'] = $a_target;
998 $_GET[
'baseClass'] =
'ilRepositoryGUI';
999 include_once(
'ilias.php');
1003 else if($ilAccess->checkAccess(
'read',
'', ROOT_FOLDER_ID))
1005 $_GET[
'target'] =
'';
1006 $_GET[
'ref_id'] = ROOT_FOLDER_ID;
1009 $_GET[
'baseClass'] =
'ilRepositoryGUI';
1010 include(
'ilias.php');
1014 $ilErr->raiseError($lng->txt(
'msg_no_perm_read'), $ilErr->FATAL);
1017 public function performDeleteThreadsObject()
1024 if(!$this->is_moderator)
1026 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1030 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']))
1036 require_once
'Modules/Forum/classes/class.ilForum.php';
1037 require_once
'Modules/Forum/classes/class.ilObjForum.php';
1041 $this->objProperties->setObjId($forumObj->getId());
1044 if(count(
$_POST[
'thread_ids']) > 1 )
1046 $success_message =
'forums_threads_deleted';
1050 $success_message =
'forums_thread_deleted';
1053 foreach(
$_POST[
'thread_ids'] as $topic_id)
1055 $frm->setForumId($forumObj->getId());
1056 $frm->setForumRefId($forumObj->getRefId());
1058 $first_node = $frm->getFirstPostNode($topic_id);
1059 if((
int)$first_node[
'pos_pk'])
1061 $frm->deletePost($first_node[
'pos_pk']);
1065 $this->ctrl->redirect($this,
'showThreads');
1068 public function confirmDeleteThreads()
1075 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']))
1081 if(!$this->is_moderator)
1083 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1087 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
1090 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteThreads'));
1091 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_delete_threads'));
1092 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
1093 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteThreads');
1095 foreach((array)
$_POST[
'thread_ids'] as $thread_id)
1100 $this->confirmation_gui_html = $c_gui->getHTML();
1104 return $this->tpl->setContent($c_gui->getHTML());
1107 public function prepareThreadScreen(
ilObjForum $a_forum_obj)
1115 global
$tpl,
$lng, $ilTabs, $ilHelp;
1117 $ilHelp->setScreenIdComponent(
"frm");
1119 $tpl->getStandardTemplate();
1125 $ilTabs->setBackTarget($lng->txt(
'all_topics'),
'ilias.php?baseClass=ilRepositoryGUI&ref_id='.$_GET[
'ref_id']);
1128 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1129 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1131 $ilTabs->addTarget(
'sort_by_posts', $this->ctrl->getLinkTarget($this,
'viewThread'));
1134 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1135 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1137 $ilTabs->addTarget(
'order_by_date', $this->ctrl->getLinkTarget($this,
'viewThread'));
1139 $this->ctrl->clearParameters($this);
1143 $ilTabs->setTabActive(
'sort_by_posts');
1147 $ilTabs->setTabActive(
'order_by_date');
1153 $frm = $a_forum_obj->Forum;
1154 $frm->setForumId($a_forum_obj->
getId());
1159 if($this->is_moderator)
1161 $this->objCurrentPost->activatePost();
1162 $GLOBALS[
'ilAppEventHandler']->raise(
1166 'ref_id' => $this->object->getRefId(),
1173 $this->viewThreadObject();
1178 if($this->is_moderator)
1183 $this->viewThreadObject();
1188 $this->display_confirm_post_activation = $status;
1196 public function toggleThreadNotificationObject()
1203 if($this->objCurrentTopic->isNotificationEnabled($ilUser->getId()))
1205 $this->objCurrentTopic->disableNotification($ilUser->getId());
1210 $this->objCurrentTopic->enableNotification($ilUser->getId());
1214 $this->viewThreadObject();
1219 if($this->is_moderator)
1221 if($this->objCurrentTopic->isSticky())
1223 $this->objCurrentTopic->unmakeSticky();
1227 $this->objCurrentTopic->makeSticky();
1231 $this->viewThreadObject();
1236 $_GET[
'action'] =
'';
1237 $this->viewThreadObject();
1240 public function getDeleteFormHTML()
1248 $form_tpl =
new ilTemplate(
'tpl.frm_delete_post_form.html',
true,
true,
'Modules/Forum');
1250 $form_tpl->setVariable(
'ANKER', $this->objCurrentPost->getId());
1251 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1252 $form_tpl->setVariable(
'TXT_DELETE', $lng->txt(
'forums_info_delete_post'));
1253 $this->ctrl->setParameter($this,
'action',
'ready_delete');
1254 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1255 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1256 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1257 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1258 $this->ctrl->clearParameters($this);
1259 $form_tpl->setVariable(
'CANCEL_BUTTON', $lng->txt(
'cancel'));
1260 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'confirm'));
1262 return $form_tpl->get();
1265 public function getActivationFormHTML()
1272 $form_tpl =
new ilTemplate(
'tpl.frm_activation_post_form.html',
true,
true,
'Modules/Forum');
1274 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1275 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1276 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1277 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this,
'performPostActivation'));
1278 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1279 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1280 $form_tpl->setVariable(
'TXT_ACT', $lng->txt(
'activate_post_txt'));
1281 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'activate_only_current'));
1282 $form_tpl->setVariable(
'CMD_CONFIRM',
'performPostActivation');
1283 $form_tpl->setVariable(
'CANCEL_BUTTON', $lng->txt(
'cancel'));
1284 $form_tpl->setVariable(
'CMD_CANCEL',
'viewThread');
1285 $this->ctrl->clearParameters($this);
1287 return $form_tpl->get();
1290 public function getCensorshipFormHTML()
1298 $form_tpl =
new ilTemplate(
'tpl.frm_censorship_post_form.html',
true,
true,
'Modules/Forum');
1300 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1301 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1302 $this->ctrl->setParameter($this,
'action',
'ready_censor');
1303 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1304 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1305 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1306 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1307 $this->ctrl->clearParameters($this);
1308 $form_tpl->setVariable(
'TXT_CENS_MESSAGE', $lng->txt(
'forums_the_post'));
1309 $form_tpl->setVariable(
'TXT_CENS_COMMENT', $lng->txt(
'forums_censor_comment').
':');
1310 $form_tpl->setVariable(
'CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1312 if($this->objCurrentPost->isCensored())
1314 $form_tpl->setVariable(
'TXT_CENS', $lng->txt(
'forums_info_censor2_post'));
1315 $form_tpl->setVariable(
'YES_BUTTON', $lng->txt(
'confirm'));
1316 $form_tpl->setVariable(
'NO_BUTTON', $lng->txt(
'cancel'));
1320 $form_tpl->setVariable(
'TXT_CENS', $lng->txt(
'forums_info_censor_post'));
1321 $form_tpl->setVariable(
'CANCEL_BUTTON', $lng->txt(
'cancel'));
1322 $form_tpl->setVariable(
'CONFIRM_BUTTON', $lng->txt(
'confirm'));
1325 return $form_tpl->get();
1331 private function initReplyEditForm()
1343 $frm = $oForumObjects[
'frm'];
1344 $oFDForum = $oForumObjects[
'file_obj'];
1346 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1348 $this->replyEditForm->setTableWidth(
'100%');
1350 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply')
1352 $this->ctrl->setParameter($this,
'action',
'ready_showreply');
1356 $this->ctrl->setParameter($this,
'action',
'ready_showedit');
1359 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
1360 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
1361 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1362 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1365 $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this,
'saveTopLevelPost'),
'frm_page_bottom');
1369 $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this,
'savePost'), $this->objCurrentPost->getId());
1371 $this->ctrl->clearParameters($this);
1373 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1375 $this->replyEditForm->setTitle($this->lng->txt(
'forums_your_reply'));
1379 $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_post'));
1383 if($this->objProperties->isAnonymized() &&
1384 in_array($_GET[
'action'], array(
'showreply',
'ready_showreply')))
1386 $oAnonymousNameGUI =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
1388 $oAnonymousNameGUI->setInfo($this->lng->txt(
'forums_use_alias'));
1390 $this->replyEditForm->addItem($oAnonymousNameGUI);
1394 $oSubjectGUI =
new ilTextInputGUI($this->lng->txt(
'forums_subject'),
'subject');
1396 $oSubjectGUI->setRequired(
true);
1398 if($this->objProperties->getSubjectSetting() ==
'empty_subject')
1399 $oSubjectGUI->setInfo($this->lng->txt(
'enter_new_subject'));
1401 $this->replyEditForm->addItem($oSubjectGUI);
1405 $_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply' ? $this->lng->txt(
'forums_your_reply') : $this->lng->txt(
'forums_edit_post'),
1409 $oPostGUI->setCols(50);
1410 $oPostGUI->setRows(15);
1411 $oPostGUI->setUseRte(
true);
1412 $oPostGUI->addPlugin(
'latex');
1413 $oPostGUI->addButton(
'latex');
1414 $oPostGUI->addButton(
'pastelatex');
1415 $oPostGUI->addPlugin(
'ilfrmquote');
1418 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1420 $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
1422 $oPostGUI->removePlugin(
'advlink');
1423 $oPostGUI->setRTERootBlockElement(
'');
1424 $oPostGUI->usePurifier(
true);
1425 $oPostGUI->disableButtons(array(
1442 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1444 $oPostGUI->setRTESupport($ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.5.11');
1448 $oPostGUI->setRTESupport($this->objCurrentPost->getId(),
'frm',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.5.11');
1451 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
1454 $this->replyEditForm->addItem($oPostGUI);
1457 include_once
'Services/Mail/classes/class.ilMail.php';
1458 $umail =
new ilMail($ilUser->getId());
1459 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
1460 !$frm->isThreadNotificationEnabled($ilUser->getId(), $this->objCurrentPost->getThreadId()) &&
1461 !$this->objProperties->isAnonymized())
1464 $oNotificationGUI->setInfo($this->lng->txt(
'forum_notify_me'));
1466 $this->replyEditForm->addItem($oNotificationGUI);
1469 if($this->objProperties->isFileUploadAllowed())
1471 $oFileUploadGUI =
new ilFileWizardInputGUI($this->lng->txt(
'forums_attachments_add'),
'userfile');
1473 $this->replyEditForm->addItem($oFileUploadGUI);
1476 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
1478 $ilUser->isAnonymous() &&
1479 !$ilUser->isCaptchaVerified() &&
1480 ilCaptchaUtil::isActiveForForum()
1483 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
1484 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
1486 $this->replyEditForm->addItem($captcha);
1489 $attachments_of_node = $oFDForum->getFilesOfPost();
1490 if(count($attachments_of_node) && ($_GET[
'action'] ==
'showedit' || $_GET[
'action'] ==
'ready_showedit'))
1493 foreach($oFDForum->getFilesOfPost() as
$file)
1496 $oAttachmentGUI->setValue(
$file[
'md5']);
1497 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
1499 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
1504 $this->replyEditForm->addCommandButton(
'saveTopLevelPost', $this->lng->txt(
'create'));
1508 $this->replyEditForm->addCommandButton(
'savePost', $this->lng->txt(
'save'));
1511 if($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'ready_showreply')
1513 include_once
'Services/RTE/classes/class.ilRTE.php';
1516 if(array_key_exists(
'show_rte',
$_POST))
1525 $this->replyEditForm->addCommandButton(
'quoteTopLevelPost', $this->lng->txt(
'forum_add_quote'));
1529 $this->replyEditForm->addCommandButton(
'quotePost', $this->lng->txt(
'forum_add_quote'));
1533 $this->replyEditForm->addCommandButton(
'cancelPost', $this->lng->txt(
'cancel'));
1541 if(null === $this->replyEditForm)
1543 $this->initReplyEditForm();
1554 $this->viewThreadObject();
1563 $this->savePostObject();
1579 public function savePostObject()
1588 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
1590 if($this->objCurrentTopic->isClosed())
1592 $_GET[
'action'] =
'';
1593 return $this->viewThreadObject();
1597 if($oReplyEditForm->checkInput())
1599 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
1601 $ilUser->isAnonymous() &&
1602 !$ilUser->isCaptchaVerified() &&
1603 ilCaptchaUtil::isActiveForForum()
1606 $ilUser->setCaptchaVerified(
true);
1614 $forumObj = $oForumObjects[
'forumObj'];
1618 $frm = $oForumObjects[
'frm'];
1619 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
1620 $topicData = $frm->getOneTopic();
1623 if(
$_GET[
'action'] ==
'ready_showreply')
1625 if(!$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
1627 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1632 $send_activation_mail = 0;
1634 if($this->objProperties->isPostActivationEnabled())
1636 if(!$this->is_moderator)
1639 $send_activation_mail = 1;
1641 else if($this->objCurrentPost->isAnyParentDeactivated())
1647 if($this->objProperties->isAnonymized())
1649 if(!strlen($oReplyEditForm->getInput(
'alias')))
1651 $user_alias = $this->lng->txt(
'forums_anonymous');
1655 $user_alias = $oReplyEditForm->getInput(
'alias');
1660 $user_alias = $ilUser->getLogin();
1663 $newPost = $frm->generatePost(
1664 $topicData[
'top_pk'],
1665 $this->objCurrentTopic->getId(),
1667 ($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()),
1669 $this->objCurrentPost->getId(),
1670 (int)$oReplyEditForm->getInput(
'notify'),
1675 $send_activation_mail
1679 $this->
object->markPostRead($ilUser->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
1682 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
1685 foreach($mediaObjects as $mob)
1687 foreach($myMediaObjects as $myMob)
1699 if($this->objProperties->isFileUploadAllowed())
1702 $file = $_FILES[
'userfile'];
1703 if(is_array($file) && !empty($file))
1705 $oFDForum->storeUploadedFile($file);
1709 $GLOBALS[
'ilAppEventHandler']->raise(
1713 'ref_id' => $this->object->getRefId(),
1715 'notify_moderators' => (bool)$send_activation_mail
1720 if(!$this->is_moderator && !$status)
1722 $message .= $lng->txt(
'forums_post_needs_to_be_activated');
1726 $message .= $lng->txt(
'forums_post_new_entry');
1729 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$this->objCurrentPost->getId();
1732 $this->ctrl->setParameter($this,
'pos_pk', $newPost);
1733 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1734 $this->ctrl->redirect($this,
'viewThread');
1738 if((!$this->is_moderator &&
1739 !$this->objCurrentPost->isOwner($ilUser->getId())) || $this->objCurrentPost->isCensored() ||
1740 $ilUser->getId() == ANONYMOUS_USER_ID)
1742 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
1746 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
1749 foreach($oldMediaObjects as $oldMob)
1752 foreach($curMediaObjects as $curMob)
1754 if($oldMob == $curMob)
1773 $send_activation_mail = 0;
1775 if($this->objProperties->isPostActivationEnabled())
1777 if(!$this->is_moderator)
1780 $send_activation_mail = 1;
1782 else if($this->objCurrentPost->isAnyParentDeactivated())
1787 $this->objCurrentPost->setStatus($status);
1789 $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
1791 $this->objCurrentPost->setNotification((
int)$oReplyEditForm->getInput(
'notify'));
1792 $this->objCurrentPost->setChangeDate(date(
'Y-m-d H:i:s'));
1793 $this->objCurrentPost->setUpdateUserId($ilUser->getId());
1796 if($this->objCurrentPost->update())
1798 $this->objCurrentPost->reload();
1801 include_once
'Services/News/classes/class.ilNewsItem.php';
1804 'frm', $this->objCurrentPost->getId(),
'pos');
1808 $news_item->setTitle($this->objCurrentPost->getSubject());
1810 $this->objCurrentPost->getMessage(), 0), 1)
1812 $news_item->update();
1815 $oFDForum = $oForumObjects[
'file_obj'];
1817 if($this->objProperties->isFileUploadAllowed())
1819 $file = $_FILES[
'userfile'];
1822 $oFDForum->storeUploadedFile(
$file);
1826 $file2delete = $oReplyEditForm->getInput(
'del_file');
1827 if(is_array($file2delete) && count($file2delete))
1829 $oFDForum->unlinkFilesByMD5Filenames($file2delete);
1832 $GLOBALS[
'ilAppEventHandler']->raise(
1836 'ref_id' => $this->object->getRefId(),
1838 'notify_moderators' => (bool)$send_activation_mail
1845 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1846 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1847 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
1848 $this->ctrl->redirect($this,
'viewThread');
1853 $_GET[
'action'] = substr(
$_GET[
'action'], 6);
1855 return $this->viewThreadObject();
1860 if(null === $a_flag)
1871 if(!is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
1873 if($this->objCurrentTopic->isClosed())
1875 $_GET[
'action'] =
'';
1876 return $this->viewThreadObject();
1882 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
1883 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
1885 $oReplyEditForm->checkInput();
1888 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
1889 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
1891 $_GET[
'action'] =
'showreply';
1893 $this->viewThreadObject();
1896 public function getQuotationHTMLAsynchObject()
1902 $frm = $oForumObjects[
'frm'];
1904 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
1906 $this->objCurrentPost->getPosAuthorId(),
1907 $this->objCurrentPost->getDisplayUserId(),
1908 $this->objCurrentPost->getUserAlias(),
1909 $this->objCurrentPost->getImportName()
1919 if(null === $this->forumObjects)
1922 $file_obj =
new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
1923 $frm = $forumObj->Forum;
1924 $frm->setForumId($forumObj->getId());
1925 $frm->setForumRefId($forumObj->getRefId());
1927 $this->forumObjects[
'forumObj'] = $forumObj;
1928 $this->forumObjects[
'frm'] = $frm;
1929 $this->forumObjects[
'file_obj'] = $file_obj;
1937 include_once
'Modules/Forum/classes/class.ilForumExplorer.php';
1941 $this->objCurrentTopic,
1942 $this->objProperties
1945 return $explorer->render()->getHtml();
1950 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
1951 include_once
'Modules/Forum/classes/class.ilForumExplorer.php';
1953 $response =
new stdClass();
1954 $response->success =
false;
1956 if(
$_GET[
'nodeId'] )
1958 $response->success =
true;
1959 $response->children = array();
1961 $key = array_search((
int)
$_GET[
'nodeId'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
1962 if(
false === $key )
1964 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$_GET[
'nodeId'];
1967 $children = $this->objCurrentTopic->getNestedSetPostChildren(
1968 (
int)$_GET[
'nodeId'],
1969 (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']
1973 $pageHits = $frm->getPageHits();
1975 $fetchedNodes = array();
1977 foreach( $children as $child )
1979 if($child[
'parent_pos'] != (
int)$_GET[
'nodeId'] &&
1980 !in_array($child[
'parent_pos'], $fetchedNodes))
1985 $fetchedNodes[] = $child[
'pos_pk'];
1987 $this->ctrl->setParameter($this,
'thr_pk', (
int)$_GET[
'thr_pk']);
1995 $responseChild =
new stdClass();
1996 $responseChild->nodeId = $child[
'pos_pk'];
1997 $responseChild->parentId = $child[
'parent_pos'];
1998 $responseChild->hasChildren = ($child[
'children'] >= 1);
1999 $responseChild->fetchedWithChildren = in_array((
int)$child[
'pos_pk'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
2000 $responseChild->html =
$html;
2002 $response->children[] = $responseChild;
2012 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
2014 $response =
new stdClass();
2015 $response->success =
true;
2017 if(
$_GET[
'nodeId'] )
2019 if(
$_GET[
'nodeId'] > 0 )
2021 $key = array_search((
int)
$_GET[
'nodeId'], (array)
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes']);
2022 if(
false === $key )
2024 $_SESSION[
'frm'][(int)$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$_GET[
'nodeId'];
2029 $key = array_search((
int)abs(
$_GET[
'nodeId']), (array)
$_SESSION[
'frm'][(
int)
$_GET[
'thr_pk']][
'openTreeNodes']);
2030 if(
false !== $key )
2032 unset(
$_SESSION[
'frm'][(
int)$_GET[
'thr_pk']][
'openTreeNodes'][$key]);
2038 shuffle(
$_SESSION[
'frm'][(
int)
$_GET[
'thr_pk']][
'openTreeNodes']);
2042 public function viewThreadObject()
2054 global
$tpl,
$lng,
$ilUser, $ilAccess, $rbacreview, $ilNavigationHistory,
$ilCtrl, $frm, $ilToolbar, $ilLocator;
2056 $bottom_toolbar = clone $ilToolbar;
2057 $bottom_toolbar_split_button_items = array();
2059 $tpl->addCss(
'./Modules/Forum/css/forum_tree.css');
2062 $_SESSION[
'viewmode'] = $this->objProperties->getDefaultView();
2066 if(!isset(
$_SESSION[
'thread_control'][
'old']))
2092 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
2094 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2102 $forumObj = $oForumObjects[
'forumObj'];
2106 $frm = $oForumObjects[
'frm'];
2110 $file_obj = $oForumObjects[
'file_obj'];
2115 if(!
$path = $file_obj->getFileDataByMD5Filename(
$_GET[
'file']))
2125 if(!$this->objCurrentTopic->getId())
2127 $ilCtrl->redirect($this,
'showThreads');
2131 $append =
'_'.$this->objCurrentTopic->getId().
2132 ($this->objCurrentPost->getId() ?
'_'.$this->objCurrentPost->getId() :
'');
2133 $tpl->setLoginTargetPar(
'frm_'.
$_GET[
'ref_id'].$append);
2136 if(
$_GET[
'action'] !=
'showreply' &&
$_GET[
'action'] !=
'showedit')
2140 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
2142 foreach(
$mobs as $mob)
2157 require_once
'./Modules/Forum/classes/class.ilObjForum.php';
2158 require_once
'./Modules/Forum/classes/class.ilFileDataForum.php';
2160 $lng->loadLanguageModule(
'forum');
2164 $ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
2166 $ilCtrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2167 $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this,
'showThreads'),
'frm');
2171 $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId());
2173 $this->prepareThreadScreen($forumObj);
2175 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_view.html',
'Modules/Forum');
2177 if(isset(
$_GET[
'anchor']))
2179 $tpl->setVariable(
'JUMP2ANCHOR_ID', (
int)
$_GET[
'anchor']);
2184 $orderField =
'frm_posts_tree.rgt';
2185 $this->objCurrentTopic->setOrderDirection(
'DESC');
2189 $orderField =
'frm_posts_tree.fpt_date';
2190 $this->objCurrentTopic->setOrderDirection(
2197 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2199 if(is_array($topicData = $frm->getOneTopic()))
2202 $this->objCurrentTopic->updateVisits();
2204 $tpl->setTitle($lng->txt(
'forums_thread').
" \"".$this->objCurrentTopic->getSubject().
"\"");
2208 $ilLocator->addRepositoryItems();
2209 $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this,
""),
"_top");
2215 $menutpl =
new ilTemplate(
'tpl.forums_threads_menu.html',
true,
true,
'Modules/Forum');
2217 include_once(
"./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
2221 $ilUser->getId() != ANONYMOUS_USER_ID &&
2222 $forumObj->getCountUnread($ilUser->getId(), (int) $this->objCurrentTopic->getId())
2225 $this->ctrl->setParameter($this,
'mark_read',
'1');
2226 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2228 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
2230 $mark_thr_read_button->setCaption(
'forums_mark_read');
2231 $mark_thr_read_button->setUrl($this->ctrl->getLinkTarget($this,
'viewThread'));
2234 $bottom_toolbar_split_button_items[] = $mark_thr_read_button;
2236 $this->ctrl->clearParameters($this);
2240 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_thread', $this->objCurrentTopic->getId());
2241 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_top_fk', $this->objCurrentTopic->getForumId());
2243 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
2245 $print_thr_button->setCaption(
'forums_print_thread');
2246 $print_thr_button->setUrl($this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printThread'));
2248 $bottom_toolbar_split_button_items[] = $print_thr_button;
2250 $this->ctrl->clearParametersByClass(
'ilforumexportgui');
2254 if(
$_GET[
'mark_read'])
2256 $forumObj->markThreadRead($ilUser->getId(), (int)$this->objCurrentTopic->getId());
2261 require_once
'./Modules/Forum/classes/class.ilForum.php';
2263 if (
$_GET[
'action'] ==
'ready_delete' &&
$_POST[
'confirm'] !=
'')
2265 if(!$this->objCurrentTopic->isClosed() &&
2266 ($this->is_moderator ||
2267 ($this->objCurrentPost->isOwner($ilUser->getId()) && !$this->objCurrentPost->hasReplies())) &&
2268 $ilUser->getId() != ANONYMOUS_USER_ID)
2272 $frm->setForumId($forumObj->getId());
2273 $frm->setForumRefId($forumObj->getRefId());
2275 $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
2278 if ($dead_thr == $this->objCurrentTopic->getId())
2281 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($forumObj->getId()));
2283 $topicData = $frm->getOneTopic();
2287 if ($topicData[
'top_num_threads'] > 0)
2289 $this->ctrl->redirect($this,
'showThreads');
2293 $this->ctrl->redirect($this,
'createThread');
2301 if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'ready_censor')
2305 if((
$_POST[
'confirm'] !=
'' ||
$_POST[
'no_cs_change'] !=
'') &&
$_GET[
'action'] ==
'ready_censor')
2307 $frm->postCensorship($cens_message, $this->objCurrentPost->getId(), 1);
2310 else if((
$_POST[
'cancel'] !=
'' ||
$_POST[
'yes_cs_change'] !=
'') &&
$_GET[
'action'] ==
'ready_censor')
2312 $frm->postCensorship($cens_message, $this->objCurrentPost->getId());
2318 $first_node = $this->objCurrentTopic->getFirstPostNode();
2319 $this->objCurrentTopic->setOrderField($orderField);
2320 $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
2326 !$this->objCurrentTopic->isClosed() &&
2327 $ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])
2330 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
2332 $reply_button->setPrimary(
true);
2333 $reply_button->setCaption(
'add_new_answer');
2334 $this->ctrl->setParameter($this,
'action',
'showreply');
2335 $this->ctrl->setParameter($this,
'pos_pk', $first_node->getId());
2336 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2337 $this->ctrl->setParameter($this,
'offset', (
int)$_GET[
'offset']);
2338 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2340 $reply_button->setUrl($this->ctrl->getLinkTarget($this,
'createToLevelPost',
'frm_page_bottom'));
2342 $this->ctrl->clearParameters($this);
2343 array_unshift($bottom_toolbar_split_button_items, $reply_button);
2347 if (!$posNum = count($subtree_nodes))
2352 $pageHits = $frm->getPageHits();
2357 if ($posNum > $pageHits)
2360 'ref_id' => $_GET[
'ref_id'],
2361 'thr_pk' => $this->objCurrentTopic->getId(),
2362 'orderby' => $_GET[
'orderby']
2365 if (!$_GET[
'offset'])
2371 $Start = $_GET[
'offset'];
2374 $linkbar =
ilUtil::Linkbar($ilCtrl->getLinkTarget($this,
'viewThread'), $posNum, $pageHits, $Start,
$params);
2378 $menutpl->setCurrentBlock(
'linkbar');
2379 $menutpl->setVariable(
'LINKBAR', $linkbar);
2380 $menutpl->parseCurrentBlock();
2384 $tpl->setVariable(
'THREAD_MENU', $menutpl->get());
2390 foreach($subtree_nodes as $node)
2396 $this->ctrl->clearParameters($this);
2398 if($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId())
2403 if ($posNum > $pageHits && $z >= ($Start + $pageHits))
2406 if ($this->objCurrentPost->getId() && $jump < 1)
2408 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2409 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2410 $this->ctrl->setParameter($this,
'offset', ($Start + $pageHits));
2411 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2412 $this->ctrl->redirect($this,
'viewThread', $this->objCurrentPost->getId());
2420 if(($posNum > $pageHits && $z >= $Start) || $posNum <= $pageHits)
2425 # actions for "active" post 2426 if($this->is_moderator || $node->isActivated())
2429 if(!$this->objCurrentTopic->isClosed() && ($_GET[
'action'] ==
'showreply' || $_GET[
'action'] ==
'showedit'))
2431 if($_GET[
'action'] ==
'showedit' &&
2432 ((!$this->is_moderator &&
2433 !$node->isOwner($ilUser->getId()) || $ilUser->getId() == ANONYMOUS_USER_ID) || $node->isCensored()))
2435 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2437 else if($_GET[
'action'] ==
'showreply' && !$ilAccess->checkAccess(
'add_reply',
'', (
int)$_GET[
'ref_id']))
2439 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
2442 $tpl->setVariable(
'REPLY_ANKER', $this->objCurrentPost->getId());
2445 switch($this->objProperties->getSubjectSetting())
2447 case 'add_re_to_subject':
2451 case 'preset_subject':
2452 $subject = $this->objCurrentPost->getSubject();
2455 case 'empty_subject':
2461 switch($_GET[
'action'])
2464 if($this->ctrl->getCmd() ==
'savePost')
2466 $oEditReplyForm->setValuesByPost();
2468 else if($this->ctrl->getCmd() ==
'quotePost')
2470 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2472 $node->getPosAuthorId(),
2473 $node->getDisplayUserId(),
2474 $node->getUserAlias(),
2475 $node->getImportName()
2478 $oEditReplyForm->setValuesByPost();
2479 $oEditReplyForm->getItemByPostVar(
'message')->setValue(
2481 $frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()).
"\n".$oEditReplyForm->getInput(
'message'), 1
2487 $oEditReplyForm->setValuesByArray(array(
2489 'subject' => $subject,
2493 'del_file' => array()
2497 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2498 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2500 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
2501 $jsTpl->setVariable(
'IL_FRM_QUOTE_CALLBACK_SRC',
2502 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true));
2503 $this->ctrl->clearParameters($this);
2504 $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
2507 if($this->ctrl->getCmd() ==
'savePost')
2509 $oEditReplyForm->setValuesByPost();
2513 $oEditReplyForm->setValuesByArray(array(
2515 'subject' => $this->objCurrentPost->getSubject(),
2517 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true :
false,
2519 'del_file' => array()
2524 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2525 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2526 $this->ctrl->setParameter($this,
'offset', (
int)$_GET[
'offset']);
2527 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2528 $this->ctrl->setParameter($this,
'action', $_GET[
'action']);
2529 $tpl->setVariable(
'FORM', $oEditReplyForm->getHTML());
2530 $this->ctrl->clearParameters($this);
2533 else if(!$this->objCurrentTopic->isClosed() && $_GET[
'action'] ==
'delete')
2535 if($this->is_moderator ||
2536 ($node->isOwner($ilUser->getId()) && !$node->hasReplies()) &&
2537 $ilUser->getId() != ANONYMOUS_USER_ID)
2540 $tpl->setVariable(
'FORM', $this->getDeleteFormHTML());
2543 else if(!$this->objCurrentTopic->isClosed() && $_GET[
'action'] ==
'censor')
2545 if($this->is_moderator)
2548 $tpl->setVariable(
'FORM', $this->getCensorshipFormHTML());
2553 if ($this->is_moderator)
2556 $tpl->setVariable(
'FORM', $this->getActivationFormHTML());
2562 if ($this->objCurrentPost->getId() != $node->getId() ||
2563 ($_GET[
'action'] !=
'showreply' &&
2564 $_GET[
'action'] !=
'showedit' &&
2565 $_GET[
'action'] !=
'censor' &&
2566 $_GET[
'action'] !=
'delete' &&
2570 if($this->is_moderator || $node->isActivated())
2573 if(!$this->objCurrentTopic->isClosed() && $node->isActivated() &&
2574 $ilAccess->checkAccess(
'add_reply',
'', (
int)$_GET[
'ref_id']) &&
2575 !$node->isCensored()
2578 $this->ctrl->setParameter($this,
'action',
'showreply');
2579 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2580 $this->ctrl->setParameter($this,
'offset', $Start);
2581 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2582 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2584 $actions[
'reply_to_postings'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId());
2586 $this->ctrl->clearParameters($this);
2590 if (!$this->objCurrentTopic->isClosed() && $node->isActivated() &&
2591 ($node->isOwner($ilUser->getId()) || $this->is_moderator) &&
2592 !$node->isCensored() &&
2593 $ilUser->getId() != ANONYMOUS_USER_ID)
2595 $this->ctrl->setParameter($this,
'action',
'showedit');
2596 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2597 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2598 $this->ctrl->setParameter($this,
'offset', $Start);
2599 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2601 $actions[
'edit'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId());
2603 $this->ctrl->clearParameters($this);
2607 if ($ilUser->getId() != ANONYMOUS_USER_ID && !$node->isPostRead())
2609 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2610 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2611 $this->ctrl->setParameter($this,
'offset', $Start);
2612 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2613 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2615 $actions[
'frm_mark_as_read'] = $this->ctrl->getLinkTarget($this,
'markPostRead', $node->getId());
2617 $this->ctrl->clearParameters($this);
2621 if ($ilUser->getId() != ANONYMOUS_USER_ID &&
2622 $node->isPostRead())
2624 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2625 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2626 $this->ctrl->setParameter($this,
'offset', $Start);
2627 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2628 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2630 $actions[
'frm_mark_as_unread'] = $this->ctrl->getLinkTarget($this,
'markPostUnread', $node->getId());
2632 $this->ctrl->clearParameters($this);
2636 if (!$node->isCensored())
2638 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_post', $node->getId());
2639 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'top_pk', $node->getForumId());
2640 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_pk', $node->getThreadId());
2642 $actions[
'print'] = $this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printPost');
2644 $this->ctrl->clearParameters($this);
2647 # buttons for every post except the "active" 2648 if (!$this->objCurrentTopic->isClosed() &&
2649 ($this->is_moderator ||
2650 ($node->isOwner($ilUser->getId()) && !$node->hasReplies())) &&
2651 $ilUser->getId() != ANONYMOUS_USER_ID)
2654 $this->ctrl->setParameter($this,
'action',
'delete');
2655 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2656 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2657 $this->ctrl->setParameter($this,
'offset', $Start);
2658 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2660 $actions[
'delete'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId());
2662 $this->ctrl->clearParameters($this);
2668 $this->ctrl->setParameter($this,
'action',
'censor');
2669 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2670 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2671 $this->ctrl->setParameter($this,
'offset', $Start);
2672 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2673 if($node->isCensored())
2675 $actions[
'frm_revoke_censorship'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId());
2679 $actions[
'frm_censorship'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->getId());
2682 $this->ctrl->clearParameters($this);
2685 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2686 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2687 $this->ctrl->setParameter($this,
'offset', $Start);
2688 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2690 if (!$node->isActivated())
2692 $actions[
'activate_post'] = $this->ctrl->getLinkTarget($this,
'askForPostActivation', $node->getId());
2695 $this->ctrl->clearParameters($this);
2701 $tmp_file_obj =
new ilFileDataForum($forumObj->getId(), $node->getId());
2702 $attachments_of_node = $tmp_file_obj->getFilesOfPost();
2703 if(count($attachments_of_node))
2705 if ($node->getId() != $this->objCurrentPost->getId() || $_GET[
'action'] !=
'showedit')
2707 foreach($attachments_of_node as
$file)
2709 $tpl->setCurrentBlock(
'attachment_download_row');
2710 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2711 $this->ctrl->setParameter($this,
'file', $file[
'md5']);
2712 $tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this,
'viewThread'));
2713 $tpl->setVariable(
'TXT_FILENAME', $file[
'name']);
2714 $this->ctrl->clearParameters($this);
2715 $tpl->parseCurrentBlock();
2717 $tpl->setCurrentBlock(
'attachments');
2718 $tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD',$lng->txt(
'forums_attachments'));
2719 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
2721 $tpl->parseCurrentBlock();
2725 $tpl->setCurrentBlock(
'posts_row');
2728 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
2737 $sb_item->setCaption($lng_id);
2738 $sb_item->setUrl(
$url);
2740 $action_button->setDefaultButton($sb_item);
2745 $sb_item->setCaption($lng_id);
2746 $sb_item->setUrl(
$url);
2754 $tpl->setVariable(
'COMMANDS', $action_button->render());
2757 $tpl->setVariable(
'POST_ANKER', $node->getId());
2761 $tpl->setVariable(
'TXT_PERMA_LINK', $lng->txt(
'perma_link'));
2762 $tpl->setVariable(
'PERMA_TARGET',
'_top');
2766 $rowCol =
'ilPostingNeedsActivation';
2768 else if($this->objProperties->getMarkModeratorPosts() == 1)
2772 $rowCol =
'ilModeratorPosting';
2774 elseif($node->getIsAuthorModerator())
2776 $rowCol =
'ilModeratorPosting';
2781 if (( $_GET[
'action'] !=
'delete' && $_GET[
'action'] !=
'censor' &&
2784 || $this->objCurrentPost->getId() != $node->getId())
2786 $tpl->setVariable(
'ROWCOL',
' '.$rowCol);
2791 $rowCol =
'tblrowmarked';
2795 if ($node->isCensored())
2798 if ($_GET[
'action'] !=
'censor')
2800 $tpl->setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
2804 $rowCol =
'tblrowmarked';
2808 $tpl->setVariable(
'ROWCOL',
' '.$rowCol);
2810 if(!$node->isActivated() && $node->isOwner($ilUser->getId()))
2812 $tpl->setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
2816 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2817 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2818 $backurl = urlencode($this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
2819 $this->ctrl->clearParameters($this);
2821 $this->ctrl->setParameter($this,
'backurl', $backurl);
2822 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2823 $this->ctrl->setParameter($this,
'user', $node->getDisplayUserId());
2825 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2827 $node->getPosAuthorId(),
2828 $node->getDisplayUserId(),
2829 $node->getUserAlias(),
2830 $node->getImportName(),
2832 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
2836 $this->ctrl->clearParameters($this);
2838 if($authorinfo->hasSuffix())
2840 $tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
2841 $tpl->setVariable(
'USR_NAME', $node->getUserAlias());
2845 $tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
2846 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized())
2848 $tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
2852 $tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
2853 if($authorinfo->getAuthor()->getId() &&
ilForum::_isModerator((
int)$_GET[
'ref_id'], $node->getPosAuthorId()))
2855 if($authorinfo->getAuthor()->getGender() ==
'f')
2857 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
2859 else if($authorinfo->getAuthor()->getGender() ==
'm')
2861 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
2866 if ($node->getUpdateUserId() > 0)
2871 $posMod = $frm->getModeratorFromPost($node->getId());
2873 if (is_array($posMod) && $posMod[
'top_mods'] > 0)
2875 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
2877 if (is_array($MODS))
2879 if (in_array($node->getUpdateUserId(), $MODS))
2880 $spanClass =
'moderator_small';
2884 $node->setChangeDate($node->getChangeDate());
2886 if ($spanClass ==
'') $spanClass =
'small';
2888 $this->ctrl->setParameter($this,
'backurl', $backurl);
2889 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2890 $this->ctrl->setParameter($this,
'user', $node->getUpdateUserId());
2892 $update_user_id = $node->getUpdateUserId();
2893 if($node->getPosAuthorId() == $node->getUpdateUserId()
2894 && $node->getDisplayUserId() == 0)
2896 $update_user_id = $node->getDisplayUserId();
2898 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2900 $node->getPosAuthorId(),
2902 $node->getUserAlias(),
2903 $node->getImportName(),
2905 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
2908 $this->ctrl->clearParameters($this);
2910 $tpl->setVariable(
'POST_UPDATE_TXT', $lng->txt(
'edited_on').
': '.$frm->convertDate($node->getChangeDate()).
' - '.strtolower($lng->txt(
'by')));
2911 $tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
2912 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix())
2914 $tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
2921 $node->setMessage($frm->prepareText($node->getMessage()));
2923 if($ilUser->getId() == ANONYMOUS_USER_ID ||
2924 $node->isPostRead())
2926 $tpl->setVariable(
'SUBJECT', $node->getSubject());
2930 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
2931 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
2932 $this->ctrl->setParameter($this,
'offset', $Start);
2933 $this->ctrl->setParameter($this,
'orderby', $_GET[
'orderby']);
2934 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2935 $mark_post_target = $this->ctrl->getLinkTarget($this,
'markPostRead', $node->getId());
2937 $tpl->setVariable(
'SUBJECT',
"<a href=\"".$mark_post_target.
"\"><b>".$node->getSubject().
"</b></a>");
2941 $tpl->setVariable(
'POST_DATE', $frm->convertDate($node->getCreateDate()));
2943 if (!$node->isCensored() ||
2944 ($this->objCurrentPost->getId() == $node->getId() && $_GET[
'action'] ==
'censor'))
2947 $modAuthor = $frm->getModeratorFromPost($node->getId());
2951 if (is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
2955 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
2957 if (is_array($MODS))
2959 if (in_array($node->getDisplayUserId(), $MODS))
2960 $spanClass =
'moderator';
2965 if($node->getMessage() == strip_tags($node->getMessage()))
2968 $node->setMessage(nl2br($node->getMessage()));
2971 if ($spanClass !=
"")
2982 $tpl->setVariable(
'POST',
"<span class=\"moderator\">".nl2br($node->getCensorshipComment()).
"</span>");
2985 $tpl->parseCurrentBlock();
2991 $first_node = $this->objCurrentTopic->getFirstPostNode();
2994 in_array($this->ctrl->getCmd(), array(
'createToLevelPost',
'saveTopLevelPost',
'quoteTopLevelPost')) &&
2995 !$this->objCurrentTopic->isClosed() &&
2996 $ilAccess->checkAccess(
'add_reply',
'', (
int)$_GET[
'ref_id']))
2999 $this->objCurrentPost->setId($first_node->getId());
3002 if($this->ctrl->getCmd() ==
'saveTopLevelPost')
3004 $form->setValuesByPost();
3006 else if($this->ctrl->getCmd() ==
'quoteTopLevelPost')
3008 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
3010 $first_node->getPosAuthorId(),
3011 $first_node->getDisplayUserId(),
3012 $first_node->getUserAlias(),
3013 $first_node->getImportName()
3016 $form->setValuesByPost();
3017 $form->getItemByPostVar(
'message')->setValue(
3019 $frm->prepareText($first_node->getMessage(), 1, $authorinfo->getAuthorName()).
"\n".$form->getInput(
'message'), 1
3023 $this->ctrl->setParameter($this,
'pos_pk', $first_node->getId());
3024 $this->ctrl->setParameter($this,
'thr_pk', $first_node->getThreadId());
3025 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
3026 $jsTpl->setVariable(
'IL_FRM_QUOTE_CALLBACK_SRC',
3027 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true));
3028 $this->ctrl->clearParameters($this);
3029 $tpl->setVariable(
'BOTTOM_FORM_ADDITIONAL_JS', $jsTpl->get());;
3030 $tpl->setVariable(
'BOTTOM_FORM', $form->getHTML());
3035 $tpl->setCurrentBlock(
'posts_no');
3036 $tpl->setVariable(
'TXT_MSG_NO_POSTS_AVAILABLE', $lng->txt(
'forums_posts_not_available'));
3037 $tpl->parseCurrentBlock();
3040 if($bottom_toolbar_split_button_items)
3044 foreach($bottom_toolbar_split_button_items as $item)
3048 $bottom_split_button->setDefaultButton($item);
3057 $bottom_toolbar->addStickyItem($bottom_split_button);
3060 $ilToolbar = clone $bottom_toolbar;
3062 if($bottom_toolbar_split_button_items)
3064 $bottom_toolbar->addSeparator();
3067 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
3069 $to_top_button->setCaption(
'top_of_page');
3070 $to_top_button->setUrl(
'#frm_page_top');
3071 $bottom_toolbar->addButtonInstance($to_top_button);
3072 $tpl->setVariable(
'TOOLBAR_BOTTOM', $bottom_toolbar->getHTML());
3074 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
3075 $permalink =
new ilPermanentLinkGUI(
'frm', $this->object->getRefId(),
'_'.$this->objCurrentTopic->getId());
3076 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
3088 $subject = $this->objCurrentPost->getSubject();
3089 $re_txt = $this->lng->txt(
'post_reply');
3091 $re_txt_with_num = str_replace(
':',
'(',$re_txt);
3092 $search_length = strlen($re_txt_with_num);
3093 $comp = substr_compare($re_txt_with_num, substr($subject, 0 , $search_length), 0, $search_length);
3097 $modified_subject = $subject;
3098 if($on_reply ==
true)
3101 $str_pos_start = strpos($subject,
'(');
3102 $str_pos_end = strpos($subject,
')');
3104 $length = ((int)$str_pos_end - (
int)$str_pos_start);
3106 $txt_number = substr($subject, $str_pos_start, $length - 1);
3108 if(is_numeric($txt_number))
3110 $re_count = (int)$txt_number + 1;
3111 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
3117 $re_count = substr_count($subject, $re_txt);
3118 if($re_count >= 1 && $on_reply ==
true)
3120 $subject = str_replace($re_txt,
'', $subject);
3124 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
3126 else if($re_count >= 1 && $on_reply ==
false)
3130 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
3132 else if($re_count == 0)
3135 $modified_subject = $this->lng->txt(
'post_reply').
' '. $this->objCurrentPost->getSubject();
3138 return $modified_subject;
3141 public function showUserObject()
3152 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
3154 $add = $this->getUserProfileAdditional(
$_GET[
'ref_id'],
$_GET[
'user']);
3155 $profile_gui->setAdditional($add);
3156 $profile_gui->setBackUrl(
$_GET[
'backurl']);
3157 $tpl->setContent($this->ctrl->getHTML($profile_gui));
3160 protected function getUserProfileAdditional($a_forum_ref_id, $a_user_id)
3166 global
$lng, $ilAccess;
3168 if(!$ilAccess->checkAccess(
'read',
'', $a_forum_ref_id))
3170 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3173 require_once
'Modules/Forum/classes/class.ilForum.php';
3175 $lng->loadLanguageModule(
'forum');
3181 if($ref_obj->getType() ==
'frm')
3184 $frm = $forumObj->Forum;
3185 $frm->setForumId($forumObj->getId());
3186 $frm->setForumRefId($forumObj->getRefId());
3194 if($ilAccess->checkAccess(
'moderate_frm',
'', $a_forum_ref_id))
3196 $numPosts = $frm->countUserArticles(addslashes($a_user_id));
3200 $numPosts = $frm->countActiveUserArticles(addslashes($a_user_id));
3203 return array($lng->txt(
'forums_posts') => $numPosts);
3206 public function performThreadsActionObject()
3215 if(isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids']))
3217 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] ==
'move')
3219 if($this->is_moderator)
3222 $this->moveThreadsObject();
3225 else if(
$_POST[
'selected_cmd'] ==
'enable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
3227 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3230 $tmp_obj->enableNotification($ilUser->getId());
3234 $this->ctrl->redirect($this,
'showThreads');
3236 else if(
$_POST[
'selected_cmd'] ==
'disable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
3238 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3241 $tmp_obj->disableNotification($ilUser->getId());
3245 $this->ctrl->redirect($this,
'showThreads');
3248 else if(
$_POST[
'selected_cmd'] ==
'close')
3250 if($this->is_moderator)
3252 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3260 $this->ctrl->redirect($this,
'showThreads');
3262 else if(
$_POST[
'selected_cmd'] ==
'reopen')
3264 if($this->is_moderator)
3266 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3275 $this->ctrl->redirect($this,
'showThreads');
3277 else if(
$_POST[
'selected_cmd'] ==
'makesticky')
3279 if($this->is_moderator)
3281 $message = $this->lng->txt(
'sel_threads_make_sticky');
3283 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3286 $makeSticky = $tmp_obj->makeSticky();
3290 $message = $this->lng->txt(
'sel_threads_already_sticky');
3296 if($message != null)
3300 $this->ctrl->redirect($this,
'showThreads');
3302 else if(
$_POST[
'selected_cmd'] ==
'unmakesticky')
3304 if($this->is_moderator)
3306 $message = $this->lng->txt(
'sel_threads_make_unsticky');
3307 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3310 $unmakeSticky = $tmp_obj->unmakeSticky();
3313 $message = $this->lng->txt(
'sel_threads_already_unsticky');
3320 if($message != null)
3324 $this->ctrl->redirect($this,
'showThreads');
3326 else if(
$_POST[
'selected_cmd'] ==
'editThread')
3328 if($this->is_moderator)
3330 $count = count(
$_POST[
'thread_ids']);
3334 $this->ctrl->redirect($this,
'showThreads');
3338 foreach(
$_POST[
'thread_ids'] as $thread_id)
3340 return $this->editThreadObject($thread_id, null);
3345 $this->ctrl->redirect($this,
'showThreads');
3347 else if(
$_POST[
'selected_cmd'] ==
'html')
3349 $this->ctrl->setCmd(
'exportHTML');
3350 $this->ctrl->setCmdClass(
'ilForumExportGUI');
3353 else if(
$_POST[
'selected_cmd'] ==
'confirmDeleteThreads')
3355 $this->confirmDeleteThreads();
3357 else if(
$_POST[
'selected_cmd'] ==
'merge')
3363 ilUtil::sendInfo($this->lng->txt(
'topics_please_select_one_action'),
true);
3364 $this->ctrl->redirect($this,
'showThreads');
3370 $this->ctrl->redirect($this,
'showThreads');
3374 public function performMoveThreadsObject()
3380 global
$lng, $ilObjDataCache;
3382 if(!$this->is_moderator)
3384 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3387 if(isset(
$_POST[
'frm_ref_id']) && (int)
$_POST[
'frm_ref_id'])
3389 $this->
object->Forum->moveThreads((array)
$_SESSION[
'threads2move'], $this->object->getRefId(), $ilObjDataCache->lookupObjId($_POST[
'frm_ref_id']));
3391 unset($_SESSION[
'threads2move']);
3393 $this->ctrl->redirect($this,
'showThreads');
3398 $this->moveThreadsObject();
3402 public function cancelMoveThreadsObject()
3409 if(!$this->is_moderator)
3411 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3416 $this->ctrl->redirect($this,
'showThreads');
3419 public function moveThreadsObject()
3428 if(!$this->is_moderator)
3430 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3433 $threads2move =
$_SESSION[
'threads2move'];
3434 if(!count($threads2move))
3437 $this->ctrl->redirect($this,
'showThreads');
3440 require_once
'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php';
3442 $exp->setPathOpen($this->object->getRefId());
3443 $exp->setNodeSelected(isset(
$_POST[
'frm_ref_id']) && (
int)
$_POST[
'frm_ref_id'] ? (
int)
$_POST[
'frm_ref_id'] : 0);
3444 $exp->setCurrentFrmRefId($this->object->getRefId());
3445 $exp->setHighlightedNode($this->object->getRefId());
3446 if(!$exp->handleCommand())
3448 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_move.html',
'Modules/Forum');
3451 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this));
3454 $tblThr->setId(
'il_frm_thread_move_table_'.$this->object->getRefId());
3455 $tblThr->setTitle($this->lng->txt(
'move_chosen_topics'));
3456 $tblThr->addColumn($this->lng->txt(
'subject'),
'top_name',
'100%');
3457 $tblThr->disable(
'header');
3458 $tblThr->disable(
'footer');
3459 $tblThr->disable(
'linkbar');
3460 $tblThr->disable(
'sort');
3461 $tblThr->disable(
'linkbar');
3462 $tblThr->setLimit(PHP_INT_MAX);
3463 $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html',
'Modules/Forum');
3464 $tblThr->setDefaultOrderField(
'is_sticky');
3467 foreach($threads2move as $thr_pk)
3471 $result[$counter][
'num'] = $counter + 1;
3478 $this->tpl->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
3480 $this->tpl->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
3481 $this->tpl->setVariable(
'CMD_SUBMIT',
'performMoveThreads');
3482 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'move'));
3483 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this,
'performMoveThreads'));
3489 private function initTopicCreateForm()
3501 $this->create_topic_form_gui->setTitle($this->lng->txt(
'forums_new_thread'));
3503 $this->create_topic_form_gui->setTableWidth(
'100%');
3506 $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this,
'addThread'));
3508 if($this->objProperties->isAnonymized() == 1)
3510 $alias_gui =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
3511 $alias_gui->
setInfo($this->lng->txt(
'forums_use_alias'));
3512 $alias_gui->setMaxLength(255);
3513 $alias_gui->setSize(50);
3514 $this->create_topic_form_gui->addItem($alias_gui);
3519 $alias_gui->
setValue($ilUser->getLogin());
3520 $this->create_topic_form_gui->addItem($alias_gui);
3524 $subject_gui =
new ilTextInputGUI($this->lng->txt(
'forums_thread'),
'subject');
3526 $subject_gui->setSize(50);
3527 $subject_gui->setRequired(
true);
3528 $this->create_topic_form_gui->addItem($subject_gui);
3533 $post_gui->setRows(15);
3534 $post_gui->setRequired(
true);
3535 $post_gui->setUseRte(
true);
3536 $post_gui->addPlugin(
'latex');
3537 $post_gui->addButton(
'latex');
3538 $post_gui->addButton(
'pastelatex');
3539 $post_gui->addPlugin(
'ilfrmquote');
3541 $post_gui->removePlugin(
'advlink');
3542 $post_gui->usePurifier(
true);
3543 $post_gui->setRTERootBlockElement(
'');
3544 $post_gui->setRTESupport($ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.5.11');
3545 $post_gui->disableButtons(array(
3563 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
3565 $this->create_topic_form_gui->addItem($post_gui);
3567 if($this->objProperties->isFileUploadAllowed())
3571 $this->create_topic_form_gui->addItem($fi);
3574 include_once
'Services/Mail/classes/class.ilMail.php';
3575 $umail =
new ilMail($ilUser->getId());
3577 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
3578 !$this->objProperties->isAnonymized())
3581 $dir_notification_gui =
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'),
'notify');
3582 $dir_notification_gui->
setInfo($this->lng->txt(
'forum_notify_me_directly'));
3583 $dir_notification_gui->setValue(1);
3584 $this->create_topic_form_gui->addItem($dir_notification_gui);
3586 if($ilias->getSetting(
'forum_notification') != 0)
3589 $gen_notification_gui =
new ilCheckboxInputGUI($this->lng->txt(
'forum_general_notification'),
'notify_posts');
3590 $gen_notification_gui->
setInfo($this->lng->txt(
'forum_notify_me_generally'));
3591 $gen_notification_gui->setValue(1);
3592 $this->create_topic_form_gui->addItem($gen_notification_gui);
3596 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
3598 $ilUser->isAnonymous() &&
3599 !$ilUser->isCaptchaVerified() &&
3600 ilCaptchaUtil::isActiveForForum()
3603 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
3604 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
3606 $this->create_topic_form_gui->addItem($captcha);
3608 $this->create_topic_form_gui->addCommandButton(
'addThread', $this->lng->txt(
'create'));
3609 $this->create_topic_form_gui->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
3614 $this->create_topic_form_gui->setValuesByArray(array(
3623 public function createThreadObject()
3629 global $ilAccess,
$lng;
3631 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
3633 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3636 $this->initTopicCreateForm();
3639 $create_form =
new ilTemplate(
'tpl.create_thread_form.html',
true,
true,
'Modules/Forum');
3640 $create_form->setVariable(
'CREATE_FORM',$this->create_topic_form_gui->getHTML());
3641 $create_form->parseCurrentBlock();
3643 $this->tpl->setContent($create_form->get());
3646 public function addThreadObject($a_prevent_redirect =
false)
3655 $frm = $this->
object->Forum;
3656 $frm->setForumId($this->object->getId());
3657 $frm->setForumRefId($this->object->getRefId());
3659 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
3661 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
3664 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
3666 $topicData = $frm->getOneTopic();
3668 $this->initTopicCreateForm();
3669 if($this->create_topic_form_gui->checkInput())
3671 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
3673 $ilUser->isAnonymous() &&
3674 !$ilUser->isCaptchaVerified() &&
3675 ilCaptchaUtil::isActiveForForum()
3678 $ilUser->setCaptchaVerified(
true);
3681 if($this->objProperties->isAnonymized())
3683 if(!strlen($this->create_topic_form_gui->getInput(
'alias')))
3685 $user_alias = $this->lng->txt(
'forums_anonymous');
3689 $user_alias = $this->create_topic_form_gui->getInput(
'alias');
3694 $user_alias = $ilUser->getLogin();
3699 $this->objProperties->isPostActivationEnabled() &&
3700 !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
3707 $newPost = $frm->generateThread(
3708 $topicData[
'top_pk'],
3710 ($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()),
3711 $this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'),
false),
3713 $this->create_topic_form_gui->getItemByPostVar(
'notify') ? (int)$this->create_topic_form_gui->getInput(
'notify') : 0,
3714 $this->create_topic_form_gui->getItemByPostVar(
'notify_posts') ? (int)$this->create_topic_form_gui->getInput(
'notify_posts') : 0,
3720 if($this->objProperties->isFileUploadAllowed())
3722 $file = $_FILES[
'userfile'];
3725 $tmp_file_obj =
new ilFileDataForum($this->object->getId(), $newPost);
3731 $frm->setDbTable(
'frm_data');
3732 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
3733 $frm->updateVisits($topicData[
'top_pk']);
3735 $frm->setMDB2WhereCondition(
'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
3736 array(
'integer',
'text'), array($topicData[
'top_pk'], $this->create_topic_form_gui->getInput(
'subject')));
3739 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
3741 foreach($mediaObjects as $mob)
3750 $GLOBALS[
'ilAppEventHandler']->raise(
3754 'ref_id' => $this->object->getRefId(),
3756 'notify_moderators' => !$status
3760 if(!$a_prevent_redirect)
3763 $this->ctrl->redirect($this);
3772 $this->create_topic_form_gui->setValuesByPost();
3774 if(!$this->objProperties->isAnonymized())
3776 $this->create_topic_form_gui->getItemByPostVar(
'alias')->setValue($ilUser->getLogin());
3779 return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
3783 public function enableForumNotificationObject()
3790 $frm = $this->
object->Forum;
3791 $frm->setForumId($this->object->getId());
3792 $frm->enableForumNotification($ilUser->getId());
3794 if(!$this->objCurrentTopic->getId())
3801 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3802 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_enabled'),
true);
3803 $this->ctrl->redirect($this,
'viewThread');
3807 public function disableForumNotificationObject()
3814 $frm = $this->
object->Forum;
3815 $frm->setForumId($this->object->getId());
3816 $frm->disableForumNotification($ilUser->getId());
3818 if(!$this->objCurrentTopic->getId())
3825 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3826 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_disabled'),
true);
3827 $this->ctrl->redirect($this,
'viewThread');
3842 global
$lng, $ilAccess;
3844 $column_gui->
setBlockProperty(
'news',
'title', $lng->txt(
'frm_latest_postings'));
3848 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
3851 $enable_internal_rss = $news_set->get(
'enable_rss_for_internal');
3852 if($enable_internal_rss)
3855 $column_gui->
setBlockProperty(
'news',
'public_notifications_option',
true);
3863 global $ilObjDataCache;
3865 if (!
$_POST[
'clone_source'])
3868 if (isset(
$_SESSION[
'wizard_search_title']))
3870 $this->searchCloneSourceObject();
3878 $source_id =
$_POST[
'clone_source'];
3881 $this->ctrl->setParameter($this,
'clone_source', (
int)
$_POST[
'clone_source']);
3882 $this->ctrl->setParameter($this,
'new_type', $new_type);
3884 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.frm_wizard_page.html',
'Modules/Forum');
3885 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this));
3887 $this->tpl->setVariable(
'ALT_IMG', $this->lng->txt(
'obj_'.$new_type));
3888 $this->tpl->setVariable(
'TXT_DUPLICATE', $this->lng->txt(
'frm_wizard_page'));
3889 $this->tpl->setVariable(
'INFO_THREADS', $this->lng->txt(
'fmr_copy_threads_info'));
3890 $this->tpl->setVariable(
'THREADS', $this->lng->txt(
'forums_threads'));
3892 $forum_id = $ilObjDataCache->lookupObjId((
int) $_POST[
'clone_source']);
3893 include_once(
'Modules/Forum/classes/class.ilForum.php');
3895 foreach ($threads as $thread_id => $title)
3897 $this->tpl->setCurrentBlock(
'thread_row');
3898 $this->tpl->setVariable(
'CHECK_THREAD',
ilUtil::formCheckbox(0,
'cp_options['.$source_id.
'][threads][]', $thread_id));
3899 $this->tpl->setVariable(
'NAME_THREAD', $title);
3900 $this->tpl->parseCurrentBlock();
3902 $this->tpl->setVariable(
'SELECT_ALL', $this->lng->txt(
'select_all'));
3903 $this->tpl->setVariable(
'JS_FIELD',
'cp_options['.$source_id.
'][threads]');
3904 $this->tpl->setVariable(
'BTN_COPY', $this->lng->txt(
'obj_'.$new_type.
'_duplicate'));
3905 if (isset(
$_SESSION[
'wizard_search_title']))
3907 $this->tpl->setVariable(
'BACK_CMD',
'searchCloneSource');
3911 $this->tpl->setVariable(
'BACK_CMD',
'create');
3913 $this->tpl->setVariable(
'BTN_BACK', $this->lng->txt(
'btn_back'));
3922 if($this->
object instanceof
ilObject)
3924 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
''),
'', $this->
object->getRefId());
3930 $a_text = str_replace(
"<",
"<", $a_text);
3931 $a_text = str_replace(
">",
">", $a_text);
3940 $a_text = str_replace(
"<",
"<", $a_text);
3941 $a_text = str_replace(
">",
">", $a_text);
3953 $this->ctrl->setCmd(
'showSummary');
3954 $this->ctrl->setCmdClass(
'ilinfoscreengui');
3955 $this->infoScreen();
3958 public function infoScreen()
3965 if(!$ilAccess->checkAccess(
'visible',
'', $this->object->getRefId()))
3967 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->
ilias->error_obj->MESSAGE);
3970 include_once
'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
3973 $info->enablePrivateNotes();
3976 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
3979 $this->ctrl->forwardCommand(
$info);
3982 public function updateNotificationSettingsObject()
3988 global $ilAccess,
$ilErr;
3989 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
3991 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
3998 if($this->notificationSettingsForm->checkInput())
4000 if(isset(
$_POST[
'notification_type']) &&
$_POST[
'notification_type']==
'all_users')
4003 $this->objProperties->setAdminForceNoti(1);
4004 $this->objProperties->setUserToggleNoti((
int) $this->notificationSettingsForm->getInput(
'usr_toggle'));
4005 $this->objProperties->setNotificationType(
'all_users');
4008 else if(
$_POST[
'notification_type']==
'per_user')
4010 $this->objProperties->setNotificationType(
'per_user');
4011 $this->objProperties->setAdminForceNoti(1);
4012 $this->objProperties->setUserToggleNoti(0);
4017 $this->objProperties->setNotificationType(
'default');
4018 $this->objProperties->setAdminForceNoti(0);
4019 $this->objProperties->setUserToggleNoti(0);
4020 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4025 $this->objProperties->update();
4030 $this->notificationSettingsForm->setValuesByPost();
4032 return $this->showMembersObject();
4037 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4039 $oParticipants = $this->getParticipantsObject();
4042 $moderator_ids = $frm_noti->
_getModerators($this->object->getRefId());
4044 $admin_ids = $oParticipants->getAdmins();
4045 $member_ids = $oParticipants->getMembers();
4046 $tutor_ids = $oParticipants->getTutors();
4048 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
4049 $all_forum_users= array_unique($all_forum_users);
4051 $all_notis = $frm_noti->read();
4053 foreach($all_forum_users as $user_id)
4055 $frm_noti->setUserId($user_id);
4057 $frm_noti->setAdminForce(1);
4058 $frm_noti->setUserToggle($this->objProperties->isUserToggleNoti());
4060 if(array_key_exists($user_id, $all_notis) && $update_all_users)
4062 $frm_noti->update();
4064 else if($frm_noti->existsNotification() ==
false)
4066 $frm_noti->insertAdminForce();
4073 if(null === $this->notificationSettingsForm)
4076 $form->setFormAction($this->ctrl->getFormAction($this,
'updateNotificationSettings'));
4077 $form->setTitle($this->lng->txt(
'forums_notification_settings'));
4080 $radio_grp->setValue(
'default');
4082 $opt_default =
new ilRadioOption($this->lng->txt(
"user_decides_notification"),
'default');
4083 $opt_0 =
new ilRadioOption($this->lng->txt(
"settings_for_all_members"),
'all_users');
4084 $opt_1 =
new ilRadioOption($this->lng->txt(
"settings_per_users"),
'per_user');
4086 $radio_grp->addOption($opt_default,
'default');
4087 $radio_grp->addOption($opt_0,
'all_users');
4088 $radio_grp->addOption($opt_1,
'per_user');
4094 $form->addItem($radio_grp);
4096 $form->addCommandButton(
'updateNotificationSettings', $this->lng->txt(
'save'));
4098 $this->notificationSettingsForm = $form;
4108 $icon = $user_toggle_noti
4109 ?
"<img src=\"".ilUtil::getImagePath(
"icon_ok.svg").
"\" alt=\"".$this->lng->txt(
"enabled").
"\" title=\"".$this->lng->txt(
"enabled").
"\" border=\"0\" vspace=\"0\"/>" 4110 :
"<img src=\"".ilUtil::getImagePath(
"icon_not_ok.svg").
"\" alt=\"".$this->lng->txt(
"disabled").
"\" title=\"".$this->lng->txt(
"disabled").
"\" border=\"0\" vspace=\"0\"/>";
4114 public function showMembersObject()
4125 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4127 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4130 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_members_list.html',
'Modules/Forum');
4132 $ilTabs->setTabActive(
'settings');
4133 $this->settingsTabs();
4139 $this->notificationSettingsForm->setValuesByArray(array(
4140 'notification_type' => $this->objProperties->getNotificationType(),
4141 'adm_force' => (bool) $this->objProperties->isAdminForceNoti(),
4142 'usr_toggle' => (bool) $this->objProperties->isUserToggleNoti()
4147 $tpl->setVariable(
'NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
4149 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4150 include_once
'Modules/Forum/classes/class.ilObjForum.php';
4153 $oParticipants = $this->getParticipantsObject();
4155 $moderator_ids = $frm_noti->_getModerators($this->object->getRefId());
4157 $admin_ids = $oParticipants->getAdmins();
4158 $member_ids = $oParticipants->getMembers();
4159 $tutor_ids = $oParticipants->getTutors();
4161 if($this->objProperties->getNotificationType() ==
'default')
4164 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4166 $forum_noti->
setAdminForce($this->objProperties->isAdminForceNoti());
4167 $forum_noti->setUserToggle($this->objProperties->isUserToggleNoti());
4168 $forum_noti->setForumId($this->objProperties->getObjId());
4170 else if($this->objProperties->getNotificationType() ==
'per_user')
4177 $this->__showMembersTable($moderators, $admins, $members, $tutors);
4185 foreach($user_ids as $user_id)
4189 $icon_ok = $this->
getIcon(!$user_toggle_noti);
4194 $users[$counter][
'firstname'] = $name[
'firstname'];
4195 $users[$counter][
'lastname'] = $name[
'lastname'];
4196 $users[$counter][
'user_toggle_noti'] = $icon_ok;
4202 private function __showMembersTable($moderators, $admins, $members, $tutors)
4214 $tbl_mod->setId(
'tbl_id_mod');
4215 $tbl_mod->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4216 $tbl_mod->setTitle($lng->txt(
'moderators'));
4218 $tbl_mod->addColumn(
'',
'',
'1%',
true);
4219 $tbl_mod->addColumn($lng->txt(
'login'),
'',
'10%');
4220 $tbl_mod->addColumn($lng->txt(
'firstname'),
'',
'10%');
4221 $tbl_mod->addColumn($lng->txt(
'lastname'),
'',
'10%');
4222 $tbl_mod->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4223 $tbl_mod->setSelectAllCheckbox(
'user_id');
4225 $tbl_mod->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4226 $tbl_mod->setData($moderators);
4228 $tbl_mod->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4229 $tbl_mod->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4231 $tpl->setCurrentBlock(
'moderators_table');
4232 $tpl->setVariable(
'MODERATORS',$tbl_mod->getHTML());
4238 $tbl_adm->setId(
'tbl_id_adm');
4239 $tbl_adm->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4240 $tbl_adm->setTitle($lng->txt(
'administrator'));
4242 $tbl_adm->addColumn(
'',
'',
'1%',
true);
4243 $tbl_adm->addColumn($lng->txt(
'login'),
'',
'10%');
4244 $tbl_adm->addColumn($lng->txt(
'firstname'),
'',
'10%');
4245 $tbl_adm->addColumn($lng->txt(
'lastname'),
'',
'10%');
4246 $tbl_adm->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4247 $tbl_adm->setSelectAllCheckbox(
'user_id');
4248 $tbl_adm->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4250 $tbl_adm->setData($admins);
4251 $tbl_adm->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4252 $tbl_adm->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4254 $tpl->setCurrentBlock(
'admins_table');
4255 $tpl->setVariable(
'ADMINS',$tbl_adm->getHTML());
4261 $tbl_mem->setId(
'tbl_id_mem');
4262 $tbl_mem->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4263 $tbl_mem->setTitle($lng->txt(
'members'));
4265 $tbl_mem->addColumn(
'',
'',
'1%',
true);
4266 $tbl_mem->addColumn($lng->txt(
'login'),
'',
'10%');
4267 $tbl_mem->addColumn($lng->txt(
'firstname'),
'',
'10%');
4268 $tbl_mem->addColumn($lng->txt(
'lastname'),
'',
'10%');
4269 $tbl_mem->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4270 $tbl_mem->setSelectAllCheckbox(
'user_id');
4271 $tbl_mem->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4272 $tbl_mem->setData($members);
4274 $tbl_mem->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4275 $tbl_mem->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4277 $tpl->setCurrentBlock(
'members_table');
4278 $tpl->setVariable(
'MEMBERS',$tbl_mem->getHTML());
4284 $tbl_tut->setId(
'tbl_id_tut');
4285 $tbl_tut->setFormAction($ilCtrl->getFormAction($this,
'showMembers'));
4286 $tbl_tut->setTitle($lng->txt(
'tutors'));
4288 $tbl_tut->addColumn(
'',
'',
'1%',
true);
4289 $tbl_tut->addColumn($lng->txt(
'login'),
'',
'10%');
4290 $tbl_tut->addColumn($lng->txt(
'firstname'),
'',
'10%');
4291 $tbl_tut->addColumn($lng->txt(
'lastname'),
'',
'10%');
4292 $tbl_tut->addColumn($lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
4293 $tbl_tut->setSelectAllCheckbox(
'user_id');
4294 $tbl_tut->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
4295 $tbl_tut->setData($tutors);
4297 $tbl_tut->addMultiCommand(
'enableHideUserToggleNoti',$lng->txt(
'enable_hide_user_toggle'));
4298 $tbl_tut->addMultiCommand(
'disableHideUserToggleNoti',$lng->txt(
'disable_hide_user_toggle'));
4300 $tpl->setCurrentBlock(
'tutors_table');
4301 $tpl->setVariable(
'TUTORS',$tbl_tut->getHTML());
4305 public function enableAdminForceNotiObject()
4311 global $ilAccess,
$ilErr;
4312 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4314 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4317 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4323 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4326 foreach(
$_POST[
'user_id'] as $user_id)
4329 $is_enabled = $frm_noti->isAdminForceNotification();
4331 $frm_noti->setUserToggle(0);
4334 $frm_noti->setAdminForce(1);
4335 $frm_noti->insertAdminForce();
4342 $this->showMembersObject();
4345 public function disableAdminForceNotiObject()
4351 global $ilAccess,
$ilErr;
4352 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4354 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4357 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4363 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4366 foreach(
$_POST[
'user_id'] as $user_id)
4369 $is_enabled = $frm_noti->isAdminForceNotification();
4373 $frm_noti->deleteAdminForce();
4380 $this->showMembersObject();
4383 public function enableHideUserToggleNotiObject()
4389 global $ilAccess,
$ilErr;
4390 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4392 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4394 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4400 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4403 foreach(
$_POST[
'user_id'] as $user_id)
4406 $is_enabled = $frm_noti->isAdminForceNotification();
4407 $frm_noti->setUserToggle(1);
4411 $frm_noti->setAdminForce(1);
4412 $frm_noti->insertAdminForce();
4416 $frm_noti->updateUserToggle();
4423 $this->showMembersObject();
4426 public function disableHideUserToggleNotiObject()
4432 global $ilAccess,
$ilErr;
4433 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4435 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),$ilErr->MESSAGE);
4438 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
4444 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4447 foreach(
$_POST[
'user_id'] as $user_id)
4450 $is_enabled = $frm_noti->isAdminForceNotification();
4451 $frm_noti->setUserToggle(0);
4454 $frm_noti->updateUserToggle();
4458 $frm_noti->setAdminForce(1);
4459 $frm_noti->insertAdminForce();
4466 $this->showMembersObject();
4469 public function markPostUnreadObject()
4476 if(isset(
$_GET[
'pos_pk']))
4478 $this->
object->markPostUnread($ilUser->getId(), (int)
$_GET[
'pos_pk']);
4481 $this->viewThreadObject();
4484 public function markPostReadObject()
4491 $this->
object->markPostRead($ilUser->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
4492 $this->viewThreadObject();
4502 $lg = parent::initHeaderAction();
4505 if($this->objCurrentTopic->getId())
4507 $container_obj = null;
4508 $lg->setContainerObject($container_obj);
4513 if($ilUser->getId() != ANONYMOUS_USER_ID && $this->
ilias->getSetting(
'forum_notification') != 0 )
4517 $frm = $this->
object->Forum;
4518 $frm->setForumId($this->object->getId());
4519 $frm->setForumRefId($this->object->getRefId());
4520 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4521 $frm_notificiation_enabled = $frm->isForumNotificationEnabled($ilUser->getId());
4523 if($this->objCurrentTopic->getId())
4525 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
4532 $frm_notificiation_enabled &&
4533 $is_user_allowed_to_deactivate_notification
4536 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
4540 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
4545 if($frm_notificiation_enabled)
4547 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
4551 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
4555 $topic_notification_enabled =
false;
4556 if($this->objCurrentTopic->getId())
4558 $topic_notification_enabled = $this->objCurrentTopic->isNotificationEnabled($ilUser->getId());
4559 if($topic_notification_enabled)
4561 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_disable_notification");
4565 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_enable_notification");
4568 $this->ctrl->setParameter($this,
'thr_pk',
'');
4570 if($frm_notificiation_enabled || $topic_notification_enabled)
4575 $this->lng->txt(
"frm_notification_activated")
4583 $this->lng->txt(
"frm_notification_deactivated")
4594 if($this->objProperties->getNotificationType() ==
'default')
4599 if($this->objProperties->isUserToggleNoti() == 0)
4608 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4611 $frm_noti->setUserId($ilUser->getId());
4613 $user_toggle = (int)$frm_noti->isUserToggleNotification();
4614 if($user_toggle == 0)
4628 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
4629 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
4631 if($grp_ref_id == 0 && $crs_ref_id == 0)
4641 public function getParticipantsObject()
4645 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(),
'grp');
4646 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(),
'crs');
4650 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'), $ilErr->MESSAGE);
4656 $oParticipants = null;
4661 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
4663 return $oParticipants;
4665 else if($crs_ref_id > 0)
4669 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
4671 return $oParticipants;
4674 return $oParticipants;
4688 if((
int)$ilSetting->get(
'disable_my_offers'))
4694 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4707 if((
int)$ilSetting->get(
'disable_my_offers'))
4713 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4721 $_POST[
'thread_sorting'] ? $thread_sorting =
$_POST[
'thread_sorting'] :$thread_sorting = array();
4723 foreach($thread_sorting as $thr_pk=>$sorting_value)
4725 $sorting_value = str_replace(
',',
'.',$sorting_value);
4726 $sorting_value = (float)$sorting_value * 100;
4727 $this->
object->setThreadSorting($thr_pk,$sorting_value);
4739 if(!$this->is_moderator)
4741 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4744 $selected_thread_id = 0;
4745 if(isset(
$_GET[
'merge_thread_id']) && (int)
$_GET[
'merge_thread_id'])
4747 $selected_thread_id = (int)$_GET[
'merge_thread_id'];
4749 else if(isset(
$_POST[
'thread_ids']) && count((array)
$_POST[
'thread_ids']) == 1)
4751 $selected_thread_id = (int)current($_POST[
'thread_ids']);
4760 if($selected_thread_id)
4762 $frm = $this->
object->Forum;
4763 $frm->setForumId($this->object->getId());
4764 $frm->setForumRefId($this->object->getRefId());
4766 $selected_thread_obj =
new ilForumTopic($selected_thread_id);
4775 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4777 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
4779 $topicData = $frm->getOneTopic();
4782 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
4783 $this->ctrl->setParameter($this,
'merge_thread_id', $selected_thread_id);
4784 $tbl =
new ilForumTopicTableGUI($this,
'mergeThreads',
'', (
int)$_GET[
'ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
4785 $tbl->setSelectedThread($selected_thread_obj);
4786 $tbl->setMapper($frm)->fetchData();
4788 $this->tpl->setVariable(
'THREADS_TABLE',
$tbl->getHTML());
4804 if(!$this->is_moderator)
4806 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4809 if(!isset(
$_GET[
'merge_thread_id']) || !(int)
$_GET[
'merge_thread_id'] || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 1)
4816 $source_thread_id = (int)
$_GET[
'merge_thread_id'];
4817 $target_thread_id = (int)current(
$_POST[
'thread_ids']);
4819 if($source_thread_id == $target_thread_id)
4829 $this->ctrl->clearParameters($this);
4839 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
4842 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performMergeThreads'));
4843 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_merge_threads'));
4844 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
4845 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performMergeThreads');
4847 $c_gui->addItem(
'thread_ids[]', $source_thread_id, sprintf($this->lng->txt(
'frm_merge_src'),
ilForumTopic::_lookupTitle($source_thread_id)));
4848 $c_gui->addItem(
'thread_ids[]', $target_thread_id, sprintf($this->lng->txt(
'frm_merge_target'),
ilForumTopic::_lookupTitle($target_thread_id)));
4850 $this->tpl->setContent($c_gui->getHTML());
4857 public function performMergeThreadsObject()
4864 if(!$this->is_moderator)
4866 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
4869 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 2)
4876 if((
int)
$_POST[
'thread_ids'][0] == (
int)
$_POST[
'thread_ids'][1])
4885 ilForum::mergeThreads($this->object->id, (
int)$_POST[
'thread_ids'][0], (
int)$_POST[
'thread_ids'][1]);
4909 if(!
$GLOBALS[
'ilCtrl']->isAsynch())
4911 require_once
'Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
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 _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
afterSave(ilObjForum $forumObj)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
setTopicCreateDefaultValues()
static _lookupDate($thread_id)
This class represents an option in a radio group.
_getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
deleteNotificationAllUsers()
static _lookupObjIdForForumId($a_for_id)
Class Forum core functions for forum.
static getTreeNodeHtml($object, ilObjForumGUI $gui, $pageHits)
Returns the html used for a single forum tree node public.
Class ilForumExplorer class for explorer view of forum posts.
Base class for ILIAS Exception handling.
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
fetchTreeChildrenAsyncObject()
setValue($a_value)
Set Value.
setDisplayConfirmPostActivation($status=0)
Class for permanent links.
static lookupForumIdByObjId($obj_id)
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static mergeThreads($obj_id, $source_id, $target_id)
GUI class for the workflow of copying objects.
isUserToggleNotification()
$notificationSettingsForm
getIcon($user_toggle_noti)
const TITLE_LENGTH
max length of object title
static getFirstNewsIdForContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
Class ilObject Basic functions for all objects.
static Linkbar($AScript, $AHits, $ALimit, $AOffset, $AParams=array(), $ALayout=array(), $prefix='')
Linkbar Diese Funktion erzeugt einen typischen Navigationsbalken mit "Previous"- und "Next"-Links und...
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
getSubTabs($subtab='showThreads')
static get($a_var)
Get a value.
static get($a_glyph, $a_text="")
Get glyph html.
setAdminForce($a_admin_force)
static set($a_var, $a_val)
Set a value.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static _lookupTitle($a_id)
lookup object title
saveThreadSortingObject()
createObject()
create new object form
Class ilForumNotification.
addTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
static addToDesktop()
Add desktop item public.
setInfo($a_info)
Set Info.
setTreeStateAsynchObject()
initForumCreateForm($object_type)
confirmMergeThreadsObject()
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _setRichTextEditorUserState($a_state)
Sets the state of the rich text editor visibility for the current user.
initNotificationSettingsForm()
static _getAllReferences($a_id)
get all reference ids of object
Class ilForumTopicTableGUI.
static _lookupObjectId($a_ref_id)
lookup object id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getCenterColumnHTML()
Get center column.
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
Export User Interface Class.
GUI class for public user profile presentation.
static getInstance($a_obj_id=0)
hideToolbar($a_flag=null)
static encode($mixed, $suppress_native=false)
& executeCommand()
execute command
getId()
get object id public
prepareFormOutput($a_text)
Class ilForumModeratorsGUI.
addSubItem($a_item)
Add Subitem.
Forum export to HTML and Print.
Column user interface class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class Mail this class handles base functions for mail handling.
getTabs(&$tabs_gui)
get tabs abstract method.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
special template class to simplify handling of ITX/PEAR
setSize($a_size)
Set Size.
This class represents a text property in a property form.
setCols($a_cols)
Set Cols.
askForPostActivationObject()
static infoPanel($a_keep=true)
redirection script todo: (a better solution should control the processing via a xml file) ...
static getOverallRatingForObject($a_obj_id, $a_obj_type, $a_sub_obj_id=null, $a_sub_obj_type=null, $a_category_id=null)
Get overall rating for an object.
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
updateUserNotifications($update_all_users=false)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static _getThreads($a_obj_id, $a_sort_mode=self::SORT_DATE)
Get thread infos of object.
prepareOutput()
prepare output
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getModifiedReOnSubject($on_reply=false)
isUserAllowedToDeactivateNotification()
static getSearchBlockHTML($a_title)
Get standar search block html.
displayConfirmPostActivation()
static removeFromDesktop()
Remove item from personal desktop public.
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
ilForumMoveTopicsExplorer
getRightColumnHTML()
Display right column.
cancelObject($in_rep=false)
setColumnSettings($column_gui)
May be overwritten in subclasses.
This class represents a non editable value in a property form.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
static _getRichTextEditorUserState()
Gets the state of the rich text editor visibility for the current user.
This class represents a text area property in a property form.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
createToLevelPostObject()
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']
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
$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) ...
quoteTopLevelPostObject()
Confirmation screen class.