103 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
107 $this->ctrl = $DIC->ctrl();
108 $this->ctrl->saveParameter($this, [
'ref_id',
'cmdClass']);
110 $this->tpl = $DIC->ui()->mainTemplate();
111 $this->lng = $DIC->language();
112 $this->httpRequest = $DIC->http()->request();
113 $this->
http = $DIC->http();
114 $this->uiFactory = $DIC->ui()->factory();
115 $this->uiRenderer = $DIC->ui()->renderer();
116 $this->globalScreen = $DIC->globalScreen();
118 $this->access = $DIC->access();
119 $this->ilObjDataCache = $DIC[
'ilObjDataCache'];
120 $this->tabs = $DIC->tabs();
121 $this->error = $DIC[
'ilErr'];
123 $this->
user = $DIC->user();
125 $this->toolbar = $DIC->toolbar();
126 $this->repositoryTree = $DIC->repositoryTree();
127 $this->
ilHelp = $DIC[
'ilHelp'];
128 $this->rbac = $DIC->rbac();
129 $this->locator = $DIC[
'ilLocator'];
131 $this->tpl->addJavaScript(
'./Services/JavaScript/js/Basic.js');
136 $this->lng->loadLanguageModule(
'forum');
141 $this->is_moderator = $this->access->checkAccess(
'moderate_frm',
'',
$_GET[
'ref_id']);
146 $this->requestAction = (string) ($this->httpRequest->getQueryParams()[
'action'] ??
'');
153 if (!is_array($forumValues)) {
158 $threadId = $this->httpRequest->getQueryParams()[
'thr_pk'] ?? 0;
159 if ((
int) $threadId > 0 && !is_array($forumValues[(
int) $threadId])) {
160 $forumValues[(int) $threadId] = [];
171 'frm_exp_' . $this->objCurrentTopic->getId(),
175 $this->objCurrentTopic->getFirstPostNode($this->is_moderator)
188 array $subtree_nodes,
189 array $pagedPostings,
193 if ($firstForumPost->
getId() == $this->objCurrentPost->getId()) {
197 if (count($subtree_nodes) > 0 && $this->objCurrentPost->getId() > 0) {
198 $isCurrentPostingInPage = array_filter($pagedPostings,
function (
ilForumPost $posting) {
199 return $posting->
getId() == $this->objCurrentPost->getId();
202 if (0 === count($isCurrentPostingInPage)) {
203 $pageOfCurrentPosting = 0;
205 foreach ($subtree_nodes as $node) {
206 if (
$i > 0 && 0 ===
$i % $pageSize) {
207 ++$pageOfCurrentPosting;
210 if ($node->getId() == $this->objCurrentPost->getId()) {
217 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
218 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
219 $this->ctrl->setParameter($this,
'page', $pageOfCurrentPosting);
220 $this->ctrl->setParameter(
225 $this->ctrl->redirect($this,
'viewThread', $this->objCurrentPost->getId());
237 if ((
int) $thread->
getForumId() !== (int) $forumId) {
238 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
250 $this->tpl->addJavascript(
'./Modules/Forum/js/autosave.js');
251 $autosave_cmd =
'autosaveDraftAsync';
252 if ($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0) {
253 $autosave_cmd =
'autosaveThreadDraftAsync';
255 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
256 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
257 $draft_id = (int)
$_GET[
'draft_id'] > 0 ? (
int)
$_GET[
'draft_id'] : 0;
258 $this->ctrl->setParameter($this,
'draft_id', $draft_id);
260 $this->tpl->addOnLoadCode(
261 "il.Language.setLangVar('saving', " . json_encode($this->lng->txt(
'saving')) .
");" 264 $this->tpl->addOnLoadCode(
'il.ForumDraftsAutosave.init(' . json_encode(array(
266 'draft_id' => $draft_id,
267 'interval' => $interval * 1000,
268 'url' => $this->ctrl->getFormAction($this, $autosave_cmd,
'',
true,
false),
269 'selectors' => array(
270 'form' =>
'#form_' . $form->
getId()
282 strtolower($this->ctrl->getCmd()),
283 array_map(
'strtolower', array(
'createTopLevelPost',
'saveTopLevelPost',
'saveTopLevelDraft'))
289 $next_class = $this->ctrl->getNextClass($this);
290 $cmd = $this->ctrl->getCmd();
292 $exclude_cmds = array(
296 'showThreadNotification',
297 'performPostActivation',
298 'askForPostActivation',
299 'askForPostDeactivation',
300 'toggleThreadNotification',
301 'toggleThreadNotificationTab',
306 'createTopLevelPost',
309 'getQuotationHTMLAsynch',
310 'autosaveDraftAsync',
311 'autosaveThreadDraftAsync',
315 'deliverDraftZipFile',
318 'deleteThreadDrafts',
320 'deletePostingDraft',
325 if (!in_array($cmd, $exclude_cmds)) {
329 if (!$this->
getCreationMode() && !$this->ctrl->isAsynch() && $this->access->checkAccess(
335 (
int)
$_GET[
'ref_id'],
341 switch ($next_class) {
342 case 'ilforumsettingsgui':
347 case 'ilrepositoryobjectsearchgui':
350 $this->tabs->activateTab(
"forums_threads");
351 $this->ctrl->setReturn($this,
'view');
353 $this->object->getRefId(),
357 $this->ctrl->forwardCommand($search_gui);
360 case 'ilpermissiongui':
362 $this->ctrl->forwardCommand($perm_gui);
365 case 'ilforumexportgui':
367 $this->ctrl->forwardCommand($fex_gui);
368 $this->
http->close();
371 case 'ilforummoderatorsgui':
373 $this->ctrl->forwardCommand($fm_gui);
376 case 'ilinfoscreengui':
384 case 'ilpublicuserprofilegui':
386 $add = $this->getUserProfileAdditional((
int) $_GET[
'ref_id'], (
int) $_GET[
'user']);
387 $profile_gui->setAdditional($add);
388 $ret = $this->ctrl->forwardCommand($profile_gui);
389 $this->tpl->setContent(
$ret);
392 case 'ilobjectcopygui':
395 $this->ctrl->forwardCommand($cp);
399 $this->tabs->activateTab(
'export');
401 $exp->addFormat(
'xml');
402 $this->ctrl->forwardCommand($exp);
406 if (!$this->objProperties->isIsThreadRatingEnabled() || $this->
user->isAnonymous()) {
407 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
410 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
411 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
417 $rating_gui->setObject(
418 $this->object->getId(),
419 $this->
object->getType(),
420 $this->objCurrentTopic->getId(),
424 $this->ctrl->setParameter($this,
'thr_pk', (
int) $this->objCurrentTopic->getId());
425 $this->ctrl->forwardCommand($rating_gui);
428 $this->object->getId(),
429 $this->
object->getType(),
430 (int) $this->objCurrentTopic->getId(),
433 $this->objCurrentTopic->setAverageRating($avg[
'avg']);
434 $this->objCurrentTopic->update();
436 $this->ctrl->redirect($this,
"showThreads");
439 case 'ilcommonactiondispatchergui':
441 $this->ctrl->forwardCommand($gui);
444 case "ilcontainernewssettingsgui":
448 $this->lng->loadLanguageModule(
'cont');
450 $news_set_gui->setNewsBlockForced(
true);
451 $news_set_gui->setPublicNotification(
true);
452 $this->ctrl->forwardCommand($news_set_gui);
464 if (isset(
$_POST[
'select_cmd2'])) {
468 if (isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] != null) {
470 'enableAdminForceNoti',
471 'disableAdminForceNoti',
472 'enableHideUserToggleNoti',
473 'disableHideUserToggleNoti' 478 ) ? $cmd =
$_POST[
'selected_cmd'] : $cmd =
'performThreadsAction';
479 } elseif (!$cmd && !
$_POST[
'selected_cmd']) {
480 $cmd =
'showThreads';
490 if ($cmd !=
'viewThreadObject' && $cmd !=
'showUserObject') {
500 $this->ctrl->setCmd(
'showSummary');
501 $this->ctrl->setCmdClass(
'ilinfoscreengui');
511 $this->forum_settings_gui->getCustomForm($a_form);
519 $this->forum_settings_gui->getCustomValues($a_values);
527 $this->forum_settings_gui->updateCustomValues($a_form);
537 $this->ctrl->setParameter($this,
'thr_pk', $a_thread_id);
538 $form->setFormAction($this->ctrl->getFormAction($this,
'updateThread'));
541 $ti_prop->setRequired(
true);
542 $ti_prop->setMaxLength(255);
543 $ti_prop->setSize(50);
544 $form->addItem($ti_prop);
546 $form->addCommandButton(
'updateThread', $this->lng->txt(
'save'));
547 $form->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
558 if (!$this->is_moderator) {
559 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
562 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
563 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
566 $thread = new \ilForumTopic($threadId);
569 $this->tabs->activateTab(
'forums_threads');
573 $form->setValuesByArray(array(
574 'title' => $thread->getSubject()
578 $this->tpl->setContent($form->getHTML());
586 if (!$this->is_moderator) {
587 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
590 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
591 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
594 if (!$this->objCurrentTopic->getId()) {
602 if (!$form->checkInput()) {
603 $form->setValuesByPost();
608 $this->objCurrentTopic->setSubject($form->getInput(
'title'));
609 $this->objCurrentTopic->updateThreadTitle();
611 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
617 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
618 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
621 $this->
object->markAllThreadsRead($this->
user->getId());
643 $this->tabs->addSubTabTarget(
645 $this->ctrl->getLinkTarget($this,
'showThreads'),
649 $subtab ==
'showThreads' ? true : false
652 if ($this->object->getNumStickyThreads() > 1) {
653 $this->tabs->addSubTabTarget(
654 'sticky_threads_sorting',
655 $this->ctrl->getLinkTarget($this,
'sortThreads'),
658 $subtab ==
'sortThreads' ? true : false
666 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
667 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
670 $cmd = $this->ctrl->getCmd();
671 $frm = $this->
object->Forum;
672 $frm->setForumId($this->object->getId());
673 $frm->setForumRefId($this->object->getRefId());
674 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
676 $threadsTemplate = new \ilTemplate(
677 'tpl.forums_threads_liste.html',
683 if ((
int) strlen($this->confirmation_gui_html)) {
684 $threadsTemplate->setVariable(
'CONFIRMATION_GUI', $this->confirmation_gui_html);
688 if ($this->access->checkAccess(
'add_thread',
'', $this->object->getRefId()) && !$this->
hideToolbar()) {
690 $btn->setUrl($this->ctrl->getLinkTarget($this,
'createThread'));
691 $btn->setCaption(
'forums_new_thread');
692 $this->toolbar->addStickyItem($btn);
696 if (!$this->
user->isAnonymous() && !(int) strlen($this->confirmation_gui_html)) {
697 $this->toolbar->addButton(
698 $this->lng->txt(
'forums_mark_read'),
699 $this->ctrl->getLinkTarget($this,
'markAllRead'),
703 $this->ctrl->clearParameters($this);
708 $this->
user->getId(),
711 if (count($drafts) > 0) {
715 $this->access->checkAccess(
'add_thread',
'', $this->object->getRefId())
717 $draftsTable->setData($drafts);
718 $threadsTemplate->setVariable(
'THREADS_DRAFTS_TABLE', $draftsTable->getHTML());
723 $topicData = $frm->getOneTopic();
726 $frm->setDbTable(
'frm_data');
727 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
728 $frm->updateVisits($topicData[
'top_pk']);
730 if (!in_array($cmd, array(
'showThreads',
'sortThreads'))) {
731 $cmd =
'showThreads';
738 (
int)
$_GET[
'ref_id'],
741 $this->
settings->get(
'forum_overview')
744 $tbl->setMapper($frm)->fetchData();
745 $threadsTemplate->setVariable(
'THREADS_TABLE', $tbl->getHTML());
748 $this->tpl->setPermanentLink($this->object->getType(), $this->
object->getRefId(),
'',
'_top');
750 $this->tpl->setContent($threadsTemplate->get());
766 $frm = $this->
object->Forum;
768 foreach ($drafts as $draft) {
770 $filesOfDraft = $tmp_file_obj->getFilesOfPost();
771 ksort($filesOfDraft);
773 if (count($filesOfDraft)) {
774 if ($action !==
'showdraft') {
775 foreach ($filesOfDraft as $file) {
777 $this->ctrl->setParameter($this,
'draft_id', $tmp_file_obj->getDraftId());
778 $this->ctrl->setParameter($this,
'file', $file[
'md5']);
779 $tpl->
setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this,
'viewThread'));
781 $this->ctrl->setParameter($this,
'file',
'');
782 $this->ctrl->setParameter($this,
'draft_id',
'');
783 $this->ctrl->clearParameters($this);
788 $tpl->
setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt(
'forums_attachments'));
793 if (count($filesOfDraft) > 1) {
795 $download_zip_button->setCaption($this->lng->txt(
'download'),
false);
796 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
797 $download_zip_button->setUrl($this->ctrl->getLinkTarget($this,
'deliverDraftZipFile'));
798 $this->ctrl->setParameter($this,
'draft_id',
'');
799 $tpl->
setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
810 (
int) $this->httpRequest->getQueryParams()[
'page'],
814 $rowCol =
'tblrowmarked';
816 $depth = (int) ($referencePosting->
getDepth() - 1);
822 $this->ctrl->setParameter($this,
'pos_pk', $referencePosting->
getId());
823 $this->ctrl->setParameter($this,
'thr_pk', $referencePosting->
getThreadId());
824 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
826 $backurl = urlencode($this->ctrl->getLinkTarget($this,
'viewThread', $referencePosting->
getId()));
828 $this->ctrl->setParameter($this,
'backurl', $backurl);
829 $this->ctrl->setParameter($this,
'thr_pk', $referencePosting->
getThreadId());
830 $this->ctrl->setParameter($this,
'user', $draft->getPostDisplayUserId());
833 $draft->getPostAuthorId(),
834 $draft->getPostDisplayUserId(),
835 $draft->getPostUserAlias(),
838 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
842 $this->ctrl->clearParameters($this);
844 if ($authorinfo->hasSuffix()) {
845 $tpl->
setVariable(
'AUTHOR', $authorinfo->getSuffix());
846 $tpl->
setVariable(
'USR_NAME', $draft->getPostUserAlias());
848 $tpl->
setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
849 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
850 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
853 $tpl->
setVariable(
'DRAFT_ANCHOR',
'draft_' . $draft->getDraftId());
855 $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
859 $draft->getPostAuthorId()
861 if ($authorinfo->getAuthor()->getGender() ==
'f') {
862 $tpl->
setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
863 } elseif ($authorinfo->getAuthor()->getGender() ==
'm') {
864 $tpl->
setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
865 } elseif ($authorinfo->getAuthor()->getGender() ==
'n') {
866 $tpl->
setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_n'));
870 if ($draft->getUpdateUserId() > 0) {
871 $draft->setPostUpdate($draft->getPostUpdate());
873 $this->ctrl->setParameter($this,
'backurl', $backurl);
874 $this->ctrl->setParameter($this,
'thr_pk', $referencePosting->
getThreadId());
875 $this->ctrl->setParameter($this,
'user', $referencePosting->
getUpdateUserId());
876 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
879 $draft->getPostAuthorId(),
881 $draft->getPostDisplayUserId(),
882 $draft->getPostUserAlias(),
885 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
889 $this->ctrl->clearParameters($this);
893 $this->lng->txt(
'edited_on') .
': ' . $frm->convertDate($draft->getPostUpdate()) .
' - ' . strtolower($this->lng->txt(
'by'))
895 $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
896 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
897 $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
901 $draft->setPostMessage($frm->prepareText($draft->getPostMessage()));
903 $tpl->
setVariable(
'SUBJECT', $draft->getPostSubject());
904 $tpl->
setVariable(
'POST_DATE', $frm->convertDate($draft->getPostDate()));
906 if (!$referencePosting->
isCensored() || ($this->objCurrentPost->getId() == $referencePosting->
getId() && $action ===
'censor')) {
909 $spanClass =
'moderator';
912 if ($draft->getPostMessage() == strip_tags($draft->getPostMessage())) {
914 $draft->setPostMessage(nl2br($draft->getPostMessage()));
917 if ($spanClass !=
"") {
921 $draft->getPostMessage(),
930 if (!$this->objCurrentTopic->isClosed() && $action ===
'deletedraft') {
931 if (!$this->
user->isAnonymous() && (int) $draft->getDraftId() === (int)
$_GET[
'draft_id']) {
933 $tpl->
setVariable(
'FORM', $this->getDeleteDraftFormHTML());
935 } elseif ($action ===
'editdraft' && (
int) $draft->getDraftId() === (int)
$_GET[
'draft_id']) {
938 if (!$this->objCurrentTopic->isClosed() && in_array($this->requestAction, [
'showdraft',
'editdraft'])) {
939 $this->renderPostingForm($tpl, $frm, $referencePosting, $this->requestAction);
942 $tpl->
setVariable(
'EDIT_DRAFT_ANCHOR',
'draft_edit_' . $draft->getDraftId());
966 $frm = $this->
object->Forum;
972 if (count($filesOfPost) > 0) {
973 if ($node->
getId() != $this->objCurrentPost->getId() || $action !==
'showedit') {
974 foreach ($filesOfPost as $file) {
976 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
977 $this->ctrl->setParameter($this,
'file', $file[
'md5']);
978 $tpl->
setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this,
'viewThread'));
980 $this->ctrl->clearParameters($this);
985 $tpl->
setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt(
'forums_attachments'));
990 if (count($filesOfPost) > 1) {
992 $download_zip_button->setCaption($this->lng->txt(
'download'),
false);
993 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
994 $download_zip_button->setUrl($this->ctrl->getLinkTarget($this,
'deliverZipFile'));
996 $tpl->
setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
1005 $tpl->
setVariable(
'TXT_PERMA_LINK', $this->lng->txt(
'perma_link'));
1010 $rowCol =
'ilPostingNeedsActivation';
1011 } elseif ($this->objProperties->getMarkModeratorPosts() == 1) {
1014 $rowCol =
'ilModeratorPosting';
1016 $rowCol =
'ilModeratorPosting';
1022 $this->objCurrentPost->getId() != $node->
getId()
1026 $rowCol =
'tblrowmarked';
1030 if ($action !==
'censor') {
1031 $tpl->
setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
1034 $rowCol =
'tblrowmarked';
1040 $tpl->
setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
1043 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
1044 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1045 $backurl = urlencode($this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId()));
1046 $this->ctrl->clearParameters($this);
1048 $this->ctrl->setParameter($this,
'backurl', $backurl);
1049 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1057 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
1060 $this->ctrl->clearParameters($this);
1062 if ($authorinfo->hasSuffix()) {
1063 if (!$authorinfo->isDeleted()) {
1064 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAlias());
1066 $tpl->
setVariable(
'AUTHOR', $authorinfo->getSuffix());
1068 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
1069 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
1071 $tpl->
setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
1074 $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
1077 if ($authorinfo->getAuthor()->getId() && $isModerator) {
1078 $authorRole = $this->lng->txt(
'frm_moderator_n');
1079 if (is_string($authorinfo->getAuthor()->getGender()) && strlen($authorinfo->getAuthor()->getGender()) > 0) {
1080 $authorRole = $this->lng->txt(
'frm_moderator_' . $authorinfo->getAuthor()->getGender());
1088 $this->ctrl->setParameter($this,
'backurl', $backurl);
1089 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1101 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
1104 $this->ctrl->clearParameters($this);
1108 $this->lng->txt(
'edited_on') .
': ' . $frm->convertDate($node->
getChangeDate()) .
' - ' . strtolower($this->lng->txt(
'by'))
1110 $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
1111 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
1112 $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
1121 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
1122 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1123 $this->ctrl->setParameter($this,
'page', $pageIndex);
1124 $this->ctrl->setParameter(
1129 $this->ctrl->setParameter($this,
'viewmode', $this->selectedSorting);
1130 $mark_post_target = $this->ctrl->getLinkTarget($this,
'markPostRead', $node->
getId());
1134 "<a href=\"" . $mark_post_target .
"\"><b>" . $node->
getSubject() .
"</b></a>" 1140 if (!$node->
isCensored() || ($this->objCurrentPost->getId() == $node->
getId() && $action ===
'censor')) {
1143 $spanClass =
'moderator';
1152 if ($spanClass !==
'') {
1155 "<span class=\"" . $spanClass .
"\">" .
1174 \ilUtil::sendSuccess($this->lng->txt(
'frm_added'),
true);
1175 $this->ctrl->setParameter($this,
'ref_id', $a_new_object->
getRefId());
1176 $this->ctrl->redirect($this,
'createThread');
1181 $this->
ilHelp->setScreenIdComponent(
"frm");
1183 $this->ctrl->setParameter($this,
'ref_id', $this->ref_id);
1190 'enableForumNotification',
1191 'disableForumNotification',
1193 'performMoveThreads',
1194 'cancelMoveThreads',
1195 'performThreadsAction',
1199 'confirmDeleteThreads',
1202 'performMergeThreads' 1205 (in_array($this->ctrl->getCmd(), $active)) ? $force_active = true : $force_active =
false;
1207 if ($this->access->checkAccess(
1212 $this->tabs->addTarget(
1214 $this->ctrl->getLinkTarget($this,
'showThreads'),
1215 $this->ctrl->getCmd(),
1223 if ($this->access->checkAccess(
'visible',
'', $this->ref_id) || $this->access->checkAccess(
1228 $force_active = ($this->ctrl->getNextClass() ==
'ilinfoscreengui' || strtolower(
$_GET[
'cmdClass']) ==
'ilnotegui') ?
true :
false;
1229 $this->tabs->addTarget(
1231 $this->ctrl->getLinkTargetByClass(array(
'ilobjforumgui',
'ilinfoscreengui'),
'showSummary'),
1232 array(
'showSummary',
'infoScreen'),
1239 if ($this->access->checkAccess(
'write',
'', $this->ref_id)) {
1240 $force_active = ($this->ctrl->getCmd() ==
'edit') ?
true :
false;
1241 $this->tabs->addTarget(
1243 $this->ctrl->getLinkTarget($this,
'edit'),
1251 if ($this->access->checkAccess(
'write',
'', $this->ref_id)) {
1252 $this->tabs->addTarget(
1254 $this->ctrl->getLinkTargetByClass(
'ilForumModeratorsGUI',
'showModerators'),
1260 if ($this->
settings->get(
'enable_fora_statistics',
false)) {
1261 $hasStatisticsAccess = $this->access->checkAccess(
'write',
'', $this->ref_id);
1262 if (!$hasStatisticsAccess) {
1263 $hasStatisticsAccess = (
1264 $this->objProperties->isStatisticEnabled() &&
1265 $this->access->checkAccess(
'read',
'', $this->ref_id)
1269 if ($hasStatisticsAccess) {
1270 $force_active = ($this->ctrl->getCmd() ==
'showStatistics') ?
true :
false;
1271 $this->tabs->addTarget(
1273 $this->ctrl->getLinkTarget($this,
'showStatistics'),
1282 if ($this->access->checkAccess(
'write',
'', $this->object->getRefId())) {
1283 $this->tabs->addTarget(
'export', $this->ctrl->getLinkTargetByClass(
'ilexportgui',
''),
'',
'ilexportgui');
1286 if ($this->access->checkAccess(
'edit_permission',
'', $this->ref_id)) {
1287 $this->tabs->addTarget(
1289 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'),
1290 array(
'perm',
'info',
'owner'),
1299 if (!$this->
settings->get(
'enable_fora_statistics',
false)) {
1300 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1304 if (!$this->access->checkAccess(
'read',
'', (
int)
$_GET[
'ref_id'])) {
1305 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1309 if (!$this->objProperties->isStatisticEnabled()) {
1311 if ($this->access->checkAccess(
'write',
'', (
int) $_GET[
'ref_id'])) {
1312 ilUtil::sendInfo($this->lng->txt(
'frm_statistics_disabled_for_participants'));
1314 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1318 $this->
object->Forum->setForumId($this->object->getId());
1321 $tbl->setId(
'il_frm_statistic_table_' . (
int) $_GET[
'ref_id']);
1323 $this->lng->txt(
'statistic'),
1325 $this->lng->txt(
'obj_' . $this->object->getType())
1328 $data = $this->
object->Forum->getUserStatistic($this->is_moderator);
1331 foreach (
$data as $row) {
1332 $result[$counter][
'ranking'] = $row[0];
1333 $result[$counter][
'login'] = $row[1];
1334 $result[$counter][
'lastname'] = $row[2];
1335 $result[$counter][
'firstname'] = $row[3];
1341 $this->tpl->setContent($tbl->getHTML());
1344 public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
1348 $ilAccess = $DIC->access();
1349 $lng = $DIC->language();
1352 if ($ilAccess->checkAccess(
'read',
'', $a_target)) {
1353 if ($a_thread != 0) {
1355 if ($objTopic->getFrmObjId() &&
1358 foreach ($ref_ids as
$ref_id) {
1359 if ($ilAccess->checkAccess(
'read',
'', $ref_id)) {
1365 if (isset($new_ref_id) && $new_ref_id != $a_target) {
1366 $DIC->ctrl()->redirectToURL(
1367 ILIAS_HTTP_PATH .
'/goto.php?target=frm_' . $new_ref_id .
'_' . $a_thread .
'_' . $a_posting
1372 $DIC->ctrl()->setParameterByClass(ilObjForumGUI::class,
'ref_id', (
int) $a_target);
1373 if (is_numeric($a_thread)) {
1374 $DIC->ctrl()->setParameterByClass(ilObjForumGUI::class,
'thr_pk', (
int) $a_thread);
1376 if (is_numeric($a_posting)) {
1377 $DIC->ctrl()->setParameterByClass(ilObjForumGUI::class,
'pos_pk', (
int) $a_posting);
1379 $DIC->ctrl()->redirectByClass(
1380 [ilRepositoryGUI::class, self::class],
1382 is_numeric($a_posting) ? (
int) $a_posting :
'' 1385 $_GET[
'ref_id'] = $a_target;
1386 $_GET[
'baseClass'] =
'ilRepositoryGUI';
1387 include_once(
'ilias.php');
1388 $DIC->http()->close();
1390 } elseif ($ilAccess->checkAccess(
'visible',
'', $a_target)) {
1391 $DIC->ctrl()->setParameterByClass(ilInfoScreenGUI::class,
'ref_id', $a_target);
1392 $DIC->ctrl()->redirectByClass(
1394 ilRepositoryGUI::class,
1396 ilInfoScreenGUI::class
1401 $_GET[
'target'] =
'';
1404 $lng->txt(
'msg_no_perm_read_item'),
1407 $_GET[
'baseClass'] =
'ilRepositoryGUI';
1408 include_once(
'ilias.php');
1409 $DIC->http()->close();
1417 if (!$this->is_moderator) {
1418 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1421 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1422 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1425 if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
1430 $forumObj =
new ilObjForum($this->object->getRefId());
1431 $this->objProperties->setObjId($forumObj->getId());
1435 $success_message =
"forums_thread_deleted";
1436 if (count(
$_POST[
'thread_ids']) > 1) {
1437 $success_message =
"forums_threads_deleted";
1441 if (isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids'])) {
1442 $threadIds =
$_POST[
'thread_ids'];
1446 array_walk($threadIds,
function ($threadId) use (&$threads) {
1447 $thread = new \ilForumTopic($threadId);
1450 $threads[] = $thread;
1453 foreach ($threads as $thread) {
1454 $frm->setForumId($forumObj->getId());
1455 $frm->setForumRefId($forumObj->getRefId());
1457 $first_node = $frm->getFirstPostNode($thread->getId());
1458 if ((
int) $first_node[
'pos_pk']) {
1459 $frm->deletePost($first_node[
'pos_pk']);
1463 $this->ctrl->redirect($this,
'showThreads');
1468 if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
1473 if (!$this->is_moderator) {
1474 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1477 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1478 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1482 array_walk(
$_POST[
'thread_ids'],
function ($threadId) use (&$threads) {
1483 $thread = new \ilForumTopic($threadId);
1486 $threads[] = $thread;
1491 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteThreads'));
1492 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_delete_threads'));
1493 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
1494 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteThreads');
1496 foreach ($threads as $thread) {
1497 $c_gui->addItem(
'thread_ids[]', $thread->getId(), $thread->getSubject());
1500 $this->confirmation_gui_html = $c_gui->getHTML();
1504 return $this->tpl->setContent($c_gui->getHTML());
1509 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1510 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1513 $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()[
'draft_ids'] ?? []));
1514 if (0 === count($draftIds)) {
1521 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'deleteThreadDrafts'));
1522 $confirmation->setHeaderText($this->lng->txt(
'sure_delete_drafts'));
1523 $confirmation->setCancel($this->lng->txt(
'cancel'),
'showThreads');
1524 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'deleteThreadDrafts');
1526 foreach ($draftIds as $draftId) {
1527 if (array_key_exists($draftId, $instances)) {
1528 $confirmation->addItem(
'draft_ids[]', $draftId, $instances[$draftId]->getPostSubject());
1532 $this->tpl->setContent($confirmation->getHTML());
1535 public function prepareThreadScreen(
ilObjForum $a_forum_obj)
1537 $this->
ilHelp->setScreenIdComponent(
"frm");
1539 $this->tpl->loadStandardTemplate();
1544 $this->tabs->setBackTarget(
1545 $this->lng->txt(
'all_topics'),
1546 $this->ctrl->getLinkTarget(
1555 $frm = $a_forum_obj->Forum;
1556 $frm->setForumId($a_forum_obj->
getId());
1561 if (!$this->is_moderator) {
1562 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1565 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1566 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1571 $this->objCurrentPost->activatePost();
1572 $GLOBALS[
'ilAppEventHandler']->raise(
1576 'ref_id' => $this->object->getRefId(),
1582 $this->viewThreadObject();
1585 private function deletePostingObject()
1588 !$this->objCurrentTopic->isClosed() && (
1589 $this->is_moderator ||
1590 ($this->objCurrentPost->isOwner($this->
user->getId()) && !$this->objCurrentPost->hasReplies())
1592 !$this->
user->isAnonymous()
1598 $forumObj = $oForumObjects[
'forumObj'];
1601 $frm->setForumId($forumObj->getId());
1602 $frm->setForumRefId($forumObj->getRefId());
1603 $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
1606 if ($dead_thr == $this->objCurrentTopic->getId()) {
1607 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($forumObj->getId()));
1608 $topicData = $frm->getOneTopic();
1610 if ($topicData[
'top_num_threads'] > 0) {
1611 $this->ctrl->redirect($this,
'showThreads');
1613 $this->ctrl->redirect($this,
'createThread');
1617 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1618 $this->ctrl->redirect($this,
'viewThread');
1621 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1631 $this->handleCensorship(
true);
1636 $this->handleCensorship();
1645 foreach ($this->modalActionsContainer as $modal) {
1646 $modalString .= $this->uiRenderer->render($modal);
1649 return $modalString;
1652 private function handleCensorship($wasRevoked =
false)
1663 $frm = $oForumObjects[
'frm'];
1666 $frm->postCensorship(
$message, $this->objCurrentPost->getId());
1667 ilUtil::sendSuccess($this->lng->txt(
'frm_censorship_revoked'));
1669 $frm->postCensorship(
$message, $this->objCurrentPost->getId(), 1);
1670 ilUtil::sendSuccess($this->lng->txt(
'frm_censorship_applied'));
1673 $this->viewThreadObject();
1677 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1682 if (!$this->is_moderator) {
1683 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1686 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1687 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1692 $this->viewThreadObject();
1697 $this->display_confirm_post_activation = $status;
1707 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1708 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1713 if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
1714 $this->objCurrentTopic->disableNotification($this->
user->getId());
1717 $this->objCurrentTopic->enableNotification($this->
user->getId());
1721 $this->viewThreadObject();
1726 if (!$this->is_moderator) {
1727 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1730 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1731 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1736 if ($this->objCurrentTopic->isSticky()) {
1737 $this->objCurrentTopic->unmakeSticky();
1739 $this->objCurrentTopic->makeSticky();
1742 $this->viewThreadObject();
1747 $this->requestAction =
'';
1748 if (isset(
$_POST[
'draft_id']) && (
int)
$_POST[
'draft_id'] > 0) {
1750 $draft->deleteDraftsByDraftIds(array((
int) $_POST[
'draft_id']));
1753 $this->viewThreadObject();
1758 $this->requestAction =
'';
1759 if (isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0) {
1762 $history_obj->getFirstAutosaveByDraftId((
int)
$_GET[
'draft_id']);
1764 $draft->setPostSubject($history_obj->getPostSubject());
1765 $draft->setPostMessage($history_obj->getPostMessage());
1768 $history_obj->getPostMessage(),
1770 $history_obj->getHistoryId(),
1772 $draft->getDraftId()
1775 $draft->updateDraft();
1777 $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
1780 $this->ctrl->clearParameters($this);
1781 $this->viewThreadObject();
1786 $form_tpl =
new ilTemplate(
'tpl.frm_activation_post_form.html',
true,
true,
'Modules/Forum');
1787 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1788 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1789 $this->ctrl->setParameter(
1794 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this,
'performPostActivation'));
1795 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1796 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1797 $form_tpl->setVariable(
'TXT_ACT', $this->lng->txt(
'activate_post_txt'));
1798 $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'activate_only_current'));
1799 $form_tpl->setVariable(
'CMD_CONFIRM',
'performPostActivation');
1800 $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
1801 $form_tpl->setVariable(
'CMD_CANCEL',
'viewThread');
1802 $this->ctrl->clearParameters($this);
1804 return $form_tpl->get();
1809 $frm = $this->
object->Forum;
1810 $form_tpl =
new ilTemplate(
'tpl.frm_censorship_post_form.html',
true,
true,
'Modules/Forum');
1812 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
1813 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1814 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1815 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1816 $this->ctrl->setParameter(
1821 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this,
'viewThread'));
1822 $this->ctrl->clearParameters($this);
1823 $form_tpl->setVariable(
'TXT_CENS_MESSAGE', $this->lng->txt(
'forums_the_post'));
1824 $form_tpl->setVariable(
'TXT_CENS_COMMENT', $this->lng->txt(
'forums_censor_comment') .
':');
1825 $form_tpl->setVariable(
'CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1827 if ($this->objCurrentPost->isCensored()) {
1828 $form_tpl->setVariable(
'TXT_CENS', $this->lng->txt(
'forums_info_censor2_post'));
1829 $form_tpl->setVariable(
'YES_BUTTON', $this->lng->txt(
'confirm'));
1830 $form_tpl->setVariable(
'NO_BUTTON', $this->lng->txt(
'cancel'));
1831 $form_tpl->setVariable(
'CMD_REVOKE_CENSORSHIP',
'revokeCensorship');
1832 $form_tpl->setVariable(
'CMD_CANCEL_REVOKE_CENSORSHIP',
'viewThread');
1834 $form_tpl->setVariable(
'TXT_CENS', $this->lng->txt(
'forums_info_censor_post'));
1835 $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
1836 $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'confirm'));
1837 $form_tpl->setVariable(
'CMD_ADD_CENSORSHIP',
'addCensorship');
1838 $form_tpl->setVariable(
'CMD_CANCEL_ADD_CENSORSHIP',
'viewThread');
1841 return $form_tpl->get();
1847 private function initReplyEditForm()
1852 $isReply = in_array($this->requestAction, [
'showreply',
'ready_showreply']);
1853 $isDraft = in_array($this->requestAction, [
'publishDraft',
'editdraft']);
1857 $frm = $oForumObjects[
'frm'];
1858 $oFDForum = $oForumObjects[
'file_obj'];
1861 $this->replyEditForm->setId(
'id_showreply');
1862 $this->replyEditForm->setTableWidth(
'100%');
1863 $cancel_cmd =
'cancelPost';
1864 if (in_array($this->requestAction, [
'showreply',
'ready_showreply'])) {
1865 $this->ctrl->setParameter($this,
'action',
'ready_showreply');
1866 } elseif (in_array($this->requestAction, [
'showdraft',
'editdraft'])) {
1867 $this->ctrl->setParameter($this,
'action', $this->requestAction);
1868 $this->ctrl->setParameter($this,
'draft_id', (
int)
$_GET[
'draft_id']);
1870 $this->ctrl->setParameter($this,
'action',
'ready_showedit');
1873 $this->ctrl->setParameter($this,
'page', (
int) $this->httpRequest->getQueryParams()[
'page']);
1874 $this->ctrl->setParameter(
1879 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1880 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1882 $this->replyEditForm->setFormAction(
1883 $this->ctrl->getFormAction($this,
'saveTopLevelPost'),
1886 } elseif (in_array($this->requestAction, [
'publishDraft',
'editdraft'])) {
1887 $this->replyEditForm->setFormAction(
1888 $this->ctrl->getFormAction($this,
'publishDraft'),
1889 $this->objCurrentPost->getId()
1892 $this->replyEditForm->setFormAction(
1893 $this->ctrl->getFormAction($this,
'savePost'),
1894 $this->objCurrentPost->getId()
1897 $this->ctrl->clearParameters($this);
1900 $this->replyEditForm->setTitle($this->lng->txt(
'forums_your_reply'));
1901 } elseif ($isDraft) {
1902 $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_draft'));
1904 $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_post'));
1909 in_array($this->requestAction, [
'showreply',
'ready_showreply',
'editdraft'])
1911 $oAnonymousNameGUI =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
1912 $oAnonymousNameGUI->setMaxLength(64);
1913 $oAnonymousNameGUI->setInfo($this->lng->txt(
'forums_use_alias'));
1915 $this->replyEditForm->addItem($oAnonymousNameGUI);
1918 $oSubjectGUI =
new ilTextInputGUI($this->lng->txt(
'forums_subject'),
'subject');
1919 $oSubjectGUI->setMaxLength(255);
1920 $oSubjectGUI->setRequired(
true);
1922 if ($this->objProperties->getSubjectSetting() ==
'empty_subject') {
1923 $oSubjectGUI->setInfo($this->lng->txt(
'enter_new_subject'));
1926 $this->replyEditForm->addItem($oSubjectGUI);
1929 $isReply ? $this->lng->txt(
'forums_your_reply') : $this->lng->txt(
'forums_edit_post'),
1933 $oPostGUI->setRows(15);
1934 $oPostGUI->setUseRte(
true);
1935 $oPostGUI->addPlugin(
'latex');
1936 $oPostGUI->addButton(
'latex');
1937 $oPostGUI->addButton(
'pastelatex');
1941 ($isReply && $this->objCurrentPost->getDepth() >= 2) ||
1942 (!$isDraft && !$isReply && $this->objCurrentPost->getDepth() > 2) ||
1943 ($isDraft && $this->objCurrentPost->getDepth() >= 2)
1946 if ($quotingAllowed) {
1947 $oPostGUI->addPlugin(
'ilfrmquote');
1948 $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
1951 $oPostGUI->removePlugin(
'advlink');
1952 $oPostGUI->setRTERootBlockElement(
'');
1953 $oPostGUI->usePurifier(
true);
1954 $oPostGUI->disableButtons(array(
1971 if (in_array($this->requestAction, [
'showreply',
'ready_showreply',
'showdraft',
'editdraft'])) {
1972 $oPostGUI->setRTESupport(
1973 $this->
user->getId(),
1976 'tpl.tinymce_frm_post.js',
1981 $oPostGUI->setRTESupport(
1982 $this->objCurrentPost->getId(),
1985 'tpl.tinymce_frm_post.js',
1993 $this->replyEditForm->addItem($oPostGUI);
1997 if ($this->rbac->system()->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
1998 !$frm->isThreadNotificationEnabled($this->user->getId(), $this->objCurrentPost->getThreadId()) &&
1999 !$this->objProperties->isAnonymized()) {
2000 $oNotificationGUI =
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'),
'notify');
2001 $oNotificationGUI->
setInfo($this->lng->txt(
'forum_notify_me'));
2003 $this->replyEditForm->addItem($oNotificationGUI);
2006 if ($this->objProperties->isFileUploadAllowed()) {
2007 $oFileUploadGUI =
new ilFileWizardInputGUI($this->lng->txt(
'forums_attachments_add'),
'userfile');
2009 $this->replyEditForm->addItem($oFileUploadGUI);
2013 $this->
user->isAnonymous() &&
2014 !$this->
user->isCaptchaVerified() &&
2015 ilCaptchaUtil::isActiveForForum()
2017 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
2019 $this->replyEditForm->addItem($captcha);
2022 $attachments_of_node = $oFDForum->getFilesOfPost();
2023 if (count($attachments_of_node) && in_array($this->requestAction, [
'showedit',
'ready_showedit'])) {
2025 foreach ($oFDForum->getFilesOfPost() as $file) {
2027 $oAttachmentGUI->setValue($file[
'md5']);
2028 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
2030 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
2034 if (in_array($this->requestAction, [
'showdraft',
'editdraft'])) {
2036 $draftInfoGUI->setValue(sprintf(
2037 $this->lng->txt(
'autosave_draft_info'),
2040 $this->replyEditForm->addItem($draftInfoGUI);
2041 } elseif (!in_array($this->requestAction, [
'showedit',
'ready_showedit'])) {
2043 $draftInfoGUI->setValue(sprintf(
2044 $this->lng->txt(
'autosave_post_draft_info'),
2047 $this->replyEditForm->addItem($draftInfoGUI);
2051 $selected_draft_id = (int)
$_GET[
'draft_id'];
2053 $this->
user->getId(),
2054 $this->objCurrentPost->getId(),
2057 if ($draftObj->getDraftId() > 0) {
2059 if (count($oFDForumDrafts->getFilesOfPost())) {
2061 $this->lng->txt(
'forums_delete_file'),
2064 foreach ($oFDForumDrafts->getFilesOfPost() as $file) {
2066 $oAttachmentGUI->setValue($file[
'md5']);
2067 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
2069 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
2074 $this->replyEditForm->addCommandButton(
'saveTopLevelPost', $this->lng->txt(
'create'));
2076 $this->replyEditForm->addCommandButton(
'publishDraft', $this->lng->txt(
'publish'));
2078 $this->replyEditForm->addCommandButton(
'savePost', $this->lng->txt(
'save'));
2081 if (isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0) {
2082 $auto_save_draft_id = (int)
$_GET[
'draft_id'];
2084 $hidden_draft_id->setValue($auto_save_draft_id);
2085 $this->replyEditForm->addItem($hidden_draft_id);
2087 if (in_array($this->requestAction, [
'showreply',
'ready_showreply',
'editdraft'])) {
2090 if (array_key_exists(
'show_rte',
$_POST)) {
2095 if ($quotingAllowed) {
2096 $this->replyEditForm->addCommandButton(
'quotePost', $this->lng->txt(
'forum_add_quote'));
2101 !$this->
user->isAnonymous() &&
2102 in_array($this->requestAction, [
'editdraft',
'showreply',
'ready_showreply']) &&
2109 if ($this->requestAction ==
'editdraft') {
2110 $this->replyEditForm->addCommandButton(
'updateDraft', $this->lng->txt(
'save_message'));
2112 $this->replyEditForm->addCommandButton(
'saveTopLevelDraft', $this->lng->txt(
'save_message'));
2114 $this->replyEditForm->addCommandButton(
'saveAsDraft', $this->lng->txt(
'save_message'));
2117 $cancel_cmd =
'cancelDraft';
2120 $this->replyEditForm->addCommandButton($cancel_cmd, $this->lng->txt(
'cancel'));
2128 if (null === $this->replyEditForm) {
2129 $this->initReplyEditForm();
2140 if (isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0 && !$this->
user->isAnonymous()
2143 $this->
user->getId(),
2144 $this->objCurrentPost->getId(),
2145 (int)
$_GET[
'draft_id']
2150 $this->ctrl->setParameter($this,
'action',
'editdraft');
2151 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2152 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2153 $this->ctrl->setParameter($this,
'draft_id', $draft_obj->getDraftId());
2154 $this->ctrl->setParameter($this,
'page', 0);
2155 $this->ctrl->setParameter(
2160 $this->ctrl->redirect($this,
'editDraft');
2162 $this->viewThreadObject();
2172 $this->savePostObject();
2178 if (isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0) {
2185 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2186 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2189 if (!$this->access->checkAccess(
'add_reply',
'', $this->object->getRefId())) {
2190 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2193 if (!$this->objCurrentTopic->getId()) {
2195 $this->ctrl->redirect($this);
2198 if ($this->objCurrentTopic->isClosed()) {
2200 $this->ctrl->redirect($this);
2203 if (!$this->objCurrentPost->getId()) {
2204 $this->requestAction =
'';
2206 $this->viewThreadObject();
2210 $post_id = $this->objCurrentPost->getId();
2214 if ($use_replyform) {
2216 if (!$oReplyEditForm->checkInput()) {
2217 $oReplyEditForm->setValuesByPost();
2218 return $this->viewThreadObject();
2220 $post_subject = $oReplyEditForm->getInput(
'subject');
2221 $post_message = $oReplyEditForm->getInput(
'message');
2224 $post_subject = $draft_obj->getPostSubject();
2225 $post_message = $draft_obj->getPostMessage();
2229 if ($draft_obj->getDraftId() > 0) {
2232 $frm = $oForumObjects[
'frm'];
2233 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2237 $send_activation_mail = 0;
2239 if ($this->objProperties->isPostActivationEnabled()) {
2240 if (!$this->is_moderator) {
2242 $send_activation_mail = 1;
2243 } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
2248 $newPost = $frm->generatePost(
2249 $draft_obj->getForumId(),
2250 $draft_obj->getThreadId(),
2251 $this->
user->getId(),
2252 $draft_obj->getPostDisplayUserId(),
2254 $draft_obj->getPostId(),
2255 (int) $draft_obj->getNotify(),
2257 $draft_obj->getPostUserAlias(),
2260 $send_activation_mail
2263 $this->
object->markPostRead(
2264 $this->
user->getId(),
2265 (int) $this->objCurrentTopic->getId(),
2266 (int) $this->objCurrentPost->getId()
2271 foreach ($uploadedObjects as $mob) {
2277 if ($this->objProperties->isFileUploadAllowed()) {
2278 $file = $_FILES[
'userfile'];
2279 if (is_array($file) && !empty($file)) {
2280 $tmp_file_obj =
new ilFileDataForum($this->object->getId(), $newPost);
2288 $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
2289 $oFDForumDrafts->
delete();
2293 $GLOBALS[
'ilAppEventHandler']->raise(
2297 'draftObj' => $draft_obj,
2298 'obj_id' => $this->object->getId(),
2299 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
2303 $draft_obj->deleteDraft();
2305 $GLOBALS[
'ilAppEventHandler']->raise(
2309 'ref_id' => $this->object->getRefId(),
2311 'notify_moderators' => (bool) $send_activation_mail
2316 if (!$this->is_moderator && !$status) {
2317 $message .= $this->lng->txt(
'forums_post_needs_to_be_activated');
2319 $message .= $this->lng->txt(
'forums_post_new_entry');
2322 $_SESSION[
'frm'][(int)
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
2324 $this->ctrl->clearParameters($this);
2325 ilUtil::sendSuccess(
$message,
true);
2326 $this->ctrl->setParameter($this,
'pos_pk', $newPost);
2327 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2329 $this->ctrl->redirect($this,
'viewThread');
2336 public function savePostObject()
2338 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2339 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2342 if (!$this->objCurrentTopic->getId()) {
2344 $this->ctrl->redirect($this);
2347 if ($this->objCurrentTopic->isClosed()) {
2349 $this->ctrl->redirect($this);
2354 if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
2355 $_POST[
'del_file'] = array();
2359 if ($oReplyEditForm->checkInput()) {
2360 if (!$this->objCurrentPost->getId()) {
2361 $this->requestAction =
'';
2363 $this->viewThreadObject();
2374 $forumObj = $oForumObjects[
'forumObj'];
2378 $frm = $oForumObjects[
'frm'];
2379 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2380 $topicData = $frm->getOneTopic();
2383 if ($this->requestAction ==
'ready_showreply') {
2384 if (!$this->access->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])) {
2385 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2390 $send_activation_mail = 0;
2392 if ($this->objProperties->isPostActivationEnabled()) {
2393 if (!$this->is_moderator) {
2395 $send_activation_mail = 1;
2396 } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
2402 if (!strlen($oReplyEditForm->getInput(
'alias'))) {
2403 $user_alias = $this->lng->txt(
'forums_anonymous');
2405 $user_alias = $oReplyEditForm->getInput(
'alias');
2407 $display_user_id = 0;
2409 $user_alias = $this->
user->getLogin();
2410 $display_user_id = $this->
user->getId();
2413 $newPost = $frm->generatePost(
2414 $topicData[
'top_pk'],
2415 $this->objCurrentTopic->getId(),
2416 $this->
user->getId(),
2419 $this->objCurrentPost->getId(),
2420 (int) $oReplyEditForm->getInput(
'notify'),
2425 $send_activation_mail
2431 $draft_id =
$_POST[
'draft_id'];
2433 $draft_obj =
new ilForumPostDraft($this->
user->getId(), $this->objCurrentPost->getId(), $draft_id);
2440 $this->
object->markPostRead(
2441 $this->
user->getId(),
2442 (int) $this->objCurrentTopic->getId(),
2443 (int) $this->objCurrentPost->getId()
2448 $oReplyEditForm->getInput(
'message'),
2450 $this->
user->getId(),
2455 if ($this->objProperties->isFileUploadAllowed()) {
2457 $file = $_FILES[
'userfile'];
2458 if (is_array($file) && !empty($file)) {
2463 $GLOBALS[
'ilAppEventHandler']->raise(
2467 'ref_id' => $this->object->getRefId(),
2469 'notify_moderators' => (bool) $send_activation_mail
2474 if (!$this->is_moderator && !$status) {
2475 $message .= $this->lng->txt(
'forums_post_needs_to_be_activated');
2477 $message .= $this->lng->txt(
'forums_post_new_entry');
2480 ilUtil::sendSuccess(
$message,
true);
2481 $this->ctrl->clearParameters($this);
2482 $this->ctrl->setParameter($this,
'post_created_below', $this->objCurrentPost->getId());
2483 $this->ctrl->setParameter($this,
'pos_pk', $newPost);
2484 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2485 $this->ctrl->redirect($this,
'viewThread');
2487 if ((!$this->is_moderator &&
2488 !$this->objCurrentPost->isOwner($this->user->getId())) || $this->objCurrentPost->isCensored() ||
2489 $this->
user->isAnonymous()) {
2490 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2498 foreach ($oldMediaObjects as $oldMob) {
2500 foreach ($curMediaObjects as $curMob) {
2501 if ($oldMob == $curMob) {
2516 $old_status_was_active = $this->objCurrentPost->isActivated();
2520 $send_activation_mail = 0;
2522 if ($this->objProperties->isPostActivationEnabled()) {
2523 if (!$this->is_moderator) {
2525 $send_activation_mail = 1;
2526 } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
2530 $this->objCurrentPost->setStatus($status);
2532 $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
2534 $oReplyEditForm->getInput(
'message'),
2537 $this->objCurrentPost->setNotification((
int) $oReplyEditForm->getInput(
'notify'));
2538 $this->objCurrentPost->setChangeDate(date(
'Y-m-d H:i:s'));
2539 $this->objCurrentPost->setUpdateUserId($this->
user->getId());
2542 if ($this->objCurrentPost->update()) {
2543 $this->objCurrentPost->reload();
2550 $this->objCurrentPost->getId(),
2555 $news_item->setTitle($this->objCurrentPost->getSubject());
2556 $news_item->setContent(
2558 $this->objCurrentPost->getMessage(),
2563 if ($this->objCurrentPost->getMessage() != strip_tags($this->objCurrentPost->getMessage())) {
2564 $news_item->setContentHtml(
true);
2566 $news_item->setContentHtml(
false);
2568 $news_item->update();
2571 $oFDForum = $oForumObjects[
'file_obj'];
2573 $file2delete = $oReplyEditForm->getInput(
'del_file');
2574 if (is_array($file2delete) && count($file2delete)) {
2575 $oFDForum->unlinkFilesByMD5Filenames($file2delete);
2578 if ($this->objProperties->isFileUploadAllowed()) {
2579 $file = $_FILES[
'userfile'];
2580 if (is_array($file) && !empty($file)) {
2581 $oFDForum->storeUploadedFile($file);
2585 $GLOBALS[
'ilAppEventHandler']->raise(
2589 'ref_id' => $this->object->getRefId(),
2591 'notify_moderators' => (bool) $send_activation_mail,
2592 'old_status_was_active' => (
bool) $old_status_was_active
2596 ilUtil::sendSuccess($this->lng->txt(
'forums_post_modified'),
true);
2599 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2600 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2601 $this->ctrl->setParameter($this,
'viewmode', $this->selectedSorting);
2602 $this->ctrl->redirect($this,
'viewThread');
2605 $this->requestAction = substr($this->requestAction, 6);
2607 return $this->viewThreadObject();
2612 if (null === $a_flag) {
2622 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2623 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2626 if (!is_array(
$_POST[
'del_file'])) {
2627 $_POST[
'del_file'] = array();
2630 if ($this->objCurrentTopic->isClosed()) {
2631 $this->requestAction =
'';
2632 return $this->viewThreadObject();
2638 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
2639 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
2641 $oReplyEditForm->checkInput();
2644 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
2645 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
2647 $this->requestAction =
'showreply';
2649 $this->viewThreadObject();
2652 public function getQuotationHTMLAsynchObject()
2654 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2655 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2664 $frm = $oForumObjects[
'frm'];
2667 $this->objCurrentPost->getPosAuthorId(),
2668 $this->objCurrentPost->getDisplayUserId(),
2669 $this->objCurrentPost->getUserAlias(),
2670 $this->objCurrentPost->getImportName()
2674 $this->objCurrentPost->getMessage(),
2676 $authorinfo->getAuthorName()
2679 $this->
http->saveResponse($this->
http->response()->withBody(
2682 $this->
http->sendResponse();
2683 $this->
http->close();
2688 if (null === $this->forumObjects) {
2690 $file_obj =
new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
2691 $frm = $forumObj->Forum;
2692 $frm->setForumId($forumObj->getId());
2693 $frm->setForumRefId($forumObj->getRefId());
2695 $this->forumObjects[
'forumObj'] = $forumObj;
2696 $this->forumObjects[
'frm'] = $frm;
2697 $this->forumObjects[
'file_obj'] = $file_obj;
2705 $this->selectedSorting = $this->objProperties->getDefaultView();
2716 isset($this->httpRequest->getQueryParams()[
'viewmode']) &&
2717 (
int) $this->httpRequest->getQueryParams()[
'viewmode'] !== (int) $this->selectedSorting
2719 $this->selectedSorting = (int) $this->httpRequest->getQueryParams()[
'viewmode'];
2722 if (!in_array($this->selectedSorting, [
2727 $this->selectedSorting = $this->objProperties->getDefaultView();
2733 public function viewThreadObject()
2736 $bottom_toolbar_split_button_items = [];
2739 if (!isset(
$_SESSION[
'thread_control'][
'old'])) {
2748 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2749 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2753 if (isset($this->httpRequest->getQueryParams()[
'page'])) {
2754 $pageIndex = max((
int) $this->httpRequest->getQueryParams()[
'page'], $pageIndex);
2757 $firstNodeInThread = $this->objCurrentTopic->getFirstPostNode();
2759 $toolContext = $this->globalScreen
2777 $forumObj = $oForumObjects[
'forumObj'];
2779 $frm = $oForumObjects[
'frm'];
2781 $file_obj = $oForumObjects[
'file_obj'];
2783 $selected_draft_id = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
2785 if (isset($this->httpRequest->getQueryParams()[
'file'])) {
2786 $file_obj_for_delivery = $file_obj;
2793 if (!$this->objCurrentTopic->getId()) {
2794 $this->ctrl->redirect($this,
'showThreads');
2800 $append =
'_' . $this->objCurrentTopic->getId() .
2801 ($this->objCurrentPost->getId() ?
'_' . $this->objCurrentPost->getId() :
'');
2802 $this->tpl->setLoginTargetPar(
'frm_' .
$_GET[
'ref_id'] . $append);
2805 if (!in_array($this->requestAction, [
'showreply',
'showedit'])) {
2808 foreach (
$mobs as $mob) {
2819 if (!$this->
getCreationMode() && $this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2821 (
int) $this->object->getRefId(),
2828 $forumObj->updateLastAccess($this->
user->getId(), (int) $this->objCurrentTopic->getId());
2830 $this->prepareThreadScreen($forumObj);
2832 $threadContentTemplate = new \ilTemplate(
2833 'tpl.forums_threads_view.html',
2839 if (isset($this->httpRequest->getQueryParams()[
'anchor'])) {
2840 $threadContentTemplate->setVariable(
'JUMP2ANCHOR_ID', (
int) $this->httpRequest->getQueryParams()[
'anchor']);
2845 $orderField =
'frm_posts_tree.rgt';
2846 $this->objCurrentTopic->setOrderDirection(
'DESC');
2848 $orderField =
'frm_posts.pos_date';
2849 $this->objCurrentTopic->setOrderDirection(
2854 $threadContentTemplate->setVariable(
'LIST_TYPE', $this->viewModeOptions[$this->selectedSorting]);
2856 $numberOfPostings = 0;
2859 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2861 if ($firstNodeInThread) {
2862 $this->objCurrentTopic->updateVisits();
2864 $this->tpl->setTitle($this->lng->txt(
'forums_thread') .
" \"" . $this->objCurrentTopic->getSubject() .
"\"");
2866 $this->locator->addRepositoryItems();
2867 $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"_top");
2868 $this->tpl->setLocator();
2871 !$this->
user->isAnonymous() &&
2872 $forumObj->getCountUnread($this->
user->getId(), (int) $this->objCurrentTopic->getId(),
true)
2874 $this->ctrl->setParameter($this,
'mark_read',
'1');
2875 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2878 $mark_thr_read_button->setCaption(
'forums_mark_read');
2879 $mark_thr_read_button->setUrl($this->ctrl->getLinkTarget($this,
'viewThread'));
2882 $bottom_toolbar_split_button_items[] = $mark_thr_read_button;
2884 $this->ctrl->clearParameters($this);
2888 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_thread', $this->objCurrentTopic->getId());
2889 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_top_fk', $this->objCurrentTopic->getForumId());
2892 $print_thr_button->setCaption(
'forums_print_thread');
2893 $print_thr_button->setUrl($this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printThread'));
2895 $bottom_toolbar_split_button_items[] = $print_thr_button;
2897 $this->ctrl->clearParametersByClass(
'ilforumexportgui');
2901 if (isset($this->httpRequest->getQueryParams()[
'mark_read'])) {
2902 $forumObj->markThreadRead($this->
user->getId(), (int) $this->objCurrentTopic->getId());
2906 $this->objCurrentTopic->setOrderField($orderField);
2907 $subtree_nodes = $this->objCurrentTopic->getPostTree($firstNodeInThread);
2911 !$this->objCurrentTopic->isClosed() &&
2912 $this->access->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])
2915 $reply_button->setPrimary(
true);
2916 $reply_button->setCaption(
'add_new_answer');
2917 $this->ctrl->setParameter($this,
'action',
'showreply');
2918 $this->ctrl->setParameter($this,
'pos_pk', $firstNodeInThread->getId());
2919 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2920 $this->ctrl->setParameter($this,
'page', (
int) $this->httpRequest->getQueryParams()[
'page']);
2921 $this->ctrl->setParameter(
2927 $reply_button->setUrl($this->ctrl->getLinkTarget($this,
'createTopLevelPost',
'frm_page_bottom'));
2929 $this->ctrl->clearParameters($this);
2930 array_unshift($bottom_toolbar_split_button_items, $reply_button);
2934 if (!$numberOfPostings = count($subtree_nodes)) {
2938 $pageSize = $frm->getPageHits();
2940 if ($numberOfPostings > $pageSize) {
2941 $this->ctrl->setParameter($this,
'ref_id', (
int) $this->object->getRefId());
2942 $this->ctrl->setParameter($this,
'thr_pk', (
int) $this->objCurrentTopic->getId());
2943 $this->ctrl->setParameter(
2948 $paginationUrl = $this->ctrl->getLinkTarget($this,
'viewThread',
'',
false,
false);
2949 $this->ctrl->clearParameters($this);
2951 $pagination = $this->uiFactory->viewControl()
2953 ->withTargetURL($paginationUrl,
'page')
2954 ->withTotalEntries($numberOfPostings)
2955 ->withPageSize($pageSize)
2956 ->withMaxPaginationButtons(10)
2957 ->withCurrentPage($pageIndex);
2959 $threadContentTemplate->setVariable(
'THREAD_MENU', $this->uiRenderer->render(
2962 $threadContentTemplate->setVariable(
'THREAD_MENU_BOTTOM', $this->uiRenderer->render(
2968 $draftsObjects = [];
2969 if ($doRenderDrafts) {
2971 (
int) $this->
user->getId(),
2972 (int) $this->objCurrentTopic->getId(),
2977 $pagedPostings = array_slice($subtree_nodes, $pageIndex * $pageSize, $pageSize);
2982 $doRenderDrafts && 0 === $pageIndex &&
2985 foreach ($draftsObjects as $draft) {
2986 $referencePosting = array_values(array_filter(
2988 static function (
ilForumPost $post) use ($draft) :
bool {
2989 return $draft->getPostId() == $post->
getId();
2991 ))[0] ?? $firstNodeInThread;
2994 $threadContentTemplate,
2995 $this->requestAction,
3002 foreach ($pagedPostings as $node) {
3003 $this->ctrl->clearParameters($this);
3006 if ($this->is_moderator || $node->isActivated() || $node->isOwner($this->
user->getId())) {
3007 if (!$this->objCurrentTopic->isClosed() && in_array($this->requestAction, [
3011 $this->renderPostingForm($threadContentTemplate, $frm, $node, $this->requestAction);
3012 } elseif (!$this->objCurrentTopic->isClosed() && $this->requestAction ===
'censor') {
3013 if ($this->is_moderator) {
3017 if ($this->is_moderator) {
3024 $this->
renderPostContent($threadContentTemplate, $node, $this->requestAction, $pageIndex, $postIndex);
3027 $threadContentTemplate,
3028 $this->requestAction,
3030 $draftsObjects[$node->getId()] ?? []
3039 $doRenderDrafts && $pageIndex === max(0, (
int) (ceil($numberOfPostings / $pageSize) - 1))
3041 foreach ($draftsObjects as $draft) {
3042 $referencePosting = array_values(array_filter(
3044 static function (
ilForumPost $post) use ($draft) :
bool {
3045 return $draft->getPostId() == $post->
getId();
3047 ))[0] ?? $firstNodeInThread;
3050 $threadContentTemplate,
3051 $this->requestAction,
3059 $firstNodeInThread instanceof
ilForumPost && $doRenderDrafts &&
3063 $threadContentTemplate,
3064 $this->requestAction,
3066 $draftsObjects[$firstNodeInThread->getId()] ?? []
3072 in_array($this->ctrl->getCmd(), array(
'createTopLevelPost',
'saveTopLevelPost',
'saveTopLevelDraft')) &&
3073 !$this->objCurrentTopic->isClosed() &&
3074 $this->access->checkAccess(
'add_reply',
'', (
int) $_GET[
'ref_id'])) {
3076 $this->objCurrentPost->setId($firstNodeInThread->getId());
3079 if (in_array($this->ctrl->getCmd(), [
'saveTopLevelPost',
'saveTopLevelDraft'])) {
3080 $form->setValuesByPost();
3082 $this->ctrl->setParameter($this,
'pos_pk', $firstNodeInThread->getId());
3083 $this->ctrl->setParameter($this,
'thr_pk', $firstNodeInThread->getThreadId());
3084 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
3085 $jsTpl->setVariable(
3086 'IL_FRM_QUOTE_CALLBACK_SRC',
3087 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true)
3089 $this->ctrl->clearParameters($this);
3090 $threadContentTemplate->setVariable(
'BOTTOM_FORM_ADDITIONAL_JS', $jsTpl->get());
3091 $threadContentTemplate->setVariable(
'BOTTOM_FORM', $form->getHTML());
3094 $threadContentTemplate->setCurrentBlock(
'posts_no');
3095 $threadContentTemplate->setVariable(
3096 'TXT_MSG_NO_POSTS_AVAILABLE',
3097 $this->lng->txt(
'forums_posts_not_available')
3099 $threadContentTemplate->parseCurrentBlock();
3102 if ($bottom_toolbar_split_button_items) {
3105 foreach ($bottom_toolbar_split_button_items as $item) {
3107 $bottom_split_button->setDefaultButton($item);
3114 $bottom_toolbar->addStickyItem($bottom_split_button);
3115 $this->toolbar->addStickyItem($bottom_split_button);
3118 if ($bottom_toolbar_split_button_items) {
3119 $bottom_toolbar->addSeparator();
3123 $to_top_button->setCaption(
'top_of_page');
3124 $to_top_button->setUrl(
'#frm_page_top');
3125 $bottom_toolbar->addButtonInstance($to_top_button);
3126 if ($numberOfPostings > 0) {
3127 $threadContentTemplate->setVariable(
'TOOLBAR_BOTTOM', $bottom_toolbar->getHTML());
3135 $this->tpl->setPermanentLink(
3136 $this->object->getType(),
3137 $this->
object->getRefId(),
3138 '_' . $this->objCurrentTopic->getId(),
3142 $this->tpl->addOnLoadCode(
'$(".ilFrmPostContent img").each(function() { 3145 maxWidth: $elm.attr("width") + "px", 3146 maxHeight: $elm.attr("height") + "px" 3148 $elm.removeAttr("width"); 3149 $elm.removeAttr("height"); 3152 $this->tpl->setContent($threadContentTemplate->get() . $this->
getModalActions());
3159 $translationKeys = [];
3160 foreach ($this->viewModeOptions as $sortingConstantKey => $languageKey) {
3161 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3162 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
3163 $this->ctrl->setParameter($this,
'viewmode', $sortingConstantKey);
3165 $translationKeys[$this->lng->txt($languageKey)] = $this->ctrl->getLinkTarget(
3173 $this->ctrl->clearParameters($this);
3180 $sortViewControl = $this->uiFactory
3182 ->mode($translationKeys, $this->lng->txt($this->viewModeOptions[$currentViewMode]))
3183 ->withActive($this->lng->txt($this->viewModeOptions[$currentViewMode]));
3184 $this->toolbar->addComponent($sortViewControl);
3189 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3190 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
3191 $target = $this->ctrl->getLinkTarget(
3199 $translatedSortationOptions = array_map(
function ($value) {
3200 return $this->lng->txt($value);
3203 $sortingDirectionViewControl = $this->uiFactory
3205 ->sortation($translatedSortationOptions)
3206 ->withLabel($this->lng->txt($this->sortationOptions[$currentSorting]))
3207 ->withTargetURL($target,
'viewmode');
3208 $this->toolbar->addComponent($sortingDirectionViewControl);
3213 $subject = $this->objCurrentPost->getSubject();
3214 $re_txt = $this->lng->txt(
'post_reply');
3216 $re_txt_with_num = str_replace(
':',
'(', $re_txt);
3217 $search_length = strlen($re_txt_with_num);
3218 $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
3221 $modified_subject = $subject;
3222 if ($on_reply ==
true) {
3224 $str_pos_start = strpos($subject,
'(');
3225 $str_pos_end = strpos($subject,
')');
3227 $length = ((int) $str_pos_end - (
int) $str_pos_start);
3229 $txt_number = substr($subject, $str_pos_start, $length - 1);
3231 if (is_numeric($txt_number)) {
3232 $re_count = (int) $txt_number + 1;
3233 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr(
3240 $re_count = substr_count($subject, $re_txt);
3241 if ($re_count >= 1 && $on_reply ==
true) {
3242 $subject = str_replace($re_txt,
'', $subject);
3246 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count) .
' ' . trim($subject);
3247 } elseif ($re_count >= 1 && $on_reply ==
false) {
3250 $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count) .
' ' . trim($subject);
3251 } elseif ($re_count == 0) {
3253 $modified_subject = $this->lng->txt(
'post_reply') .
' ' . $this->objCurrentPost->getSubject();
3256 return $modified_subject;
3262 $add = $this->getUserProfileAdditional((
int) $_GET[
'ref_id'], (
int) $_GET[
'user']);
3263 $profile_gui->setAdditional($add);
3265 $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
3268 protected function getUserProfileAdditional($a_forum_ref_id, $a_user_id)
3270 if (!$this->access->checkAccess(
'read',
'', $a_forum_ref_id)) {
3271 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3278 if ($ref_obj->getType() ==
'frm') {
3280 $frm = $forumObj->Forum;
3281 $frm->setForumId($forumObj->getId());
3282 $frm->setForumRefId($forumObj->getRefId());
3288 if ($this->access->checkAccess(
'moderate_frm',
'', $a_forum_ref_id)) {
3289 $numPosts = $frm->countUserArticles(addslashes($a_user_id));
3291 $numPosts = $frm->countActiveUserArticles(addslashes($a_user_id));
3294 return array($this->lng->txt(
'forums_posts') => $numPosts);
3299 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3300 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3305 if (isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids'])) {
3306 if (isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] ==
'move') {
3307 if ($this->is_moderator) {
3311 } elseif (
$_POST[
'selected_cmd'] ==
'enable_notifications' && $this->
settings->get(
'forum_notification') != 0) {
3315 $tmp_obj->enableNotification($this->
user->getId());
3318 $this->ctrl->redirect($this,
'showThreads');
3319 } elseif (
$_POST[
'selected_cmd'] ==
'disable_notifications' && $this->
settings->get(
'forum_notification') != 0) {
3323 $tmp_obj->disableNotification($this->
user->getId());
3326 $this->ctrl->redirect($this,
'showThreads');
3327 } elseif (
$_POST[
'selected_cmd'] ==
'close') {
3328 if ($this->is_moderator) {
3335 ilUtil::sendSuccess($this->lng->txt(
'selected_threads_closed'),
true);
3336 $this->ctrl->redirect($this,
'showThreads');
3337 } elseif (
$_POST[
'selected_cmd'] ==
'reopen') {
3338 if ($this->is_moderator) {
3346 ilUtil::sendSuccess($this->lng->txt(
'selected_threads_reopened'),
true);
3347 $this->ctrl->redirect($this,
'showThreads');
3348 } elseif (
$_POST[
'selected_cmd'] ==
'makesticky') {
3349 if ($this->is_moderator) {
3350 $message = $this->lng->txt(
'sel_threads_make_sticky');
3355 $makeSticky = $tmp_obj->makeSticky();
3358 $message = $this->lng->txt(
'sel_threads_already_sticky');
3365 $this->ctrl->redirect($this,
'showThreads');
3366 } elseif (
$_POST[
'selected_cmd'] ==
'unmakesticky') {
3367 if ($this->is_moderator) {
3368 $message = $this->lng->txt(
'sel_threads_make_unsticky');
3372 $unmakeSticky = $tmp_obj->unmakeSticky();
3373 if (!$unmakeSticky) {
3374 $message = $this->lng->txt(
'sel_threads_already_unsticky');
3382 $this->ctrl->redirect($this,
'showThreads');
3383 } elseif (
$_POST[
'selected_cmd'] ==
'editThread') {
3384 if ($this->is_moderator) {
3385 $count = count(
$_POST[
'thread_ids']);
3388 $this->ctrl->redirect($this,
'showThreads');
3390 foreach (
$_POST[
'thread_ids'] as $thread_id) {
3396 $this->ctrl->redirect($this,
'showThreads');
3397 } elseif (
$_POST[
'selected_cmd'] ==
'html') {
3398 $this->ctrl->setCmd(
'exportHTML');
3399 $this->ctrl->setCmdClass(
'ilForumExportGUI');
3401 } elseif (
$_POST[
'selected_cmd'] ==
'confirmDeleteThreads') {
3403 } elseif (
$_POST[
'selected_cmd'] ==
'merge') {
3406 ilUtil::sendInfo($this->lng->txt(
'topics_please_select_one_action'),
true);
3407 $this->ctrl->redirect($this,
'showThreads');
3411 $this->ctrl->redirect($this,
'showThreads');
3417 if (!$this->is_moderator) {
3418 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3421 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3422 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3426 $threads2move =
$_SESSION[
'threads2move'];
3427 if (!is_array($threads2move) || !count($threads2move)) {
3429 $this->ctrl->redirect($this,
'showThreads');
3432 if (!$this->access->checkAccess(
'read',
'', (
int)
$_POST[
'frm_ref_id'])) {
3433 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3437 array_walk($threads2move,
function ($threadId) use (&$threads) {
3438 $thread = new \ilForumTopic($threadId);
3441 $threads[] = $threadId;
3444 if (isset($_POST[
'frm_ref_id']) && (int) $_POST[
'frm_ref_id']) {
3445 $errorMessages = $this->
object->Forum->moveThreads(
3447 $this->object->getRefId(),
3448 $this->ilObjDataCache->lookupObjId($_POST[
'frm_ref_id'])
3451 if (array() !== $errorMessages) {
3453 implode(
"<br><br>", $errorMessages),
3456 return $this->ctrl->redirectByClass(
'ilObjForumGUI',
'showThreads');
3459 unset($_SESSION[
'threads2move']);
3461 $this->ctrl->redirect($this,
'showThreads');
3471 $this->ctrl->redirect($this,
'showThreads');
3476 if (!$this->is_moderator) {
3477 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3480 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3481 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3484 $threads2move =
$_SESSION[
'threads2move'];
3485 if (!is_array($threads2move) || !count($threads2move)) {
3487 $this->ctrl->redirect($this,
'showThreads');
3492 array_walk($threads2move,
function ($threadId) use (&$threads, $isModerator) {
3493 $thread = new \ilForumTopic($threadId, $isModerator);
3496 $threads[] = $thread;
3500 $exp->setPathOpen($this->object->getRefId());
3501 $exp->setNodeSelected(isset(
$_POST[
'frm_ref_id']) && (
int)
$_POST[
'frm_ref_id'] ? (
int)
$_POST[
'frm_ref_id'] : 0);
3502 $exp->setCurrentFrmRefId($this->object->getRefId());
3503 $exp->setHighlightedNode($this->object->getRefId());
3504 if (!$exp->handleCommand()) {
3506 'tpl.forums_threads_move.html',
3513 $this->toolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this));
3517 $tblThr->setId(
'il_frm_thread_move_table_' . $this->object->getRefId());
3518 $tblThr->setTitle($this->lng->txt(
'move_chosen_topics'));
3519 $tblThr->addColumn($this->lng->txt(
'subject'),
'top_name',
'100%');
3520 $tblThr->disable(
'header');
3521 $tblThr->disable(
'footer');
3522 $tblThr->disable(
'linkbar');
3523 $tblThr->disable(
'sort');
3524 $tblThr->disable(
'linkbar');
3525 $tblThr->setLimit(PHP_INT_MAX);
3526 $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html',
'Modules/Forum');
3527 $tblThr->setDefaultOrderField(
'is_sticky');
3530 foreach ($threads as $thread) {
3531 $result[$counter][
'num'] = $counter + 1;
3532 $result[$counter][
'thr_subject'] = $thread->getSubject();
3536 $moveThreadTemplate->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
3538 $moveThreadTemplate->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
3539 $moveThreadTemplate->setVariable(
'CMD_SUBMIT',
'performMoveThreads');
3540 $moveThreadTemplate->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'move'));
3541 $moveThreadTemplate->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this,
'performMoveThreads'));
3543 $this->tpl->setContent($moveThreadTemplate->get());
3551 if ($this->objProperties->isAnonymized() && (!$this->is_moderator || !$this->objProperties->getMarkModeratorPosts())) {
3559 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3560 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3563 $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()[
'draft_ids'] ?? []));
3564 if (0 === count($draftIds)) {
3565 $draftIds = array_filter([(
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0)]);
3569 $checkedDraftIds = [];
3570 foreach ($draftIds as $draftId) {
3571 if (array_key_exists($draftId, $instances)) {
3572 $checkedDraftIds[] = $draftId;
3573 $draft = $instances[$draftId];
3577 $draftFileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
3578 $draftFileData->delete();
3580 $GLOBALS[
'ilAppEventHandler']->raise(
3584 'draftObj' => $draft,
3585 'obj_id' => $this->object->getId(),
3586 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
3590 $draft->deleteDraft();
3594 if (count($checkedDraftIds) > 1) {
3599 $this->ctrl->redirect($this,
'showThreads');
3608 $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
3609 $allowNotification = !$this->objProperties->isAnonymized();
3611 $mail = new \ilMail($this->
user->getId());
3612 if (!$this->rbac->system()->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId())) {
3613 $allowNotification =
false;
3616 $form = new \ilForumThreadFormGUI(
3618 $this->objProperties,
3632 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3633 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3636 if (!$this->access->checkAccess(
'add_thread',
'', $this->object->getRefId())) {
3637 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3640 $templateForWidthHandling = new \ilTemplate(
'tpl.create_thread_form.html',
true,
true,
'Modules/Forum');
3642 $templateForWidthHandling->parseCurrentBlock();
3644 $this->tpl->setContent($templateForWidthHandling->get());
3655 !$this->access->checkAccess(
'add_thread',
'', $this->object->getRefId()) ||
3656 !$this->access->checkAccess(
'read',
'', $this->object->getRefId())
3658 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3661 $frm = $this->
object->Forum;
3662 $frm->setForumId($this->object->getId());
3663 $frm->setForumRefId($this->object->getRefId());
3664 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
3665 $topicData = $frm->getOneTopic();
3668 if ($form->checkInput()) {
3671 $userIdForDisplayPurposes = $this->
user->getId();
3673 $userIdForDisplayPurposes = 0;
3679 $this->objCurrentPost->isAnyParentDeactivated()
3684 if ($createFromDraft) {
3685 $newThread = new \ilForumTopic(0,
true,
true);
3686 $newThread->setForumId($topicData[
'top_pk']);
3689 $newThread->setSubject($this->
handleFormInput($form->getInput(
'subject'),
false));
3692 $newPost = $frm->generateThread(
3701 $form->getInput(
'alias'),
3702 $this->objProperties->isAnonymized()
3704 $newThread = new \ilForumTopic(0,
true,
true);
3705 $newThread->setForumId($topicData[
'top_pk']);
3706 $newThread->setThrAuthorId($this->
user->getId());
3707 $newThread->setDisplayUserId($userIdForDisplayPurposes);
3708 $newThread->setSubject($this->
handleFormInput($form->getInput(
'subject'),
false));
3709 $newThread->setUserAlias($userAlias);
3711 $newPost = $frm->generateThread(
3714 $form->getItemByPostVar(
'notify') ? (int) $form->getInput(
'notify') : 0,
3720 if ($this->objProperties->isFileUploadAllowed()) {
3721 $file = $_FILES[
'userfile'];
3722 if (is_array($file) && !empty($file)) {
3723 $fileData = new \ilFileDataForum($this->object->getId(), $newPost);
3724 $fileData->storeUploadedFile($file);
3728 $frm->setDbTable(
'frm_data');
3729 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
3730 $frm->updateVisits($topicData[
'top_pk']);
3732 if ($createFromDraft) {
3737 foreach ($mediaObjects as $mob) {
3745 $draftHistory = new \ilForumDraftsHistory();
3746 $draftHistory->deleteHistoryByDraftIds([$draft->
getDraftId()]);
3747 if ($this->objProperties->isFileUploadAllowed()) {
3748 $forumFileData = new \ilFileDataForum($this->object->getId(), $newPost);
3749 $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->
getDraftId());
3750 $draftFileData->moveFilesOfDraft($forumFileData->getForumPath(), $newPost);
3755 $GLOBALS[
'ilAppEventHandler']->raise(
3759 'ref_id' => $this->object->getRefId(),
3760 'post' => new \ilForumPost($newPost),
3761 'notify_moderators' => !$status
3765 \ilUtil::sendSuccess($this->lng->txt(
'forums_thread_new_entry'),
true);
3766 $this->ctrl->redirect($this);
3769 $form->setValuesByPost();
3770 if (!$this->objProperties->isAnonymized()) {
3771 $form->getItemByPostVar(
'alias')->setValue($this->
user->getLogin());
3774 $this->tpl->setContent($form->getHTML());
3780 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3783 $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
3786 if ((
int) $draft->getDraftId() <= 0) {
3787 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3795 $draft = new \ilForumPostDraft();
3797 $draftId = (int) ($this->httpRequest->getParsedBody()[
'draft_id'] ?? 0);
3808 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3809 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3812 $frm = $this->
object->Forum;
3813 $frm->setForumId($this->object->getId());
3814 $frm->enableForumNotification($this->
user->getId());
3816 if ((
int) $this->objCurrentTopic->getId() > 0) {
3817 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3819 $this->ctrl->redirect($this,
'viewThread');
3828 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3829 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3832 $frm = $this->
object->Forum;
3833 $frm->setForumId($this->object->getId());
3834 $frm->disableForumNotification($this->
user->getId());
3836 if ((
int) $this->objCurrentTopic->getId() > 0) {
3837 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3839 $this->ctrl->redirect($this,
'viewThread');
3851 $column_gui->
setBlockProperty(
'news',
'title', $this->lng->txt(
'frm_latest_postings'));
3855 if ($this->access->checkAccess(
'write',
'', $this->object->getRefId())) {
3856 $news_set = new \ilSetting(
'news');
3857 if ($news_set->get(
'enable_rss_for_internal')) {
3859 $column_gui->
setBlockProperty(
'news',
'public_notifications_option',
true);
3870 $this->locator->addItem(
3871 $this->object->getTitle(),
3872 $this->ctrl->getLinkTarget($this),
3874 $this->
object->getRefId()
3881 $a_text = str_replace(
"<",
"<", $a_text);
3882 $a_text = str_replace(
">",
">", $a_text);
3883 if ($a_stripslashes) {
3892 $a_text = str_replace(
"<",
"<", $a_text);
3893 $a_text = str_replace(
">",
">", $a_text);
3901 !$this->access->checkAccess(
'visible',
'', $this->object->getRefId()) &&
3902 !$this->access->checkAccess(
'read',
'', $this->object->getRefId())
3904 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
3907 $info = new \ilInfoScreenGUI($this);
3908 $info->enablePrivateNotes();
3909 $info->addMetaDataSections($this->object->getId(), 0, $this->
object->getType());
3910 $this->ctrl->forwardCommand($info);
3918 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3919 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3922 if ((
int) $this->objCurrentPost->getId() > 0) {
3925 $this->
object->markPostUnread($this->
user->getId(), (int) $this->objCurrentPost->getId());
3927 $this->viewThreadObject();
3935 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3936 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3939 if ((
int) $this->objCurrentTopic->getId() > 0 && (int) $this->objCurrentPost->getId() > 0) {
3942 $this->
object->markPostRead(
3943 $this->
user->getId(),
3944 (int) $this->objCurrentTopic->getId(),
3945 (int) $this->objCurrentPost->getId()
3948 $this->viewThreadObject();
3956 $lg = parent::initHeaderAction();
3958 if ((
int) $this->objCurrentTopic->getId() > 0) {
3959 $container_obj = null;
3960 $lg->setContainerObject($container_obj);
3967 if ($this->
user->isAnonymous() || !$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3971 $frm = $this->
object->Forum;
3972 $frm->setForumId($this->object->getId());
3973 $frm->setForumRefId($this->object->getRefId());
3974 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
3976 $isForumNotificationEnabled = $frm->isForumNotificationEnabled($this->
user->getId());
3979 if ((
int) $this->objCurrentTopic->getId() > 0) {
3980 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3985 if ($isForumNotificationEnabled && $userMayDisableNotifications) {
3986 $lg->addCustomCommand(
3987 $this->ctrl->getLinkTarget($this,
'disableForumNotification'),
3988 'forums_disable_forum_notification' 3990 } elseif (!$isForumNotificationEnabled) {
3991 $lg->addCustomCommand(
3992 $this->ctrl->getLinkTarget($this,
'enableForumNotification'),
3993 'forums_enable_forum_notification' 3996 } elseif ($isForumNotificationEnabled) {
3997 $lg->addCustomCommand(
3998 $this->ctrl->getLinkTarget($this,
'disableForumNotification'),
3999 'forums_disable_forum_notification' 4002 $lg->addCustomCommand(
4003 $this->ctrl->getLinkTarget($this,
'enableForumNotification'),
4004 'forums_enable_forum_notification' 4008 $isThreadNotificationEnabled =
false;
4009 if ((
int) $this->objCurrentTopic->getId() > 0) {
4010 $isThreadNotificationEnabled = $this->objCurrentTopic->isNotificationEnabled($this->
user->getId());
4011 if ($isThreadNotificationEnabled) {
4012 $lg->addCustomCommand(
4013 $this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
4014 'forums_disable_notification' 4017 $lg->addCustomCommand(
4018 $this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
4019 'forums_enable_notification' 4023 $this->ctrl->setParameter($this,
'thr_pk',
'');
4025 if ($isForumNotificationEnabled || $isThreadNotificationEnabled) {
4029 $this->lng->txt(
'frm_notification_activated')
4035 $this->lng->txt(
'frm_notification_deactivated')
4044 if ($this->objProperties->getNotificationType() ==
'default') {
4048 if ($this->objProperties->isUserToggleNoti() == 0) {
4054 $frm_noti->setUserId($this->
user->getId());
4056 $user_toggle = (int) $frm_noti->isUserToggleNotification();
4057 if ($user_toggle == 0 && $this->objProperties->isUserToggleNoti() == 0) {
4067 $grpRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(),
'grp');
4068 $crsRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(),
'crs');
4070 return ($grpRefId > 0 || $crsRefId > 0);
4075 if (!$this->is_moderator) {
4076 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4079 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4080 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4083 $threadIdToSortValueMap = (array) ($this->httpRequest->getParsedBody()[
'thread_sorting'] ?? []);
4085 array_walk($threadIdToSortValueMap,
function ($sortValue, $threadId) {
4089 foreach ($threadIdToSortValueMap as $threadId => $sortValue) {
4090 $sortValue = str_replace(
',',
'.', $sortValue);
4091 $sortValue = (float) $sortValue * 100;
4092 $this->
object->setThreadSorting((
int) $threadId, $sortValue);
4095 \ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
4096 $this->ctrl->redirect($this,
'showThreads');
4104 if (!$this->is_moderator) {
4105 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4108 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4109 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4112 $threadIdToMerge = (int) ($this->httpRequest->getQueryParams()[
'merge_thread_id'] ?? 0);
4113 if (!($threadIdToMerge > 0)) {
4114 $threadIds = array_values(
4115 array_filter(array_map(
'intval', (array) $this->httpRequest->getParsedBody()[
'thread_ids'] ?? []))
4117 if (1 === count($threadIds)) {
4118 $threadIdToMerge = current($threadIds);
4126 $frm = $this->
object->Forum;
4127 $frm->setForumId($this->object->getId());
4128 $frm->setForumRefId($this->object->getRefId());
4138 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4140 $threadsTemplate = new \ilTemplate(
4141 'tpl.forums_threads_liste.html',
4147 $topicData = $frm->getOneTopic();
4149 $this->ctrl->setParameter($this,
'merge_thread_id', $threadIdToMerge);
4150 $tbl = new \ilForumTopicTableGUI(
4154 (
int) $this->httpRequest->getQueryParams()[
'ref_id'],
4157 $this->
settings->get(
'forum_overview')
4159 $tbl->setSelectedThread($threadToMerge);
4160 $tbl->setMapper($frm)->fetchData();
4162 $threadsTemplate->setVariable(
'THREADS_TABLE', $tbl->getHTML());
4163 $this->tpl->setContent($threadsTemplate->get());
4175 if (!$this->is_moderator) {
4176 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4179 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4180 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4183 $sourceThreadId = (int) ($this->httpRequest->getQueryParams()[
'merge_thread_id'] ?? 0);
4184 $targetThreadIds = array_values(
4185 array_filter(array_map(
'intval', (array) $this->httpRequest->getParsedBody()[
'thread_ids'] ?? []))
4188 if (!($sourceThreadId > 0) || 1 !== count($targetThreadIds)) {
4194 $targetThreadId = current($targetThreadIds);
4195 if ($sourceThreadId == $targetThreadId) {
4203 $this->ctrl->clearParameters($this);
4217 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performMergeThreads'));
4218 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_merge_threads'));
4219 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
4220 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performMergeThreads');
4232 $this->tpl->setContent($c_gui->getHTML());
4240 if (!$this->is_moderator) {
4241 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4244 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4245 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4248 $threadIds = array_values(
4249 array_filter(array_map(
'intval', (array) $this->httpRequest->getParsedBody()[
'thread_ids'] ?? []))
4251 if (2 !== count($threadIds)) {
4257 if ((
int) $threadIds[0] === (
int) $threadIds[1]) {
4264 $frm = new \ilForum();
4265 $frm->setForumId($this->object->getId());
4266 $frm->setForumRefId($this->object->getRefId());
4271 $frm->mergeThreads((
int) $threadIds[0], (
int) $threadIds[1]);
4272 \ilUtil::sendSuccess($this->lng->txt(
'merged_threads_successfully'));
4286 if (!$this->ctrl->isAsynch()) {
4287 $content = implode(
'', [
4292 $this->tpl->setRightContent($content);
4300 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4301 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4304 $draftId = $this->httpRequest->getQueryParams()[
'draft_id'] ?? 0;
4306 if ($draft->getPostAuthorId() == $this->
user->getId()) {
4307 $fileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
4308 if (!$fileData->deliverZipFile()) {
4309 $this->ctrl->redirect($this);
4319 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4320 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4325 $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
4326 if (!$fileData->deliverZipFile()) {
4327 $this->ctrl->redirect($this);
4337 !$this->access->checkAccess(
'add_thread',
'', $this->object->getRefId()) ||
4338 !$this->access->checkAccess(
'read',
'', $this->object->getRefId()) ||
4341 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4344 $frm = $this->
object->Forum;
4345 $frm->setForumId($this->object->getId());
4346 $frm->setForumRefId($this->object->getRefId());
4348 $draft = new \ilForumPostDraft();
4349 $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
4351 $draft = $draft->newInstanceByDraftId($draftId);
4354 $historyCheck = (int) ($this->httpRequest->getQueryParams()[
'hist_check'] ?? 1);
4359 if (!$form instanceof \ilPropertyFormGUI) {
4361 $form->setValuesByArray([
4362 'alias' => $draft->getPostUserAlias(),
4363 'subject' => $draft->getPostSubject(),
4365 'notify' => $draft->getNotify() ? true :
false,
4370 $this->ctrl->setParameter($this,
'draft_id', $draftId);
4378 $historyId = (int) ($this->httpRequest->getQueryParams()[
'history_id'] ?? 0);
4379 $history = new \ilForumDraftsHistory($historyId);
4381 $draft = $history->rollbackAutosave();
4382 if ($draft->getThreadId() == 0 && $draft->getPostId() == 0) {
4383 $this->ctrl->setParameter($this,
'draft_id', $history->getDraftId());
4384 $this->ctrl->redirect($this,
'editThreadDraft');
4387 $this->ctrl->clearParameters($this);
4388 $this->ctrl->setParameter($this,
'pos_pk', $draft->getPostId());
4389 $this->ctrl->setParameter($this,
'thr_pk', $draft->getThreadId());
4390 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
4391 $this->ctrl->setParameter($this,
'action',
'editdraft');
4396 $this->ctrl->redirect($this,
'viewThread');
4402 !$this->access->checkAccess(
'add_thread',
'', $this->object->getRefId()) ||
4403 !$this->access->checkAccess(
'read',
'', $this->object->getRefId()) ||
4406 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4409 $autoSavedDraftId = (int) ($this->httpRequest->getParsedBody()[
'draft_id'] ?? 0);
4410 if ($autoSavedDraftId <= 0) {
4411 $autoSavedDraftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
4414 $frm = $this->
object->Forum;
4415 $frm->setForumId($this->object->getId());
4416 $frm->setForumRefId($this->object->getRefId());
4417 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4418 $topicData = $frm->getOneTopic();
4421 if ($form->checkInput()) {
4424 if (0 === $autoSavedDraftId) {
4425 $draft = new \ilForumPostDraft();
4430 $draft->setForumId($topicData[
'top_pk']);
4431 $draft->setThreadId(0);
4432 $draft->setPostId(0);
4433 $draft->setPostSubject($this->
handleFormInput($form->getInput(
'subject'),
false));
4436 $form->getInput(
'alias'),
4437 $this->objProperties->isAnonymized()
4439 $draft->setPostUserAlias($userAlias);
4440 $draft->setNotify((
int) $form->getInput(
'notify'));
4441 $draft->setPostAuthorId($this->
user->getId());
4444 if (0 === $autoSavedDraftId) {
4445 $draftId = $draft->saveDraft();
4447 $draft->updateDraft();
4448 $draftId = $draft->getDraftId();
4451 $GLOBALS[
'ilAppEventHandler']->raise(
4455 'draftObj' => $draft,
4456 'obj_id' => $this->object->getId(),
4457 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4463 $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draftId);
4465 $files2delete = $form->getInput(
'del_file');
4466 if (is_array($files2delete) && count($files2delete) > 0) {
4467 $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4470 if ($this->objProperties->isFileUploadAllowed()) {
4471 $file = $_FILES[
'userfile'];
4472 if (is_array($file) && !empty($file)) {
4473 $draftFileData->storeUploadedFile($file);
4477 \ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'),
true);
4478 $this->ctrl->clearParameters($this);
4479 $this->ctrl->redirect($this,
'showThreads');
4482 $this->requestAction = substr($this->requestAction, 6);
4483 $form->setValuesByPost();
4484 $this->ctrl->setParameter($this,
'draft_id', $autoSavedDraftId);
4485 $this->tpl->setContent($form->getHTML());
4491 !$this->access->checkAccess(
'add_thread',
'', $this->object->getRefId()) ||
4492 !$this->access->checkAccess(
'read',
'', $this->object->getRefId()) ||
4495 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4498 $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
4500 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4504 if ($form->checkInput()) {
4508 $form->getInput(
'alias'),
4509 $this->objProperties->isAnonymized()
4513 $draft->setPostSubject($this->
handleFormInput($form->getInput(
'subject'),
false));
4515 $draft->setPostUserAlias($userAlias);
4516 $draft->setNotify((
int) $form->getInput(
'notify'));
4517 $draft->setPostAuthorId($this->
user->getId());
4519 $draft->updateDraft();
4521 $GLOBALS[
'ilAppEventHandler']->raise(
4525 'draftObj' => $draft,
4526 'obj_id' => $this->object->getId(),
4527 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4532 $form->getInput(
'message'),
4534 $draft->getDraftId(),
4536 $draft->getDraftId()
4539 $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
4541 $files2delete = $form->getInput(
'del_file');
4542 if (is_array($files2delete) && count($files2delete) > 0) {
4543 $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4546 if ($this->objProperties->isFileUploadAllowed()) {
4547 $file = $_FILES[
'userfile'];
4548 if (is_array($file) && !empty($file)) {
4549 $draftFileData->storeUploadedFile($file);
4553 \ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'),
true);
4554 $this->ctrl->clearParameters($this);
4555 $this->ctrl->redirect($this,
'showThreads');
4558 $form->setValuesByPost();
4559 $this->ctrl->setParameter($this,
'hist_check', 0);
4560 $this->ctrl->setParameter($this,
'draft_id', $draftId);
4566 $this->saveAsDraftObject();
4569 public function saveAsDraftObject()
4571 if (!$this->objCurrentTopic->getId()) {
4573 $this->ctrl->redirect($this);
4576 if ($this->objCurrentTopic->isClosed()) {
4578 $this->ctrl->redirect($this);
4581 if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
4582 $_POST[
'del_file'] = array();
4585 $autosave_draft_id = 0;
4587 $autosave_draft_id = (int)
$_POST[
'draft_id'];
4590 if ($oReplyEditForm->checkInput()) {
4591 if (!$this->objCurrentPost->getId()) {
4592 $this->requestAction =
'';
4594 $this->viewThreadObject();
4605 $forumObj = $oForumObjects[
'forumObj'];
4609 $frm = $oForumObjects[
'frm'];
4610 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4611 $topicData = $frm->getOneTopic();
4614 if ($this->requestAction ==
'ready_showreply') {
4615 if (!$this->access->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])) {
4616 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4620 $oReplyEditForm->getInput(
'alias'),
4621 $this->objProperties->isAnonymized()
4624 if ($autosave_draft_id == 0) {
4629 $draftObj->setForumId($topicData[
'top_pk']);
4630 $draftObj->setThreadId($this->objCurrentTopic->getId());
4631 $draftObj->setPostId($this->objCurrentPost->getId());
4633 $draftObj->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
4635 $draftObj->setPostUserAlias($user_alias);
4636 $draftObj->setNotify((
int) $oReplyEditForm->getInput(
'notify'));
4637 $draftObj->setPostNotify((
int) $oReplyEditForm->getInput(
'notify_post'));
4639 $draftObj->setPostAuthorId($this->
user->getId());
4642 if ($autosave_draft_id == 0) {
4643 $draft_id = $draftObj->saveDraft();
4645 $draftObj->updateDraft();
4646 $draft_id = $draftObj->getDraftId();
4650 $GLOBALS[
'ilAppEventHandler']->raise(
4654 'draftObj' => $draftObj,
4655 'obj_id' => $this->object->getId(),
4656 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
4661 if ($this->objProperties->isFileUploadAllowed()) {
4662 $file = $_FILES[
'userfile'];
4663 if (is_array($file) && !empty($file)) {
4671 $oReplyEditForm->getInput(
'message'),
4678 $_SESSION[
'frm'][(int) $_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
4680 ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'),
true);
4681 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
4682 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
4683 $this->ctrl->redirect($this,
'viewThread');
4686 $oReplyEditForm->setValuesByPost();
4687 $this->requestAction = substr($this->requestAction, 6);
4689 return $this->viewThreadObject();
4695 $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
4701 $this->viewThreadObject();
4707 public function updateDraftObject()
4709 if (!$this->objCurrentTopic->getId()) {
4711 $this->ctrl->redirect($this);
4714 if ($this->objCurrentTopic->isClosed()) {
4716 $this->ctrl->redirect($this);
4719 if (!$this->objCurrentPost->getId()) {
4720 $this->requestAction =
'';
4722 $this->viewThreadObject();
4726 if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
4727 $_POST[
'del_file'] = array();
4731 if ($oReplyEditForm->checkInput()) {
4739 $forumObj = $oForumObjects[
'forumObj'];
4741 if (!$this->
user->isAnonymous() && in_array($this->requestAction, [
'showdraft',
'editdraft'])) {
4742 if (!$this->access->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])) {
4743 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4746 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4750 $oReplyEditForm->getInput(
'alias'),
4751 $this->objProperties->isAnonymized()
4756 $this->
user->getId(),
4757 $this->objCurrentPost->getId(),
4758 (int) $_GET[
'draft_id']
4761 $update_draft->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
4763 $oReplyEditForm->getInput(
'message'),
4766 $update_draft->setPostUserAlias($user_alias);
4767 $update_draft->setNotify((
int) $oReplyEditForm->getInput(
'notify'));
4768 $update_draft->setUpdateUserId($this->
user->getId());
4769 $update_draft->setPostAuthorId($this->
user->getId());
4772 $update_draft->updateDraft();
4775 $GLOBALS[
'ilAppEventHandler']->raise(
4779 'draftObj' => $update_draft,
4780 'obj_id' => $this->object->getId(),
4781 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
4788 foreach ($uploadedObjects as $mob) {
4793 $oReplyEditForm->getInput(
'message'),
4795 $update_draft->getDraftId()
4800 $file2delete = $oReplyEditForm->getInput(
'del_file');
4801 if (is_array($file2delete) && count($file2delete)) {
4805 if ($this->objProperties->isFileUploadAllowed()) {
4806 $file = $_FILES[
'userfile'];
4807 if (is_array($file) && !empty($file)) {
4808 $oFDForumDrafts->storeUploadedFile($file);
4812 $_SESSION[
'frm'][(int) $_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
4813 ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'),
true);
4815 $this->ctrl->clearParameters($this);
4816 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
4817 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
4818 $this->ctrl->setParameter($this,
'draft_id', $update_draft->getDraftId());
4820 $this->ctrl->clearParameters($this);
4821 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
4822 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
4823 $this->ctrl->setParameter($this,
'draft_id', (
int)
$_GET[
'draft_id']);
4824 $this->ctrl->setParameter($this,
'action',
'editdraft');
4825 $oReplyEditForm->setValuesByPost();
4826 return $this->viewThreadObject();
4828 $this->ctrl->clearParameters($this);
4829 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
4830 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
4831 $this->ctrl->redirect($this,
'viewThread');
4844 foreach ($oldMediaObjects as $oldMob) {
4846 foreach ($curMediaObjects as $curMob) {
4847 if ($oldMob == $curMob) {
4868 !$this->access->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']) ||
4869 $this->
user->isAnonymous() ||
4870 ($draft_obj instanceof
ilForumPostDraft && $this->
user->getId() != $draft_obj->getPostAuthorId())) {
4871 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4874 $post_id = $this->objCurrentPost->getId();
4876 $draft_id_to_delete = (int) $_GET[
'draft_id'];
4877 $draft_obj =
new ilForumPostDraft($this->
user->getId(), $post_id, $draft_id_to_delete);
4879 if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete)) {
4880 $this->ctrl->clearParameters($this);
4881 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
4882 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
4883 $this->ctrl->redirect($this,
'viewThread');
4887 $this->
deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
4890 $objFileDataForumDrafts->
delete();
4893 $GLOBALS[
'ilAppEventHandler']->raise(
4897 'draftObj' => $draft_obj,
4898 'obj_id' => $this->object->getId(),
4899 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
4903 $draft_obj->deleteDraft();
4905 ilUtil::sendSuccess($this->lng->txt(
'delete_draft_successfully'),
true);
4906 $this->ctrl->clearParameters($this);
4907 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
4908 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
4909 $this->ctrl->redirect($this,
'viewThread');
4914 $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
4916 $this->requestAction !==
'ready_showreply' &&
4917 $this->access->checkAccess(
'read',
'', $this->object->getRefId()) &&
4918 $this->access->checkAccess(
'add_reply',
'', $this->object->getRefId())
4920 $action = new \ilForumAutoSaveAsyncDraftAction(
4923 $this->objProperties,
4924 $this->objCurrentTopic,
4925 $this->objCurrentPost,
4926 function (
string $message) :
string {
4934 $this->
http->saveResponse($this->
http->response()->withBody(
4935 \
ILIAS\
Filesystem\Stream\Streams::ofString(json_encode($action->executeAndGetResponseObject()))
4939 $this->
http->sendResponse();
4940 $this->
http->close();
4945 $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
4947 $this->requestAction !==
'ready_showreply' &&
4948 $this->access->checkAccess(
'read',
'', $this->object->getRefId()) &&
4949 $this->access->checkAccess(
'add_thread',
'', $this->object->getRefId())
4951 $action = new \ilForumAutoSaveAsyncDraftAction(
4954 $this->objProperties,
4955 $this->objCurrentTopic,
4956 $this->objCurrentPost,
4957 function (
string $message) :
string {
4965 $this->
http->saveResponse($this->
http->response()->withBody(
4966 \
ILIAS\
Filesystem\Stream\Streams::ofString(json_encode($action->executeAndGetResponseObject()))
4970 $this->
http->sendResponse();
4971 $this->
http->close();
4995 $this->objCurrentPost->getId() != $node->
getId() || (
4996 !in_array($action, [
'showreply',
'showedit',
'censor',
'delete'],
true) &&
5001 if ($this->is_moderator && !$this->objCurrentTopic->isClosed() && !$node->
isActivated()) {
5002 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5003 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
5004 $this->ctrl->setParameter($this,
'page', $pageIndex);
5005 $this->ctrl->setParameter(
5010 $actions[
'activate_post'] = $this->ctrl->getLinkTarget(
5012 'askForPostActivation',
5015 $this->ctrl->clearParameters($this);
5020 $this->access->checkAccess(
'add_reply',
'', (
int) $this->object->getRefId())
5022 $this->ctrl->setParameter($this,
'action',
'showreply');
5023 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5024 $this->ctrl->setParameter($this,
'page', $pageIndex);
5025 $this->ctrl->setParameter(
5030 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
5031 $actions[
'reply_to_postings'] = $this->ctrl->getLinkTarget(
5034 'reply_' . $node->
getId()
5036 $this->ctrl->clearParameters($this);
5040 !$this->objCurrentTopic->isClosed() &&
5042 !$this->
user->isAnonymous() &&
5043 ($node->
isOwner($this->
user->getId()) || $this->is_moderator)
5045 $this->ctrl->setParameter($this,
'action',
'showedit');
5046 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5047 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
5048 $this->ctrl->setParameter($this,
'page', $pageIndex);
5049 $this->ctrl->setParameter(
5054 $actions[
'edit'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId());
5055 $this->ctrl->clearParameters($this);
5058 if (!$this->
user->isAnonymous()) {
5059 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5060 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
5061 $this->ctrl->setParameter($this,
'page', $pageIndex);
5062 $this->ctrl->setParameter(
5067 $this->ctrl->setParameter($this,
'viewmode', $this->selectedSorting);
5069 $read_undread_txt =
'frm_mark_as_read';
5070 $read_undread_cmd =
'markPostRead';
5072 $read_undread_txt =
'frm_mark_as_unread';
5073 $read_undread_cmd =
'markPostUnread';
5075 $actions[$read_undread_txt] = $this->ctrl->getLinkTarget(
5081 $this->ctrl->clearParameters($this);
5085 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_post', $node->
getId());
5086 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'top_pk', $node->
getForumId());
5087 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_pk', $node->
getThreadId());
5089 $actions[
'print'] = $this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printPost');
5091 $this->ctrl->clearParameters($this);
5095 !$this->objCurrentTopic->isClosed() &&
5096 !$this->
user->isAnonymous() &&
5099 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5100 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
5101 $this->ctrl->setParameter($this,
'page', $pageIndex);
5102 $this->ctrl->setParameter(
5107 $actions[
'delete'] = $this->ctrl->getFormAction($this,
'deletePosting');
5108 $this->ctrl->clearParameters($this);
5111 if ($this->is_moderator && !$this->objCurrentTopic->isClosed()) {
5112 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5113 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
5114 $this->ctrl->setParameter($this,
'page', $pageIndex);
5115 $this->ctrl->setParameter(
5121 $this->ctrl->setParameter($this,
'action',
'viewThread');
5122 $actions[
'frm_revoke_censorship'] = $this->ctrl->getFormAction($this,
'revokeCensorship');
5124 $actions[
'frm_censorship'] = $this->ctrl->getFormAction($this,
'addCensorship');
5126 $this->ctrl->clearParameters($this);
5130 } elseif (
$_GET[
'draft_id'] != $draft->getDraftId() || !in_array($action, [
'deletedraft',
'editdraft'])) {
5132 $this->ctrl->setParameter($this,
'action',
'publishdraft');
5133 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5134 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
5135 $this->ctrl->setParameter($this,
'page', $pageIndex);
5136 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
5137 $this->ctrl->setParameter(
5142 $actions[
'publish'] = $this->ctrl->getLinkTarget($this,
'publishSelectedDraft', $node->
getId());
5143 $this->ctrl->clearParameters($this);
5145 $this->ctrl->setParameter($this,
'action',
'editdraft');
5146 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5147 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
5148 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
5149 $this->ctrl->setParameter($this,
'page', $pageIndex);
5150 $this->ctrl->setParameter(
5155 $actions[
'edit'] = $this->ctrl->getLinkTarget($this,
'editDraft',
'draft_edit_' . $draft->getDraftId());
5156 $this->ctrl->clearParameters($this);
5158 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
5159 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
5160 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
5161 $this->ctrl->setParameter($this,
'page', $pageIndex);
5162 $this->ctrl->setParameter(
5167 $actions[
'delete'] = $this->ctrl->getFormAction($this,
'deletePostingDraft');
5168 $this->ctrl->clearParameters($this);
5170 if (isset(
$_GET[
'draft_id']) && $action ===
'editdraft') {
5176 if (count(
$actions) > 0 && !$this->objCurrentTopic->isClosed()) {
5183 $sb_item->setCaption($lng_id);
5184 $sb_item->setUrl(
$url);
5186 $action_button->setDefaultButton($sb_item);
5189 if (
'frm_revoke_censorship' === $lng_id ||
'frm_censorship' === $lng_id) {
5190 $modalTemplate =
new ilTemplate(
"tpl.forums_censor_modal.html",
true,
true,
'Modules/Forum');
5191 $formID = uniqid(
'form');
5192 $modalTemplate->setVariable(
'FORM_ID', $formID);
5195 $modalTemplate->setVariable(
'BODY', $this->lng->txt(
'forums_info_censor2_post'));
5197 $modalTemplate->setVariable(
'BODY', $this->lng->txt(
'forums_info_censor_post'));
5198 $modalTemplate->touchBlock(
'message');
5201 $modalTemplate->setVariable(
'FORM_ACTION',
$url);
5203 $content = $this->uiFactory->legacy($modalTemplate->get());
5204 $submitBtn = $this->uiFactory->button()->primary($this->lng->txt(
'submit'),
'#')->
withOnLoadCode(
5205 static function (
string $id) use ($formID) :
string {
5206 return "$('#{$id}').click(function() { $('#{$formID}').submit(); return false; });";
5209 $modal = $this->uiFactory->modal()->roundtrip($this->lng->txt($lng_id), $content)->withActionButtons([$submitBtn]);
5210 $sb_item = $this->uiFactory->button()->shy($this->lng->txt($lng_id),
'#')->withOnClick(
5211 $modal->getShowSignal()
5214 $this->modalActionsContainer[] = $modal;
5218 } elseif (
'delete' === $lng_id) {
5219 $modal = $this->uiFactory->modal()->interruptive(
5220 $this->lng->txt($lng_id),
5221 strpos(
$url,
'deletePostingDraft') !==
false ?
5222 $this->lng->txt(
'forums_info_delete_draft') :
5223 $this->lng->txt(
'forums_info_delete_post'),
5225 )->withActionButtonLabel(
5226 strpos(
$url,
'deletePostingDraft') !==
false ?
'deletePostingDraft' :
'deletePosting' 5229 $deleteAction = $this->uiFactory->button()->shy($this->lng->txt($lng_id),
'#')->withOnClick(
5230 $modal->getShowSignal()
5233 $this->modalActionsContainer[] = $modal;
5235 $action_button->addMenuItem(
5242 $sb_item->setCaption($lng_id);
5243 $sb_item->setUrl(
$url);
5249 $tpl->
setVariable(
'COMMANDS', $action_button->render());
5261 !$this->access->checkAccess(
'add_reply',
'', $this->object->getRefId()) || $this->
user->isAnonymous() ||
5262 ($draft instanceof \ilForumPostDraft && $this->
user->getId() != $draft->getPostAuthorId())
5264 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5276 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5285 if (is_array($draftsFromHistory) &&
sizeof($draftsFromHistory) > 0) {
5287 $modal->setHeading($this->lng->txt(
'restore_draft_from_autosave'));
5288 $modal->setId(
'frm_autosave_restore');
5289 $form_tpl = new \ilTemplate(
'tpl.restore_thread_draft.html',
true,
true,
'Modules/Forum');
5291 foreach ($draftsFromHistory as $key => $history_instance) {
5293 $accordion->setId(
'acc_' . $history_instance->getHistoryId());
5295 $form_tpl->setCurrentBlock(
'list_item');
5299 $history_instance->getDraftDate(),
5302 $this->ctrl->setParameter($this,
'history_id', $history_instance->getHistoryId());
5303 $header = $history_date .
' - ' . $history_instance->getPostSubject();
5304 $accordion->addItem($header,
$message . $this->uiRenderer->render(
5305 $this->uiFactory->button()->standard(
5306 $this->lng->txt(
'restore'),
5307 $this->ctrl->getLinkTarget($this,
'restoreFromHistory')
5311 $form_tpl->setVariable(
'ACC_AUTO_SAVE', $accordion->getHtml());
5312 $form_tpl->parseCurrentBlock();
5315 $form_tpl->setVariable(
'RESTORE_DATA_EXISTS',
'found_threat_history_to_restore');
5316 $modal->setBody($form_tpl->get());
5318 $this->modal_history = $modal->getHTML();
5329 if ($this->
user->isAnonymous() && !$this->
user->isCaptchaVerified() && \ilCaptchaUtil::isActiveForForum()) {
5330 $this->
user->setCaptchaVerified(
true);
5344 $action ==
'showedit' && (
5345 (!$this->is_moderator && !$node->
isOwner($this->user->getId()) || $this->
user->isAnonymous()) || $node->
isCensored()
5348 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->getMessage());
5349 } elseif ($action ==
'showreply' && !$this->access->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])) {
5350 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->getMessage());
5353 $tpl->
setVariable(
'REPLY_ANKER',
'reply_' . $this->objCurrentPost->getId());
5355 if ($action !==
'editdraft') {
5356 switch ($this->objProperties->getSubjectSetting()) {
5357 case 'add_re_to_subject':
5361 case 'preset_subject':
5362 $subject = $this->objCurrentPost->getSubject();
5365 case 'empty_subject':
5374 if ($this->ctrl->getCmd() ==
'savePost' || $this->ctrl->getCmd() ==
'saveAsDraft') {
5375 $oEditReplyForm->setValuesByPost();
5376 } elseif ($this->ctrl->getCmd() ==
'quotePost') {
5384 $oEditReplyForm->setValuesByPost();
5385 $oEditReplyForm->getItemByPostVar(
'message')->setValue(
5390 $authorinfo->getAuthorName()
5391 ) .
"\n" . $oEditReplyForm->getInput(
'message'),
5396 $oEditReplyForm->setValuesByArray(array(
5398 'subject' => $subject,
5402 'del_file' => array()
5406 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
5407 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
5409 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
5410 $jsTpl->setVariable(
5411 'IL_FRM_QUOTE_CALLBACK_SRC',
5412 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true)
5414 $this->ctrl->clearParameters($this);
5415 $tpl->
setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
5419 if ($this->ctrl->getCmd() ==
'savePost') {
5420 $oEditReplyForm->setValuesByPost();
5422 $oEditReplyForm->setValuesByArray(array(
5424 'subject' => $this->objCurrentPost->getSubject(),
5426 $this->objCurrentPost->getMessage(),
5429 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true :
false,
5431 'del_file' => array()
5435 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getParentId());
5436 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
5437 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
5438 $jsTpl->setVariable(
5439 'IL_FRM_QUOTE_CALLBACK_SRC',
5440 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true)
5442 $this->ctrl->clearParameters($this);
5443 $tpl->
setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
5447 if (in_array($this->ctrl->getCmd(), array(
'saveDraft',
'updateDraft',
'publishDraft'))) {
5448 $oEditReplyForm->setValuesByPost();
5449 } elseif (isset($_GET[
'draft_id']) && (
int) $_GET[
'draft_id'] > 0) {
5454 $this->
user->getId(),
5455 $this->objCurrentPost->getId(),
5456 (int) $_GET[
'draft_id']
5458 $oEditReplyForm->setValuesByArray(array(
5459 'alias' => $draftObject->getPostUserAlias(),
5460 'subject' => $draftObject->getPostSubject(),
5462 $draftObject->getPostMessage(),
5465 'notify' => $draftObject->getNotify() ? true :
false,
5471 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
5472 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
5474 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
5475 $jsTpl->setVariable(
5476 'IL_FRM_QUOTE_CALLBACK_SRC',
5477 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true)
5479 $this->ctrl->clearParameters($this);
5480 $tpl->
setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
5484 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
5485 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
5486 $this->ctrl->setParameter($this,
'page', (
int) $this->httpRequest->getQueryParams()[
'page']);
5487 $this->ctrl->setParameter(
5492 $this->ctrl->setParameter(
5497 if ($action !==
'editdraft') {
5498 $tpl->
setVariable(
'FORM', $oEditReplyForm->getHTML());
5500 $this->ctrl->clearParameters($this);
Class ilForumStatisticsTableGUI.
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
static _getRTEClassname()
static getDraftInstancesByUserId($user_id)
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
renderPostContent(ilTemplate $tpl, ilForumPost $node, string $action, int $pageIndex, int $postIndex)
static getThreadDraftData($post_author_id, $forum_id)
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
initEditCustomForm(ilPropertyFormGUI $a_form)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static _lookupDate($thread_id)
performMergeThreadsObject()
editThreadDraftObject(\ilPropertyFormGUI $form=null)
initHeaderAction($a_sub_type=null, $a_sub_id=null)
static _lookupObjIdForForumId($a_for_id)
Class Forum core functions for forum.
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...
setDisplayConfirmPostActivation($status=0)
static lookupForumIdByObjId($obj_id)
Class ilForumExplorerGUI.
static getPublicUserAlias($user_alias, $is_anonymized=false)
storeUploadedFile($files)
Store uploaded files in filesystem.
GUI class for the workflow of copying objects.
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
renderSortationControl(int $currentSorting)
static _goto($a_target, $a_thread=0, $a_posting=0)
disableForumNotificationObject()
doCaptchaCheck()
Performs a CAPTCHA check for anonymous users if the CAPTCHA should be used for forums in the public a...
autosaveDraftAsyncObject()
Class ChatMainBarProvider .
static lookupForumIdByRefId($ref_id)
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)
getSubTabs($subtab='showThreads')
static get($a_var)
Get a value.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
static get($a_glyph, $a_text="")
Get glyph html.
Class ilForumDraftsTableGUI.
publishThreadDraftObject()
static set($a_var, $a_val)
Set a value.
static _lookupTitle($a_id)
lookup object title
static lookupAutosaveInterval()
saveThreadSortingObject()
Class ilForumSettingsGUI.
afterSave(ilObject $a_new_object)
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
ensureValidPageForCurrentPosting(array $subtree_nodes, array $pagedPostings, int $pageSize, ilForumPost $firstForumPost)
This class handles all operations on files for the drafts of a forum object.
renderSplitButton(ilTemplate $tpl, string $action, bool $is_post, ilForumPost $node, int $pageIndex=0, ilForumPostDraft $draft=null)
Class ilForumNotification.
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.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static _getAllReferences($a_id)
get all reference ids of object
saveThreadAsDraftObject()
unlinkFilesByMD5Filenames($a_md5_filename)
get file data of a specific attachment
renderDraftContent(ilTemplate $tpl, string $action, ilForumPost $referencePosting, array $drafts)
Class ilForumTopicTableGUI.
Class ilForumDraftHistory.
setColumnSettings(ilColumnGUI $column_gui)
static _lookupObjectId($a_ref_id)
lookup object id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
deleteSelectedDraft(ilForumPostDraft $draft_obj=null)
getCenterColumnHTML()
Get center column.
Export User Interface Class.
buildThreadForm($isDraft=false)
prepareOutput($a_show_subobjects=true)
prepare output
GUI class for public user profile presentation.
static getInstance($a_obj_id=0)
addItem( $a_ref_id, $a_link, $a_type, $a_title="", $a_sub_obj_id="", $a_goto_link="")
Add an item to the stack.
publishDraftObject($use_replyform=true)
hideToolbar($a_flag=null)
static http()
Fetches the global http state from ILIAS.
setVariable($variable, $value='')
Sets a variable value.
static createDraftBackup($draft_id)
deletePostingDraftObject()
renderViewModeControl(int $currentViewMode)
getId()
get object id public
prepareFormOutput($a_text)
prepareText($text, $edit=0, $quote_user='', $type='')
prepares given string public
Class ilForumModeratorsGUI.
performThreadsActionObject()
Forum export to HTML and Print.
static isAutoSavePostDraftAllowed()
Column user interface class.
saveTopLevelDraftObject()
enableForumNotificationObject()
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
News settings for containers.
getEditFormCustomValues(array &$a_values)
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
editThreadObject($threadId, ilPropertyFormGUI $form=null)
cancelMoveThreadsObject()
performMoveThreadsObject()
isWritingWithPseudonymAllowed()
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
askForPostActivationObject()
static newInstanceByDraftId($draft_id)
static infoPanel($a_keep=true)
Online help application class.
restoreFromHistoryObject()
static getInstancesByDraftId($draft_id)
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.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
deleteThreadDraftsObject()
performDeleteThreadsObject()
Navigation History of Repository Items.
createTopLevelPostObject()
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
getModifiedReOnSubject($on_reply=false)
toggleThreadNotificationObject()
isUserAllowedToDeactivateNotification()
static isSavePostDraftAllowed()
deliverDraftZipFileObject()
updateThreadDraftObject()
createThread(\ilForumPostDraft $draft, bool $createFromDraft=false)
Refactored thread creation to method, refactoring to a separate class should be done in next refactor...
static getSearchBlockHTML($a_title)
Get standar search block html.
displayConfirmPostActivation()
static getInstance()
Get instance.
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.
static getSortedDrafts(int $usrId, int $threadId, int $sorting=ilForumProperties::VIEW_DATE_ASC)
ilForumMoveTopicsExplorer
getRightColumnHTML()
Display right column.
decorateWithAutosave(\ilPropertyFormGUI $form)
This class represents a non editable value in a property form.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
__construct(Container $dic, ilPlugin $plugin)
autosaveThreadDraftAsyncObject()
static _getRichTextEditorUserState()
Gets the state of the rich text editor visibility for the current user.
This class represents a text area property in a property form.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
This class handles all operations on files for the forum object.
confirmDeleteThreadDraftsObject()
publishSelectedDraftObject()
static _getInstanceByType(string $type)
Factory method for creating purifier instances.
getCreationMode()
get creation mode
getRefId()
get reference id public
updateCustom(ilPropertyFormGUI $a_form)
handleFormInput($a_text, $a_stripslashes=true)
toggleExplorerNodeState()
Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed...
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
setChangeDate($a_changedate)
$display_confirm_post_activation
static _lookupTitle($a_topic_id)
Looks up the title/subject of a topic/thread.
Accordion user interface class.
addHeaderAction()
Add header action menu.
getThreadEditingForm($a_thread_id)
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
Class FlySystemFileAccessTest disabled disabled disabled.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
storeUploadedFile($files)
Store uploaded files in filesystem.
checkDraftAccess(int $draftId)
performPostActivationObject()
toggleExplorerNodeStateObject()
Toggle explorer node.
static lookupForumIdByTopicId($a_topic_id)
Confirmation screen class.
withOnLoadCode(\Closure $binder)