19 declare(strict_types=1);
    59     private \ILIAS\HTTP\Services 
$http;
    70     public \ILIAS\DI\RBACServices 
$rbac;
    85         $this->
ctrl = $DIC->ctrl();
    86         $this->
ctrl->saveParameter($this, [
'ref_id']);
    88         $this->httpRequest = $DIC->http()->request();
    89         $this->
http = $DIC->http();
    91         $this->uiFactory = $DIC->ui()->factory();
    92         $this->uiRenderer = $DIC->ui()->renderer();
    95         $this->ilObjDataCache = $DIC[
'ilObjDataCache'];
    97         $this->
ilHelp = $DIC[
'ilHelp'];
    98         $this->
rbac = $DIC->rbac();
    99         $this->factory = $DIC->ui()->factory();
   100         $this->renderer = $DIC->ui()->renderer();
   105         $this->tpl->addJavaScript(
'./Services/JavaScript/js/Basic.js');
   107         $this->
lng->loadLanguageModule(
'forum');
   108         $this->
lng->loadLanguageModule(
'content');
   116         $this->is_moderator = $this->
access->checkAccess(
'moderate_frm', 
'', 
$ref_id);
   118         $this->objCurrentTopic = 
new ilForumTopic($thr_pk, $this->is_moderator);
   119         $this->requestAction = (string) ($this->httpRequest->getQueryParams()[
'action'] ?? 
'');
   120         $cs = $DIC->contentStyle();
   121         $this->content_style_gui = $cs->gui();
   122         if (is_object($this->
object)) {
   123             $this->content_style_domain = $cs->domain()->styleForRefId($this->
object->getRefId());
   125         $this->in_page_editor_style_context = $this->
http->wrapper()->query()->has(
'page_editor_style');
   126         $this->
ctrl->saveParameterByClass(ilObjectContentStyleSettingsGUI::class, 
'page_editor_style');
   132         if (!is_array($forumValues)) {
   137         $threadId = $this->httpRequest->getQueryParams()[
'thr_pk'] ?? 0;
   138         if ((
int) $threadId > 0 && !isset($forumValues[(
int) $threadId])) {
   139             $forumValues[(
int) $threadId] = [];
   148         return $this->retrieveIntOrZeroFrom($this->
http->wrapper()->query(), 
'ref_id');
   153         return $this->retrieveIntOrZeroFrom($this->
http->wrapper()->query(), 
'thr_pk');
   158         return $this->retrieveIntOrZeroFrom($this->
http->wrapper()->query(), 
'draft_id');
   164             'frm_exp_' . $this->objCurrentTopic->getId(),
   174         array $subtree_nodes,
   175         array $pagedPostings,
   179         if ($firstForumPost->
getId() === $this->objCurrentPost->getId()) {
   183         if ($subtree_nodes !== [] && $this->objCurrentPost->getId() > 0) {
   184             $isCurrentPostingInPage = array_filter($pagedPostings, fn(
ilForumPost $posting): 
bool => (
   185                 $posting->
getId() === $this->objCurrentPost->getId()
   188             if ([] === $isCurrentPostingInPage) {
   189                 $pageOfCurrentPosting = 0;
   191                 foreach ($subtree_nodes as $node) {
   192                     if ($i > 0 && 0 === $i % $pageSize) {
   193                         ++$pageOfCurrentPosting;
   196                     if ($node->getId() === $this->objCurrentPost->getId()) {
   203                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
   204                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
   205                 $this->
ctrl->setParameter($this, 
'page', $pageOfCurrentPosting);
   206                 $this->
ctrl->setParameter(
   211                 $this->
ctrl->redirect($this, 
'viewThread', (
string) $this->objCurrentPost->getId());
   220             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   231             $this->tpl->addJavaScript(
'./Modules/Forum/js/autosave.js');
   232             $autosave_cmd = 
'autosaveDraftAsync';
   233             if ($this->objCurrentPost->getId() === 0 && $this->objCurrentPost->getThreadId() === 0) {
   234                 $autosave_cmd = 
'autosaveThreadDraftAsync';
   236             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
   237             $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
   238             $draft_id = max($draft_id, 0);
   239             $this->
ctrl->setParameter($this, 
'draft_id', $draft_id);
   241             $this->tpl->addOnLoadCode(
   242                 "il.Language.setLangVar('saving', " . json_encode($this->
lng->txt(
'saving'), JSON_THROW_ON_ERROR) . 
');'   245             $this->tpl->addOnLoadCode(
'il.ForumDraftsAutosave.init(' . json_encode([
   247                 'draft_id' => $draft_id,
   248                 'interval' => $interval * 1000,
   249                 'url' => $this->
ctrl->getFormAction($this, $autosave_cmd, 
'', 
true),
   251                     'form' => 
'#form_' . $form->
getId()
   253             ], JSON_THROW_ON_ERROR) . 
');');
   260             strtolower($this->
ctrl->getCmd()),
   261             array_map(
'strtolower', [
'createTopLevelPost', 
'saveTopLevelPost', 
'saveTopLevelDraft']),
   269             'enableForumNotification',
   270             'disableForumNotification',
   271             'toggleThreadNotification'   282         $next_class = $this->
ctrl->getNextClass($this);
   283         $cmd = $this->
ctrl->getCmd();
   289             'showThreadNotification',
   290             'performPostActivation',
   291             'askForPostActivation',
   292             'askForPostDeactivation',
   293             'toggleThreadNotification',
   294             'toggleThreadNotificationTab',
   299             'createTopLevelPost',
   302             'getQuotationHTMLAsynch',
   303             'autosaveDraftAsync',
   304             'autosaveThreadDraftAsync',
   308             'deliverDraftZipFile',
   311             'deleteThreadDrafts',
   313             'deletePostingDraft',
   316             'confirmDeleteThreadsObject'   319         if (!in_array($cmd, $exclude_cmds, 
true)) {
   323         if (!$this->creation_mode) {
   325             $pos_pk = $this->retrieveIntOrZeroFrom($this->
http->wrapper()->query(), 
'pos_pk');
   327                 $this->selected_post_storage->get($this->objCurrentTopic->getId()) > 0) {
   329                     $this->selected_post_storage->get($this->objCurrentTopic->getId()) ?? 0,
   332                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
   334                 $this->selected_post_storage->set($this->objCurrentTopic->getId(), 0);
   351                 ilLink::_getLink(
$ref_id, 
'frm'),
   356         switch (strtolower($next_class)) {
   357             case strtolower(ilForumPageGUI::class):
   358                 if (in_array(strtolower($cmd), array_map(
'strtolower', [
   359                     self::UI_CMD_COPAGE_DOWNLOAD_FILE,
   360                     self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN,
   361                     self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH,
   365                         $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   368                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   371                 $this->content_style_gui->addCss($this->tpl, $this->ref_id);
   372                 $this->tpl->setCurrentBlock(
'SyntaxStyle');
   374                 $this->tpl->parseCurrentBlock();
   386                     $this->content_style_domain
   389                 $pageContent = $forwarder->forward();
   390                 if ($pageContent !== 
'') {
   391                     $this->tpl->setContent($pageContent);
   395             case strtolower(ilLearningProgressGUI::class):
   397                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   400                 $this->tabs_gui->activateTab(
'learning_progress');
   402                 $usrId = $this->
user->getId();
   404                     isset($this->request->getQueryParams()[
'user_id']) &&
   405                     is_numeric($this->request->getQueryParams()[
'user_id'])
   407                     $usrId = (
int) $this->request->getQueryParams()[
'user_id'];
   412                     $this->
object->getRefId(),
   417             case strtolower(ilObjectContentStyleSettingsGUI::class):
   420                 if ($this->in_page_editor_style_context) {
   421                     $this->tabs_gui->setBackTarget(
   422                         $this->
lng->txt(
'back'),
   430                 $settings_gui = $this->content_style_gui
   431                     ->objectSettingsGUIForRefId(
   435                 $this->
ctrl->forwardCommand($settings_gui);
   438             case strtolower(ilForumSettingsGUI::class):
   440                 $this->
ctrl->forwardCommand($forum_settings_gui);
   443             case strtolower(ilRepositoryObjectSearchGUI::class):
   446                 $this->tabs_gui->activateTab(
'forums_threads');
   447                 $this->
ctrl->setReturn($this, 
'view');
   449                     $this->
object->getRefId(),
   453                 $this->
ctrl->forwardCommand($search_gui);
   456             case strtolower(ilPermissionGUI::class):
   458                 $this->
ctrl->forwardCommand($perm_gui);
   461             case strtolower(ilForumExportGUI::class):
   463                 $this->
ctrl->forwardCommand($fex_gui);
   464                 $this->
http->close();
   467             case strtolower(ilForumModeratorsGUI::class):
   469                 $this->
ctrl->forwardCommand($fm_gui);
   472             case strtolower(ilInfoScreenGUI::class):
   476             case strtolower(ilColumnGUI::class):
   480             case strtolower(ilPublicUserProfileGUI::class):
   481                 $user = $this->retrieveIntOrZeroFrom($this->
http->wrapper()->query(), 
'user');
   484                 $profile_gui->setAdditional($add);
   485                 $ret = $this->
ctrl->forwardCommand($profile_gui);
   486                 $this->tpl->setContent($ret);
   489             case strtolower(ilObjectCopyGUI::class):
   492                 $this->
ctrl->forwardCommand($cp);
   495             case strtolower(ilExportGUI::class):
   496                 $this->tabs_gui->activateTab(
'export');
   498                 $exp->addFormat(
'html');
   499                 $exp->addFormat(
'xml');
   500                 if ($cmd === 
'createExportFile') {
   501                     if ($this->
http->wrapper()->post()->has(
'format')) {
   502                         $format = $this->
http->wrapper()->post()->retrieve(
'format', $this->
refinery->kindlyTo()->string());
   503                         if ($format === 
'html') {
   505                             $fex_gui->exportHTML();
   509                 $this->
ctrl->forwardCommand($exp);
   512             case strtolower(ilRatingGUI::class):
   513                 if (!$this->objProperties->isIsThreadRatingEnabled() || $this->
user->isAnonymous()) {
   514                     $this->error->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
   517                 if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
   518                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   524                 $rating_gui->setObject(
   526                     $this->
object->getType(),
   527                     $this->objCurrentTopic->getId(),
   531                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
   532                 $this->
ctrl->forwardCommand($rating_gui);
   536                     $this->
object->getType(),
   537                     $this->objCurrentTopic->getId(),
   540                 $this->objCurrentTopic->setAverageRating($avg[
'avg']);
   541                 $this->objCurrentTopic->update();
   543                 $this->
ctrl->redirect($this, 
'showThreads');
   546             case strtolower(ilCommonActionDispatcherGUI::class):
   548                 $this->
ctrl->forwardCommand($gui);
   551             case strtolower(ilContainerNewsSettingsGUI::class):
   557                 $this->
lng->loadLanguageModule(
'cont');
   559                 $news_set_gui->setNewsBlockForced(
true);
   560                 $news_set_gui->setPublicNotification(
true);
   561                 $this->
ctrl->forwardCommand($news_set_gui);
   565                 if (in_array($cmd, [
'close', 
'reopen', 
'make_topics_non_sticky', 
'makesticky', 
'editThread', 
'move'])) {
   566                     $cmd = 
'performThreadsAction';
   569                     $notificationCommands = [
   570                         'enableAdminForceNoti',
   571                         'disableAdminForceNoti',
   572                         'enableHideUserToggleNoti',
   573                         'disableHideUserToggleNoti'   576                     if (!in_array($cmd, $notificationCommands, 
true)) {
   577                         $cmd = 
'performThreadsAction';
   579                 } elseif (($cmd === null || $cmd === 
'') && $this->
getTableCommands() === []) {
   580                     $cmd = 
'showThreads';
   589         if (!$this->in_page_editor_style_context &&
   590             $cmd !== 
'viewThreadObject' && $cmd !== 
'showUserObject' && !in_array(
   591                 strtolower($next_class),
   592                 array_map(
'strtolower', [ilForumPageGUI::class]),
   605         if ($this->
http->wrapper()->post()->has(
'selected_cmd')) {
   606             $tableCommands[] = $this->
http->wrapper()->post()->retrieve(
   608                 $this->
refinery->kindlyTo()->string()
   611         if ($this->
http->wrapper()->post()->has(
'selected_cmd2')) {
   612             $tableCommands[] = $this->
http->wrapper()->post()->retrieve(
   614                 $this->
refinery->kindlyTo()->string()
   618         return $tableCommands;
   623         $this->
ctrl->setCmd(
'showSummary');
   624         $this->
ctrl->setCmdClass(ilInfoScreenGUI::class);
   631         $this->forum_settings_gui->getCustomForm($a_form);
   636         $this->forum_settings_gui->getCustomValues($a_values);
   641         $this->forum_settings_gui->updateCustomValues($form);
   647         $this->
ctrl->setParameter($this, 
'thr_pk', $a_thread_id);
   648         $form->setFormAction($this->
ctrl->getFormAction($this, 
'updateThread'));
   651         $ti_prop->setRequired(
true);
   652         $ti_prop->setMaxLength(255);
   653         $ti_prop->setSize(50);
   654         $form->addItem($ti_prop);
   656         $form->addCommandButton(
'updateThread', $this->
lng->txt(
'save'));
   657         $form->addCommandButton(
'showThreads', $this->
lng->txt(
'cancel'));
   663         if (!$this->is_moderator) {
   664             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   667         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
   668             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   671         if ($this->objCurrentTopic->getId() === 0) {
   678         $title = $this->
getEditTitleModal($this->objCurrentTopic)->withRequest($this->
http->request())->getData();
   679         if (array_key_exists(0, $title)) {
   680             $new_subject = $title[0];
   681             if ($new_subject !== 
'') {
   682                 $this->objCurrentTopic->setSubject($new_subject);
   683                 $this->objCurrentTopic->updateThreadTitle();
   684                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'));
   693         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
   694             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   697         $this->
object->markAllThreadsRead($this->
user->getId());
   698         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_all_threads_marked_read'));
   710         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
   711             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   714         $cmd = $this->
ctrl->getCmd();
   715         $frm = $this->
object->Forum;
   716         $frm->setForumId($this->
object->getId());
   717         $frm->setForumRefId($this->
object->getRefId());
   718         $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', [
'integer'], [$frm->getForumId()]);
   720         $frm_object = $frm->getOneTopic();
   721         if ($frm_object->getTopPk() > 0) {
   722             $frm->setDbTable(
'frm_data');
   723             $frm->setMDB2WhereCondition(
'top_pk = %s ', [
'integer'], [$frm_object->getTopPk()]);
   724             $frm->updateVisits($frm_object->getTopPk());
   728                 $this->
object->getRefId(),
   729                 $this->
object->getId(),
   733             if ($cmd !== 
'showThreads') {
   734                 $cmd = 
'showThreads';
   737         $this->tpl->setPermanentLink($this->
object->getType(), $this->
object->getRefId());
   740         if (!$this->
hideToolbar() && $this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
   741             $btn = $this->uiFactory->button()
   743                                        $this->
lng->txt(
'forums_new_thread'),
   744                                        $this->
ctrl->getLinkTarget($this, 
'createThread')
   746             $this->
toolbar->addStickyItem($btn);
   753         if ($this->confirmation_gui_html === 
'' && !$this->
user->isAnonymous()) {
   755                 $this->
lng->txt(
'forums_mark_read'),
   756                 $this->
ctrl->getLinkTarget($this, 
'markAllRead')
   758             $this->
ctrl->clearParameters($this);
   761         if (!$this->
user->isAnonymous() && $this->
access->checkAccess(
'write', 
'', $this->ref_id)) {
   762             $this->
lng->loadLanguageModule(
'cntr');
   764                 $this->uiFactory->button()->standard(
   765                     $this->
lng->txt(
'cntr_text_media_editor'),
   766                     $this->
ctrl->getLinkTargetByClass(ilForumPageGUI::class, 
'edit')
   782         $this->renderThreadOverview($tbl, $frm, $frm_object);
   788         $data_objects = $tbl->
setMapper($frm)->fetchDataAnReturnObject();
   790         $sticky_threads = [];
   791         $regular_threads = [];
   793         if (count($data_objects) > 0) {
   794             foreach ($data_objects as $thread) {
   795                 if (array_key_exists(
'thread', $thread)) {
   797                     $current_thread = $thread[
'thread'];
   798                     $ref_id = $this->
object->getRefId();
   799                     $subject = $current_thread->getSubject();
   800                     if ($current_thread->isClosed()) {
   801                         $subject .= 
' (' . $this->
lng->txt(
'forums_closed') . 
')';
   807                     $list_item = $this->factory
   810                         ->withActions($actions)
   813                     if ($current_thread->isSticky()) {
   814                         $sticky_threads[] = $list_item;
   816                         $regular_threads[] = $list_item;
   822         $sticky_threads_item_group = null;
   823         if (count($sticky_threads) > 0) {
   824             $sticky_threads_item_group = $this->factory->item()->group(
   825                 count($regular_threads) > 0 ? $this->
lng->txt(
'top_thema') : 
'',
   830         $regular_threads_item_group = null;
   831         if (count($regular_threads) > 0) {
   832             $regular_threads_item_group = $this->factory->item()->group(
   833                 count($sticky_threads) > 0 ? $this->
lng->txt(
'thema') : 
'',
   838         $url = $this->
http->request()->getRequestTarget();
   841             $current_page = $this->
http->wrapper()->query()->retrieve(
   848         $view_controls[] = $this->factory
   854             ->withMaxPaginationButtons(5)
   855             ->withCurrentPage($current_page);
   857         $item_groups = array_filter([$sticky_threads_item_group, $regular_threads_item_group]);
   858         if ($item_groups === []) {
   859             $vc_container = $this->factory->panel()->listing()->standard(
   860                 $this->
lng->txt(
'thread_overview'),
   861                 [$this->factory->item()->group($this->
lng->txt(
'frm_no_threads'), [])]
   864             $vc_container = $this->factory->panel()->listing()->standard(
   865                 $this->
lng->txt(
'thread_overview'),
   867             )->withViewControls($view_controls);
   870         $default_html = $this->renderer->render($vc_container);
   871         $modals = $this->renderer->render($this->modal_collection);
   879             $this->content_style_domain
   884         $this->tpl->setContent($forwarder->forward() . $default_html . $modals);
   889         return $this->
http->wrapper()->query()->retrieve(
   892                 $this->refinery->kindlyTo()->int(),
   900         return $this->
http->wrapper()->query()->retrieve(
   903                 $this->refinery->kindlyTo()->int(),
   920         $sortation = ThreadSortation::tryFrom(
   923         if ($sortation === null) {
   924             $sortation = ThreadSortation::DEFAULT_SORTATION;
   934             $this->
ctrl->setParameter($this, 
'page', $offset);
   937         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
   938         $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
   939         $base_url = $this->
ctrl->getLinkTarget($this, 
'showThreads');
   941         $translationKeys = [];
   942         foreach (ThreadSortation::cases() as $sortation) {
   943             $this->
ctrl->setParameter($this, 
'thread_sortation', $sortation->value);
   944             $url = $this->
ctrl->getLinkTarget($this, 
'showThreads');
   946             $translationKeys[
$url] = $this->
lng->txt($sortation->languageId());
   948         $this->
ctrl->clearParameters($this);
   950         return $this->factory
   952             ->sortation($translationKeys)
   953             ->withTargetURL($base_url, 
'thread_sortation');
   962         $query = $this->
http->wrapper()->query()->has(
'thr_pk');
   963         $post = $this->
http->wrapper()->post()->has(
'thread_ids');
   965             $thread_ids = $this->
http->wrapper()->post()->retrieve(
   970             $thread_ids = $this->
http->wrapper()->query()->retrieve(
   984         $this->
ctrl->setParameter($this, 
'thr_pk', $forum_topic->
getId());
   986         $is_top_thread = $forum_topic->
isSticky();
   988         if ($unread_counter === 0) {
   991             $unread = 
' (' . $unread_counter . 
' ' . $this->
lng->txt(
'unread') . 
')';
  1002             $this->
lng->txt(
'forums_created_by') => $authorinfo->getAuthorName(),
  1003             $this->
lng->txt(
'forums_articles') => $forum_topic->
getNumPosts() . $unread,
  1004             $this->
lng->txt(
'forums_last_post') => $this->
object->Forum->convertDate($forum_topic->
getLastPost()->getCreateDate()),
  1005             $this->
lng->txt(
'visits') => $forum_topic->
getVisits(),
  1008         if ($is_top_thread === 
true) {
  1009             $is_top_thread = [$this->
lng->txt(
'relevance') => $this->
lng->txt(
'sticky')];
  1010             $properties = array_merge($properties, $is_top_thread);
  1013         $rating_property = [];
  1014         if ($this->objProperties->isIsThreadRatingEnabled()) {
  1018                 $this->
object->getType(),
  1019                 $forum_topic->
getId(),
  1022             $rating->setUserId($this->
user->getId());
  1023             $rating_property = [$this->
lng->txt(
'frm_rating') => $rating->getHTML()];
  1025         $this->
ctrl->setParameter($this, 
'thr_pk', null);
  1027         return array_merge($properties, $rating_property);
  1034         int $thread_id = null
  1036         $this->
ctrl->setParameter($this, 
'ref_id', $ref_id);
  1037         $this->
ctrl->setParameter($this, 
'thr_pk', $thread_id);
  1038         $this->
ctrl->setParameter($this, 
'page', 0);
  1039         $url = $this->
ctrl->getLinkTarget($this, $cmd);
  1040         $this->
ctrl->setParameter($this, 
'ref_id', null);
  1041         $this->
ctrl->setParameter($this, 
'thr_pk', null);
  1042         $this->
ctrl->setParameter($this, 
'page', null);
  1044         return $this->uiFactory->link()->standard($title, 
$url);
  1049         $actions = $this->uiFactory->dropdown()->standard([]);
  1050         if ($this->is_moderator) {
  1054             $this->modal_collection[] = $edit_title_modal;
  1055             $edit_title = $this->factory->button()->shy($this->
lng->txt(
'frm_edit_title'), 
'#')->withOnClick(
  1056                 $edit_title_modal->getShowSignal()
  1061                 $this->
lng->txt(
'move_thread_to_forum'),
  1063                 $forum_topic->
getId()
  1067                 $this->
lng->txt(
'merge_posts_into_thread'),
  1069                 $forum_topic->
getId()
  1073                 $this->
lng->txt(
'delete_thread'),
  1074                 'confirmDeleteThreads',
  1075                 $forum_topic->
getId()
  1077             $actions = $this->uiFactory->dropdown()->standard([
  1092         $topic_id = $this->
refinery->kindlyTo()->string()->transform($topic->
getId());
  1093         $this->
ctrl->setParameter($this, 
'thr_pk', (
string) $topic_id);
  1094         $target = $this->
ctrl->getLinkTargetByClass(
  1095             ilObjForumGUI::class,
  1098         $this->
ctrl->setParameter($this, 
'thread_id', null);
  1100         return $this->factory->modal()->roundtrip(
  1101             $this->
lng->txt(
'frm_edit_title'),
  1104                 $this->factory->input()->field()->text($this->
lng->txt(
'frm_edit_title'))->
withValue($topic->
getSubject()),
  1113             $this->
user->getId(),
  1116         if ($drafts !== []) {
  1120                 $this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId())
  1122             $draftsTable->setData($drafts);
  1124                 'tpl.forums_threads_liste.html',
  1129             $threadsTemplate->setVariable(
'THREADS_DRAFTS_TABLE', $draftsTable->getHTML());
  1131             $draft_modal = $this->factory->modal()->roundtrip(
  1132                 $this->
lng->txt(
'drafts'),
  1133                 [$this->factory->legacy($threadsTemplate->get())]
  1135             $this->modal_collection[] = $draft_modal;
  1136             $edit_title = $this->factory->button()->standard($this->
lng->txt(
'drafts'), 
'#')->withOnClick(
  1137                 $draft_modal->getShowSignal()
  1139             $this->
toolbar->addComponent($edit_title);
  1141             return $draft_modal;
  1149             $this->
lng->txt($forum_topic->
isSticky() ? 
'make_topics_non_sticky' : 
'make_topics_sticky'),
  1150             $forum_topic->
isSticky() ? 
'make_topics_non_sticky' : 
'makesticky',
  1151             $forum_topic->
getId()
  1159             $this->
lng->txt($forum_topic->
isClosed() ? 
'reopen_topics' : 
'close_topics'),
  1160             $forum_topic->
isClosed() ? 
'reopen' : 
'close',
  1161             $forum_topic->
getId()
  1170             $df = new \ILIAS\Data\Factory();
  1171             $list_item = $list_item->withColor($df->color(
'#B54F00'));
  1179         $this->content_style_gui->addCss($this->tpl, $this->ref_id);
  1180         $this->tpl->setCurrentBlock(
'SyntaxStyle');
  1182         $this->tpl->parseCurrentBlock();
  1187         $this->content_style_gui->redirectToObjectSettings();
  1199         $frm = $this->
object->Forum;
  1204         foreach ($drafts as $draft) {
  1207             ksort($filesOfDraft);
  1209             if ($action !== 
'showdraft' && $filesOfDraft !== []) {
  1210                 foreach ($filesOfDraft as $file) {
  1212                     $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  1213                     $this->
ctrl->setParameter($this, 
'file', $file[
'md5']);
  1214                     $tpl->
setVariable(
'HREF_DOWNLOAD', $this->
ctrl->getLinkTarget($this, 
'viewThread'));
  1216                     $this->
ctrl->setParameter($this, 
'file', 
'');
  1217                     $this->
ctrl->setParameter($this, 
'draft_id', 
'');
  1218                     $this->
ctrl->clearParameters($this);
  1223                 $tpl->
setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->
lng->txt(
'forums_attachments'));
  1226                     $this->uiRenderer->render(
  1227                         $this->uiFactory->symbol()->glyph()->attachment($this->
lng->txt(
'forums_download_attachment'))
  1230                 if (count($filesOfDraft) > 1) {
  1231                     $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  1232                     $download_zip_button = $this->uiFactory->button()
  1234                                                                $this->
lng->txt(
'download'),
  1235                                                                $this->
ctrl->getLinkTarget($this, 
'deliverDraftZipFile')
  1237                     $this->
ctrl->setParameter($this, 
'draft_id', 
'');
  1238                     $tpl->
setVariable(
'DOWNLOAD_ZIP', $this->uiRenderer->render($download_zip_button));
  1243             $page = $this->
http->wrapper()->query()->retrieve(
  1245                 $this->
refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->
refinery->always(0)])
  1257             $rowCol = 
'tblrowmarked';
  1259             $depth = $referencePosting->
getDepth() - 1;
  1265             $this->
ctrl->setParameter($this, 
'pos_pk', $referencePosting->
getId());
  1266             $this->
ctrl->setParameter($this, 
'thr_pk', $referencePosting->
getThreadId());
  1267             $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  1269             $backurl = urlencode($this->
ctrl->getLinkTarget($this, 
'viewThread', (
string) $referencePosting->
getId()));
  1271             $this->
ctrl->setParameter($this, 
'backurl', $backurl);
  1272             $this->
ctrl->setParameter($this, 
'thr_pk', $referencePosting->
getThreadId());
  1273             $this->
ctrl->setParameter($this, 
'user', $draft->getPostDisplayUserId());
  1276                 $draft->getPostAuthorId(),
  1277                 $draft->getPostDisplayUserId(),
  1278                 $draft->getPostUserAlias(),
  1281                     'href' => $this->
ctrl->getLinkTarget($this, 
'showUser')
  1285             $this->
ctrl->clearParameters($this);
  1287             if ($authorinfo->hasSuffix()) {
  1288                 $tpl->
setVariable(
'AUTHOR', $authorinfo->getSuffix());
  1289                 $tpl->
setVariable(
'USR_NAME', $draft->getPostUserAlias());
  1291                 $tpl->
setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
  1292                 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
  1293                     $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
  1296             $tpl->
setVariable(
'DRAFT_ANCHOR', 
'draft_' . $draft->getDraftId());
  1298             $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
  1305                 $draft->getPostAuthorId()
  1307                 if ($authorinfo->getAuthor()->getGender() === 
'f') {
  1309                 } elseif ($authorinfo->getAuthor()->getGender() === 
'm') {
  1311                 } elseif ($authorinfo->getAuthor()->getGender() === 
'n') {
  1316             if ($draft->getUpdateUserId() > 0) {
  1317                 $draft->setPostUpdate($draft->getPostUpdate());
  1319                 $this->
ctrl->setParameter($this, 
'backurl', $backurl);
  1320                 $this->
ctrl->setParameter($this, 
'thr_pk', $referencePosting->
getThreadId());
  1322                 $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  1325                     $draft->getPostAuthorId(),
  1327                     $draft->getPostDisplayUserId(),
  1328                     $draft->getPostUserAlias(),
  1330                     [
'href' => $this->
ctrl->getLinkTarget($this, 
'showUser')]
  1333                 $this->
ctrl->clearParameters($this);
  1337                     $this->
lng->txt(
'edited_on') . 
': ' . $frm->
convertDate($draft->getPostUpdate()) . 
' - ' . strtolower($this->
lng->txt(
'by'))
  1339                 $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
  1340                 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
  1341                     $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
  1345             $draft->setPostMessage($frm->
prepareText($draft->getPostMessage()));
  1347             $tpl->
setVariable(
'SUBJECT', $draft->getPostSubject());
  1350             $tpl->
setVariable(
'POST_DRAFT_TEXT', $this->
lng->txt(
'post_draft_info'));
  1352             if (!$referencePosting->
isCensored() || ($this->objCurrentPost->getId() === $referencePosting->
getId() && $action === 
'censor')) {
  1355                     $spanClass = 
'moderator';
  1358                 if ($draft->getPostMessage() === strip_tags($draft->getPostMessage())) {
  1360                     $draft->setPostMessage(nl2br($draft->getPostMessage()));
  1363                 if ($spanClass !== 
'') {
  1367                             $draft->getPostMessage(),
  1376             if ($action === 
'editdraft' && $draft->getDraftId() === $draft_id) {
  1379                 if (!$this->objCurrentTopic->isClosed() && in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
  1380                     $this->renderPostingForm($tpl, $frm, $referencePosting, $this->requestAction);
  1383                 $tpl->
setVariable(
'EDIT_DRAFT_ANCHOR', 
'draft_edit_' . $draft->getDraftId());
  1399         $frm = $this->
object->Forum;
  1404         ksort($filesOfPost);
  1405         if ($filesOfPost !== [] && ($action !== 
'showedit' || $node->
getId() !== $this->objCurrentPost->getId())) {
  1406             foreach ($filesOfPost as $file) {
  1408                 $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  1409                 $this->
ctrl->setParameter($this, 
'file', $file[
'md5']);
  1410                 $tpl->
setVariable(
'HREF_DOWNLOAD', $this->
ctrl->getLinkTarget($this, 
'viewThread'));
  1412                 $this->
ctrl->clearParameters($this);
  1416             $tpl->
setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->
lng->txt(
'forums_attachments'));
  1419                 $this->uiRenderer->render(
  1420                     $this->uiFactory->symbol()->glyph()->attachment($this->
lng->txt(
'forums_download_attachment'))
  1423             if (count($filesOfPost) > 1) {
  1424                 $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  1425                 $download_zip_button = $this->uiFactory->button()
  1427                                                            $this->
lng->txt(
'download'),
  1428                                                            $this->
ctrl->getLinkTarget($this, 
'deliverZipFile')
  1430                 $tpl->
setVariable(
'DOWNLOAD_ZIP', $this->uiRenderer->render($download_zip_button));
  1437         $tpl->
setVariable(
'TXT_PERMA_LINK', $this->
lng->txt(
'perma_link'));
  1441         if (($this->is_moderator || $node->
isOwner($this->user->getId())) && !$node->
isActivated() && !$this->objCurrentTopic->isClosed()) {
  1442             $rowCol = 
'ilPostingNeedsActivation';
  1443         } elseif ($this->objProperties->getMarkModeratorPosts()) {
  1446                 $rowCol = 
'ilModeratorPosting';
  1448                 $rowCol = 
'ilModeratorPosting';
  1454             $this->objCurrentPost->getId() !== $node->
getId()
  1458             $rowCol = 
'tblrowmarked';
  1462             if ($action !== 
'censor') {
  1463                 $tpl->
setVariable(
'TXT_CENSORSHIP_ADVICE', $this->
lng->txt(
'post_censored_comment_by_moderator'));
  1466             $rowCol = 
'tblrowmarked';
  1472             $tpl->
setVariable(
'POST_NOT_ACTIVATED_YET', $this->
lng->txt(
'frm_post_not_activated_yet'));
  1475         $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  1477         $backurl = urlencode($this->
ctrl->getLinkTarget($this, 
'viewThread', (
string) $node->
getId()));
  1478         $this->
ctrl->clearParameters($this);
  1480         $this->
ctrl->setParameter($this, 
'backurl', $backurl);
  1489                 'href' => $this->
ctrl->getLinkTarget($this, 
'showUser')
  1492         $this->
ctrl->clearParameters($this);
  1494         if ($authorinfo->hasSuffix()) {
  1495             if (!$authorinfo->isDeleted()) {
  1496                 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAlias());
  1498             $tpl->
setVariable(
'AUTHOR', $authorinfo->getSuffix());
  1500             if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
  1501                 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
  1503             $tpl->
setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
  1506         $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
  1512         if ($isModerator && $authorinfo->getAuthor()->getId()) {
  1513             $authorRole = $this->
lng->txt(
'frm_moderator_n');
  1514             if (is_string($authorinfo->getAuthor()->getGender()) && $authorinfo->getAuthor()->getGender() !== 
'') {
  1515                 $authorRole = $this->
lng->txt(
'frm_moderator_' . $authorinfo->getAuthor()->getGender());
  1523             $this->
ctrl->setParameter($this, 
'backurl', $backurl);
  1536                     'href' => $this->
ctrl->getLinkTarget($this, 
'showUser')
  1539             $this->
ctrl->clearParameters($this);
  1545             $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
  1546             if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
  1547                 $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
  1552             && $node->
getId() !== $this->selected_post_storage->get($node->
getThreadId())) {
  1553             $target = $this->uiFactory->symbol()->icon()->custom(
  1555                 $this->
lng->txt(
'target_select')
  1558             $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  1563                 $this->uiRenderer->render(
  1564                     $this->uiFactory->link()->bulky(
  1566                         $this->
lng->txt(
'select'),
  1567                         new \ILIAS\Data\URI(
  1568                             ILIAS_HTTP_PATH . 
'/' . $this->
ctrl->getLinkTarget($this, 
'selectPost', (
string) $node->
getId())
  1580             $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  1582             $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  1583             $this->
ctrl->setParameter(
  1588             $this->
ctrl->setParameter($this, 
'viewmode', $this->selectedSorting);
  1589             $mark_post_target = $this->
ctrl->getLinkTarget($this, 
'markPostRead', (
string) $node->
getId());
  1593                 '<a href="' . $mark_post_target . 
'"><b>' . $node->
getSubject() . 
'</b></a>'  1599         if (!$node->
isCensored() || ($this->objCurrentPost->getId() === $node->
getId() && $action === 
'censor')) {
  1602                 $spanClass = 
'moderator';
  1611             if ($spanClass !== 
'') {
  1614                     '<span class="' . $spanClass . 
'">' .
  1633         $thr_pk = (
int) $this->httpRequest->getQueryParams()[
'thr_pk'];
  1634         $pos_pk = (
int) $this->httpRequest->getQueryParams()[
'pos_pk'];
  1636         $this->selected_post_storage->set(
  1649         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'frm_added'), 
true);
  1650         $this->
ctrl->setParameter($this, 
'ref_id', $new_object->
getRefId());
  1651         $this->
ctrl->redirect($this, 
'createThread');
  1656         if ($this->in_page_editor_style_context) {
  1660         $this->
ilHelp->setScreenIdComponent(
'frm');
  1662         $this->
ctrl->setParameter($this, 
'ref_id', $this->ref_id);
  1669             'enableForumNotification',
  1670             'disableForumNotification',
  1672             'performMoveThreads',
  1673             'cancelMoveThreads',
  1674             'performThreadsAction',
  1678             'confirmDeleteThreads',
  1681             'performMergeThreads'  1684         $force_active = 
false;
  1685         if (in_array($this->
ctrl->getCmd(), $active, 
true)) {
  1686             $force_active = 
true;
  1689         if ($this->
access->checkAccess(
  1694             $this->tabs_gui->addTarget(
  1695                 self::UI_TAB_ID_THREADS,
  1696                 $this->
ctrl->getLinkTarget($this, 
'showThreads'),
  1697                 $this->
ctrl->getCmd(),
  1704         if ($this->
access->checkAccess(
'visible', 
'', $this->ref_id) || $this->
access->checkAccess(
  1709             $cmdClass = $this->
http->wrapper()->query()->retrieve(
  1711                 $this->
refinery->byTrying([$this->refinery->kindlyTo()->string(), $this->
refinery->always(
'')])
  1714             $force_active = $this->
ctrl->getNextClass() === 
'ilinfoscreengui' || strtolower($cmdClass) === 
'ilnotegui';
  1715             $this->tabs_gui->addTarget(
  1716                 self::UI_TAB_ID_INFO,
  1717                 $this->
ctrl->getLinkTargetByClass([__CLASS__, ilInfoScreenGUI::class], 
'showSummary'),
  1718                 [
'showSummary', 
'infoScreen'],
  1725         if ($this->
access->checkAccess(
'write', 
'', $this->ref_id)) {
  1726             $force_active = $this->
ctrl->getCmd() === 
'edit';
  1727             $this->tabs_gui->addTarget(
  1728                 self::UI_TAB_ID_SETTINGS,
  1729                 $this->
ctrl->getLinkTarget($this, 
'edit'),
  1737         if ($this->
access->checkAccess(
'write', 
'', $this->ref_id)) {
  1738             $this->tabs_gui->addTarget(
  1739                 self::UI_TAB_ID_MODERATORS,
  1740                 $this->
ctrl->getLinkTargetByClass(ilForumModeratorsGUI::class, 
'showModerators'),
  1747             $this->tabs_gui->addTab(
  1748                 'learning_progress',
  1749                 $this->
lng->txt(
'learning_progress'),
  1750                 $this->
ctrl->getLinkTargetByClass(ilLearningProgressGUI::class)
  1754         if ($this->
settings->get(
'enable_fora_statistics', 
'0')) {
  1755             $hasStatisticsAccess = $this->
access->checkAccess(
'write', 
'', $this->ref_id);
  1756             if (!$hasStatisticsAccess) {
  1757                 $hasStatisticsAccess = (
  1758                     $this->objProperties->isStatisticEnabled() &&
  1759                     $this->
access->checkAccess(
'read', 
'', $this->ref_id)
  1763             if ($hasStatisticsAccess) {
  1764                 $force_active = $this->
ctrl->getCmd() === 
'showStatistics';
  1765                 $this->tabs_gui->addTarget(
  1766                     self::UI_TAB_ID_STATS,
  1767                     $this->
ctrl->getLinkTarget($this, 
'showStatistics'),
  1776         if ($this->
access->checkAccess(
'write', 
'', $this->object->getRefId())) {
  1777             $this->tabs_gui->addTarget(
  1778                 self::UI_TAB_ID_EXPORT,
  1779                 $this->
ctrl->getLinkTargetByClass(ilExportGUI::class, 
''),
  1785         if ($this->
access->checkAccess(
'edit_permission', 
'', $this->ref_id)) {
  1786             $this->tabs_gui->addTarget(
  1787                 self::UI_TAB_ID_PERMISSIONS,
  1788                 $this->
ctrl->getLinkTargetByClass([$this::class, ilPermissionGUI::class], 
'perm'),
  1789                 [
'perm', 
'info', 
'owner'],
  1797         if (!$this->
settings->get(
'enable_fora_statistics', 
'0')) {
  1798             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  1801         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  1802             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  1805         if (!$this->objProperties->isStatisticEnabled()) {
  1806             if ($this->
access->checkAccess(
'write', 
'', $this->object->getRefId())) {
  1807                 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'frm_statistics_disabled_for_participants'));
  1809                 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  1813         $this->
object->Forum->setForumId($this->
object->getId());
  1821             $this->
access->checkRbacOrPositionPermissionAccess(
  1822                 'read_learning_progress',
  1823                 'read_learning_progress',
  1824                 $this->object->getRefId()
  1827         $tbl->
setId(
'il_frm_statistic_table_' . $this->
object->getRefId());
  1829             $this->
lng->txt(
'statistic'),
  1830             'standard/icon_usr.svg',
  1831             $this->
lng->txt(
'obj_' . $this->
object->getType())
  1834         $data = $this->
object->Forum->getUserStatistics($this->objProperties->isPostActivationEnabled());
  1837         foreach (
$data as $row) {
  1838             $result[$counter][
'usr_id'] = $row[
'usr_id'];
  1839             $result[$counter][
'ranking'] = $row[
'num_postings'];
  1840             $result[$counter][
'login'] = $row[
'login'];
  1841             $result[$counter][
'lastname'] = $row[
'lastname'];
  1842             $result[$counter][
'firstname'] = $row[
'firstname'];
  1848         $this->tpl->setContent($tbl->
getHTML());
  1851     public static function _goto($a_target, $a_thread = 0, $a_posting = 0): void
  1854         $main_tpl = $DIC->ui()->mainTemplate();
  1856         $ilAccess = $DIC->access();
  1857         $lng = $DIC->language();
  1860         $a_target = is_numeric($a_target) ? (
int) $a_target : 0;
  1861         $a_thread = is_numeric($a_thread) ? (
int) $a_thread : 0;
  1862         if ($ilAccess->checkAccess(
'read', 
'', $a_target)) {
  1863             if ($a_thread !== 0) {
  1865                 if ($objTopic->getFrmObjId() &&
  1868                     foreach ($ref_ids as 
$ref_id) {
  1869                         if ($ilAccess->checkAccess(
'read', 
'', $ref_id)) {
  1875                     if (isset($new_ref_id) && $new_ref_id !== $a_target) {
  1876                         $DIC->ctrl()->redirectToURL(
  1877                             ILIAS_HTTP_PATH . 
'/goto.php?target=frm_' . $new_ref_id . 
'_' . $a_thread . 
'_' . $a_posting
  1882                 $DIC->ctrl()->setParameterByClass(__CLASS__, 
'ref_id', (
string) ((
int) $a_target));
  1883                 if (is_numeric($a_thread)) {
  1884                     $DIC->ctrl()->setParameterByClass(__CLASS__, 
'thr_pk', (
string) ((
int) $a_thread));
  1886                 if (is_numeric($a_posting)) {
  1887                     $DIC->ctrl()->setParameterByClass(__CLASS__, 
'pos_pk', (
string) ((
int) $a_posting));
  1889                 $DIC->ctrl()->redirectByClass(
  1890                     [ilRepositoryGUI::class, self::class],
  1892                     is_numeric($a_posting) ? (
string) ((
int) $a_posting) : 
''  1895                 $DIC->ctrl()->setParameterByClass(self::class, 
'ref_id', $a_target);
  1896                 $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, self::class,], 
'');
  1897                 $DIC->http()->close();
  1899         } elseif ($ilAccess->checkAccess(
'visible', 
'', $a_target)) {
  1900             $DIC->ctrl()->setParameterByClass(ilInfoScreenGUI::class, 
'ref_id', $a_target);
  1901             $DIC->ctrl()->redirectByClass(
  1903                     ilRepositoryGUI::class,
  1905                     ilInfoScreenGUI::class
  1910             $main_tpl->setOnScreenMessage(
'info', sprintf(
  1911                 $lng->
txt(
'msg_no_perm_read_item'),
  1914             $DIC->http()->close();
  1923         if ($threadIds === []) {
  1924             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_at_least_one_thread'), 
true);
  1925             $this->
ctrl->redirect($this, 
'showThreads');
  1928         if (!$this->is_moderator) {
  1929             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  1932         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  1933             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  1937         $this->objProperties->setObjId($forumObj->getId());
  1941         $success_message = 
'forums_thread_deleted';
  1942         if (count($threadIds) > 1) {
  1943             $success_message = 
'forums_threads_deleted';
  1947         array_walk($threadIds, 
function (
int $threadId) use (&$threads): 
void {
  1951             $threads[] = $thread;
  1956         foreach ($threads as $thread) {
  1958             if (isset($first_node[
'pos_pk']) && (
int) $first_node[
'pos_pk']) {
  1959                 $frm->
deletePost((
int) $first_node[
'pos_pk']);
  1960                 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($success_message), 
true);
  1963         $this->
ctrl->redirect($this, 
'showThreads');
  1966     public function confirmDeleteThreadsObject(): 
void  1969         if ($thread_ids === []) {
  1970             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_at_least_one_thread'));
  1971             $this->
ctrl->redirect($this, 
'showThreads');
  1974         if (!$this->is_moderator) {
  1975             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  1978         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  1979             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  1984         array_walk($thread_ids, 
function (
int $threadId) use (&$threads): 
void {
  1988             $threads[] = $thread;
  1993         $c_gui->setFormAction($this->
ctrl->getFormAction($this, 
'performDeleteThreads'));
  1994         $c_gui->setHeaderText($this->
lng->txt(
'frm_sure_delete_threads'));
  1995         $c_gui->setCancel($this->
lng->txt(
'cancel'), 
'showThreads');
  1996         $c_gui->setConfirm($this->
lng->txt(
'confirm'), 
'performDeleteThreads');
  1998         foreach ($threads as $thread) {
  1999             $c_gui->addItem(
'thread_ids[]', (
string) $thread->getId(), $thread->getSubject());
  2002         $this->confirmation_gui_html = $c_gui->getHTML();
  2005         $this->tpl->setContent($c_gui->getHTML());
  2010         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  2011             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2014         $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()[
'draft_ids'] ?? []));
  2015         if ($draftIds === []) {
  2016             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_at_least_one_thread'));
  2022         $confirmation->setFormAction($this->
ctrl->getFormAction($this, 
'deleteThreadDrafts'));
  2023         $confirmation->setHeaderText($this->
lng->txt(
'sure_delete_drafts'));
  2024         $confirmation->setCancel($this->
lng->txt(
'cancel'), 
'showThreads');
  2025         $confirmation->setConfirm($this->
lng->txt(
'confirm'), 
'deleteThreadDrafts');
  2027         foreach ($draftIds as $draftId) {
  2028             if (array_key_exists($draftId, $instances)) {
  2029                 $confirmation->addItem(
'draft_ids[]', (
string) $draftId, $instances[$draftId]->getPostSubject());
  2033         $this->tpl->setContent($confirmation->getHTML());
  2036     public function prepareThreadScreen(
ilObjForum $a_forum_obj): 
void  2038         $this->
ilHelp->setScreenIdComponent(
'frm');
  2040         $this->tpl->loadStandardTemplate();
  2044         $this->tabs_gui->setBackTarget(
  2045             $this->
lng->txt(
'frm_all_threads'),
  2046             $this->
ctrl->getLinkTarget(
  2053         $frm = $a_forum_obj->Forum;
  2059         if (!$this->is_moderator) {
  2060             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2063         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  2064             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2069         $this->objCurrentPost->activatePost();
  2070         $GLOBALS[
'ilAppEventHandler']->raise(
  2074                 'object' => $this->
object,
  2075                 'ref_id' => $this->
object->getRefId(),
  2079         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_post_was_activated'), 
true);
  2087             !$this->
user->isAnonymous() &&
  2088             !$this->objCurrentTopic->isClosed() && (
  2089                 $this->is_moderator ||
  2090                 ($this->objCurrentPost->isOwner($this->
user->getId()) && !$this->objCurrentPost->hasReplies())
  2096             $forumObj = $oForumObjects[
'forumObj'];
  2101             $dead_thr = $frm->
deletePost($this->objCurrentPost->getId());
  2104             if ($dead_thr === $this->objCurrentTopic->getId()) {
  2107                 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_post_deleted'), 
true);
  2108                 if ($topicData->getTopNumThreads() > 0) {
  2109                     $this->
ctrl->redirect($this, 
'showThreads');
  2111                     $this->
ctrl->redirect($this, 
'createThread');
  2114             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_post_deleted'), 
true);
  2115             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  2116             $this->
ctrl->redirect($this, 
'viewThread');
  2119         $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2140         foreach ($this->modalActionsContainer as $modal) {
  2141             $modalString .= $this->uiRenderer->render($modal);
  2144         return $modalString;
  2150         if ($this->is_moderator && !$this->objCurrentTopic->isClosed()) {
  2151             if ($this->
http->wrapper()->post()->has(
'formData')) {
  2152                 $formData = $this->
http->wrapper()->post()->retrieve(
  2159             if (
$message === 
'' && $this->
http->wrapper()->post()->has(
'cens_message')) {
  2160                 $cens_message = $this->
http->wrapper()->post()->retrieve(
  2162                     $this->
refinery->kindlyTo()->string()
  2169             $frm = $oForumObjects[
'frm'];
  2173                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'frm_censorship_revoked'));
  2176                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'frm_censorship_applied'));
  2183         $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2188         if (!$this->is_moderator) {
  2189             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2192         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  2193             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2203         $this->display_confirm_post_activation = $status;
  2213         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  2214             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2219         if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
  2220             $this->objCurrentTopic->disableNotification($this->
user->getId());
  2221             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_notification_disabled'), 
true);
  2223             $this->objCurrentTopic->enableNotification($this->
user->getId());
  2224             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_notification_enabled'), 
true);
  2227         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  2228         $this->
ctrl->redirect($this, 
'viewThread');
  2233         if (!$this->is_moderator) {
  2234             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2237         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  2238             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2243         if ($this->objCurrentTopic->isSticky()) {
  2244             $this->objCurrentTopic->unmakeSticky();
  2246             $this->objCurrentTopic->makeSticky();
  2254         $draft_id = $this->
http->wrapper()->post()->retrieve(
  2256             $this->
refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->
refinery->always(0)])
  2259         $this->requestAction = 
'';
  2260         if ($draft_id > 0) {
  2262             $draft->deleteDraftsByDraftIds([$draft_id]);
  2272         $this->requestAction = 
'';
  2275             $history_obj->getFirstAutosaveByDraftId($draft_id);
  2277             $draft->setPostSubject($history_obj->getPostSubject());
  2278             $draft->setPostMessage($history_obj->getPostMessage());
  2281                 $history_obj->getPostMessage(),
  2283                 $history_obj->getHistoryId(),
  2285                 $draft->getDraftId()
  2288             $draft->updateDraft();
  2290             $history_obj->deleteHistoryByDraftIds([$draft->getDraftId()]);
  2292         $this->
ctrl->clearParameters($this);
  2299         $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  2301         $this->
ctrl->setParameter(
  2306         $form->setFormAction($this->
ctrl->getFormAction($this, 
'performPostActivation'));
  2307         $this->
ctrl->clearParameters($this);
  2308         $form->setId(
'frm_activate_post_' . $node->
getId());
  2309         $form_id = $form->getId();
  2310         $message = $this->uiFactory->messageBox()->confirmation($this->
lng->txt(
'activate_post_txt'));
  2311         $submitBtn = $this->uiFactory->button()->primary(
  2312             $this->
lng->txt(
'activate_only_current'),
  2315             static function (
string $id) use ($form_id): 
string {
  2316                 return "$('#$id').click(function() { $('#form_$form_id').submit(); return false; });";
  2319         $modal = $this->uiFactory->modal()->roundtrip(
  2320             $this->
lng->txt(
'activate_only_current'),
  2321             [$this->uiFactory->legacy($form->getHTML()), 
$message]
  2322         )->withActionButtons([$submitBtn]);
  2323         $action_button = $this->uiFactory->button()->standard($this->
lng->txt(
'activate_post'), 
'#')->withOnClick(
  2324             $modal->getShowSignal()
  2326         $this->modalActionsContainer[] = $modal;
  2327         $this->
ctrl->clearParameters($this);
  2329         return $action_button;
  2332     public function getCensorshipFormHTML(): 
string  2335         $frm = $this->
object->Forum;
  2336         $form_tpl = 
new ilTemplate(
'tpl.frm_censorship_post_form.html', 
true, 
true, 
'Modules/Forum');
  2338         $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
  2339         $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
  2340         $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  2341         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  2342         $this->
ctrl->setParameter(
  2347         $form_tpl->setVariable(
'FORM_ACTION', $this->
ctrl->getFormAction($this, 
'viewThread'));
  2348         $this->
ctrl->clearParameters($this);
  2349         $form_tpl->setVariable(
'TXT_CENS_MESSAGE', $this->
lng->txt(
'forums_the_post'));
  2350         $form_tpl->setVariable(
'TXT_CENS_COMMENT', $this->
lng->txt(
'forums_censor_comment') . 
':');
  2351         $form_tpl->setVariable(
'CENS_MESSAGE', $frm->
prepareText((
string) $this->objCurrentPost->getCensorshipComment(), 2));
  2353         if ($this->objCurrentPost->isCensored()) {
  2354             $form_tpl->setVariable(
'TXT_CENS', $this->
lng->txt(
'forums_info_censor2_post'));
  2355             $form_tpl->setVariable(
'YES_BUTTON', $this->
lng->txt(
'confirm'));
  2356             $form_tpl->setVariable(
'NO_BUTTON', $this->
lng->txt(
'cancel'));
  2357             $form_tpl->setVariable(
'CMD_REVOKE_CENSORSHIP', 
'revokeCensorship');
  2358             $form_tpl->setVariable(
'CMD_CANCEL_REVOKE_CENSORSHIP', 
'viewThread');
  2360             $form_tpl->setVariable(
'TXT_CENS', $this->
lng->txt(
'forums_info_censor_post'));
  2361             $form_tpl->setVariable(
'CANCEL_BUTTON', $this->
lng->txt(
'cancel'));
  2362             $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->
lng->txt(
'confirm'));
  2363             $form_tpl->setVariable(
'CMD_ADD_CENSORSHIP', 
'addCensorship');
  2364             $form_tpl->setVariable(
'CMD_CANCEL_ADD_CENSORSHIP', 
'viewThread');
  2367         return $form_tpl->get();
  2372         $isReply = in_array($this->requestAction, [
'showreply', 
'ready_showreply']);
  2373         $isDraft = in_array($this->requestAction, [
'publishDraft', 
'editdraft']);
  2379         $frm = $oForumObjects[
'frm'];
  2380         $oFDForum = $oForumObjects[
'file_obj'];
  2383         $this->replyEditForm->setId(
'id_showreply');
  2384         $this->replyEditForm->setTableWidth(
'100%');
  2385         $cancel_cmd = 
'cancelPost';
  2386         if (in_array($this->requestAction, [
'showreply', 
'ready_showreply'])) {
  2387             $this->
ctrl->setParameter($this, 
'action', 
'ready_showreply');
  2388         } elseif (in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
  2389             $this->
ctrl->setParameter($this, 
'action', $this->requestAction);
  2390             $this->
ctrl->setParameter($this, 
'draft_id', $draft_id);
  2392             $this->
ctrl->setParameter($this, 
'action', 
'ready_showedit');
  2395         $this->
ctrl->setParameter($this, 
'page', (
int) ($this->httpRequest->getQueryParams()[
'page'] ?? 0));
  2396         $this->
ctrl->setParameter(
  2401         $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  2402         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  2404             $this->replyEditForm->setFormAction(
  2405                 $this->
ctrl->getFormAction($this, 
'saveTopLevelPost', 
'frm_page_bottom')
  2407         } elseif (in_array($this->requestAction, [
'publishDraft', 
'editdraft'])) {
  2408             $this->replyEditForm->setFormAction(
  2409                 $this->
ctrl->getFormAction($this, 
'publishDraft', (
string) $this->objCurrentPost->getId())
  2412             $this->replyEditForm->setFormAction(
  2413                 $this->
ctrl->getFormAction($this, 
'savePost', (
string) $this->objCurrentPost->getId())
  2416         $this->
ctrl->clearParameters($this);
  2419             $this->replyEditForm->setTitle($this->
lng->txt(
'forums_your_reply'));
  2420         } elseif ($isDraft) {
  2421             $this->replyEditForm->setTitle($this->
lng->txt(
'forums_edit_draft'));
  2423             $this->replyEditForm->setTitle($this->
lng->txt(
'forums_edit_post'));
  2428             in_array($this->requestAction, [
'showreply', 
'ready_showreply', 
'editdraft'])
  2430             $oAnonymousNameGUI = 
new ilTextInputGUI($this->
lng->txt(
'forums_your_name'), 
'alias');
  2431             $oAnonymousNameGUI->setMaxLength(64);
  2432             $oAnonymousNameGUI->setInfo(sprintf($this->
lng->txt(
'forums_use_alias'), $this->
lng->txt(
'forums_anonymous')));
  2434             $this->replyEditForm->addItem($oAnonymousNameGUI);
  2437         $oSubjectGUI = 
new ilTextInputGUI($this->
lng->txt(
'forums_subject'), 
'subject');
  2438         $oSubjectGUI->setMaxLength(255);
  2439         $oSubjectGUI->setRequired(
true);
  2441         if ($this->objProperties->getSubjectSetting() === 
'empty_subject') {
  2442             $oSubjectGUI->setInfo($this->
lng->txt(
'enter_new_subject'));
  2445         $this->replyEditForm->addItem($oSubjectGUI);
  2448             $isReply ? $this->
lng->txt(
'forums_your_reply') : $this->
lng->txt(
'forums_edit_post'),
  2452         $oPostGUI->setRows(15);
  2453         $oPostGUI->setUseRte(
true);
  2454         $oPostGUI->addPlugin(
'latex');
  2455         $oPostGUI->addButton(
'latex');
  2456         $oPostGUI->addButton(
'pastelatex');
  2460                 ($isReply && $this->objCurrentPost->getDepth() >= 2) ||
  2461                 (!$isDraft && !$isReply && $this->objCurrentPost->getDepth() > 2) ||
  2462                 ($isDraft && $this->objCurrentPost->getDepth() >= 2)
  2465         if ($quotingAllowed) {
  2466             $oPostGUI->addPlugin(
'ilfrmquote');
  2467             $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
  2470         $oPostGUI->removePlugin(
'advlink');
  2471         $oPostGUI->setRTERootBlockElement(
'');
  2472         $oPostGUI->usePurifier(
true);
  2473         $oPostGUI->disableButtons([
  2490         if (in_array($this->requestAction, [
'showreply', 
'ready_showreply', 
'showdraft', 
'editdraft'])) {
  2491             $oPostGUI->setRTESupport(
  2492                 $this->
user->getId(),
  2495                 'tpl.tinymce_frm_post.js',
  2500             $oPostGUI->setRTESupport(
  2501                 $this->objCurrentPost->getId(),
  2504                 'tpl.tinymce_frm_post.js',
  2512         $this->replyEditForm->addItem($oPostGUI);
  2515         if (!$this->
user->isAnonymous() &&
  2516             !$this->objProperties->isAnonymized() &&
  2517             $this->
rbac->system()->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
  2520             $oNotificationGUI->setInfo($this->
lng->txt(
'forum_notify_me'));
  2521             $this->replyEditForm->addItem($oNotificationGUI);
  2524         if ($this->objProperties->isFileUploadAllowed()) {
  2527             $this->replyEditForm->addItem($oFileUploadGUI);
  2530         $attachments_of_node = $oFDForum->getFilesOfPost();
  2531         if (count($attachments_of_node) && in_array($this->requestAction, [
'showedit', 
'ready_showedit'])) {
  2533             foreach ($oFDForum->getFilesOfPost() as $file) {
  2536             $this->replyEditForm->addItem($oExistingAttachmentsGUI);
  2540             if (in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
  2542                 $draftInfoGUI->setValue(sprintf(
  2543                     $this->
lng->txt(
'autosave_draft_info'),
  2546                 $this->replyEditForm->addItem($draftInfoGUI);
  2547             } elseif (!in_array($this->requestAction, [
'showedit', 
'ready_showedit'])) {
  2549                 $draftInfoGUI->setValue(sprintf(
  2550                     $this->
lng->txt(
'autosave_post_draft_info'),
  2553                 $this->replyEditForm->addItem($draftInfoGUI);
  2557         $selected_draft_id = $draft_id;
  2559             $this->
user->getId(),
  2560             $this->objCurrentPost->getId(),
  2563         if ($draftObj->getDraftId() > 0) {
  2567             if ($files_of_draft !== []) {
  2569                     $this->
lng->txt(
'forums_delete_file'),
  2572                 foreach ($files_of_draft as $file) {
  2575                 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
  2580             $this->replyEditForm->addCommandButton(
'saveTopLevelPost', $this->
lng->txt(
'create'));
  2582             $this->replyEditForm->addCommandButton(
'publishDraft', $this->
lng->txt(
'publish'));
  2584             $this->replyEditForm->addCommandButton(
'savePost', $this->
lng->txt(
'save'));
  2589         $hidden_draft_id->setValue((
string) $auto_save_draft_id);
  2590         $this->replyEditForm->addItem($hidden_draft_id);
  2592         if (in_array($this->requestAction, [
'showreply', 
'ready_showreply', 
'editdraft'])) {
  2594             $show_rte = $this->
http->wrapper()->post()->retrieve(
  2596                 $this->
refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->
refinery->always(0)])
  2605                 $this->replyEditForm->addCommandButton(
'quotePost', $this->
lng->txt(
'forum_add_quote'));
  2609                 !$this->
user->isAnonymous() &&
  2610                 in_array($this->requestAction, [
'editdraft', 
'showreply', 
'ready_showreply']) &&
  2617                 if ($this->requestAction === 
'editdraft') {
  2618                     $this->replyEditForm->addCommandButton(
'updateDraft', $this->
lng->txt(
'save_message'));
  2620                     $this->replyEditForm->addCommandButton(
'saveTopLevelDraft', $this->
lng->txt(
'save_message'));
  2622                     $this->replyEditForm->addCommandButton(
'saveAsDraft', $this->
lng->txt(
'save_message'));
  2625                 $cancel_cmd = 
'cancelDraft';
  2628         $this->replyEditForm->addCommandButton($cancel_cmd, $this->
lng->txt(
'cancel'));
  2633         if (null === $this->replyEditForm) {
  2645         if ($draft_id > 0 && !$this->
user->isAnonymous()
  2648                 $this->
user->getId(),
  2649                 $this->objCurrentPost->getId(),
  2655             $this->
ctrl->setParameter($this, 
'action', 
'editdraft');
  2656             $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  2657             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  2658             $this->
ctrl->setParameter($this, 
'draft_id', $draft_obj->getDraftId());
  2659             $this->
ctrl->setParameter($this, 
'page', 0);
  2660             $this->
ctrl->setParameter(
  2665             $this->
ctrl->redirect($this, 
'editDraft');
  2679         if ($draft_id > 0) {
  2686         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  2687             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2690         if (!$this->
access->checkAccess(
'add_reply', 
'', $this->object->getRefId())) {
  2691             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2694         if ($this->objCurrentTopic->getId() === 0) {
  2695             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_deleted'), 
true);
  2696             $this->
ctrl->redirect($this);
  2699         if ($this->objCurrentTopic->isClosed()) {
  2700             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_closed'), 
true);
  2701             $this->
ctrl->redirect($this);
  2704         if ($this->objCurrentPost->getId() === 0) {
  2705             $this->requestAction = 
'';
  2706             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_parent_deleted'));
  2711         $post_id = $this->objCurrentPost->getId();
  2716         if ($use_replyform) {
  2718             if (!$oReplyEditForm->checkInput()) {
  2719                 $oReplyEditForm->setValuesByPost();
  2723             $post_subject = $oReplyEditForm->getInput(
'subject');
  2724             $post_message = $oReplyEditForm->getInput(
'message');
  2727             $post_subject = $draft_obj->getPostSubject();
  2728             $post_message = $draft_obj->getPostMessage();
  2732         if ($draft_obj->getDraftId() > 0) {
  2734             $frm = $oForumObjects[
'frm'];
  2739             $send_activation_mail = 
false;
  2741             if ($this->objProperties->isPostActivationEnabled()) {
  2742                 if (!$this->is_moderator) {
  2744                     $send_activation_mail = 
true;
  2745                 } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
  2750             $newPost = $frm->generatePost(
  2751                 $draft_obj->getForumId(),
  2752                 $draft_obj->getThreadId(),
  2753                 $this->
user->getId(),
  2754                 $draft_obj->getPostDisplayUserId(),
  2756                 $draft_obj->getPostId(),
  2757                 $draft_obj->isNotificationEnabled(),
  2759                 $draft_obj->getPostUserAlias(),
  2762                 $send_activation_mail
  2765             $this->
object->markPostRead(
  2766                 $this->
user->getId(),
  2767                 $this->objCurrentTopic->getId(),
  2768                 $this->objCurrentPost->getId()
  2773             foreach ($uploadedObjects as $mob) {
  2780             if ($draft_obj->getRCID() > 0) {
  2781                 $post_obj->setRCID($draft_obj->getRCID());
  2782                 $post_obj->update();
  2785             if ($this->objProperties->isFileUploadAllowed()) {
  2786                 $file = $_FILES[
'userfile'] ?? [];
  2787                 if (is_array($file) && !empty($file)) {
  2794                 $GLOBALS[
'ilAppEventHandler']->raise(
  2798                         'draftObj' => $draft_obj,
  2799                         'obj_id' => $this->
object->getId(),
  2800                         'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
  2804             $draft_obj->deleteDraft();
  2806             $GLOBALS[
'ilAppEventHandler']->raise(
  2810                     'object' => $this->
object,
  2811                     'ref_id' => $this->
object->getRefId(),
  2812                     'post' => $post_obj,
  2813                     'notify_moderators' => $send_activation_mail
  2818             if (!$this->is_moderator && !$status) {
  2819                 $message .= $this->
lng->txt(
'forums_post_needs_to_be_activated');
  2821                 $message .= $this->
lng->txt(
'forums_post_new_entry');
  2827             if (is_array($frm_session_values)) {
  2828                 $frm_session_values[$thr_pk][
'openTreeNodes'][] = $this->objCurrentPost->getId();
  2832             $this->
ctrl->clearParameters($this);
  2833             $this->tpl->setOnScreenMessage(
'success', 
$message, 
true);
  2834             $this->
ctrl->setParameter($this, 
'pos_pk', $newPost);
  2835             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  2837             $this->
ctrl->redirect($this, 
'viewThread');
  2843         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  2844             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2847         if ($this->objCurrentTopic->getId() === 0) {
  2848             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_deleted'), 
true);
  2849             $this->
ctrl->redirect($this);
  2852         if ($this->objCurrentTopic->isClosed()) {
  2853             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_closed'), 
true);
  2854             $this->
ctrl->redirect($this);
  2860         if ($oReplyEditForm->checkInput()) {
  2861             if ($this->objCurrentPost->getId() === 0) {
  2862                 $this->requestAction = 
'';
  2863                 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_parent_deleted'), 
true);
  2870             $forumObj = $oForumObjects[
'forumObj'];
  2871             $frm = $oForumObjects[
'frm'];
  2876             $post_draft_id = $this->
http->wrapper()->post()->retrieve(
  2878                 $this->
refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->
refinery->always(0)])
  2882             if ($this->requestAction === 
'ready_showreply') {
  2883                 if (!$this->
access->checkAccess(
'add_reply', 
'', 
$ref_id)) {
  2884                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2889                 $send_activation_mail = 
false;
  2891                 if ($this->objProperties->isPostActivationEnabled()) {
  2892                     if (!$this->is_moderator) {
  2894                         $send_activation_mail = 
true;
  2895                     } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
  2901                     if ((
string) $oReplyEditForm->getInput(
'alias') === 
'') {
  2902                         $user_alias = $this->
lng->txt(
'forums_anonymous');
  2904                         $user_alias = $oReplyEditForm->getInput(
'alias');
  2906                     $display_user_id = 0;
  2908                     $user_alias = $this->
user->getLogin();
  2909                     $display_user_id = $this->
user->getId();
  2912                 $newPost = $frm->generatePost(
  2913                     $topicData->getTopPk(),
  2914                     $this->objCurrentTopic->getId(),
  2915                     $this->
user->getId(),
  2918                     $this->objCurrentPost->getId(),
  2919                     $oReplyEditForm->getInput(
'notify') && !$this->
user->isAnonymous(),
  2924                     $send_activation_mail
  2930                         $draft_id = $post_draft_id; 
  2932                     $draft_obj = 
new ilForumPostDraft($this->
user->getId(), $this->objCurrentPost->getId(), $draft_id);
  2937                 $this->
object->markPostRead(
  2938                     $this->
user->getId(),
  2939                     $this->objCurrentTopic->getId(),
  2940                     $this->objCurrentPost->getId()
  2945                     $oReplyEditForm->getInput(
'message'),
  2947                     $this->
user->getId(),
  2952                 if ($this->objProperties->isFileUploadAllowed()) {
  2954                     $file = $_FILES[
'userfile'];
  2955                     if (is_array($file) && !empty($file)) {
  2960                 $GLOBALS[
'ilAppEventHandler']->raise(
  2964                         'object' => $this->
object,
  2965                         'ref_id' => $this->
object->getRefId(),
  2967                         'notify_moderators' => $send_activation_mail
  2972                 if (!$this->is_moderator && !$status) {
  2973                     $message .= $this->
lng->txt(
'forums_post_needs_to_be_activated');
  2975                     $message .= $this->
lng->txt(
'forums_post_new_entry');
  2978                 $this->tpl->setOnScreenMessage(
'success', 
$message, 
true);
  2979                 $this->
ctrl->clearParameters($this);
  2980                 $this->
ctrl->setParameter($this, 
'post_created_below', $this->objCurrentPost->getId());
  2981                 $this->
ctrl->setParameter($this, 
'pos_pk', $newPost);
  2982                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  2984                 if ((!$this->is_moderator &&
  2985                         !$this->objCurrentPost->isOwner($this->user->getId())) || $this->objCurrentPost->isCensored() ||
  2986                     $this->
user->isAnonymous()) {
  2987                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  2994                 foreach ($oldMediaObjects as $oldMob) {
  2996                     foreach ($curMediaObjects as $curMob) {
  2997                         if ($oldMob === $curMob) {
  3010                 $old_status_was_active = $this->objCurrentPost->isActivated();
  3014                 $send_activation_mail = 
false;
  3016                 if ($this->objProperties->isPostActivationEnabled()) {
  3017                     if (!$this->is_moderator) {
  3019                         $send_activation_mail = 
true;
  3020                     } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
  3024                 $this->objCurrentPost->setStatus($status);
  3026                 $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
  3028                     $oReplyEditForm->getInput(
'message')
  3030                 $this->objCurrentPost->setNotification($oReplyEditForm->getInput(
'notify') && !$this->
user->isAnonymous());
  3031                 $this->objCurrentPost->setChangeDate(date(
'Y-m-d H:i:s'));
  3032                 $this->objCurrentPost->setUpdateUserId($this->
user->getId());
  3034                 if ($this->objCurrentPost->update()) {
  3035                     $this->objCurrentPost->reload();
  3042                         $this->objCurrentPost->getId(),
  3047                         $news_item->setTitle($this->objCurrentPost->getSubject());
  3048                         $news_item->setContent(
  3050                                 $this->objCurrentPost->getMessage()
  3054                         if ($this->objCurrentPost->getMessage() !== strip_tags($this->objCurrentPost->getMessage())) {
  3055                             $news_item->setContentHtml(
true);
  3057                             $news_item->setContentHtml(
false);
  3059                         $news_item->update();
  3062                     $oFDForum = $oForumObjects[
'file_obj'];
  3064                     $file2delete = $oReplyEditForm->getInput(
'del_file');
  3065                     if (is_array($file2delete) && count($file2delete)) {
  3066                         $oFDForum->unlinkFilesByMD5Filenames($file2delete);
  3069                     if ($this->objProperties->isFileUploadAllowed()) {
  3070                         $file = $_FILES[
'userfile'];
  3071                         if (is_array($file) && !empty($file)) {
  3072                             $oFDForum->storeUploadedFiles();
  3076                     $GLOBALS[
'ilAppEventHandler']->raise(
  3080                             'ref_id' => $this->
object->getRefId(),
  3082                             'notify_moderators' => $send_activation_mail,
  3083                             'old_status_was_active' => $old_status_was_active
  3087                     $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'forums_post_modified'), 
true);
  3090                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  3091                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  3092                 $this->
ctrl->setParameter($this, 
'viewmode', $this->selectedSorting);
  3094             $this->
ctrl->redirect($this, 
'viewThread');
  3096             $this->requestAction = substr($this->requestAction, 6);
  3103         if (null === $a_flag) {
  3113         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  3114             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3117         if ($this->objCurrentTopic->isClosed()) {
  3118             $this->requestAction = 
'';
  3125         $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
  3126         $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
  3128         $oReplyEditForm->checkInput();
  3130         $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
  3131         $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
  3133         $this->requestAction = 
'showreply';
  3140         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  3141             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3147         $frm = $oForumObjects[
'frm'];
  3150             $this->objCurrentPost->getPosAuthorId(),
  3151             $this->objCurrentPost->getDisplayUserId(),
  3152             (string) $this->objCurrentPost->getUserAlias(),
  3153             (string) $this->objCurrentPost->getImportName()
  3157             $this->objCurrentPost->getMessage(),
  3159             $authorinfo->getAuthorName()
  3162         $this->
http->saveResponse($this->
http->response()->withBody(
  3165         $this->
http->sendResponse();
  3166         $this->
http->close();
  3174         if (null === $this->forumObjects) {
  3176             $file_obj = 
new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
  3177             $frm = $forumObj->Forum;
  3178             $frm->setForumId($forumObj->getId());
  3179             $frm->setForumRefId($forumObj->getRefId());
  3181             $this->forumObjects[
'forumObj'] = $forumObj;
  3182             $this->forumObjects[
'frm'] = $frm;
  3183             $this->forumObjects[
'file_obj'] = $file_obj;
  3191         $this->selectedSorting = $this->objProperties->getDefaultView();
  3194             $view_mode = 
'viewmode_' . $this->
getObject()->getId();
  3204                 isset($this->httpRequest->getQueryParams()[
'viewmode']) &&
  3207                 $this->selectedSorting = (
int) $this->httpRequest->getQueryParams()[
'viewmode'];
  3210             if (!in_array($this->selectedSorting, [
  3215                 $this->selectedSorting = $this->objProperties->getDefaultView();
  3224         $this->selected_post_storage->set($this->objCurrentTopic->getId(), 0);
  3225         $this->
ctrl->redirect($this, 
'viewThread');
  3234         $toolbar_items = [];
  3237         $thread_control_session_values = 
ilSession::get(
'thread_control');
  3238         if (is_array($thread_control_session_values)) {
  3239             if (!isset($thread_control_session_values[
'old'])) {
  3240                 $thread_control_session_values[
'old'] = $thr_pk;
  3241                 $thread_control_session_values[
'new'] = $thr_pk;
  3242                 ilSession::set(
'thread_control', $thread_control_session_values);
  3243             } elseif (isset($thread_control_session_values[
'old']) && $thr_pk !== $thread_control_session_values[
'old']) {
  3244                 $thread_control_session_values[
'new'] = $thr_pk;
  3245                 ilSession::set(
'thread_control', $thread_control_session_values);
  3249         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  3250             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3254         $forumObj = $oForumObjects[
'forumObj'];
  3255         $frm = $oForumObjects[
'frm'];
  3256         $file_obj = $oForumObjects[
'file_obj'];
  3258         $selected_draft_id = (
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
  3259         if (isset($this->httpRequest->getQueryParams()[
'file'])) {
  3260             $file_obj_for_delivery = $file_obj;
  3267         if ($this->objCurrentTopic->getId() === 0) {
  3268             $this->
ctrl->redirect($this, 
'showThreads');
  3272         if (isset($this->httpRequest->getQueryParams()[
'page'])) {
  3273             $pageIndex = max((
int) $this->httpRequest->getQueryParams()[
'page'], $pageIndex);
  3276         if ($this->selected_post_storage->get($this->objCurrentTopic->getId()) > 0) {
  3278                 $this->selected_post_storage->get($this->objCurrentTopic->getId()),
  3279                 $this->is_moderator,
  3283             $firstNodeInThread = $this->objCurrentTopic->getPostRootNode();
  3294             'tpl.forums_threads_view.html',
  3302             $order_field = 
'frm_posts_tree.rgt';
  3303             $this->objCurrentTopic->setOrderDirection(
'DESC');
  3304             $threadContentTemplate->setVariable(
'LIST_TYPE', $this->viewModeOptions[$this->selectedSorting]);
  3306             $order_field = 
'frm_posts.pos_date';
  3307             $this->objCurrentTopic->setOrderDirection(
  3310             $threadContentTemplate->setVariable(
'LIST_TYPE', $this->sortationOptions[$this->selectedSorting]);
  3312         $this->objCurrentTopic->setOrderField($order_field);
  3315         $subtree_nodes = $this->objCurrentTopic->getPostTree($firstNodeInThread);
  3316         $numberOfPostings = count($subtree_nodes);
  3327         $append = 
'_' . $this->objCurrentTopic->getId() .
  3328             ($this->objCurrentPost->getId() !== 0 ? 
'_' . $this->objCurrentPost->getId() : 
'');
  3329         $this->tpl->setLoginTargetPar(
'frm_' . 
$ref_id . $append);
  3332         if (!in_array($this->requestAction, [
'showreply', 
'showedit'])) {
  3335                 foreach ($mobs as $mob) {
  3346         if (!$this->
getCreationMode() && $this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  3348                 $this->
object->getRefId(),
  3349                 ilLink::_getLink($this->
object->getRefId(), 
'frm'),
  3354         $this->prepareThreadScreen($forumObj);
  3357         if (isset($this->httpRequest->getQueryParams()[
'anchor'])) {
  3358             $threadContentTemplate->setVariable(
'JUMP2ANCHOR_ID', (
int) $this->httpRequest->getQueryParams()[
'anchor']);
  3363             $this->
object->getType(),
  3364             $this->
object->getRefId(),
  3365             $this->
object->getId(),
  3366             $this->
user->getId()
  3369         if ($firstNodeInThread) {
  3370             $this->objCurrentTopic->updateVisits();
  3372             $this->tpl->setTitle($this->
lng->txt(
'forums_thread') . 
' "' . $this->objCurrentTopic->getSubject() . 
'"');
  3374             $this->
locator->addRepositoryItems();
  3375             $this->
locator->addItem($this->
object->getTitle(), $this->
ctrl->getLinkTarget($this, 
''), 
'_top');
  3376             $this->tpl->setLocator();
  3379                 !$this->
user->isAnonymous() &&
  3380                 $forumObj->getCountUnread($this->
user->getId(), $this->objCurrentTopic->getId(), 
true)
  3382                 $this->
ctrl->setParameter($this, 
'mark_read', 
'1');
  3383                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  3385                 $mark_thr_read_button = $this->uiFactory->button()->standard(
  3386                     $this->
lng->txt(
'forums_mark_read'),
  3387                     $this->
ctrl->getLinkTarget($this, 
'viewThread')
  3390                 $toolbar_items[] = $mark_thr_read_button;
  3392                 $this->
ctrl->clearParameters($this);
  3395             $this->
ctrl->setParameterByClass(ilForumExportGUI::class, 
'print_thread', $this->objCurrentTopic->getId());
  3396             $this->
ctrl->setParameterByClass(
  3397                 ilForumExportGUI::class,
  3399                 $this->objCurrentTopic->getForumId()
  3402             if ($numberOfPostings > 0 && $this->
settings->get(
'forum_enable_print', 
'0')) {
  3403                 $print_thr_button = $this->uiFactory->button()->standard(
  3404                     $this->
lng->txt(
'forums_print_thread'),
  3405                     $this->
ctrl->getLinkTargetByClass(ilForumExportGUI::class, 
'printThread')
  3407                 $toolbar_items[] = $print_thr_button;
  3411             $this->
ctrl->clearParametersByClass(ilForumExportGUI::class);
  3415             if (isset($this->httpRequest->getQueryParams()[
'mark_read'])) {
  3416                 $forumObj->markThreadRead($this->
user->getId(), $this->objCurrentTopic->getId());
  3417                 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_thread_marked'), 
true);
  3424                 !$this->objCurrentTopic->isClosed() &&
  3427                 $this->
ctrl->setParameter($this, 
'action', 
'showreply');
  3428                 $this->
ctrl->setParameter($this, 
'pos_pk', $firstNodeInThread->getId());
  3429                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  3430                 $this->
ctrl->setParameter(
  3433                     (
int) ($this->httpRequest->getQueryParams()[
'page'] ?? 0)
  3435                 $this->
ctrl->setParameter(
  3440                 if ($numberOfPostings > 0) {
  3441                     $reply_button = $this->uiFactory->button()->standard(
  3442                         $this->
lng->txt(
'add_new_answer'),
  3443                         $this->
ctrl->getLinkTarget($this, 
'createTopLevelPost', 
'frm_page_bottom')
  3446                     $reply_button = $this->uiFactory->button()->primary(
  3447                         $this->
lng->txt(
'add_new_answer'),
  3448                         $this->
ctrl->getLinkTarget($this, 
'createTopLevelPost', 
'frm_page_bottom')
  3451                 $this->
ctrl->clearParameters($this);
  3452                 array_unshift($toolbar_items, $reply_button);
  3456             if ($numberOfPostings === 0 && $firstNodeInThread->getId() === 0) {
  3457                 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_no_posts_available'));
  3462             if ($numberOfPostings > $pageSize) {
  3463                 $this->
ctrl->setParameter($this, 
'ref_id', $this->
object->getRefId());
  3464                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  3465                 $this->
ctrl->setParameter(
  3470                 $paginationUrl = $this->
ctrl->getLinkTarget($this, 
'viewThread', 
'');
  3471                 $this->
ctrl->clearParameters($this);
  3473                 $pagination = $this->uiFactory->viewControl()
  3475                                               ->withTargetURL($paginationUrl, 
'page')
  3476                                               ->withTotalEntries($numberOfPostings)
  3477                                               ->withPageSize($pageSize)
  3478                                               ->withMaxPaginationButtons(10)
  3479                                               ->withCurrentPage($pageIndex);
  3481                 $threadContentTemplate->setVariable(
'THREAD_MENU', $this->uiRenderer->render(
  3484                 $threadContentTemplate->setVariable(
'THREAD_MENU_BOTTOM', $this->uiRenderer->render(
  3490             $draftsObjects = [];
  3491             if ($doRenderDrafts) {
  3493                     $this->
user->getId(),
  3494                     $this->objCurrentTopic->getId(),
  3499             $pagedPostings = array_slice($subtree_nodes, $pageIndex * $pageSize, $pageSize);
  3504                 $doRenderDrafts && 0 === $pageIndex &&
  3507                 foreach ($draftsObjects as $draft) {
  3508                     $referencePosting = array_values(array_filter(
  3511                             return $draft->getPostId() === $post->
getId();
  3513                     ))[0] ?? $firstNodeInThread;
  3516                         $threadContentTemplate,
  3517                         $this->requestAction,
  3524             foreach ($pagedPostings as $node) {
  3525                 $this->
ctrl->clearParameters($this);
  3528                     ($this->is_moderator || $node->isActivated() || $node->isOwner($this->
user->getId()))) {
  3529                     if (!$this->objCurrentTopic->isClosed() && in_array($this->requestAction, [
  3533                         $this->renderPostingForm($threadContentTemplate, $frm, $node, $this->requestAction);
  3534                     } elseif ($this->requestAction === 
'censor' &&
  3536                         $threadContentTemplate->setVariable(
'FORM', $this->getCensorshipFormHTML());
  3540                 $this->
renderPostContent($threadContentTemplate, $node, $this->requestAction, $pageIndex, $postIndex);
  3543                         $threadContentTemplate,
  3544                         $this->requestAction,
  3546                         $draftsObjects[$node->getId()] ?? []
  3555                 $doRenderDrafts && $pageIndex === max(0, (
int) (ceil($numberOfPostings / $pageSize) - 1))
  3557                 foreach ($draftsObjects as $draft) {
  3558                     $referencePosting = array_values(array_filter(
  3561                             return $draft->getPostId() === $post->
getId();
  3563                     ))[0] ?? $firstNodeInThread;
  3566                         $threadContentTemplate,
  3567                         $this->requestAction,
  3575                 $firstNodeInThread instanceof 
ilForumPost && $doRenderDrafts &&
  3579                     $threadContentTemplate,
  3580                     $this->requestAction,
  3582                     $draftsObjects[$firstNodeInThread->getId()] ?? []
  3588                 !$this->objCurrentTopic->isClosed() &&
  3589                 in_array($this->
ctrl->getCmd(), [
'createTopLevelPost', 
'saveTopLevelPost', 
'saveTopLevelDraft'], 
true) &&
  3592                 $this->objCurrentPost->setId($firstNodeInThread->getId());
  3595                 if (in_array($this->
ctrl->getCmd(), [
'saveTopLevelPost', 
'saveTopLevelDraft'])) {
  3596                     $form->setValuesByPost();
  3598                 $this->
ctrl->setParameter($this, 
'pos_pk', $firstNodeInThread->getId());
  3599                 $this->
ctrl->setParameter($this, 
'thr_pk', $firstNodeInThread->getThreadId());
  3600                 $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.js', 
true, 
true, 
'Modules/Forum');
  3601                 $jsTpl->setVariable(
  3602                     'IL_FRM_QUOTE_CALLBACK_SRC',
  3603                     $this->
ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
  3605                 $this->
ctrl->clearParameters($this);
  3606                 $this->tpl->addOnLoadCode($jsTpl->get());
  3607                 $threadContentTemplate->setVariable(
'BOTTOM_FORM', $form->getHTML());
  3610             $threadContentTemplate->setCurrentBlock(
'posts_no');
  3611             $threadContentTemplate->setVariable(
  3612                 'TXT_MSG_NO_POSTS_AVAILABLE',
  3613                 $this->
lng->txt(
'forums_posts_not_available')
  3615             $threadContentTemplate->parseCurrentBlock();
  3618         $to_top_button = $this->uiFactory->button()
  3619                                          ->standard($this->
lng->txt(
'top_of_page'), 
'#frm_page_top');
  3620         $bottom_toolbar->addComponent($to_top_button);
  3621         if ($numberOfPostings > 0) {
  3622             $threadContentTemplate->setVariable(
'TOOLBAR_BOTTOM', $bottom_toolbar->getHTML());
  3625         if ($toolbar_items !== []) {
  3626             foreach ($toolbar_items as $component_index => $item) {
  3627                 $this->toolbar->addComponent($item);
  3628                 $bottom_toolbar->addComponent($item);
  3629                 if ($component_index === 0 && $numberOfPostings > 0) {
  3638         $this->tpl->setPermanentLink(
  3639             $this->
object->getType(),
  3640             $this->
object->getRefId(),
  3641             (string) $this->objCurrentTopic->getId()
  3644         $this->tpl->addOnLoadCode(
'$(".ilFrmPostContent img").each(function() {  3647                                 maxWidth: $elm.attr("width") + "px",  3648                                 maxHeight: $elm.attr("height")  + "px"  3650                         $elm.removeAttr("width");  3651                         $elm.removeAttr("height");  3658         $this->tpl->setContent(($info ?? 
'') . $threadContentTemplate->get() . $this->
getModalActions());
  3663         if ($currentViewMode === 3) {
  3664             $currentViewMode = 2;
  3666         $translationKeys = [];
  3667         foreach ($this->viewModeOptions as $sortingConstantKey => $languageKey) {
  3668             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  3669             $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  3670             $this->
ctrl->setParameter($this, 
'viewmode', $sortingConstantKey);
  3672             $translationKeys[$this->
lng->txt($languageKey)] = $this->
ctrl->getLinkTarget(
  3678             $this->
ctrl->clearParameters($this);
  3685         $sortViewControl = $this->uiFactory
  3687             ->mode($translationKeys, $this->
lng->txt($this->viewModeOptions[$currentViewMode]))
  3688             ->withActive($this->
lng->txt($this->viewModeOptions[$currentViewMode]));
  3689         $this->
toolbar->addComponent($sortViewControl);
  3694         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  3695         $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  3696         $target = $this->
ctrl->getLinkTarget(
  3702         $translatedSortationOptions = array_map(
function ($value): 
string {
  3703             return $this->
lng->txt($value);
  3706         $sortingDirectionViewControl = $this->uiFactory
  3708             ->sortation($translatedSortationOptions)
  3709             ->withLabel($this->
lng->txt($this->sortationOptions[$currentSorting]))
  3710             ->withTargetURL($target, 
'viewmode');
  3711         $this->
toolbar->addComponent($sortingDirectionViewControl);
  3717             $this->
lng->txt(
'post_reply'),
  3718             $this->
lng->txt(
'post_reply_count')
  3719         ))->build($this->objCurrentPost->getSubject());
  3724         $user_id = $this->
http->wrapper()->query()->retrieve(
  3726             $this->
refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->
refinery->always(0)])
  3729         $backurl = $this->
http->wrapper()->query()->retrieve(
  3731             $this->
refinery->byTrying([$this->refinery->kindlyTo()->string(), $this->
refinery->always(
'')])
  3735         $add = $this->getUserProfileAdditional(
$ref_id, $user_id);
  3736         $profile_gui->setAdditional($add);
  3738         $this->tpl->setContent($this->
ctrl->getHTML($profile_gui));
  3741     protected function getUserProfileAdditional(
int $a_forum_ref_id, 
int $a_user_id): array
  3743         if (!$this->
access->checkAccess(
'read', 
'', $a_forum_ref_id)) {
  3744             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3749         if ($ref_obj->getType() === 
'frm') {
  3751             $frm = $forumObj->Forum;
  3758         if ($this->
access->checkAccess(
'moderate_frm', 
'', $a_forum_ref_id)) {
  3764         return [$this->
lng->txt(
'forums_posts') => $numPosts];
  3769         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  3770             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3776         $cmd = $this->
ctrl->getCmd();
  3779         if ($thread_ids !== []) {
  3780             if ($cmd === 
'move') {
  3781                 if ($this->is_moderator) {
  3785             } elseif ($cmd === 
'enable_notifications' && (
int) $this->
settings->get(
'forum_notification', 
'0') !== 0) {
  3786                 foreach ($thread_ids as $thread_id) {
  3789                     $tmp_obj->enableNotification($this->
user->getId());
  3792                 $this->
ctrl->redirect($this, 
'showThreads');
  3793             } elseif ($cmd === 
'disable_notifications' && (
int) $this->
settings->get(
'forum_notification', 
'0') !== 0) {
  3794                 foreach ($thread_ids as $thread_id) {
  3797                     $tmp_obj->disableNotification($this->
user->getId());
  3800                 $this->
ctrl->redirect($this, 
'showThreads');
  3801             } elseif ($cmd === 
'close') {
  3802                 if ($this->is_moderator) {
  3803                     foreach ($thread_ids as $thread_id) {
  3809                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'selected_threads_closed'), 
true);
  3810                 $this->
ctrl->redirect($this, 
'showThreads');
  3811             } elseif ($cmd === 
'reopen') {
  3812                 if ($this->is_moderator) {
  3813                     foreach ($thread_ids as $thread_id) {
  3820                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'selected_threads_reopened'), 
true);
  3821                 $this->
ctrl->redirect($this, 
'showThreads');
  3822             } elseif ($cmd === 
'makesticky') {
  3823                 if ($this->is_moderator) {
  3824                     $message = $this->
lng->txt(
'sel_threads_make_sticky');
  3826                     foreach ($thread_ids as $thread_id) {
  3829                         $makeSticky = $tmp_obj->makeSticky();
  3831                             $message = $this->
lng->txt(
'sel_threads_already_sticky');
  3836                     $this->tpl->setOnScreenMessage(
'info', 
$message, 
true);
  3838                 $this->
ctrl->redirect($this, 
'showThreads');
  3839             } elseif ($cmd === 
'unmakesticky' || $cmd === 
'make_topics_non_sticky') {
  3840                 if ($this->is_moderator) {
  3841                     $message = $this->
lng->txt(
'sel_threads_make_unsticky');
  3842                     foreach ($thread_ids as $thread_id) {
  3845                         $unmakeSticky = $tmp_obj->unmakeSticky();
  3846                         if (!$unmakeSticky) {
  3847                             $message = $this->
lng->txt(
'sel_threads_already_unsticky');
  3853                     $this->tpl->setOnScreenMessage(
'info', 
$message, 
true);
  3855                 $this->
ctrl->redirect($this, 
'showThreads');
  3856             } elseif ($cmd === 
'editThread') {
  3857                 if ($this->is_moderator) {
  3858                     $count = count($thread_ids);
  3860                         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_max_one_thread'), 
true);
  3861                         $this->
ctrl->redirect($this, 
'showThreads');
  3868                 $this->
ctrl->redirect($this, 
'showThreads');
  3869             } elseif ($cmd === 
'html') {
  3870                 $this->
ctrl->setCmd(
'exportHTML');
  3871                 $this->
ctrl->setCmdClass(ilForumExportGUI::class);
  3873             } elseif ($cmd === 
'confirmDeleteThreads') {
  3874                 $this->confirmDeleteThreadsObject();
  3875             } elseif ($cmd === 
'mergeThreads') {
  3878                 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'topics_please_select_one_action'), 
true);
  3879                 $this->
ctrl->redirect($this, 
'showThreads');
  3882             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_at_least_one_thread'), 
true);
  3883             $this->
ctrl->redirect($this, 
'showThreads');
  3889         if (!$this->is_moderator) {
  3890             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3893         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  3894             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3898         if ($this->
http->wrapper()->post()->has(
'frm_ref_id')) {
  3899             $frm_ref_id = $this->
http->wrapper()->post()->retrieve(
  3904             $this->error->raiseError(
'Please select a forum', $this->error->MESSAGE);
  3908         if (!is_array($threads2move) || $threads2move === []) {
  3909             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_at_least_one_thread'), 
true);
  3910             $this->
ctrl->redirect($this, 
'showThreads');
  3913         if (!$this->
access->checkAccess(
'read', 
'', (
int) $frm_ref_id)) {
  3914             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3918         array_walk($threads2move, 
function (
int $threadId) use (&$threads): 
void {
  3922             $threads[] = $threadId;
  3925         if (isset($frm_ref_id) && (
int) $frm_ref_id) {
  3926             $errorMessages = $this->
object->Forum->moveThreads(
  3929                 $this->ilObjDataCache->lookupObjId((
int) $frm_ref_id)
  3932             if ([] !== $errorMessages) {
  3933                 $this->tpl->setOnScreenMessage(
'failure', implode(
'<br><br>', $errorMessages), 
true);
  3934                 $this->
ctrl->redirect($this, 
'showThreads');
  3938             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'threads_moved_successfully'), 
true);
  3939             $this->
ctrl->redirect($this, 
'showThreads');
  3941             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_forum_selected'));
  3949         $this->
ctrl->redirect($this, 
'showThreads');
  3954         if (!$this->is_moderator) {
  3955             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3958         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  3959             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  3962         $frm_ref_id = $this->
http->wrapper()->post()->retrieve(
  3964             $this->
refinery->byTrying([$this->refinery->kindlyTo()->int(), $this->
refinery->always(null)])
  3968         if (!is_array($threads2move) || $threads2move === []) {
  3969             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_at_least_one_thread'), 
true);
  3970             $this->
ctrl->redirect($this, 
'showThreads');
  3975         array_walk($threads2move, 
function (
int $threadId) use (&$threads, $isModerator): 
void {
  3979             $threads[] = $thread;
  3983         $exp->setPathOpen($this->
object->getRefId());
  3984         $exp->setNodeSelected(isset($frm_ref_id) && (
int) $frm_ref_id ? (
int) $frm_ref_id : 0);
  3985         $exp->setCurrentFrmRefId($this->
object->getRefId());
  3986         $exp->setHighlightedNode((
string) $this->
object->getRefId());
  3987         if (!$exp->handleCommand()) {
  3989                 'tpl.forums_threads_move.html',
  3996                 $this->
toolbar->addButton($this->
lng->txt(
'back'), $this->
ctrl->getLinkTarget($this));
  4003             foreach ($threads as $thread) {
  4004                 $result[$counter][
'num'] = $counter + 1;
  4005                 $result[$counter][
'thr_subject'] = $thread->getSubject();
  4009             $tblThr->setId(
'frmthrmv' . $this->
object->getRefId());
  4010             $tblThr->setTitle(
'');
  4011             $tblThr->addColumn($this->
lng->txt(
'subject'), 
'top_name', 
'100%');
  4012             $tblThr->disable(
'header');
  4013             $tblThr->disable(
'footer');
  4014             $tblThr->disable(
'linkbar');
  4015             $tblThr->disable(
'sort');
  4016             $tblThr->disable(
'linkbar');
  4017             $tblThr->setLimit(PHP_INT_MAX);
  4018             $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html', 
'Modules/Forum');
  4019             $tblThr->setDefaultOrderField(
'is_sticky');
  4021             $tblThr->setData($result);
  4022             $moveThreadTemplate->setVariable(
'THREAD_TITLE', sprintf($this->
lng->txt(
'move_chosen_topics'), $thread->getSubject()));
  4023             $moveThreadTemplate->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
  4024             $moveThreadTemplate->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
  4025             $moveThreadTemplate->setVariable(
'CMD_SUBMIT', 
'performMoveThreads');
  4026             $moveThreadTemplate->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'move'));
  4027             $moveThreadTemplate->setVariable(
'FORMACTION', $this->
ctrl->getFormAction($this, 
'performMoveThreads'));
  4029             $this->tpl->setContent($moveThreadTemplate->get());
  4038             $this->objProperties->isAnonymized() &&
  4039             (!$this->is_moderator || !$this->objProperties->getMarkModeratorPosts())
  4045         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4046             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4049         $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()[
'draft_ids'] ?? []));
  4050         if ([] === $draftIds) {
  4051             $draftIds = array_filter([(
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0)]);
  4055         $checkedDraftIds = [];
  4056         foreach ($draftIds as $draftId) {
  4057             if (array_key_exists($draftId, $instances)) {
  4058                 $checkedDraftIds[] = $draftId;
  4059                 $draft = $instances[$draftId];
  4063                 $GLOBALS[
'ilAppEventHandler']->raise(
  4067                         'draftObj' => $draft,
  4068                         'obj_id' => $this->
object->getId(),
  4069                         'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
  4074                 $draftFileData->delete([$draft->getDraftId()]);
  4076                 $draft->deleteDraft();
  4080         if (count($checkedDraftIds) > 1) {
  4081             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'delete_drafts_successfully'), 
true);
  4083             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'delete_draft_successfully'), 
true);
  4085         $this->
ctrl->redirect($this, 
'showThreads');
  4090         $draftId = (
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
  4091         $allowNotification = !$this->objProperties->isAnonymized() && !$this->
user->isAnonymous();
  4094         if (!$this->
rbac->system()->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId())) {
  4095             $allowNotification = 
false;
  4100             $this->objProperties,
  4114         $default_form->generateDefaultForm();
  4118         return $default_form;
  4123         $draftId = (
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
  4124         $allowNotification = !$this->objProperties->isAnonymized() && !$this->
user->isAnonymous();
  4127         if (!$this->
rbac->system()->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId())) {
  4128             $allowNotification = 
false;
  4133             $this->objProperties,
  4143         $minimal_form->generateMinimalForm();
  4145         return $minimal_form;
  4150         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4151             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4154         if (!$this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
  4155             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4158         $tpl = 
new ilTemplate(
'tpl.create_thread_form.html', 
true, 
true, 
'Modules/Forum');
  4161         $accordion->setId(
'acc_' . $this->obj_id);
  4164         $accordion->addItem($this->
lng->txt(
'new_thread_with_post'), $this->
buildThreadForm()->getHTML());
  4170         $this->tpl->setContent(
$tpl->
get());
  4179             !$this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
  4180             !$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())
  4182             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4185         $frm = $this->
object->Forum;
  4194         if ($form->checkInput()) {
  4195             $userIdForDisplayPurposes = $this->
user->getId();
  4197                 $userIdForDisplayPurposes = 0;
  4203                 $this->objCurrentPost->isAnyParentDeactivated()
  4208             if ($createFromDraft) {
  4210                 $newThread->setForumId($topicData->getTopPk());
  4213                 $newThread->setSubject($this->
handleFormInput($form->getInput(
'subject'), 
false));
  4225                     $form->getInput(
'alias'),
  4226                     $this->objProperties->isAnonymized()
  4229                 $newThread->setForumId($topicData->getTopPk());
  4230                 $newThread->setThrAuthorId($this->
user->getId());
  4231                 $newThread->setDisplayUserId($userIdForDisplayPurposes);
  4232                 $newThread->setSubject($this->
handleFormInput($form->getInput(
'subject'), 
false));
  4233                 $newThread->setUserAlias($userAlias);
  4238                     $form->getItemByPostVar(
'notify') && $form->getInput(
'notify') && !$this->
user->isAnonymous(),
  4246                 $post_obj->setRCID($draft->
getRCID());
  4247                 $post_obj->update();
  4250             if ($this->objProperties->isFileUploadAllowed()) {
  4251                 $file = $_FILES[
'userfile'];
  4252                 if (is_array($file) && !empty($file)) {
  4262             if ($createFromDraft) {
  4267             foreach ($mediaObjects as $mob) {
  4276                 $draftHistory->deleteHistoryByDraftIds([$draft->
getDraftId()]);
  4280             $GLOBALS[
'ilAppEventHandler']->raise(
  4284                     'object' => $this->
object,
  4285                     'ref_id' => $this->
object->getRefId(),
  4286                     'post' => $post_obj,
  4287                     'notify_moderators' => !$status
  4291             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'forums_thread_new_entry'), 
true);
  4292             $this->
ctrl->redirect($this);
  4295         $form->setValuesByPost();
  4296         if (!$this->objProperties->isAnonymized()) {
  4297             $form->getItemByPostVar(
'alias')->setValue($this->
user->getLogin());
  4301         $accordion->setId(
'acc_' . $this->obj_id);
  4303         $accordion->addItem($this->
lng->txt(
'new_thread_with_post'), $form->getHTML());
  4304         $accordion->addItem($this->
lng->txt(
'empty_thread'), $minimal_form->getHTML());
  4306         $this->tpl->setContent($accordion->getHTML());
  4315             !$this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
  4316             !$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())
  4318             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4321         $frm = $this->
object->Forum;
  4330         if ($minimal_form->checkInput()) {
  4331             $userIdForDisplayPurposes = $this->
user->getId();
  4333                 $userIdForDisplayPurposes = 0;
  4339                 $this->objCurrentPost->isAnyParentDeactivated()
  4345                 $minimal_form->getInput(
'alias'),
  4346                 $this->objProperties->isAnonymized()
  4349             $newThread->setForumId($topicData->getTopPk());
  4350             $newThread->setThrAuthorId($this->
user->getId());
  4351             $newThread->setDisplayUserId($userIdForDisplayPurposes);
  4352             $newThread->setSubject($this->
handleFormInput($minimal_form->getInput(
'subject'), 
false));
  4353             $newThread->setUserAlias($userAlias);
  4368             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'forums_thread_new_entry'), 
true);
  4369             $this->
ctrl->redirect($this);
  4372         $form->setValuesByPost();
  4374         if (!$this->objProperties->isAnonymized()) {
  4375             $form->getItemByPostVar(
'alias')->setValue($this->
user->getLogin());
  4379         $accordion->setId(
'acc_' . $this->obj_id);
  4381         $accordion->addItem($this->
lng->txt(
'new_thread_with_post'), $form->getHTML());
  4382         $accordion->addItem($this->
lng->txt(
'empty_thread'), $minimal_form->getHTML());
  4384         $this->tpl->setContent($accordion->getHTML());
  4390             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4393         $draftId = (
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
  4396         if ($draft->getDraftId() <= 0) {
  4397             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4407             $draftId = (
int) ($this->httpRequest->getParsedBody()[
'draft_id'] ?? 0);
  4420             $draftId = (
int) ($this->httpRequest->getParsedBody()[
'draft_id'] ?? 0);
  4431         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId()) || $this->
user->isAnonymous()) {
  4432             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4435         $frm = $this->
object->Forum;
  4439         if ($this->objCurrentTopic->getId() > 0) {
  4440             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  4441             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_forum_notification_enabled'), 
true);
  4442             $this->
ctrl->redirect($this, 
'viewThread');
  4445         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_forum_notification_enabled'));
  4451         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId()) || $this->
user->isAnonymous()) {
  4452             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4455         $frm = $this->
object->Forum;
  4459         if ($this->objCurrentTopic->getId() > 0) {
  4460             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  4461             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_forum_notification_disabled'), 
true);
  4462             $this->
ctrl->redirect($this, 
'viewThread');
  4465         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'forums_forum_notification_disabled'));
  4475         if ($this->
access->checkAccess(
'write', 
'', $this->object->getRefId())) {
  4477             if ($news_set->get(
'enable_rss_for_internal')) {
  4488                 $this->
object->getTitle(),
  4489                 $this->
ctrl->getLinkTarget($this),
  4491                 $this->
object->getRefId()
  4498         $a_text = str_replace([
'<', 
'>'], [
'<', 
'>'], $a_text);
  4499         if ($a_stripslashes) {
  4508         $a_text = str_replace([
'<', 
'>'], [
'<', 
'>'], $a_text);
  4516             !$this->
access->checkAccess(
'visible', 
'', $this->object->getRefId()) &&
  4517             !$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())
  4519             $this->error->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
  4523         $info->enablePrivateNotes();
  4524         $this->
ctrl->forwardCommand($info);
  4529         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4530             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4533         if ($this->objCurrentPost->getId() > 0) {
  4536             $this->
object->markPostUnread($this->
user->getId(), $this->objCurrentPost->getId());
  4543         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4544             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4547         if ($this->objCurrentTopic->getId() > 0 && $this->objCurrentPost->getId() > 0) {
  4550             $this->
object->markPostRead(
  4551                 $this->
user->getId(),
  4552                 $this->objCurrentTopic->getId(),
  4553                 $this->objCurrentPost->getId()
  4557         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  4558         $this->
ctrl->redirect($this, 
'viewThread');
  4563         $lg = parent::initHeaderAction();
  4569         if ($this->
user->isAnonymous() || !$this->
access->checkAccess(
'read', 
'', $this->
object->getRefId())) {
  4573         $frm = $this->
object->Forum;
  4576         $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', [
'integer'], [$frm->
getForumId()]);
  4581         if ($this->objCurrentTopic->getId() > 0) {
  4582             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  4585         if (!$this->
user->isAnonymous()) {
  4586             if ($this->
object->isParentMembershipEnabledContainer()) {
  4587                 if ($isForumNotificationEnabled && $userMayDisableNotifications) {
  4588                     $lg->addCustomCommand(
  4589                         $this->
ctrl->getLinkTarget($this, 
'disableForumNotification'),
  4590                         'forums_disable_forum_notification'  4592                 } elseif (!$isForumNotificationEnabled) {
  4593                     $lg->addCustomCommand(
  4594                         $this->
ctrl->getLinkTarget($this, 
'enableForumNotification'),
  4595                         'forums_enable_forum_notification'  4598             } elseif ($isForumNotificationEnabled) {
  4599                 $lg->addCustomCommand(
  4600                     $this->
ctrl->getLinkTarget($this, 
'disableForumNotification'),
  4601                     'forums_disable_forum_notification'  4604                 $lg->addCustomCommand(
  4605                     $this->
ctrl->getLinkTarget($this, 
'enableForumNotification'),
  4606                     'forums_enable_forum_notification'  4612         if (!$this->
user->isAnonymous() && $isForumNotificationEnabled && $userMayDisableNotifications) {
  4614             $frm_noti->setUserId($this->
user->getId());
  4615             $interested_events = $frm_noti->readInterestedEvents();
  4618                 'hidden_value' => 
'',
  4626             $notificationsModal = $this->uiFactory->modal()->roundtrip(
  4627                 $this->
lng->txt(
'notification_settings'),
  4628                 [$events_form_builder->build()]
  4629             )->withActionButtons([
  4632                     ->primary($this->
lng->txt(
'save'), 
'#')
  4635                             $('#$id').closest('.modal').find('form').addClass('ilForumNotificationSettingsForm');  4636                             $('#$id').closest('.modal').find('form .il-standard-form-header, .il-standard-form-footer').remove();  4637                             $('#$id').click(function() { $(this).closest('.modal').find('form').submit(); return false; });  4642             $showNotificationSettingsBtn = $this->uiFactory->button()
  4643                                                            ->shy($this->
lng->txt(
'notification_settings'), 
'#')
  4645                                                                $notificationsModal->getShowSignal()
  4648             $lg->addCustomCommandButton($showNotificationSettingsBtn, $notificationsModal);
  4651         $isThreadNotificationEnabled = 
false;
  4652         if (!$this->
user->isAnonymous() && $this->objCurrentTopic->getId() > 0) {
  4653             $isThreadNotificationEnabled = $this->objCurrentTopic->isNotificationEnabled($this->
user->getId());
  4654             if ($isThreadNotificationEnabled) {
  4655                 $lg->addCustomCommand(
  4656                     $this->
ctrl->getLinkTarget($this, 
'toggleThreadNotification'),
  4657                     'forums_disable_notification'  4660                 $lg->addCustomCommand(
  4661                     $this->
ctrl->getLinkTarget($this, 
'toggleThreadNotification'),
  4662                     'forums_enable_notification'  4666         $this->
ctrl->setParameter($this, 
'thr_pk', 
'');
  4668         if (!$this->
user->isAnonymous()) {
  4669             if ($isForumNotificationEnabled || $isThreadNotificationEnabled) {
  4673                     $this->
lng->txt(
'frm_notification_activated')
  4679                     $this->
lng->txt(
'frm_notification_deactivated')
  4693         if ($this->objCurrentTopic->getId() > 0) {
  4694             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  4698             $this->
ctrl->getFormAction($this, 
'saveUserNotificationSettings'),
  4709         if ($this->httpRequest->getMethod() === 
'POST') {
  4710             $form = $events_form_builder->build()->withRequest($this->httpRequest);
  4711             $formData = $form->getData();
  4715             foreach ($events_form_builder->getValidEvents() as $event) {
  4716                 $interested_events += isset($formData[$event]) && $formData[$event] ? $events_form_builder->getValueForEvent(
  4723             $frm_noti->setInterestedEvents($interested_events);
  4724             $frm_noti->updateInterestedEvents();
  4727         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'), 
true);
  4729         if ($this->objCurrentTopic->getId() > 0) {
  4730             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  4731             $this->
ctrl->redirect($this, 
'viewThread');
  4734         $this->
ctrl->redirect($this, 
'showThreads');
  4743         if (!$this->objProperties->isUserToggleNoti() &&
  4744             $this->objProperties->getNotificationType() === NotificationType::ALL_USERS) {
  4748         if ($this->objProperties->getNotificationType() === NotificationType::PER_USER &&
  4749             $this->
object->isParentMembershipEnabledContainer()) {
  4751             $frm_noti->setUserId($this->
user->getId());
  4753             return !$frm_noti->isUserToggleNotification();
  4761         if (!$this->is_moderator) {
  4762             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4765         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4766             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4769         $threadIdToMerge = $this->
http->wrapper()->query()->retrieve(
  4772                 $this->refinery->kindlyTo()->int(),
  4776         if ($threadIdToMerge <= 0) {
  4777             $threadIds = array_values(
  4778                 array_filter(array_map(
'intval', (array) ($this->httpRequest->getParsedBody()[
'thread_ids'] ?? [])))
  4780             if (1 === count($threadIds)) {
  4781                 $threadIdToMerge = current($threadIds);
  4783                 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
  4789         $frm = $this->
object->Forum;
  4796             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'not_allowed_to_merge_into_another_forum'));
  4801         $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', [
'integer'], [$frm->
getForumId()]);
  4804             'tpl.forums_threads_liste.html',
  4811         if ($topicData->getTopPk() > 0) {
  4812             $this->
ctrl->setParameter($this, 
'merge_thread_id', $threadIdToMerge);
  4816                 (
int) $this->httpRequest->getQueryParams()[
'ref_id'],
  4820             $tbl->setSelectedThread($threadToMerge);
  4823             $threadsTemplate->setVariable(
'THREADS_TABLE', $tbl->
getHTML());
  4824             $this->tpl->setContent($threadsTemplate->get());
  4826             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
  4833         if (!$this->is_moderator) {
  4834             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4837         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4838             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4841         $sourceThreadId = (
int) ($this->httpRequest->getQueryParams()[
'merge_thread_id'] ?? 0);
  4842         $targetThreadIds = array_values(
  4843             array_filter(array_map(
'intval', (array) ($this->httpRequest->getParsedBody()[
'thread_ids'] ?? [])))
  4846         if ($sourceThreadId <= 0 || 1 !== count($targetThreadIds)) {
  4847             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
  4852         $targetThreadId = current($targetThreadIds);
  4853         if ($sourceThreadId === $targetThreadId) {
  4854             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'error_same_thread_ids'));
  4860             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'not_allowed_to_merge_into_another_forum'));
  4861             $this->
ctrl->clearParameters($this);
  4867             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'switch_threads_for_merge'));
  4875         $c_gui->setFormAction($this->
ctrl->getFormAction($this, 
'performMergeThreads'));
  4876         $c_gui->setHeaderText($this->
lng->txt(
'frm_sure_merge_threads'));
  4877         $c_gui->setCancel($this->
lng->txt(
'cancel'), 
'showThreads');
  4878         $c_gui->setConfirm($this->
lng->txt(
'confirm'), 
'performMergeThreads');
  4882             (
string) $sourceThreadId,
  4887             (
string) $targetThreadId,
  4890         $this->tpl->setContent($c_gui->getHTML());
  4895         if (!$this->is_moderator) {
  4896             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4899         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4900             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4903         $threadIds = array_values(
  4904             array_filter(array_map(
'intval', (array) ($this->httpRequest->getParsedBody()[
'thread_ids'] ?? [])))
  4906         if (2 !== count($threadIds)) {
  4907             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
  4912         if ((
int) $threadIds[0] === (
int) $threadIds[1]) {
  4913             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'error_same_thread_ids'));
  4926             $frm->
mergeThreads((
int) $threadIds[0], (
int) $threadIds[1]);
  4927             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'merged_threads_successfully'));
  4929             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($e->getMessage()));
  4938         if (!$this->
ctrl->isAsynch()) {
  4939             $content = implode(
'', [
  4944         $this->tpl->setRightContent($content);
  4949         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4950             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4953         $draftId = $this->httpRequest->getQueryParams()[
'draft_id'] ?? 0;
  4955         if ($draft->getPostAuthorId() === $this->
user->getId()) {
  4957             if (!$fileData->deliverZipFile()) {
  4958                 $this->
ctrl->redirect($this);
  4965         if (!$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())) {
  4966             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4972         if (!$fileData->deliverZipFile()) {
  4973             $this->
ctrl->redirect($this);
  4984             !$this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
  4985             !$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())
  4987             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  4990         $frm = $this->
object->Forum;
  4995         $draftId = (
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
  5000         $historyCheck = (
int) ($this->httpRequest->getQueryParams()[
'hist_check'] ?? 1);
  5005         if (!$form instanceof ilPropertyFormGUI) {
  5007             $form->setValuesByArray([
  5008                 'alias' => $draft->getPostUserAlias(),
  5009                 'subject' => $draft->getPostSubject(),
  5011                 'notify' => $draft->isNotificationEnabled() && !$this->
user->isAnonymous(),
  5014                 'draft_id' => $draftId
  5017             $this->
ctrl->setParameter($this, 
'draft_id', $draftId);
  5025         $historyId = (
int) ($this->httpRequest->getQueryParams()[
'history_id'] ?? 0);
  5028         $draft = $history->rollbackAutosave();
  5029         if ($draft->getThreadId() === 0 && $draft->getPostId() === 0) {
  5030             $this->
ctrl->setParameter($this, 
'draft_id', $history->getDraftId());
  5031             $this->
ctrl->redirect($this, 
'editThreadDraft');
  5034         $this->
ctrl->clearParameters($this);
  5035         $this->
ctrl->setParameter($this, 
'pos_pk', $draft->getPostId());
  5036         $this->
ctrl->setParameter($this, 
'thr_pk', $draft->getThreadId());
  5037         $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  5038         $this->
ctrl->setParameter($this, 
'action', 
'editdraft');
  5042         $this->
ctrl->redirect($this, 
'viewThread');
  5049             !$this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
  5050             !$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())
  5052             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5055         $autoSavedDraftId = (
int) ($this->httpRequest->getParsedBody()[
'draft_id'] ?? 0);
  5056         if ($autoSavedDraftId <= 0) {
  5057             $autoSavedDraftId = (
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
  5060         $frm = $this->
object->Forum;
  5067         if ($form->checkInput()) {
  5068             if (0 === $autoSavedDraftId) {
  5074             $draft->setForumId($topicData->getTopPk());
  5075             $draft->setThreadId(0);
  5076             $draft->setPostId(0);
  5077             $draft->setPostSubject($this->
handleFormInput($form->getInput(
'subject'), 
false));
  5080                 $form->getInput(
'alias'),
  5081                 $this->objProperties->isAnonymized()
  5083             $draft->setPostUserAlias($userAlias);
  5084             $draft->setNotificationStatus($form->getInput(
'notify') && !$this->
user->isAnonymous());
  5085             $draft->setPostAuthorId($this->
user->getId());
  5088             if (0 === $autoSavedDraftId) {
  5089                 $draftId = $draft->saveDraft();
  5091                 $draft->updateDraft();
  5092                 $draftId = $draft->getDraftId();
  5095             $GLOBALS[
'ilAppEventHandler']->raise(
  5099                     'draftObj' => $draft,
  5100                     'obj_id' => $this->
object->getId(),
  5101                     'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
  5109             $files2delete = $form->getInput(
'del_file');
  5110             if (is_array($files2delete) && $files2delete !== []) {
  5114             if ($this->objProperties->isFileUploadAllowed()) {
  5115                 $file = $_FILES[
'userfile'];
  5116                 if (is_array($file) && !empty($file)) {
  5117                     $draftFileData->storeUploadedFiles();
  5121             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'save_draft_successfully'), 
true);
  5122             $this->
ctrl->clearParameters($this);
  5123             $this->
ctrl->redirect($this, 
'showThreads');
  5126         $this->requestAction = substr($this->requestAction, 6);
  5127         $form->setValuesByPost();
  5128         $this->
ctrl->setParameter($this, 
'draft_id', $autoSavedDraftId);
  5129         $this->tpl->setContent($form->getHTML());
  5136             !$this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
  5137             !$this->
access->checkAccess(
'read', 
'', $this->object->getRefId())
  5139             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5142         $draftId = (
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
  5144             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5148         if ($form->checkInput()) {
  5150                 $form->getInput(
'alias'),
  5151                 $this->objProperties->isAnonymized()
  5155             $draft->setPostSubject($this->
handleFormInput($form->getInput(
'subject'), 
false));
  5157             $draft->setPostUserAlias($userAlias);
  5158             $draft->setNotificationStatus($form->getInput(
'notify') && !$this->
user->isAnonymous());
  5159             $draft->setPostAuthorId($this->
user->getId());
  5161             $draft->updateDraft();
  5163             $GLOBALS[
'ilAppEventHandler']->raise(
  5167                     'draftObj' => $draft,
  5168                     'obj_id' => $this->
object->getId(),
  5169                     'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
  5174                 $form->getInput(
'message'),
  5176                 $draft->getDraftId(),
  5178                 $draft->getDraftId()
  5183             $files2delete = $form->getInput(
'del_file');
  5184             if (is_array($files2delete) && $files2delete !== []) {
  5188             if ($this->objProperties->isFileUploadAllowed()) {
  5189                 $file = $_FILES[
'userfile'];
  5190                 if (is_array($file) && !empty($file)) {
  5191                     if (isset($file[
'full_path'][0]) && !empty($file[
'full_path'][0])) {
  5192                         $draftFileData->storeUploadedFiles();
  5197             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'save_draft_successfully'), 
true);
  5198             $this->
ctrl->clearParameters($this);
  5199             $this->
ctrl->redirect($this, 
'showThreads');
  5202         $form->setValuesByPost();
  5203         $this->
ctrl->setParameter($this, 
'hist_check', 0);
  5204         $this->
ctrl->setParameter($this, 
'draft_id', $draftId);
  5218         $draft_id = $this->
http->wrapper()->post()->retrieve(
  5221                 $this->refinery->kindlyTo()->int(),
  5226         if ($this->objCurrentTopic->getId() === 0) {
  5227             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_deleted'), 
true);
  5228             $this->
ctrl->redirect($this);
  5231         if ($this->objCurrentTopic->isClosed()) {
  5232             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_closed'), 
true);
  5233             $this->
ctrl->redirect($this);
  5236         $autosave_draft_id = 0;
  5238             $autosave_draft_id = $draft_id;
  5241         if ($oReplyEditForm->checkInput()) {
  5242             if ($this->objCurrentPost->getId() === 0) {
  5243                 $this->requestAction = 
'';
  5244                 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_parent_deleted'), 
true);
  5250             $frm = $oForumObjects[
'frm'];
  5254             if ($this->requestAction === 
'ready_showreply') {
  5255                 if (!$this->
access->checkAccess(
'add_reply', 
'', 
$ref_id)) {
  5256                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5260                     $oReplyEditForm->getInput(
'alias'),
  5261                     $this->objProperties->isAnonymized()
  5264                 if ($autosave_draft_id === 0) {
  5269                 $draftObj->setForumId($topicData->getTopPk());
  5270                 $draftObj->setThreadId($this->objCurrentTopic->getId());
  5271                 $draftObj->setPostId($this->objCurrentPost->getId());
  5273                 $draftObj->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
  5275                 $draftObj->setPostUserAlias($user_alias);
  5276                 $draftObj->setNotificationStatus($oReplyEditForm->getInput(
'notify') && !$this->
user->isAnonymous());
  5277                 $draftObj->setPostNotificationStatus($oReplyEditForm->getInput(
'notify_post') && !$this->
user->isAnonymous());
  5279                 $draftObj->setPostAuthorId($this->
user->getId());
  5282                 if ($autosave_draft_id === 0) {
  5283                     $draft_id = $draftObj->saveDraft();
  5285                     $draftObj->updateDraft();
  5286                     $draft_id = $draftObj->getDraftId();
  5291                     $oReplyEditForm->getInput(
'message'),
  5298                 if ($this->objProperties->isFileUploadAllowed()) {
  5299                     $file = $_FILES[
'userfile'];
  5300                     if (is_array($file) && !empty($file)) {
  5307                     $GLOBALS[
'ilAppEventHandler']->raise(
  5311                             'draftObj' => $draftObj,
  5312                             'obj_id' => $this->
object->getId(),
  5313                             'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
  5319                 if (is_array($frm_session_values)) {
  5320                     $frm_session_values[$thr_pk][
'openTreeNodes'][] = $this->objCurrentPost->getId();
  5324                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'save_draft_successfully'), 
true);
  5325                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  5326                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  5327                 $this->
ctrl->redirect($this, 
'viewThread');
  5330             $oReplyEditForm->setValuesByPost();
  5331             $this->requestAction = substr($this->requestAction, 6);
  5354         if ($this->objCurrentTopic->getId() === 0) {
  5355             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_deleted'), 
true);
  5356             $this->
ctrl->redirect($this);
  5359         if ($this->objCurrentTopic->isClosed()) {
  5360             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_thr_closed'), 
true);
  5361             $this->
ctrl->redirect($this);
  5364         if ($this->objCurrentPost->getId() === 0) {
  5365             $this->requestAction = 
'';
  5366             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'frm_action_not_possible_parent_deleted'));
  5372         if ($oReplyEditForm->checkInput()) {
  5375             $forumObj = $oForumObjects[
'forumObj'];
  5377             if (!$this->
user->isAnonymous() && in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
  5378                 if (!$this->
access->checkAccess(
'add_reply', 
'', 
$ref_id)) {
  5379                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5382                     $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5386                     $oReplyEditForm->getInput(
'alias'),
  5387                     $this->objProperties->isAnonymized()
  5391                     $this->
user->getId(),
  5392                     $this->objCurrentPost->getId(),
  5398                     $oReplyEditForm->getInput(
'message')
  5400                 $update_draft->setPostUserAlias($user_alias);
  5401                 $update_draft->setNotificationStatus($oReplyEditForm->getInput(
'notify') && !$this->
user->isAnonymous());
  5402                 $update_draft->setUpdateUserId($this->
user->getId());
  5403                 $update_draft->setPostAuthorId($this->
user->getId());
  5406                 $update_draft->updateDraft();
  5409                     $GLOBALS[
'ilAppEventHandler']->raise(
  5413                             'draftObj' => $update_draft,
  5414                             'obj_id' => $this->
object->getId(),
  5415                             'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
  5422                 foreach ($uploadedObjects as $mob) {
  5427                     $oReplyEditForm->getInput(
'message'),
  5429                     $update_draft->getDraftId()
  5434                 $file2delete = $oReplyEditForm->getInput(
'del_file');
  5435                 if (is_array($file2delete) && count($file2delete)) {
  5439                 if ($this->objProperties->isFileUploadAllowed()) {
  5440                     $file = $_FILES[
'userfile'];
  5441                     if (is_array($file) && !empty($file)) {
  5442                         $oFDForumDrafts->storeUploadedFiles();
  5447                 if (is_array($frm_session_values)) {
  5448                     $frm_session_values[$thr_pk][
'openTreeNodes'][] = $this->objCurrentPost->getId();
  5451                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'save_draft_successfully'), 
true);
  5452                 $this->
ctrl->clearParameters($this);
  5453                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  5454                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  5455                 $this->
ctrl->setParameter($this, 
'draft_id', $update_draft->getDraftId());
  5458             $this->
ctrl->clearParameters($this);
  5459             $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  5460             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  5461             $this->
ctrl->setParameter($this, 
'draft_id', $draft_id);
  5462             $this->
ctrl->setParameter($this, 
'action', 
'editdraft');
  5463             $oReplyEditForm->setValuesByPost();
  5467         $this->
ctrl->clearParameters($this);
  5468         $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  5469         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  5470         $this->
ctrl->redirect($this, 
'viewThread');
  5478         foreach ($oldMediaObjects as $oldMob) {
  5480             foreach ($curMediaObjects as $curMob) {
  5481                 if ($oldMob === $curMob) {
  5501             $this->
user->isAnonymous() ||
  5502             ($draft_obj instanceof 
ilForumPostDraft && $this->
user->getId() !== $draft_obj->getPostAuthorId())) {
  5503             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5506         $post_id = $this->objCurrentPost->getId();
  5508             $draft_id_to_delete = $draft_id;
  5509             $draft_obj = 
new ilForumPostDraft($this->
user->getId(), $post_id, $draft_id_to_delete);
  5511             if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() !== $draft_id_to_delete)) {
  5512                 $this->
ctrl->clearParameters($this);
  5513                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  5514                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  5515                 $this->
ctrl->redirect($this, 
'viewThread');
  5519         $this->
deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
  5522         $objFileDataForumDrafts->
delete([$draft_obj->getDraftId()]);
  5525             $GLOBALS[
'ilAppEventHandler']->raise(
  5529                     'draftObj' => $draft_obj,
  5530                     'obj_id' => $this->
object->getId(),
  5531                     'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
  5535         $draft_obj->deleteDraft();
  5537         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'delete_draft_successfully'), 
true);
  5538         $this->
ctrl->clearParameters($this);
  5539         $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  5540         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  5541         $this->
ctrl->redirect($this, 
'viewThread');
  5547             $this->requestAction !== 
'ready_showreply' &&
  5548             $this->
access->checkAccess(
'read', 
'', $this->object->getRefId()) &&
  5549             $this->
access->checkAccess(
'add_reply', 
'', $this->object->getRefId())
  5554                 $this->objProperties,
  5555                 $this->objCurrentTopic,
  5556                 $this->objCurrentPost,
  5557                 function (
string $message): 
string {
  5565             $this->
http->saveResponse($this->
http->response()->withBody(
  5567                     $action->executeAndGetResponseObject(),
  5573         $this->
http->sendResponse();
  5574         $this->
http->close();
  5580             $this->requestAction !== 
'ready_showreply' &&
  5581             $this->
access->checkAccess(
'read', 
'', $this->object->getRefId()) &&
  5582             $this->
access->checkAccess(
'add_thread', 
'', $this->object->getRefId())
  5587                 $this->objProperties,
  5588                 $this->objCurrentTopic,
  5589                 $this->objCurrentPost,
  5590                 function (
string $message): 
string {
  5598             $this->
http->saveResponse($this->
http->response()->withBody(
  5600                     $action->executeAndGetResponseObject(),
  5606         $this->
http->sendResponse();
  5607         $this->
http->close();
  5622             if (($this->objCurrentPost->getId() !== $node->
getId() || (
  5623                 !in_array($action, [
'showreply', 
'showedit', 
'censor', 
'delete'], 
true) &&
  5626                 if ($this->is_moderator && !$this->objCurrentTopic->isClosed() && !$node->
isActivated()) {
  5627                     $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5629                     $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5630                     $this->
ctrl->setParameter(
  5635                     $primary_action = $this->
ctrl->getLinkTarget(
  5637                         'askForPostActivation',
  5638                         (
string) $node->
getId()
  5640                     $primary_action_language_id = 
'activate_post';
  5641                     $this->
ctrl->clearParameters($this);
  5645                     $this->
access->checkAccess(
'add_reply', 
'', $this->
object->getRefId())
  5647                     $this->
ctrl->setParameter($this, 
'action', 
'showreply');
  5648                     $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5649                     $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5650                     $this->
ctrl->setParameter(
  5656                     $primary_action = $this->
ctrl->getLinkTarget(
  5659                         'reply_' . $node->
getId()
  5661                     $primary_action_language_id = 
'reply_to_postings';
  5662                     $this->
ctrl->clearParameters($this);
  5665                     !$this->objCurrentTopic->isClosed() &&
  5667                     !$this->
user->isAnonymous() &&
  5668                     ($node->
isOwner($this->
user->getId()) || $this->is_moderator)
  5670                     $this->
ctrl->setParameter($this, 
'action', 
'showedit');
  5671                     $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5673                     $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5674                     $this->
ctrl->setParameter(
  5679                     $actions[
'edit'] = $this->
ctrl->getLinkTarget($this, 
'viewThread', (
string) $node->
getId());
  5680                     $this->
ctrl->clearParameters($this);
  5682                 if (!$this->
user->isAnonymous()) {
  5683                     $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5685                     $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5686                     $this->
ctrl->setParameter(
  5691                     $this->
ctrl->setParameter($this, 
'viewmode', $this->selectedSorting);
  5693                     $read_undread_txt = 
'frm_mark_as_read';
  5694                     $read_undread_cmd = 
'markPostRead';
  5696                         $read_undread_txt = 
'frm_mark_as_unread';
  5697                         $read_undread_cmd = 
'markPostUnread';
  5699                     $actions[$read_undread_txt] = $this->
ctrl->getLinkTarget(
  5702                         (
string) $node->
getId()
  5705                     $this->
ctrl->clearParameters($this);
  5708                     $this->
ctrl->setParameterByClass(ilForumExportGUI::class, 
'top_pk', $node->
getForumId());
  5709                     $this->
ctrl->setParameterByClass(ilForumExportGUI::class, 
'thr_pk', $node->
getThreadId());
  5712                     $this->
ctrl->clearParameters($this);
  5715                     !$this->objCurrentTopic->isClosed() &&
  5716                     !$this->
user->isAnonymous() &&
  5719                     $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5721                     $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5722                     $this->
ctrl->setParameter(
  5727                     $actions[
'delete'] = $this->
ctrl->getFormAction($this, 
'deletePosting');
  5728                     $this->
ctrl->clearParameters($this);
  5730                 if ($this->is_moderator && !$this->objCurrentTopic->isClosed()) {
  5731                     $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5733                     $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5734                     $this->
ctrl->setParameter(
  5740                         $this->
ctrl->setParameter($this, 
'action', 
'viewThread');
  5741                         $actions[
'frm_revoke_censorship'] = $this->
ctrl->getFormAction($this, 
'revokeCensorship');
  5743                         $actions[
'frm_censorship'] = $this->
ctrl->getFormAction($this, 
'addCensorship');
  5745                     $this->
ctrl->clearParameters($this);
  5748         } elseif ($draft_id !== $draft->getDraftId() || !in_array($action, [
'deletedraft', 
'editdraft'])) {
  5750             $this->
ctrl->setParameter($this, 
'action', 
'publishdraft');
  5751             $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5752             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  5753             $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5754             $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  5755             $this->
ctrl->setParameter(
  5760             $primary_action = $this->
ctrl->getLinkTarget($this, 
'publishSelectedDraft', (
string) $node->
getId());
  5761             $primary_action_language_id = 
'publish';
  5762             $this->
ctrl->clearParameters($this);
  5764             $this->
ctrl->setParameter($this, 
'action', 
'editdraft');
  5765             $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5766             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  5767             $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  5768             $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5769             $this->
ctrl->setParameter(
  5774             $actions[
'edit'] = $this->
ctrl->getLinkTarget($this, 
'editDraft', 
'draft_edit_' . $draft->getDraftId());
  5775             $this->
ctrl->clearParameters($this);
  5777             $this->
ctrl->setParameter($this, 
'pos_pk', $node->
getId());
  5778             $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  5779             $this->
ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
  5780             $this->
ctrl->setParameter($this, 
'page', $pageIndex);
  5781             $this->
ctrl->setParameter(
  5786             $actions[
'delete'] = $this->
ctrl->getFormAction($this, 
'deletePostingDraft');
  5787             $this->
ctrl->clearParameters($this);
  5789             if ($draft_id !== 0 && $action === 
'editdraft') {
  5795         if ($actions !== [] && !$this->objCurrentTopic->isClosed()) {
  5797             foreach ($actions as $lng_id => 
$url) {
  5798                 if (
'frm_revoke_censorship' === $lng_id || 
'frm_censorship' === $lng_id) {
  5799                     $modalTemplate = 
new ilTemplate(
'tpl.forums_censor_modal.html', 
true, 
true, 
'Modules/Forum');
  5800                     $formID = str_replace(
'.', 
'_', uniqid(
'form', 
true));
  5801                     $modalTemplate->setVariable(
'FORM_ID', $formID);
  5804                         $modalTemplate->setVariable(
'BODY', $this->
lng->txt(
'forums_info_censor2_post'));
  5806                         $modalTemplate->setVariable(
'BODY', $this->
lng->txt(
'forums_info_censor_post'));
  5807                         $modalTemplate->touchBlock(
'message');
  5810                     $modalTemplate->setVariable(
'FORM_ACTION', 
$url);
  5812                     $content = $this->uiFactory->legacy($modalTemplate->get());
  5813                     $submitBtn = $this->uiFactory->button()->primary(
  5814                         $this->
lng->txt(
'submit'),
  5817                         static function (
string $id) use ($formID): 
string {
  5818                             return "$('#$id').click(function() { $('#$formID').submit(); return false; });";
  5821                     $modal = $this->uiFactory->modal()->roundtrip(
  5822                         $this->
lng->txt($lng_id),
  5824                     )->withActionButtons([$submitBtn]);
  5825                     $items[] = $this->uiFactory->button()->shy($this->
lng->txt($lng_id), 
'#')->withOnClick(
  5826                         $modal->getShowSignal()
  5829                     $this->modalActionsContainer[] = $modal;
  5833                 if (
'delete' === $lng_id) {
  5834                     $modal = $this->uiFactory->modal()->interruptive(
  5835                         $this->
lng->txt($lng_id),
  5836                         str_contains(
$url, 
'deletePostingDraft') ?
  5837                             $this->
lng->txt(
'forums_info_delete_draft') :
  5838                             $this->
lng->txt(
'forums_info_delete_post'),
  5840                     )->withActionButtonLabel(
  5841                         $this->
lng->txt(str_contains(
$url, 
'deletePostingDraft') ? 
'deletePostingDraft' : 
'deletePosting')
  5844                     $items[] = $this->uiFactory->button()->shy($this->
lng->txt($lng_id), 
'#')->withOnClick(
  5845                         $modal->getShowSignal()
  5848                     $this->modalActionsContainer[] = $modal;
  5854                 $items[] = $this->uiFactory->button()->shy($this->
lng->txt($lng_id), 
$url);
  5857             $dropdown = $this->uiFactory->dropdown()->standard($items);
  5858             $render_action_buttons = [$dropdown];
  5859             if (isset($primary_action, $primary_action_language_id)) {
  5860                 if ($primary_action_language_id === 
'activate_post') {
  5863                     $action_button = $this->uiFactory->button()->standard(
  5864                         $this->
lng->txt($primary_action_language_id),
  5868                 $tpl->
setVariable(
'MAIN_ACTION', $this->uiRenderer->render($action_button));
  5870             $tpl->
setVariable(
'DROPDOWN_ACTIONS', $this->uiRenderer->render($render_action_buttons));
  5878             $this->
user->isAnonymous() || !$this->
access->checkAccess(
'add_reply', 
'', $this->
object->getRefId()) ||
  5879             $this->
user->getId() !== $draft->getPostAuthorId()
  5881             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5890             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5899         if ($draftsFromHistory !== []) {
  5901             $modal->setHeading($this->
lng->txt(
'restore_draft_from_autosave'));
  5902             $modal->setId(
'frm_autosave_restore');
  5903             $form_tpl = 
new ilTemplate(
'tpl.restore_thread_draft.html', 
true, 
true, 
'Modules/Forum');
  5906             foreach ($draftsFromHistory as $history_instance) {
  5908                 $accordion->setId(
'acc_' . $history_instance->getHistoryId());
  5910                 if ($first_open === null) {
  5911                     $first_open = $history_instance->getHistoryId();
  5915                 $form_tpl->setCurrentBlock(
'list_item');
  5919                     $history_instance->getDraftDate(),
  5922                 $this->
ctrl->setParameter($this, 
'history_id', $history_instance->getHistoryId());
  5923                 $header = $history_date . 
': ' . $history_instance->getPostSubject();
  5926                     'tpl.restore_thread_draft_accordion_content.html',
  5931                 $accordion_tpl->setVariable(
'MESSAGE', 
$message);
  5932                 $accordion_tpl->setVariable(
  5934                     $this->uiRenderer->render(
  5935                         $this->uiFactory->button()->standard(
  5936                             $this->
lng->txt(
'restore'),
  5937                             $this->
ctrl->getLinkTarget($this, 
'restoreFromHistory')
  5941                 $accordion->addItem($header, $accordion_tpl->get());
  5943                 $form_tpl->setVariable(
'ACC_AUTO_SAVE', $accordion->getHTML());
  5944                 $form_tpl->parseCurrentBlock();
  5947             $form_tpl->setVariable(
'RESTORE_DATA_EXISTS', 
'found_threat_history_to_restore');
  5948             $modal->setBody($form_tpl->get());
  5950             $this->modal_history = $modal->getHTML();
  5962             $action === 
'showedit' && (
  5963                 (!$this->is_moderator && !$node->
isOwner($this->user->getId())) ||
  5964                 $this->
user->isAnonymous() ||
  5968             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5969         } elseif ($action === 
'showreply' && !$this->
access->checkAccess(
'add_reply', 
'', 
$ref_id)) {
  5970             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
  5973         $tpl->
setVariable(
'REPLY_ANKER', 
'reply_' . $this->objCurrentPost->getId());
  5976         if ($action !== 
'editdraft') {
  5977             switch ($this->objProperties->getSubjectSetting()) {
  5978                 case 'add_re_to_subject':
  5982                 case 'preset_subject':
  5983                     $subject = $this->objCurrentPost->getSubject();
  5986                 case 'empty_subject':
  5994                 if ($this->
ctrl->getCmd() === 
'savePost' || $this->
ctrl->getCmd() === 
'saveAsDraft') {
  5995                     $oEditReplyForm->setValuesByPost();
  5996                 } elseif ($this->
ctrl->getCmd() === 
'quotePost') {
  6004                     $oEditReplyForm->setValuesByPost();
  6005                     $oEditReplyForm->getItemByPostVar(
'message')->setValue(
  6010                                 $authorinfo->getAuthorName()
  6011                             ) . 
"\n" . $oEditReplyForm->getInput(
'message'),
  6016                     $oEditReplyForm->setValuesByArray([
  6017                         'draft_id' => $draft_id,
  6019                         'subject' => $subject,
  6027                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  6028                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  6030                 $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.js', 
true, 
true, 
'Modules/Forum');
  6031                 $jsTpl->setVariable(
  6032                     'IL_FRM_QUOTE_CALLBACK_SRC',
  6033                     $this->
ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
  6035                 $this->
ctrl->clearParameters($this);
  6036                 $this->tpl->addOnLoadCode($jsTpl->get());
  6040                 if ($this->
ctrl->getCmd() === 
'savePost') {
  6041                     $oEditReplyForm->setValuesByPost();
  6043                     $oEditReplyForm->setValuesByArray([
  6045                         'subject' => $this->objCurrentPost->getSubject(),
  6047                             $this->objCurrentPost->getMessage(),
  6050                         'notify' => $this->objCurrentPost->isNotificationEnabled() && !$this->
user->isAnonymous(),
  6053                         'draft_id' => $draft_id
  6057                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getParentId());
  6058                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  6059                 $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.js', 
true, 
true, 
'Modules/Forum');
  6060                 $jsTpl->setVariable(
  6061                     'IL_FRM_QUOTE_CALLBACK_SRC',
  6062                     $this->
ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
  6064                 $this->
ctrl->clearParameters($this);
  6065                 $this->tpl->addOnLoadCode($jsTpl->get());
  6069                 if (in_array($this->
ctrl->getCmd(), [
'saveDraft', 
'updateDraft', 
'publishDraft'])) {
  6070                     $oEditReplyForm->setValuesByPost();
  6071                 } elseif ($draft_id > 0) {
  6074                         $this->
user->getId(),
  6075                         $this->objCurrentPost->getId(),
  6078                     $oEditReplyForm->setValuesByArray([
  6079                         'alias' => $draftObject->getPostUserAlias(),
  6080                         'subject' => $draftObject->getPostSubject(),
  6082                             $draftObject->getPostMessage(),
  6085                         'notify' => $draftObject->isNotificationEnabled() && !$this->
user->isAnonymous(),
  6088                         'draft_id' => $draft_id
  6092                 $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  6093                 $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  6095                 $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.js', 
true, 
true, 
'Modules/Forum');
  6096                 $jsTpl->setVariable(
  6097                     'IL_FRM_QUOTE_CALLBACK_SRC',
  6098                     $this->
ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
  6100                 $this->
ctrl->clearParameters($this);
  6101                 $this->tpl->addOnLoadCode($jsTpl->get());
  6105         $this->
ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
  6106         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
  6107         $this->
ctrl->setParameter($this, 
'page', (
int) ($this->httpRequest->getQueryParams()[
'page'] ?? 0));
  6108         $this->
ctrl->setParameter(
  6113         $this->
ctrl->setParameter(
  6118         if ($action !== 
'editdraft') {
  6119             $tpl->
setVariable(
'FORM', $oEditReplyForm->getHTML());
  6121         $this->
ctrl->clearParameters($this);
  6126         $this->
ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
  6129             $this->uiFactory->button()->standard(
  6130                 $this->
lng->txt(
'reset_limited_view_button'),
  6131                 $this->
ctrl->getLinkTarget($this, 
'resetLimitedView')
  6135         return $this->uiRenderer->render(
  6138                 ->
info($this->
lng->txt(
'reset_limited_view_info'))
  6139                 ->withButtons($buttons)
  6148                 $this->refinery->kindlyTo()->string(),
 
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
 
static _getMediaObjects(string $a_text, int $a_direction=0)
Returns all media objects found in the passed string. 
 
Class ilForumStatisticsTableGUI. 
 
static _getRTEClassname()
 
const PAGE_NAME_THREAD_OVERVIEW
 
array $modalActionsContainer
 
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
setOffset(int $a_offset)
set dataset offset 
 
renderPostContent(ilTemplate $tpl, ilForumPost $node, string $action, int $pageIndex, int $postIndex)
 
setDisplayConfirmPostActivation(bool $status=false)
 
buildThreadForm(bool $isDraft=false)
 
ILIAS HTTP Services $http
 
getFirstPostNode(int $tree_id)
 
static get(string $a_var)
 
initEditCustomForm(ilPropertyFormGUI $a_form)
 
isForumNotificationEnabled(int $user_id)
 
An entity that renders components to a string output. 
 
button(string $caption, string $cmd)
 
performMergeThreadsObject()
 
setPostSubject(string $post_subject)
 
getThreadEditingForm(int $a_thread_id)
 
ilObjectDataCache $ilObjDataCache
 
getQuotationHTMLAsynchObject()
 
bool $display_confirm_post_activation
 
Class Forum core functions for forum. 
 
static getInstancesByDraftId(int $draft_id)
 
initializeThreadOffsetAndLimit(ilForumThreadObjectTableGUI $tbl)
 
static moveMediaObjects(string $post_message, string $source_type, int $source_id, string $target_type, int $target_id, int $direction=0)
 
ilForumProperties $objProperties
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static lookupForumIdByObjId(int $obj_id)
 
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item. 
 
setUserId(?int $a_user_id)
 
Class ilForumExplorerGUI. 
 
getResetLimitedViewInfo()
 
ILIAS DI RBACServices $rbac
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
deliverFile(string $file)
 
GUI class for the workflow of copying objects. 
 
getEditTitleModal(ilForumTopic $topic)
 
static switchColor(int $a_num, string $a_css1, string $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
 
ILIAS GlobalScreen Services $globalScreen
 
renderSortationControl(int $currentSorting)
 
setMessage(string $a_message)
 
static _goto($a_target, $a_thread=0, $a_posting=0)
 
disableForumNotificationObject()
 
ilNavigationHistory $ilNavigationHistory
 
prepareOutput(bool $show_sub_objects=true)
 
setMDB2WhereCondition(string $query_string, array $data_type, array $data_value)
 
autosaveDraftAsyncObject()
 
Class ChatMainBarProvider . 
 
readonly bool $in_page_editor_style_context
 
getThreadProperties(ilForumTopic $forum_topic)
 
static _setRichTextEditorUserState(int $a_state)
Sets the state of the rich text editor visibility for the current user. 
 
doHistoryCheck(int $draftId)
 
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
 
markTopThreadInOverview(ilForumTopic $current_thread, Item $list_item)
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory) 
 
initializeThreadSortation(ilForumThreadObjectTableGUI $tbl)
 
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
 
Psr Http Message ServerRequestInterface $httpRequest
 
ILIAS Style Content GUIService $content_style_gui
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
 
ilForumTopic $objCurrentTopic
 
static lookupTitle(int $a_topic_id)
 
Class ilForumSaveAsyncDraftAction. 
 
disableForumNotification(int $user_id)
 
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string. 
 
Class ilForumDraftsTableGUI. 
 
getStickyActionForThread(ilForumTopic $forum_topic, int $ref_id)
 
publishThreadDraftObject()
 
addDraftButtonIfDraftsExists(string $cmd)
 
setDbTable(string $dbTable)
 
setRepositoryMode(bool $a_repositorymode)
 
handleCensorship(bool $wasRevoked=false)
 
static lookupAutosaveInterval()
 
Class ilForumSettingsGUI. 
 
getRequestedThreadSortation()
 
ensureValidPageForCurrentPosting(array $subtree_nodes, array $pagedPostings, int $pageSize, ilForumPost $firstForumPost)
 
setVariable(string $variable, $value='')
Sets the given variable to the given value. 
 
isOwner(int $a_user_id=0)
 
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
 
renderSplitButton(ilTemplate $tpl, string $action, bool $is_post, ilForumPost $node, int $pageIndex=0, ilForumPostDraft $draft=null)
 
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress 
 
Class ilForumNotification. 
 
setForumRefId(int $a_ref_id)
 
setMapper(ilForum $mapper)
 
static lookupForumIdByRefId(int $ref_id)
 
addActivationFormModal(ilForumPost $node)
 
prepareFormOutput(string $a_text)
 
buildMinimalThreadForm(bool $isDraft=false)
 
static lookupCreationDate(int $thread_id)
 
confirmMergeThreadsObject()
 
convertDate(string $date)
 
isPostNotificationEnabled()
 
ilForumSettingsGUI $forum_settings_gui
 
static createDraftBackup(int $draft_id)
 
saveThreadAsDraftObject()
 
getPostRootNode(bool $isModerator=false, bool $preventImplicitRead=false)
 
renderDraftContent(ilTemplate $tpl, string $action, ilForumPost $referencePosting, array $drafts)
 
Class ilForumTopicTableGUI. 
 
Class ilForumDraftHistory. 
 
setColumnSettings(ilColumnGUI $column_gui)
 
withOnLoadCode(Closure $binder)
 
static _lookupObjId(int $ref_id)
 
getActionsForThreadOverview(int $ref_id, ilForumTopic $forum_topic)
 
static getInstance(int $a_obj_id=0)
 
mergeThreads(int $source_id, int $target_id)
 
deleteSelectedDraft(ilForumPostDraft $draft_obj=null)
 
getCenterColumnHTML()
Get center column. 
 
getSortationViewControl()
 
Export User Interface Class. 
 
publishDraftObject(bool $use_replyform=true)
 
afterSave(ilObject $new_object)
 
ilForumPost $objCurrentPost
 
GUI class for public user profile presentation. 
 
string $confirmation_gui_html
 
hideToolbar($a_flag=null)
 
static http()
Fetches the global http state from ILIAS. 
 
setVariable($variable, $value='')
Sets a variable value. 
 
updateCustom(ilPropertyFormGUI $form)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ilGlobalTemplateInterface $tpl
 
createEmptyThread(bool $createFromDraft=false)
Refactored thread creation to method, refactoring to a separate class should be done in next refactor...
 
static _lookupTitle(int $obj_id)
 
saveUserNotificationSettingsObject()
 
setOrderDirection(string $a_order_direction)
 
deletePostingDraftObject()
 
renderViewModeControl(int $currentViewMode)
 
static getPublicUserAlias(string $user_alias, bool $is_anonymized)
 
Class ilForumModeratorsGUI. 
 
handleFormInput(string $a_text, bool $a_stripslashes=true)
 
performThreadsActionObject()
 
static saveMediaObjects(string $post_message, string $target_type, int $target_id, int $direction=0)
 
Forum export to HTML and Print. 
 
static isAutoSavePostDraftAllowed()
 
setChangeDate(?string $a_changedate)
 
Column user interface class. 
 
saveTopLevelDraftObject()
 
enableForumNotificationObject()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getEditFormCustomValues(array &$a_values)
 
getLinkActionForThread(int $ref_id, string $title, string $cmd, int $thread_id=null)
 
prepareText(string $text, int $edit=0, string $quote_user='', string $type='')
 
static _lookupObjIdForForumId(int $a_for_id)
 
Class ilObjectGUI Basic methods of all Output classes. 
 
ilObjForumGUI: ilPermissionGUI, ilForumExportGUI, ilInfoScreenGUI  ilObjForumGUI: ilColumnGUI...
 
Common interface to all items. 
 
const PAGE_SIZE_THREAD_OVERVIEW
 
cancelMoveThreadsObject()
 
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
 
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id 
 
countUserArticles(int $a_user_id)
 
performMoveThreadsObject()
 
isWritingWithPseudonymAllowed()
 
ilForumThreadSettingsSessionStorage $selected_post_storage
 
__construct($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
 
static getThreadDraftData(int $post_author_id, int $forum_id)
 
askForPostActivationObject()
 
static _lookupObjectId(int $ref_id)
 
ensureThreadBelongsToForum(int $objId, ilForumTopic $thread)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
restoreFromHistoryObject()
 
static getInstanceByType(string $type)
 
setBlockProperty(string $a_block_type, string $a_property, string $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
 
getOpenCloseActionForThread(ilForumTopic $forum_topic, int $ref_id)
 
static getSyntaxStylePath()
 
editStylePropertiesObject()
 
deleteThreadDraftsObject()
 
performDeleteThreadsObject()
 
ILIAS Style Content Object ObjectFacade $content_style_domain
 
Last visited history for repository items. 
 
createTopLevelPostObject()
 
unlinkFilesByMD5Filenames($hashed_filename_or_filenames)
 
setOrderField(string $a_order_field)
 
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
 
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
toggleThreadNotificationObject()
 
isUserAllowedToDeactivateNotification()
 
enableForumNotification(int $user_id)
 
generateThread(ilForumTopic $thread, string $message, bool $notify, bool $notify_posts, bool $status=true, bool $withFirstVisibleEntry=true)
 
static isSavePostDraftAllowed()
 
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
deliverDraftZipFileObject()
 
updateThreadDraftObject()
 
displayConfirmPostActivation()
 
static _isModerator(int $a_ref_id, int $a_usr_id)
 
A news item can be created by different sources. 
 
static getSortedDrafts(int $usrId, int $threadId, int $sorting=ilForumProperties::VIEW_DATE_ASC)
 
ilForumMoveTopicsExplorer 
 
getRightColumnHTML()
Display right column. 
 
getSafePostCommands()
This method must return a list of safe POST commands. 
 
deleteMobsOfDraft(int $draft_id, string $message)
 
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template 
 
countActiveUserArticles(int $a_user_id)
 
editThreadDraftObject(ilPropertyFormGUI $form=null)
 
autosaveThreadDraftAsyncObject()
 
static getFirstNewsIdForContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="")
Get first new id of news set related to a certain context. 
 
static _getRichTextEditorUserState()
Gets the state of the rich text editor visibility for the current user. 
 
const LP_CONTEXT_REPOSITORY
 
This class represents a text area property in a property form. 
 
const PRESENTATION_MODE_PRESENTATION
presentation mode for requesting 
 
deletePost($postIdOrRecord, bool $raiseEvents=true)
 
setLimit(int $a_limit=0, int $a_default_limit=0)
 
confirmDeleteThreadDraftsObject()
 
publishSelectedDraftObject()
 
createThread(ilForumPostDraft $draft, bool $createFromDraft=false)
Refactored thread creation to method, refactoring to a separate class should be done in next refactor...
 
postCensorship(ilObjForum $forum, string $message, int $pos_pk, int $cens=0)
 
toggleExplorerNodeState()
Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed...
 
ilPropertyFormGUI $replyEditForm
 
static lookupForumIdByTopicId(int $a_topic_id)
 
decorateWithAutosave(ilPropertyFormGUI $form)
 
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output. 
 
delete(array $posting_ids_to_delete=null)
 
This describes a Standard Dropdown. 
 
static getOverallRatingForObject(int $a_obj_id, string $a_obj_type, int $a_sub_obj_id=null, string $a_sub_obj_type=null, int $a_category_id=null)
Get overall rating for an object. 
 
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block. 
 
static newInstanceByDraftId(int $draft_id)
 
setForumId(int $a_obj_id)
 
static getDraftInstancesByUserId(int $user_id)
 
getUnsafeGetCommands()
This method must return a list of unsafe GET commands. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getRequestedThreadOffset()
 
static getSearchBlockHTML(string $a_title)
 
eventsFormBuilder(?array $predefined_values=null)
 
addHeaderAction()
Add header action menu. 
 
addItem(int $a_ref_id, string $a_link, string $a_type, string $a_title="", ?int $a_sub_obj_id=null, string $a_goto_link="")
Add an item to the stack. 
 
Interface ilCtrlSecurityInterface provides ilCtrl security information. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
static set(string $a_var, $a_val)
Set a value. 
 
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call 
 
checkDraftAccess(int $draftId)
 
performPostActivationObject()
 
isThreadNotificationEnabled(int $user_id, int $thread_id)
 
toggleExplorerNodeStateObject()
 
ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI  ilForumPageGUI: ilPublicUserProfi...