85    public function __construct($a_data, $a_id, $a_call_by_reference = 
true, $a_prepare_output = 
true)
 
   89        $this->ctrl = 
$DIC->ctrl();
 
   90        $this->ctrl->saveParameter($this, array(
'ref_id', 
'cmdClass'));
 
   92        $this->tpl = 
$DIC->ui()->mainTemplate();
 
   93        $this->lng = 
$DIC->language();
 
   94        $this->httpRequest = 
$DIC->http()->request();
 
   95        $this->uiFactory = 
$DIC->ui()->factory();
 
   96        $this->uiRenderer = 
$DIC->ui()->renderer();
 
   98        $this->access = 
$DIC->access();
 
   99        $this->ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  100        $this->tabs = 
$DIC->tabs();
 
  101        $this->
error = $DIC[
'ilErr'];
 
  103        $this->
user = $DIC->user();
 
  105        $this->toolbar = 
$DIC->toolbar();
 
  106        $this->repositoryTree = 
$DIC->repositoryTree();
 
  108        $this->rbac = 
$DIC->rbac();
 
  109        $this->locator = 
$DIC[
'ilLocator'];
 
  112        parent::__construct($a_data, $a_id, $a_call_by_reference, 
false);
 
  114        $this->lng->loadLanguageModule(
'forum');
 
  121        $this->is_moderator = $this->access->checkAccess(
'moderate_frm', 
'', 
$_GET[
'ref_id']);
 
  124        $this->objCurrentTopic = 
new ilForumTopic((
int) 
$_GET[
'thr_pk'], $this->is_moderator);
 
  127        $this->objCurrentPost = 
new ilForumPost((
int) 
$_GET[
'pos_pk'], $this->is_moderator);
 
  129        $this->requestAction = (string) ($this->httpRequest->getQueryParams()[
'action'] ?? 
'');
 
  135        if (!is_array($forumValues)) {
 
  140        $threadId = $this->httpRequest->getQueryParams()[
'thr_pk'] ?? 0;
 
  141        if ((
int) $threadId > 0 && !is_array($forumValues[(
int) $threadId])) {
 
  142            $forumValues[(int) $threadId] = [];
 
  154        if ((
int) $thread->
getForumId() !== (
int) $forumId) {
 
  155            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  167            $this->tpl->addJavascript(
'./Modules/Forum/js/autosave.js');
 
  168            $autosave_cmd = 
'autosaveDraftAsync';
 
  169            if ($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0) {
 
  170                $autosave_cmd = 
'autosaveThreadDraftAsync';
 
  172            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
  173            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
  174            $draft_id = (int) 
$_GET[
'draft_id'] > 0 ?  (
int) 
$_GET[
'draft_id'] : 0;
 
  175            $this->ctrl->setParameter($this, 
'draft_id', $draft_id);
 
  177            $this->tpl->addOnLoadCode(
 
  178                "il.Language.setLangVar('saving', " . json_encode($this->lng->txt(
'saving')) . 
");" 
  181            $this->tpl->addOnLoadCode(
'il.ForumDraftsAutosave.init(' . json_encode(array(
 
  183                    'draft_id' => $draft_id,
 
  184                    'interval' => $interval * 1000,
 
  185                    'url' => $this->ctrl->getFormAction($this, $autosave_cmd, 
'', 
true, 
false),
 
  186                    'selectors' => array(
 
  187                        'form' => 
'#form_' . 
$form->getId()
 
  213            strtolower($this->ctrl->getCmd()),
 
  214            array_map(
'strtolower', array(
'createTopLevelPost', 
'saveTopLevelPost'))
 
  220        $next_class = $this->ctrl->getNextClass($this);
 
  221        $cmd = $this->ctrl->getCmd();
 
  223        $exclude_cmds = array(
 
  224            'viewThread', 
'markPostUnread',
'markPostRead', 
'showThreadNotification',
 
  225            'performPostActivation',
 
  226            'askForPostActivation', 
'askForPostDeactivation',
 
  227            'toggleThreadNotification', 
'toggleThreadNotificationTab',
 
  228            'toggleStickiness', 
'cancelPost', 
'savePost', 
'saveTopLevelPost', 
'createTopLevelPost', 
'quotePost', 
'getQuotationHTMLAsynch',
 
  229            'autosaveDraftAsync', 
'autosaveThreadDraftAsync',
 
  230            'saveAsDraft', 
'editDraft', 
'updateDraft', 
'deliverDraftZipFile', 
'deliverZipFile', 
'cancelDraft',
 
  231            'deleteThreadDrafts',
 
  232            'deletePosting', 
'deletePostingDraft', 
'revokeCensorship', 
'addCensorship',
 
  235        if (!in_array($cmd, $exclude_cmds)) {
 
  239        if (!$this->
getCreationMode() && !$this->ctrl->isAsynch() && $this->access->checkAccess(
'read', 
'', 
$_GET[
'ref_id'])) {
 
  241                (
int) 
$_GET[
'ref_id'],
 
  247        switch ($next_class) {
 
  248            case 'ilforumsettingsgui':
 
  253            case 'ilrepositoryobjectsearchgui':
 
  256                $this->tabs->activateTab(
"forums_threads");
 
  257                $this->ctrl->setReturn($this, 
'view');
 
  259                    $this->object->getRefId(),
 
  263                $this->ctrl->forwardCommand($search_gui);
 
  266            case 'ilpermissiongui':
 
  268                $this->ctrl->forwardCommand($perm_gui);
 
  271            case 'ilforumexportgui':
 
  273                $this->ctrl->forwardCommand($fex_gui);
 
  277            case 'ilforummoderatorsgui':
 
  279                $this->ctrl->forwardCommand($fm_gui);
 
  282            case 'ilinfoscreengui':
 
  290            case 'ilpublicuserprofilegui':
 
  292                $add = $this->getUserProfileAdditional((
int) 
$_GET[
'ref_id'], (
int) 
$_GET[
'user']);
 
  293                $profile_gui->setAdditional($add);
 
  294                $ret = $this->ctrl->forwardCommand($profile_gui);
 
  295                $this->tpl->setContent(
$ret);
 
  298            case 'ilobjectcopygui':
 
  301                $this->ctrl->forwardCommand($cp);
 
  305                $this->tabs->activateTab(
'export');
 
  307                $exp->addFormat(
'xml');
 
  308                $this->ctrl->forwardCommand($exp);
 
  312                if (!$this->objProperties->isIsThreadRatingEnabled() || $this->user->isAnonymous()) {
 
  313                    $this->
error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
 
  316                if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  317                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  323                $rating_gui->setObject($this->object->getId(), $this->object->getType(), $this->objCurrentTopic->getId(), 
'thread');
 
  325                $this->ctrl->setParameter($this, 
'thr_pk', (
int) $this->objCurrentTopic->getId());
 
  326                $this->ctrl->forwardCommand($rating_gui);
 
  329                $this->objCurrentTopic->setAverageRating($avg[
'avg']);
 
  330                $this->objCurrentTopic->update();
 
  332                $this->ctrl->redirect($this, 
"showThreads");
 
  335            case 'ilcommonactiondispatchergui':
 
  337                $this->ctrl->forwardCommand($gui);
 
  340            case "ilcontainernewssettingsgui":
 
  344                $this->lng->loadLanguageModule(
'cont');
 
  345                $this->tabs_gui->activateSubTab(
'cont_news_settings');
 
  347                $news_set_gui->setNewsBlockForced(
true);
 
  348                $news_set_gui->setPublicNotification(
true);
 
  349                $this->ctrl->forwardCommand($news_set_gui);
 
  361                if (isset(
$_POST[
'select_cmd2'])) {
 
  365                if (isset(
$_POST[
'selected_cmd']) && 
$_POST[
'selected_cmd'] != 
null) {
 
  366                    $member_cmd = array(
'enableAdminForceNoti', 
'disableAdminForceNoti', 
'enableHideUserToggleNoti', 
'disableHideUserToggleNoti');
 
  367                    in_array(
$_POST[
'selected_cmd'], $member_cmd) ? $cmd = 
$_POST[
'selected_cmd'] : $cmd = 
'performThreadsAction';
 
  368                } elseif (!$cmd && !
$_POST[
'selected_cmd']) {
 
  369                    $cmd = 
'showThreads';
 
  379        if ($cmd != 
'viewThreadObject' && $cmd != 
'showUserObject') {
 
  389        $this->ctrl->setCmd(
'showSummary');
 
  390        $this->ctrl->setCmdClass(
'ilinfoscreengui');
 
  400        $this->forum_settings_gui->getCustomForm($a_form);
 
  408        $this->forum_settings_gui->getCustomValues($a_values);
 
  416        $this->forum_settings_gui->updateCustomValues($a_form);
 
  426        $this->ctrl->setParameter($this, 
'thr_pk', $a_thread_id);
 
  427        $form->setFormAction($this->ctrl->getFormAction($this, 
'updateThread'));
 
  430        $ti_prop->setRequired(
true);
 
  431        $ti_prop->setMaxLength(255);
 
  432        $ti_prop->setSize(50);
 
  433        $form->addItem($ti_prop);
 
  435        $form->addCommandButton(
'updateThread', $this->lng->txt(
'save'));
 
  436        $form->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
 
  447        if (!$this->is_moderator) {
 
  448            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  451        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  452            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  455        $thread = new \ilForumTopic($threadId);
 
  458        $this->tabs->activateTab(
'forums_threads');
 
  462            $form->setValuesByArray(array(
 
  463                'title' => $thread->getSubject()
 
  467        $this->tpl->setContent(
$form->getHTML());
 
  475        if (!$this->is_moderator) {
 
  476            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  479        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  480            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  483        if (!$this->objCurrentTopic->getId()) {
 
  491        if (!
$form->checkInput()) {
 
  492            $form->setValuesByPost();
 
  497        $this->objCurrentTopic->setSubject(
$form->getInput(
'title'));
 
  498        $this->objCurrentTopic->updateThreadTitle();
 
  500        ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
 
  506        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  507            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  510        $this->
object->markAllThreadsRead($this->
user->getId());
 
  531        if ($this->objProperties->getThreadSorting() == 1 && $this->is_moderator) {
 
  532            $this->tabs->addSubTabTarget(
'show', $this->ctrl->getLinkTarget($this, 
'showThreads'), 
'showThreads', get_class($this), 
'', $subtab == 
'showThreads'? 
true : 
false);
 
  533            $this->tabs->addSubTabTarget(
'sorting_header', $this->ctrl->getLinkTarget($this, 
'sortThreads'), 
'sortThreads', get_class($this), 
'', $subtab == 
'sortThreads'? 
true : 
false);
 
  539        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  540            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  543        $cmd = $this->ctrl->getCmd();
 
  544        $frm = $this->
object->Forum;
 
  545        $frm->setForumId($this->object->getId());
 
  546        $frm->setForumRefId($this->object->getRefId());
 
  547        $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
  549        $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_liste.html', 
'Modules/Forum');
 
  551        if ((
int) strlen($this->confirmation_gui_html)) {
 
  552            $this->tpl->setVariable(
'CONFIRMATION_GUI', $this->confirmation_gui_html);
 
  556        if ($this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) && !$this->hideToolbar()) {
 
  558            $btn->setUrl($this->ctrl->getLinkTarget($this, 
'createThread'));
 
  559            $btn->setCaption(
'forums_new_thread');
 
  560            $this->toolbar->addStickyItem($btn);
 
  564        if ($this->
user->getId() != ANONYMOUS_USER_ID && !(
int) strlen($this->confirmation_gui_html)) {
 
  565            $this->toolbar->addButton(
 
  566                $this->lng->txt(
'forums_mark_read'),
 
  567                $this->ctrl->getLinkTarget($this, 
'markAllRead'),
 
  571            $this->ctrl->clearParameters($this);
 
  576                $this->
user->getId(),
 
  579            if (count($drafts) > 0) {
 
  583                    $this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())
 
  585                $draftsTable->setData($drafts);
 
  586                $this->tpl->setVariable(
'THREADS_DRAFTS_TABLE', $draftsTable->getHTML());
 
  591        $topicData = $frm->getOneTopic();
 
  594            $frm->setDbTable(
'frm_data');
 
  595            $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
 
  596            $frm->updateVisits($topicData[
'top_pk']);
 
  598            if (!in_array($cmd, array(
'showThreads', 
'sortThreads'))) {
 
  599                $cmd = 
'showThreads';
 
  606                (
int) 
$_GET[
'ref_id'],
 
  609                $this->
settings->get(
'forum_overview')
 
  612            $tbl->setMapper($frm)->fetchData();
 
  613            $this->tpl->setVariable(
'THREADS_TABLE', 
$tbl->getHTML());
 
  618        $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
 
  631        if (!$render_drafts) {
 
  635        $frm = $this->
object->Forum;
 
  638        $drafts = $draftsObjects[$node->getId()];
 
  640        if (is_array($drafts)) {
 
  641            foreach ($drafts as $draft) {
 
  646                if (isset($edit_draft_id) && $edit_draft_id == $node->getId()) {
 
  652                $filesOfDraft = $tmp_file_obj->getFilesOfPost();
 
  653                ksort($filesOfDraft);
 
  655                if (count($filesOfDraft)) {
 
  657                        foreach ($filesOfDraft as $file) {
 
  658                            $this->tpl->setCurrentBlock(
'attachment_download_row');
 
  659                            $this->ctrl->setParameter($this, 
'draft_id', $tmp_file_obj->getDraftId());
 
  660                            $this->ctrl->setParameter($this, 
'file', $file[
'md5']);
 
  661                            $this->tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
  662                            $this->tpl->setVariable(
'TXT_FILENAME', $file[
'name']);
 
  663                            $this->ctrl->setParameter($this, 
'file', 
'');
 
  664                            $this->ctrl->setParameter($this, 
'draft_id', 
'');
 
  665                            $this->ctrl->clearParameters($this);
 
  666                            $this->tpl->parseCurrentBlock();
 
  669                        $this->tpl->setCurrentBlock(
'attachments');
 
  670                        $this->tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt(
'forums_attachments'));
 
  672                        if (count($filesOfDraft) > 1) {
 
  674                            $download_zip_button->setCaption($this->lng->txt(
'download'), 
false);
 
  675                            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
  676                            $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 
'deliverDraftZipFile'));
 
  677                            $this->ctrl->setParameter($this, 
'draft_id', 
'');
 
  678                            $this->tpl->setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
 
  680                        $this->tpl->parseCurrentBlock();
 
  688                $rowCol = 
'tblrowmarked';
 
  690                $this->tpl->setVariable(
'ROWCOL', 
' ' . $rowCol);
 
  691                $this->tpl->setVariable(
'DEPTH', (
int) ($node->getDepth() - 1));
 
  694                $this->ctrl->setParameter($this, 
'pos_pk', $node->getId());
 
  695                $this->ctrl->setParameter($this, 
'thr_pk', $node->getThreadId());
 
  696                $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
  698                $backurl = urlencode($this->ctrl->getLinkTarget($this, 
'viewThread', $node->getId()));
 
  700                $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  701                $this->ctrl->setParameter($this, 
'thr_pk', $node->getThreadId());
 
  702                $this->ctrl->setParameter($this, 
'user', $draft->getPostDisplayUserId());
 
  705                    $draft->getPostAuthorId(),
 
  706                    $draft->getPostDisplayUserId(),
 
  707                    $draft->getPostUserAlias(),
 
  710                        'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
  714                $this->ctrl->clearParameters($this);
 
  716                if ($authorinfo->hasSuffix()) {
 
  717                    $this->tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
 
  718                    $this->tpl->setVariable(
'USR_NAME', $draft->getPostUserAlias());
 
  720                    $this->tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
  721                    if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
 
  722                        $this->tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
 
  725                $this->tpl->setVariable(
'DRAFT_ANCHOR', 
'draft_' . $draft->getDraftId());
 
  727                $this->tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
 
  730                    if ($authorinfo->getAuthor()->getGender() == 
'f') {
 
  731                        $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
 
  732                    } elseif ($authorinfo->getAuthor()->getGender() == 
'm') {
 
  733                        $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
 
  734                    } elseif ($authorinfo->getAuthor()->getGender() == 
'n') {
 
  735                        $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_n'));
 
  740                if ($draft->getUpdateUserId() > 0) {
 
  741                    $spanClass = 
'small';
 
  744                        $spanClass = 
'moderator_small';
 
  747                    $draft->setPostUpdate($draft->getPostUpdate());
 
  749                    $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  750                    $this->ctrl->setParameter($this, 
'thr_pk', $node->getThreadId());
 
  751                    $this->ctrl->setParameter($this, 
'user', $node->getUpdateUserId());
 
  752                    $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
  755                        $draft->getPostAuthorId(),
 
  756                        $draft->getUpdateUserId(),
 
  757                        $draft->getPostUserAlias(),
 
  760                            'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
  764                    $this->ctrl->clearParameters($this);
 
  766                    $this->tpl->setVariable(
'POST_UPDATE_TXT', $this->lng->txt(
'edited_on') . 
': ' . $frm->convertDate($draft->getPostUpdate()) . 
' - ' . strtolower($this->lng->txt(
'by')));
 
  767                    $this->tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
  768                    if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
 
  769                        $this->tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
 
  775                $draft->setPostMessage($frm->prepareText($draft->getPostMessage()));
 
  777                $this->tpl->setVariable(
'SUBJECT', $draft->getPostSubject());
 
  778                $this->tpl->setVariable(
'POST_DATE', $frm->convertDate($draft->getPostDate()));
 
  780                if (!$node->isCensored() || ($this->objCurrentPost->getId() == $node->getId() && 
$action === 
'censor')) {
 
  784                        $spanClass = 
'moderator';
 
  787                    if ($draft->getPostMessage() == strip_tags($draft->getPostMessage())) {
 
  789                        $draft->setPostMessage(nl2br($draft->getPostMessage()));
 
  792                    if ($spanClass != 
"") {
 
  799                if (!$this->objCurrentTopic->isClosed() && 
$action === 
'deletedraft') {
 
  800                    if ($this->
user->getId() != ANONYMOUS_USER_ID && $draft->getDraftId() == (
int) 
$_GET[
'draft_id']) {
 
  802                        $this->tpl->setVariable(
'FORM', $this->getDeleteDraftFormHTML());
 
  804                } elseif (
$action === 
'editdraft' && (
int) $draft->getDraftId() == (
int) 
$_GET[
'draft_id']) {
 
  806                    $this->tpl->setVariable(
'EDIT_DRAFT_ANCHOR', 
'draft_edit_' . $draft->getDraftId());
 
  807                    $this->tpl->setVariable(
'DRAFT_FORM', $oEditReplyForm->getHTML() . $this->modal_history);
 
  810                $this->tpl->parseCurrentBlock();
 
  828        $frm = $this->
object->Forum;
 
  833        $filesOfPost = $tmp_file_obj->getFilesOfPost();
 
  835        if (count($filesOfPost)) {
 
  836            if ($node->
getId() != $this->objCurrentPost->getId() || 
$action !== 
'showedit') {
 
  837                foreach ($filesOfPost as $file) {
 
  838                    $this->tpl->setCurrentBlock(
'attachment_download_row');
 
  839                    $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
  840                    $this->ctrl->setParameter($this, 
'file', $file[
'md5']);
 
  841                    $this->tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
  842                    $this->tpl->setVariable(
'TXT_FILENAME', $file[
'name']);
 
  843                    $this->ctrl->clearParameters($this);
 
  844                    $this->tpl->parseCurrentBlock();
 
  846                $this->tpl->setCurrentBlock(
'attachments');
 
  847                $this->tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt(
'forums_attachments'));
 
  849                if (count($filesOfPost) > 1) {
 
  851                    $download_zip_button->setCaption($this->lng->txt(
'download'), 
false);
 
  852                    $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
  853                    $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 
'deliverZipFile'));
 
  855                    $this->tpl->setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
 
  858                $this->tpl->parseCurrentBlock();
 
  865        $this->tpl->setVariable(
'POST_ANKER', $node->
getId());
 
  868        $this->tpl->setVariable(
'TXT_PERMA_LINK', $this->lng->txt(
'perma_link'));
 
  869        $this->tpl->setVariable(
'PERMA_TARGET', 
'_top');
 
  871        if (!$node->
isActivated() && !$this->objCurrentTopic->isClosed() && $this->is_moderator) {
 
  872            $rowCol = 
'ilPostingNeedsActivation';
 
  873        } elseif ($this->objProperties->getMarkModeratorPosts() == 1) {
 
  875                $rowCol = 
'ilModeratorPosting';
 
  877                $rowCol = 
'ilModeratorPosting';
 
  887            $this->objCurrentPost->getId() != $node->
getId()
 
  889            $this->tpl->setVariable(
'ROWCOL', 
' ' . $rowCol);
 
  892            $rowCol = 
'tblrowmarked';
 
  899                $this->tpl->setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
 
  903            $rowCol = 
'tblrowmarked';
 
  907        $this->tpl->setVariable(
'ROWCOL', 
' ' . $rowCol);
 
  908        $this->tpl->setVariable(
'DEPTH', (
int) ($node->
getDepth() - 1));
 
  911            $this->tpl->setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
 
  915        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
  916        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
  917        $backurl = urlencode($this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId()));
 
  918        $this->ctrl->clearParameters($this);
 
  920        $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  921        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
  930                'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
  934        $this->ctrl->clearParameters($this);
 
  936        if ($authorinfo->hasSuffix()) {
 
  937            $this->tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
 
  938            if (!$authorinfo->isDeleted()) {
 
  939                $this->tpl->setVariable(
'USR_NAME', $authorinfo->getAlias());
 
  942            $this->tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
  943            if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
 
  944                $this->tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
 
  948        $this->tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
 
  951            if ($authorinfo->getAuthor()->getGender() == 
'f') {
 
  952                $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
 
  953            } elseif ($authorinfo->getAuthor()->getGender() == 
'm') {
 
  954                $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
 
  960            $spanClass = 
'small';
 
  963                $spanClass = 
'moderator_small';
 
  968            $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  969            $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
  984                    'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
  988            $this->ctrl->clearParameters($this);
 
  990            $this->tpl->setVariable(
'POST_UPDATE_TXT', $this->lng->txt(
'edited_on') . 
': ' . $frm->convertDate($node->
getChangeDate()) . 
' - ' . strtolower($this->lng->txt(
'by')));
 
  991            $this->tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
  992            if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
 
  993                $this->tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
 
 1001        if ($this->
user->getId() == ANONYMOUS_USER_ID ||
 
 1004            $this->tpl->setVariable(
'SUBJECT', $node->
getSubject());
 
 1006            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 1007            $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 1008            $this->ctrl->setParameter($this, 
'offset', $Start);
 
 1009            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1010            $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 1011            $mark_post_target = $this->ctrl->getLinkTarget($this, 
'markPostRead', $node->
getId());
 
 1013            $this->tpl->setVariable(
'SUBJECT', 
"<a href=\"" . $mark_post_target . 
"\"><b>" . $node->
getSubject() . 
"</b></a>");
 
 1016        $this->tpl->setVariable(
'POST_DATE', $frm->convertDate($node->
getCreateDate()));
 
 1019            ($this->objCurrentPost->getId() == $node->
getId() && 
$action === 
'censor')
 
 1023                $spanClass = 
'moderator';
 
 1031            if ($spanClass != 
"") {
 
 1037            $this->tpl->setVariable(
'POST', 
"<span class=\"moderator\">" . nl2br($node->
getCensorshipComment()) . 
"</span>");
 
 1040        $this->tpl->parseCurrentBlock();
 
 1049        \ilUtil::sendSuccess($this->lng->txt(
'frm_added'), 
true);
 
 1050        $this->ctrl->setParameter($this, 
'ref_id', $a_new_object->
getRefId());
 
 1051        $this->ctrl->redirect($this, 
'createThread');
 
 1056        $this->
ilHelp->setScreenIdComponent(
"frm");
 
 1058        $this->ctrl->setParameter($this, 
'ref_id', $this->ref_id);
 
 1061            '', 
'showThreads', 
'view', 
'markAllRead',
 
 1062            'enableForumNotification', 
'disableForumNotification', 
'moveThreads', 
'performMoveThreads',
 
 1063            'cancelMoveThreads', 
'performThreadsAction', 
'createThread', 
'addThread',
 
 1064            'showUser', 
'confirmDeleteThreads',
 
 1065            'merge',
'mergeThreads', 
'performMergeThreads' 
 1068        (in_array($this->ctrl->getCmd(), $active)) ? $force_active = 
true : $force_active = 
false;
 
 1069        $this->tabs->addTarget(
'forums_threads', $this->ctrl->getLinkTarget($this, 
'showThreads'), $this->ctrl->getCmd(), get_class($this), 
'', $force_active);
 
 1072        if ($this->access->checkAccess(
'visible', 
'', $this->ref_id) || $this->access->checkAccess(
'read', 
'', $this->ref_id)) {
 
 1073            $force_active = ($this->ctrl->getNextClass() == 
'ilinfoscreengui' || strtolower(
$_GET[
'cmdClass']) == 
'ilnotegui') ? 
true : 
false;
 
 1074            $this->tabs->addTarget(
 
 1076                $this->ctrl->getLinkTargetByClass(array(
'ilobjforumgui', 
'ilinfoscreengui'), 
'showSummary'),
 
 1077                array(
'showSummary', 
'infoScreen'),
 
 1084        if ($this->access->checkAccess(
'write', 
'', $this->ref_id)) {
 
 1085            $force_active = ($this->ctrl->getCmd() == 
'edit') ? 
true    : 
false;
 
 1086            $this->tabs->addTarget(
'settings', $this->ctrl->getLinkTarget($this, 
'edit'), 
'edit', get_class($this), 
'', $force_active);
 
 1089        if ($this->access->checkAccess(
'write', 
'', $this->ref_id)) {
 
 1090            $this->tabs->addTarget(
'frm_moderators', $this->ctrl->getLinkTargetByClass(
'ilForumModeratorsGUI', 
'showModerators'), 
'showModerators', get_class($this));
 
 1093        if ($this->
settings->get(
'enable_fora_statistics', 
false) &&
 
 1094           ($this->objProperties->isStatisticEnabled() || $this->access->checkAccess(
'write', 
'', $this->ref_id))) {
 
 1095            $force_active = ($this->ctrl->getCmd() == 
'showStatistics') ? 
true  : 
false;
 
 1096            $this->tabs->addTarget(
'frm_statistics', $this->ctrl->getLinkTarget($this, 
'showStatistics'), 
'showStatistics', get_class($this), 
'', $force_active); 
 
 1099        if ($this->access->checkAccess(
'write', 
'', $this->object->getRefId())) {
 
 1100            $this->tabs->addTarget(
'export', $this->ctrl->getLinkTargetByClass(
'ilexportgui', 
''), 
'', 
'ilexportgui');
 
 1103        if ($this->access->checkAccess(
'edit_permission', 
'', $this->ref_id)) {
 
 1104            $this->tabs->addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'), 
'perm'), array(
'perm', 
'info', 
'owner'), 
'ilpermissiongui');
 
 1111        if (!$this->
settings->get(
'enable_fora_statistics', 
false)) {
 
 1112            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1116        if (!$this->access->checkAccess(
'read', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 1117            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1121        if (!$this->objProperties->isStatisticEnabled()) {
 
 1123            if ($this->access->checkAccess(
'write', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 1124                ilUtil::sendInfo($this->lng->txt(
'frm_statistics_disabled_for_participants'));
 
 1126                $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1130        $this->
object->Forum->setForumId($this->object->getId());
 
 1133        $tbl->setId(
'il_frm_statistic_table_' . (
int) (
int) 
$_GET[
'ref_id']);
 
 1134        $tbl->setTitle($this->lng->txt(
'statistic'), 
'icon_usr.svg', $this->lng->txt(
'obj_' . $this->object->getType()));
 
 1136        $data = $this->
object->Forum->getUserStatistic($this->is_moderator);
 
 1149        $this->tpl->setContent(
$tbl->getHTML());
 
 1152    public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
 
 1156        $ilAccess = 
$DIC->access();
 
 1160        if ($ilAccess->checkAccess(
'read', 
'', $a_target)) {
 
 1161            if ($a_thread != 0) {
 
 1163                if ($objTopic->getFrmObjId() &&
 
 1166                    foreach ($ref_ids as 
$ref_id) {
 
 1167                        if ($ilAccess->checkAccess(
'read', 
'', 
$ref_id)) {
 
 1173                    if (isset($new_ref_id) && $new_ref_id != $a_target) {
 
 1174                        ilUtil::redirect(ILIAS_HTTP_PATH . 
"/goto.php?target=frm_" . $new_ref_id . 
"_" . $a_thread . 
"_" . $a_posting);
 
 1178                $_GET[
'ref_id'] = $a_target;
 
 1179                $_GET[
'pos_pk'] = $a_posting;
 
 1180                $_GET[
'thr_pk'] = $a_thread;
 
 1181                $_GET[
'anchor'] = $a_posting;
 
 1182                $_GET[
'cmdClass'] = 
'ilObjForumGUI';
 
 1183                $_GET[
'cmd'] = 
'viewThread';
 
 1184                $_GET[
'baseClass'] = 
'ilRepositoryGUI';
 
 1185                include_once(
'ilias.php');
 
 1188                $_GET[
'ref_id'] = $a_target;
 
 1189                $_GET[
'baseClass'] = 
'ilRepositoryGUI';
 
 1190                include_once(
'ilias.php');
 
 1193        } elseif ($ilAccess->checkAccess(
'read', 
'', ROOT_FOLDER_ID)) {
 
 1194            $_GET[
'target'] = 
'';
 
 1195            $_GET[
'ref_id'] = ROOT_FOLDER_ID;
 
 1197                $lng->txt(
'msg_no_perm_read_item'),
 
 1200            $_GET[
'baseClass'] = 
'ilRepositoryGUI';
 
 1201            include_once(
'ilias.php');
 
 1210        if (!$this->is_moderator) {
 
 1211            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1214        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1215            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1218        if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
 
 1223        $forumObj = 
new ilObjForum($this->object->getRefId());
 
 1224        $this->objProperties->setObjId($forumObj->getId());
 
 1228        $success_message = 
"forums_thread_deleted";
 
 1229        if (count(
$_POST[
'thread_ids']) > 1) {
 
 1230            $success_message = 
"forums_threads_deleted";
 
 1234        if (isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids'])) {
 
 1235            $threadIds = 
$_POST[
'thread_ids'];
 
 1239        array_walk($threadIds, 
function ($threadId) use (&$threads) {
 
 1240            $thread = new \ilForumTopic($threadId);
 
 1243            $threads[] = $thread;
 
 1246        foreach ($threads as $thread) {
 
 1247            $frm->setForumId($forumObj->getId());
 
 1248            $frm->setForumRefId($forumObj->getRefId());
 
 1250            $first_node = $frm->getFirstPostNode($thread->getId());
 
 1251            if ((
int) $first_node[
'pos_pk']) {
 
 1252                $frm->deletePost($first_node[
'pos_pk']);
 
 1256        $this->ctrl->redirect($this, 
'showThreads');
 
 1261        if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
 
 1266        if (!$this->is_moderator) {
 
 1267            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1270        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1271            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1275        array_walk(
$_POST[
'thread_ids'], 
function ($threadId) use (&$threads) {
 
 1276            $thread = new \ilForumTopic($threadId);
 
 1279            $threads[] = $thread;
 
 1284        $c_gui->setFormAction($this->ctrl->getFormAction($this, 
'performDeleteThreads'));
 
 1285        $c_gui->setHeaderText($this->lng->txt(
'frm_sure_delete_threads'));
 
 1286        $c_gui->setCancel($this->lng->txt(
'cancel'), 
'showThreads');
 
 1287        $c_gui->setConfirm($this->lng->txt(
'confirm'), 
'performDeleteThreads');
 
 1289        foreach ($threads as $thread) {
 
 1290            $c_gui->addItem(
'thread_ids[]', $thread->getId(), $thread->getSubject());
 
 1293        $this->confirmation_gui_html = $c_gui->getHTML();
 
 1297        return $this->tpl->setContent($c_gui->getHTML());
 
 1302        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1303            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1306        $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()[
'draft_ids'] ?? []));
 
 1307        if (0 === count($draftIds)) {
 
 1314        $confirmation->setFormAction($this->ctrl->getFormAction($this, 
'deleteThreadDrafts'));
 
 1315        $confirmation->setHeaderText($this->lng->txt(
'sure_delete_drafts'));
 
 1316        $confirmation->setCancel($this->lng->txt(
'cancel'), 
'showThreads');
 
 1317        $confirmation->setConfirm($this->lng->txt(
'confirm'), 
'deleteThreadDrafts');
 
 1319        foreach ($draftIds as $draftId) {
 
 1320            if (array_key_exists($draftId, $instances)) {
 
 1321                $confirmation->addItem(
'draft_ids[]', $draftId, $instances[$draftId]->getPostSubject());
 
 1325        $this->tpl->setContent($confirmation->getHTML());
 
 1328    public function prepareThreadScreen(
ilObjForum $a_forum_obj)
 
 1330        $this->
ilHelp->setScreenIdComponent(
"frm");
 
 1332        $this->tpl->getStandardTemplate();
 
 1336        $this->tpl->setTitleIcon(ilObject::_getIcon(
"", 
"big", 
"frm"));
 
 1338        $this->tabs->setBackTarget($this->lng->txt(
'all_topics'), 
'ilias.php?baseClass=ilRepositoryGUI&ref_id=' . 
$_GET[
'ref_id']);
 
 1341        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 1342        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1344        $this->tabs->addTarget(
'sort_by_posts', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 1347        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 1348        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1350        $this->tabs->addTarget(
'order_by_date', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 1352        $this->ctrl->clearParameters($this);
 
 1355            $this->tabs->activateTab(
'sort_by_posts');
 
 1357            $this->tabs->activateTab(
'order_by_date');
 
 1363        $frm = $a_forum_obj->Forum;
 
 1364        $frm->setForumId($a_forum_obj->
getId());
 
 1369        if (!$this->is_moderator) {
 
 1370            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1373        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1374            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1379        $this->objCurrentPost->activatePost();
 
 1380        $GLOBALS[
'ilAppEventHandler']->raise(
 
 1384                'ref_id' => $this->object->getRefId(),
 
 1385                'post' => $this->objCurrentPost
 
 1390        $this->viewThreadObject();
 
 1393    private function deletePostingObject()
 
 1396            !$this->objCurrentTopic->isClosed() && (
 
 1397                $this->is_moderator ||
 
 1398                ($this->objCurrentPost->isOwner($this->user->getId()) && !$this->objCurrentPost->hasReplies())
 
 1400            !$this->user->isAnonymous()
 
 1406            $forumObj = $oForumObjects[
'forumObj'];
 
 1409            $frm->setForumId($forumObj->getId());
 
 1410            $frm->setForumRefId($forumObj->getRefId());
 
 1411            $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
 
 1414            if ($dead_thr == $this->objCurrentTopic->getId()) {
 
 1415                $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($forumObj->getId()));
 
 1416                $topicData = $frm->getOneTopic();
 
 1418                if ($topicData[
'top_num_threads'] > 0) {
 
 1419                    $this->ctrl->redirect($this, 
'showThreads');
 
 1421                    $this->ctrl->redirect($this, 
'createThread');
 
 1425            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 1426            $this->ctrl->redirect($this, 
'viewThread');
 
 1429        $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1439        $this->handleCensorship(
true);
 
 1444        $this->handleCensorship();
 
 1447    private function handleCensorship($wasRevoked = 
false)
 
 1449        if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
 
 1455            $frm = $oForumObjects[
'frm'];
 
 1458                $frm->postCensorship(
$message, $this->objCurrentPost->getId());
 
 1459                ilUtil::sendSuccess($this->lng->txt(
'frm_censorship_revoked'));
 
 1461                $frm->postCensorship(
$message, $this->objCurrentPost->getId(), 1);
 
 1462                ilUtil::sendSuccess($this->lng->txt(
'frm_censorship_applied'));
 
 1465            $this->viewThreadObject();
 
 1469        $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1474        if (!$this->is_moderator) {
 
 1475            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1478        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1479            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1484        $this->viewThreadObject();
 
 1489        $this->display_confirm_post_activation = $status;
 
 1499        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1500            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1505        if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
 
 1506            $this->objCurrentTopic->disableNotification($this->
user->getId());
 
 1509            $this->objCurrentTopic->enableNotification($this->
user->getId());
 
 1513        $this->viewThreadObject();
 
 1518        if (!$this->is_moderator) {
 
 1519            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1522        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1523            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1528        if ($this->objCurrentTopic->isSticky()) {
 
 1529            $this->objCurrentTopic->unmakeSticky();
 
 1531            $this->objCurrentTopic->makeSticky();
 
 1534        $this->viewThreadObject();
 
 1539        $this->requestAction = 
'';
 
 1540        if (isset(
$_POST[
'draft_id']) && (
int) 
$_POST[
'draft_id'] > 0) {
 
 1542            $draft->deleteDraftsByDraftIds(array( (
int) 
$_POST[
'draft_id']));
 
 1545        $this->viewThreadObject();
 
 1550        $this->requestAction = 
'';
 
 1551        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 1554                $history_obj->getFirstAutosaveByDraftId((
int) 
$_GET[
'draft_id']);
 
 1556                $draft->setPostSubject($history_obj->getPostSubject());
 
 1557                $draft->setPostMessage($history_obj->getPostMessage());
 
 1560                    $history_obj->getPostMessage(),
 
 1562                    $history_obj->getHistoryId(),
 
 1564                    $draft->getDraftId()
 
 1567                $draft->updateDraft();
 
 1569                $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
 
 1572        $this->ctrl->clearParameters($this);
 
 1573        $this->viewThreadObject();
 
 1576    public function getDeleteFormHTML()
 
 1579        $form_tpl = 
new ilTemplate(
'tpl.frm_delete_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1580        $form_tpl->setVariable(
'ANKER', $this->objCurrentPost->getId());
 
 1581        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1582        $form_tpl->setVariable(
'TXT_DELETE', $this->lng->txt(
'forums_info_delete_post'));
 
 1583        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1584        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1586        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this, 
'viewThread'));
 
 1587        $this->ctrl->clearParameters($this);
 
 1588        $form_tpl->setVariable(
'CMD_CONFIRM', 
'deletePosting');
 
 1589        $form_tpl->setVariable(
'CMD_CANCEL', 
'viewThread');
 
 1590        $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1591        $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'confirm'));
 
 1593        return $form_tpl->get();
 
 1595    public function getDeleteDraftFormHTML()
 
 1598        $form_tpl = 
new ilTemplate(
'tpl.frm_delete_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1599        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1600        $form_tpl->setVariable(
'TXT_DELETE', $this->lng->txt(
'forums_info_delete_draft'));
 
 1601        $this->ctrl->setParameter($this, 
'draft_id', (
int) 
$_GET[
'draft_id']);
 
 1602        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1603        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1605        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this, 
'viewThread'));
 
 1606        $this->ctrl->clearParameters($this);
 
 1607        $form_tpl->setVariable(
'CMD_CONFIRM', 
'deletePostingDraft');
 
 1608        $form_tpl->setVariable(
'CMD_CANCEL', 
'viewThread');
 
 1609        $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1610        $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'confirm'));
 
 1612        return $form_tpl->get();
 
 1617        $form_tpl = 
new ilTemplate(
'tpl.frm_activation_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1618        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1619        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1621        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this, 
'performPostActivation'));
 
 1622        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1623        $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
 
 1624        $form_tpl->setVariable(
'TXT_ACT', $this->lng->txt(
'activate_post_txt'));
 
 1625        $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'activate_only_current'));
 
 1626        $form_tpl->setVariable(
'CMD_CONFIRM', 
'performPostActivation');
 
 1627        $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1628        $form_tpl->setVariable(
'CMD_CANCEL', 
'viewThread');
 
 1629        $this->ctrl->clearParameters($this);
 
 1631        return $form_tpl->get();
 
 1636        $frm = $this->
object->Forum;
 
 1637        $form_tpl = 
new ilTemplate(
'tpl.frm_censorship_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1639        $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
 
 1640        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1641        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1642        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1644        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this, 
'viewThread'));
 
 1645        $this->ctrl->clearParameters($this);
 
 1646        $form_tpl->setVariable(
'TXT_CENS_MESSAGE', $this->lng->txt(
'forums_the_post'));
 
 1647        $form_tpl->setVariable(
'TXT_CENS_COMMENT', $this->lng->txt(
'forums_censor_comment') . 
':');
 
 1648        $form_tpl->setVariable(
'CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
 
 1650        if ($this->objCurrentPost->isCensored()) {
 
 1651            $form_tpl->setVariable(
'TXT_CENS', $this->lng->txt(
'forums_info_censor2_post'));
 
 1652            $form_tpl->setVariable(
'YES_BUTTON', $this->lng->txt(
'confirm'));
 
 1653            $form_tpl->setVariable(
'NO_BUTTON', $this->lng->txt(
'cancel'));
 
 1654            $form_tpl->setVariable(
'CMD_REVOKE_CENSORSHIP', 
'revokeCensorship');
 
 1655            $form_tpl->setVariable(
'CMD_CANCEL_REVOKE_CENSORSHIP', 
'viewThread');
 
 1657            $form_tpl->setVariable(
'TXT_CENS', $this->lng->txt(
'forums_info_censor_post'));
 
 1658            $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1659            $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'confirm'));
 
 1660            $form_tpl->setVariable(
'CMD_ADD_CENSORSHIP', 
'addCensorship');
 
 1661            $form_tpl->setVariable(
'CMD_CANCEL_ADD_CENSORSHIP', 
'viewThread');
 
 1664        return $form_tpl->get();
 
 1670    private function initReplyEditForm()
 
 1675        $isReply = in_array($this->requestAction, [
'showreply', 
'ready_showreply']);
 
 1676        $isDraft = in_array($this->requestAction, [
'publishDraft', 
'editdraft']);
 
 1680        $frm = $oForumObjects[
'frm'];
 
 1681        $oFDForum = $oForumObjects[
'file_obj'];
 
 1684        $this->replyEditForm->setId(
'id_showreply');
 
 1685        $this->replyEditForm->setTableWidth(
'100%');
 
 1686        $cancel_cmd = 
'cancelPost';
 
 1687        if (in_array($this->requestAction, [
'showreply', 
'ready_showreply'])) {
 
 1688            $this->ctrl->setParameter($this, 
'action', 
'ready_showreply');
 
 1689        } elseif (in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
 
 1690            $this->ctrl->setParameter($this, 
'action', $this->requestAction);
 
 1691            $this->ctrl->setParameter($this, 
'draft_id', (
int) 
$_GET[
'draft_id']);
 
 1693            $this->ctrl->setParameter($this, 
'action', 
'ready_showedit');
 
 1696        $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 1697        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1698        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1699        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1701            $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this, 
'saveTopLevelPost'), 
'frm_page_bottom');
 
 1702        } elseif (in_array($this->requestAction, [
'publishDraft', 
'editdraft'])) {
 
 1703            $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this, 
'publishDraft'), $this->objCurrentPost->getId());
 
 1705            $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this, 
'savePost'), $this->objCurrentPost->getId());
 
 1707        $this->ctrl->clearParameters($this);
 
 1710            $this->replyEditForm->setTitle($this->lng->txt(
'forums_your_reply'));
 
 1711        } elseif ($isDraft) {
 
 1712            $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_draft'));
 
 1714            $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_post'));
 
 1719            in_array($this->requestAction, array(
'showreply', 
'ready_showreply', 
'editdraft'))
 
 1721            $oAnonymousNameGUI = 
new ilTextInputGUI($this->lng->txt(
'forums_your_name'), 
'alias');
 
 1722            $oAnonymousNameGUI->setMaxLength(64);
 
 1723            $oAnonymousNameGUI->setInfo($this->lng->txt(
'forums_use_alias'));
 
 1725            $this->replyEditForm->addItem($oAnonymousNameGUI);
 
 1728        $oSubjectGUI = 
new ilTextInputGUI($this->lng->txt(
'forums_subject'), 
'subject');
 
 1729        $oSubjectGUI->setMaxLength(255);
 
 1730        $oSubjectGUI->setRequired(
true);
 
 1732        if ($this->objProperties->getSubjectSetting() == 
'empty_subject') {
 
 1733            $oSubjectGUI->setInfo($this->lng->txt(
'enter_new_subject'));
 
 1736        $this->replyEditForm->addItem($oSubjectGUI);
 
 1739            $isReply ? $this->lng->txt(
'forums_your_reply') : $this->lng->txt(
'forums_edit_post'),
 
 1742        $oPostGUI->setRequired(
true);
 
 1743        $oPostGUI->setRows(15);
 
 1744        $oPostGUI->setUseRte(
true);
 
 1745        $oPostGUI->addPlugin(
'latex');
 
 1746        $oPostGUI->addButton(
'latex');
 
 1747        $oPostGUI->addButton(
'pastelatex');
 
 1751                ($isReply && $this->objCurrentPost->getDepth() >= 2) ||
 
 1752                (!$isDraft && !$isReply && $this->objCurrentPost->getDepth() > 2) ||
 
 1753                ($isDraft && $this->objCurrentPost->getDepth() >= 2)
 
 1757        if ($quotingAllowed) {
 
 1758            $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
 
 1759            $oPostGUI->addPlugin(
'ilfrmquote');
 
 1762        $oPostGUI->removePlugin(
'advlink');
 
 1763        $oPostGUI->setRTERootBlockElement(
'');
 
 1764        $oPostGUI->usePurifier(
true);
 
 1765        $oPostGUI->disableButtons(array(
 
 1782        if (in_array($this->requestAction, [
'showreply', 
'ready_showreply', 
'showdraft', 
'editdraft'])) {
 
 1783            $oPostGUI->setRTESupport($this->
user->getId(), 
'frm~', 
'frm_post', 
'tpl.tinymce_frm_post.html', 
false, 
'3.5.11');
 
 1785            $oPostGUI->setRTESupport($this->objCurrentPost->getId(), 
'frm', 
'frm_post', 
'tpl.tinymce_frm_post.html', 
false, 
'3.5.11');
 
 1790        $this->replyEditForm->addItem($oPostGUI);
 
 1794        if ($this->rbac->system()->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
 
 1795           !$frm->isThreadNotificationEnabled($this->user->getId(), $this->objCurrentPost->getThreadId()) &&
 
 1796           !$this->objProperties->isAnonymized()) {
 
 1797            $oNotificationGUI = 
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'), 
'notify');
 
 1798            $oNotificationGUI->setInfo($this->lng->txt(
'forum_notify_me'));
 
 1800            $this->replyEditForm->addItem($oNotificationGUI);
 
 1803        if ($this->objProperties->isFileUploadAllowed()) {
 
 1804            $oFileUploadGUI = 
new ilFileWizardInputGUI($this->lng->txt(
'forums_attachments_add'), 
'userfile');
 
 1805            $oFileUploadGUI->setFilenames(array(0 => 
''));
 
 1806            $this->replyEditForm->addItem($oFileUploadGUI);
 
 1810            $this->
user->isAnonymous() &&
 
 1811            !$this->user->isCaptchaVerified() &&
 
 1812            ilCaptchaUtil::isActiveForForum()
 
 1814            $captcha = 
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'), 
'captcha_code');
 
 1815            $captcha->setRequired(
true);
 
 1816            $this->replyEditForm->addItem($captcha);
 
 1819        $attachments_of_node = $oFDForum->getFilesOfPost();
 
 1820        if (count($attachments_of_node) && in_array($this->requestAction, [
'showedit', 
'ready_showedit'])) {
 
 1822            foreach ($oFDForum->getFilesOfPost() as $file) {
 
 1824                $oAttachmentGUI->setValue($file[
'md5']);
 
 1825                $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
 
 1827            $this->replyEditForm->addItem($oExistingAttachmentsGUI);
 
 1831            if (in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
 
 1834                $this->replyEditForm->addItem($draftInfoGUI);
 
 1835            } elseif (!in_array($this->requestAction, [
'showedit', 
'ready_showedit'])) {
 
 1838                $this->replyEditForm->addItem($draftInfoGUI);
 
 1841            $selected_draft_id = (int) 
$_GET[
'draft_id'];
 
 1842            $draftObj = 
new ilForumPostDraft($this->
user->getId(), $this->objCurrentPost->getId(), $selected_draft_id);
 
 1843            if ($draftObj->getDraftId() > 0) {
 
 1845                if (count($oFDForumDrafts->getFilesOfPost())) {
 
 1847                    foreach ($oFDForumDrafts->getFilesOfPost() as $file) {
 
 1849                        $oAttachmentGUI->setValue($file[
'md5']);
 
 1850                        $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
 
 1852                    $this->replyEditForm->addItem($oExistingAttachmentsGUI);
 
 1858            $this->replyEditForm->addCommandButton(
'saveTopLevelPost', $this->lng->txt(
'create'));
 
 1860            $this->replyEditForm->addCommandButton(
'publishDraft', $this->lng->txt(
'publish'));
 
 1862            $this->replyEditForm->addCommandButton(
'savePost', $this->lng->txt(
'save'));
 
 1865        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 1866            $auto_save_draft_id = (int) 
$_GET[
'draft_id'];
 
 1868        $hidden_draft_id->setValue($auto_save_draft_id);
 
 1869        $this->replyEditForm->addItem($hidden_draft_id);
 
 1871        if (in_array($this->requestAction, [
'showreply', 
'ready_showreply', 
'editdraft'])) {
 
 1874            if (array_key_exists(
'show_rte', 
$_POST)) {
 
 1879                if ($quotingAllowed) {
 
 1880                    $this->replyEditForm->addCommandButton(
'quotePost', $this->lng->txt(
'forum_add_quote'));
 
 1885                !$this->
user->isAnonymous() &&
 
 1886                in_array($this->requestAction, [
'editdraft', 
'showreply', 
'ready_showreply']) &&
 
 1893                if ($this->requestAction == 
'editdraft') {
 
 1894                    $this->replyEditForm->addCommandButton(
'updateDraft', $this->lng->txt(
'save_message'));
 
 1896                    $this->replyEditForm->addCommandButton(
'saveTopLevelDraft', $this->lng->txt(
'save_message'));
 
 1898                    $this->replyEditForm->addCommandButton(
'saveAsDraft', $this->lng->txt(
'save_message'));
 
 1901                $cancel_cmd = 
'cancelDraft';
 
 1904        $this->replyEditForm->addCommandButton($cancel_cmd, $this->lng->txt(
'cancel'));
 
 1912        if (
null === $this->replyEditForm) {
 
 1913            $this->initReplyEditForm();
 
 1924        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0 && !$this->
user->isAnonymous()
 
 1930            $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 1931            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1932            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 1933            $this->ctrl->setParameter($this, 
'draft_id', $draft_obj->getDraftId());
 
 1934            $this->ctrl->setParameter($this, 
'offset', 0);
 
 1935            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1936            $this->ctrl->redirect($this, 
'editDraft');
 
 1938            $this->viewThreadObject();
 
 1948        $this->savePostObject();
 
 1954        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 1961        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1962            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1965        if (!$this->access->checkAccess(
'add_reply', 
'', $this->object->getRefId())) {
 
 1966            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1969        if (!$this->objCurrentTopic->getId()) {
 
 1971            $this->ctrl->redirect($this);
 
 1974        if ($this->objCurrentTopic->isClosed()) {
 
 1976            $this->ctrl->redirect($this);
 
 1979        if (!$this->objCurrentPost->getId()) {
 
 1980            $this->requestAction = 
'';
 
 1982            $this->viewThreadObject();
 
 1986        $post_id = $this->objCurrentPost->getId();
 
 1990        if ($use_replyform) {
 
 1993            if (!$oReplyEditForm->checkInput()) {
 
 1994                $oReplyEditForm->setValuesByPost();
 
 1995                return $this->viewThreadObject();
 
 1997            $post_subject = $oReplyEditForm->getInput(
'subject');
 
 1998            $post_message = $oReplyEditForm->getInput(
'message');
 
 2001            $post_subject = $draft_obj->getPostSubject();
 
 2002            $post_message = $draft_obj->getPostMessage();
 
 2006        if ($draft_obj->getDraftId() > 0) {
 
 2009            $frm = $oForumObjects[
'frm'];
 
 2010            $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 2014            $send_activation_mail = 0;
 
 2016            if ($this->objProperties->isPostActivationEnabled()) {
 
 2017                if (!$this->is_moderator) {
 
 2019                    $send_activation_mail = 1;
 
 2020                } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
 
 2025            $newPost = $frm->generatePost(
 
 2026                $draft_obj->getForumId(),
 
 2027                $draft_obj->getThreadId(),
 
 2028                $this->user->getId(),
 
 2029                $draft_obj->getPostDisplayUserId(),
 
 2031                $draft_obj->getPostId(),
 
 2032                (
int) $draft_obj->getNotify(),
 
 2033                $this->handleFormInput($post_subject, 
false),
 
 2034                $draft_obj->getPostUserAlias(),
 
 2037                $send_activation_mail
 
 2040            $this->
object->markPostRead($this->
user->getId(), (
int) $this->objCurrentTopic->getId(), (
int) $this->objCurrentPost->getId());
 
 2044            foreach ($uploadedObjects as $mob) {
 
 2050            if ($this->objProperties->isFileUploadAllowed()) {
 
 2051                $file = $_FILES[
'userfile'];
 
 2052                if (is_array($file) && !empty($file)) {
 
 2053                    $tmp_file_obj = 
new ilFileDataForum($this->object->getId(), $newPost);
 
 2054                    $tmp_file_obj->storeUploadedFile($file);
 
 2061                $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
 
 2062                $oFDForumDrafts->delete();
 
 2066                $GLOBALS[
'ilAppEventHandler']->raise(
 
 2069                    array(
'draftObj' => $draft_obj,
 
 2070                          'obj_id' => $this->object->getId(),
 
 2071                          'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 2074            $draft_obj->deleteDraft();
 
 2076            $GLOBALS[
'ilAppEventHandler']->raise(
 
 2080                    'ref_id' => $this->object->getRefId(),
 
 2082                    'notify_moderators' => (
bool) $send_activation_mail
 
 2087            if (!$this->is_moderator && !$status) {
 
 2088                $message .= $this->lng->txt(
'forums_post_needs_to_be_activated');
 
 2090                $message .= $this->lng->txt(
'forums_post_new_entry');
 
 2093            $_SESSION[
'frm'][(int) 
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
 
 2095            $this->ctrl->clearParameters($this);
 
 2096            ilUtil::sendSuccess(
$message, 
true);
 
 2097            $this->ctrl->setParameter($this, 
'pos_pk', $newPost);
 
 2098            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2100            $this->ctrl->redirect($this, 
'viewThread');
 
 2107    public function savePostObject()
 
 2109        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2110            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2113        if (!$this->objCurrentTopic->getId()) {
 
 2115            $this->ctrl->redirect($this);
 
 2118        if ($this->objCurrentTopic->isClosed()) {
 
 2120            $this->ctrl->redirect($this);
 
 2125        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 2126            $_POST[
'del_file'] = array();
 
 2130        if ($oReplyEditForm->checkInput()) {
 
 2131            if (!$this->objCurrentPost->getId()) {
 
 2132                $this->requestAction = 
'';
 
 2134                $this->viewThreadObject();
 
 2145            $forumObj = $oForumObjects[
'forumObj'];
 
 2149            $frm = $oForumObjects[
'frm'];
 
 2150            $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 2151            $topicData = $frm->getOneTopic();
 
 2154            if ($this->requestAction == 
'ready_showreply') {
 
 2155                if (!$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 2156                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2161                $send_activation_mail = 0;
 
 2163                if ($this->objProperties->isPostActivationEnabled()) {
 
 2164                    if (!$this->is_moderator) {
 
 2166                        $send_activation_mail = 1;
 
 2167                    } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
 
 2173                    if (!strlen($oReplyEditForm->getInput(
'alias'))) {
 
 2174                        $user_alias = $this->lng->txt(
'forums_anonymous');
 
 2176                        $user_alias = $oReplyEditForm->getInput(
'alias');
 
 2178                    $display_user_id = 0;
 
 2180                    $user_alias = $this->
user->getLogin();
 
 2181                    $display_user_id = $this->
user->getId();
 
 2184                $newPost = $frm->generatePost(
 
 2185                    $topicData[
'top_pk'],
 
 2186                    $this->objCurrentTopic->getId(),
 
 2187                    $this->user->getId(),
 
 2190                    $this->objCurrentPost->getId(),
 
 2191                    (
int) $oReplyEditForm->getInput(
'notify'),
 
 2192                    $this->handleFormInput($oReplyEditForm->getInput(
'subject'), 
false),
 
 2196                    $send_activation_mail
 
 2202                        $draft_id = 
$_POST[
'draft_id']; 
 
 2204                    $draft_obj = 
new ilForumPostDraft($this->
user->getId(), $this->objCurrentPost->getId(), $draft_id);
 
 2206                        $draft_obj->deleteDraft();
 
 2211                $this->
object->markPostRead($this->
user->getId(), (
int) $this->objCurrentTopic->getId(), (
int) $this->objCurrentPost->getId());
 
 2216                if ($this->objProperties->isFileUploadAllowed()) {
 
 2218                    $file = $_FILES[
'userfile'];
 
 2219                    if (is_array($file) && !empty($file)) {
 
 2220                        $oFDForum->storeUploadedFile($file);
 
 2224                $GLOBALS[
'ilAppEventHandler']->raise(
 
 2228                        'ref_id' => $this->object->getRefId(),
 
 2230                        'notify_moderators' => (
bool) $send_activation_mail
 
 2235                if (!$this->is_moderator && !$status) {
 
 2236                    $message .= $this->lng->txt(
'forums_post_needs_to_be_activated');
 
 2238                    $message .= $this->lng->txt(
'forums_post_new_entry');
 
 2241                ilUtil::sendSuccess(
$message, 
true);
 
 2242                $this->ctrl->clearParameters($this);
 
 2243                $this->ctrl->setParameter($this, 
'post_created_below', $this->objCurrentPost->getId());
 
 2244                $this->ctrl->setParameter($this, 
'pos_pk', $newPost);
 
 2245                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2246                $this->ctrl->redirect($this, 
'viewThread');
 
 2248                if ((!$this->is_moderator &&
 
 2249                   !$this->objCurrentPost->isOwner($this->user->getId())) || $this->objCurrentPost->isCensored() ||
 
 2250                   $this->user->getId() == ANONYMOUS_USER_ID) {
 
 2251                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2259                foreach ($oldMediaObjects as $oldMob) {
 
 2261                    foreach ($curMediaObjects as $curMob) {
 
 2262                        if ($oldMob == $curMob) {
 
 2277                $old_status_was_active = $this->objCurrentPost->isActivated();
 
 2281                $send_activation_mail = 0;
 
 2283                if ($this->objProperties->isPostActivationEnabled()) {
 
 2284                    if (!$this->is_moderator) {
 
 2286                        $send_activation_mail = 1;
 
 2287                    } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
 
 2291                $this->objCurrentPost->setStatus($status);
 
 2293                $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
 
 2295                $this->objCurrentPost->setNotification((
int) $oReplyEditForm->getInput(
'notify'));
 
 2296                $this->objCurrentPost->setChangeDate(date(
'Y-m-d H:i:s'));
 
 2297                $this->objCurrentPost->setUpdateUserId($this->
user->getId());
 
 2300                if ($this->objCurrentPost->update()) {
 
 2301                    $this->objCurrentPost->reload();
 
 2308                        $this->objCurrentPost->getId(),
 
 2313                        $news_item->setTitle($this->objCurrentPost->getSubject());
 
 2314                        $news_item->setContent(
 
 2316                                $this->objCurrentPost->getMessage(),
 
 2321                        if ($this->objCurrentPost->getMessage() != strip_tags($this->objCurrentPost->getMessage())) {
 
 2322                            $news_item->setContentHtml(
true);
 
 2324                            $news_item->setContentHtml(
false);
 
 2326                        $news_item->update();
 
 2329                    $oFDForum = $oForumObjects[
'file_obj'];
 
 2331                    $file2delete = $oReplyEditForm->getInput(
'del_file');
 
 2332                    if (is_array($file2delete) && count($file2delete)) {
 
 2333                        $oFDForum->unlinkFilesByMD5Filenames($file2delete);
 
 2336                    if ($this->objProperties->isFileUploadAllowed()) {
 
 2337                        $file = $_FILES[
'userfile'];
 
 2338                        if (is_array($file) && !empty($file)) {
 
 2339                            $oFDForum->storeUploadedFile($file);
 
 2343                    $GLOBALS[
'ilAppEventHandler']->raise(
 
 2347                            'ref_id' => $this->object->getRefId(),
 
 2348                            'post' => $this->objCurrentPost,
 
 2349                            'notify_moderators' => (
bool) $send_activation_mail,
 
 2350                            'old_status_was_active' => (
bool) $old_status_was_active
 
 2354                    ilUtil::sendSuccess($this->lng->txt(
'forums_post_modified'), 
true);
 
 2357                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 2358                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2359                $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 2360                $this->ctrl->redirect($this, 
'viewThread');
 
 2363            $this->requestAction = substr($this->requestAction, 6);
 
 2365        return $this->viewThreadObject();
 
 2370        if (
null === $a_flag) {
 
 2380        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2381            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2384        if (!is_array(
$_POST[
'del_file'])) {
 
 2385            $_POST[
'del_file'] = array();
 
 2388        if ($this->objCurrentTopic->isClosed()) {
 
 2389            $this->requestAction = 
'';
 
 2390            return $this->viewThreadObject();
 
 2396        $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
 
 2397        $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
 
 2399        $oReplyEditForm->checkInput();
 
 2402        $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
 
 2403        $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
 
 2405        $this->requestAction = 
'showreply';
 
 2407        $this->viewThreadObject();
 
 2410    public function getQuotationHTMLAsynchObject()
 
 2412        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2413            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2422        $frm = $oForumObjects[
'frm'];
 
 2425            $this->objCurrentPost->getPosAuthorId(),
 
 2426            $this->objCurrentPost->getDisplayUserId(),
 
 2427            $this->objCurrentPost->getUserAlias(),
 
 2428            $this->objCurrentPost->getImportName()
 
 2438        if (
null === $this->forumObjects) {
 
 2440            $file_obj = 
new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
 
 2441            $frm = $forumObj->Forum;
 
 2442            $frm->setForumId($forumObj->getId());
 
 2443            $frm->setForumRefId($forumObj->getRefId());
 
 2445            $this->forumObjects[
'forumObj'] = $forumObj;
 
 2446            $this->forumObjects[
'frm'] = $frm;
 
 2447            $this->forumObjects[
'file_obj'] = $file_obj;
 
 2453    public function viewThreadObject()
 
 2456        $bottom_toolbar_split_button_items = array();
 
 2459        $this->tpl->addCss(
'./Modules/Forum/css/forum_tree.css');
 
 2461            $_SESSION[
'viewmode'] = $this->objProperties->getDefaultView();
 
 2465        if (!isset(
$_SESSION[
'thread_control'][
'old'])) {
 
 2468        } elseif (isset(
$_SESSION[
'thread_control'][
'old']) && 
$_GET[
'thr_pk'] != 
$_SESSION[
'thread_control'][
'old']) {
 
 2483        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2484            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2492        $forumObj = $oForumObjects[
'forumObj'];
 
 2496        $frm = $oForumObjects[
'frm'];
 
 2500        $file_obj = $oForumObjects[
'file_obj'];
 
 2502        $selected_draft_id = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 2504        if (isset($this->httpRequest->getQueryParams()[
'file'])) {
 
 2505            $file_obj_for_delivery = $file_obj;
 
 2509            $file_obj_for_delivery->deliverFile(\
ilUtil::stripSlashes($this->httpRequest->getQueryParams()[
'file']));
 
 2512        if (!$this->objCurrentTopic->getId()) {
 
 2513            $this->ctrl->redirect($this, 
'showThreads');
 
 2519        $append = 
'_' . $this->objCurrentTopic->getId() .
 
 2520            ($this->objCurrentPost->getId() ? 
'_' . $this->objCurrentPost->getId() : 
'');
 
 2521        $this->tpl->setLoginTargetPar(
'frm_' . 
$_GET[
'ref_id'] . $append);
 
 2524        if (!in_array($this->requestAction, [
'showreply', 
'showedit'])) {
 
 2527                foreach (
$mobs as $mob) {
 
 2534            } 
catch (Exception $e) {
 
 2538        $firstNodeInThread = $this->objCurrentTopic->getFirstPostNode($this->is_moderator, 
true);
 
 2541            $exp = 
new ilForumExplorerGUI(
'frm_exp_' . $this->objCurrentTopic->getId(), $this, 
'viewThread');
 
 2542            $exp->setThread($this->objCurrentTopic, $firstNodeInThread);
 
 2543            if (!$exp->handleCommand()) {
 
 2544                $this->tpl->setLeftNavContent($exp->getHTML());
 
 2548        if (!$this->
getCreationMode() && $this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2550                (
int) $this->object->getRefId(),
 
 2557        $forumObj->updateLastAccess($this->
user->getId(), (
int) $this->objCurrentTopic->getId());
 
 2559        $this->prepareThreadScreen($forumObj);
 
 2561        $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_view.html', 
'Modules/Forum');
 
 2563        if (isset($this->httpRequest->getQueryParams()[
'anchor'])) {
 
 2564            $this->tpl->setVariable(
'JUMP2ANCHOR_ID', (
int) $this->httpRequest->getQueryParams()[
'anchor']);
 
 2566        $this->tpl->setVariable(
'LIST_TYPE', $this->
isHierarchicalView() ? 
'sort_by_posts' : 
'sort_by_date');
 
 2569            $orderField = 
'frm_posts_tree.rgt';
 
 2570            $this->objCurrentTopic->setOrderDirection(
'DESC');
 
 2572            $orderField = 
'frm_posts.pos_date';
 
 2573            $this->objCurrentTopic->setOrderDirection(
 
 2582        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 2584        if ($firstNodeInThread) {
 
 2585            $this->objCurrentTopic->updateVisits();
 
 2587            $this->tpl->setTitle($this->lng->txt(
'forums_thread') . 
" \"" . $this->objCurrentTopic->getSubject() . 
"\"");
 
 2590            $this->locator->addRepositoryItems();
 
 2591            $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
""), 
"_top");
 
 2592            $this->tpl->setLocator();
 
 2597            $menutpl = 
new ilTemplate(
'tpl.forums_threads_menu.html', 
true, 
true, 
'Modules/Forum');
 
 2601                !$this->
user->isAnonymous() &&
 
 2602                $forumObj->getCountUnread($this->user->getId(), (
int) $this->objCurrentTopic->getId(), 
true)
 
 2604                $this->ctrl->setParameter($this, 
'mark_read', 
'1');
 
 2605                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 2608                $mark_thr_read_button->setCaption(
'forums_mark_read');
 
 2609                $mark_thr_read_button->setUrl($this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 2612                $bottom_toolbar_split_button_items[] = $mark_thr_read_button;
 
 2614                $this->ctrl->clearParameters($this);
 
 2618            $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'print_thread', $this->objCurrentTopic->getId());
 
 2619            $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'thr_top_fk', $this->objCurrentTopic->getForumId());
 
 2623            $print_thr_button->setCaption(
'forums_print_thread');
 
 2624            $print_thr_button->setUrl($this->ctrl->getLinkTargetByClass(
'ilforumexportgui', 
'printThread'));
 
 2626            $bottom_toolbar_split_button_items[] = $print_thr_button;
 
 2628            $this->ctrl->clearParametersByClass(
'ilforumexportgui');
 
 2632            if (isset($this->httpRequest->getQueryParams()[
'mark_read'])) {
 
 2633                $forumObj->markThreadRead($this->
user->getId(), (
int) $this->objCurrentTopic->getId());
 
 2638            $this->objCurrentTopic->setOrderField($orderField);
 
 2639            $subtree_nodes = $this->objCurrentTopic->getPostTree($firstNodeInThread);
 
 2643                !$this->objCurrentTopic->isClosed() &&
 
 2644                $this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])
 
 2647                $reply_button->setPrimary(
true);
 
 2648                $reply_button->setCaption(
'add_new_answer');
 
 2649                $this->ctrl->setParameter($this, 
'action', 
'showreply');
 
 2650                $this->ctrl->setParameter($this, 
'pos_pk', $firstNodeInThread->getId());
 
 2651                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 2652                $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 2653                $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 2655                $reply_button->setUrl($this->ctrl->getLinkTarget($this, 
'createTopLevelPost', 
'frm_page_bottom'));
 
 2657                $this->ctrl->clearParameters($this);
 
 2658                array_unshift($bottom_toolbar_split_button_items, $reply_button);
 
 2662            if (!$posNum = count($subtree_nodes)) {
 
 2666            $pageHits = $frm->getPageHits();
 
 2671            if ($posNum > $pageHits) {
 
 2673                    'ref_id' => 
$_GET[
'ref_id'],
 
 2674                    'thr_pk' => $this->objCurrentTopic->getId(),
 
 2675                    'orderby' => 
$_GET[
'orderby']
 
 2678                if (!isset(
$_GET[
'offset'])) {
 
 2681                    $Start = (int) 
$_GET[
'offset'];
 
 2684                $linkbar = 
ilUtil::Linkbar($this->ctrl->getLinkTarget($this, 
'viewThread'), $posNum, $pageHits, $Start, 
$params);
 
 2686                if ($linkbar != 
'') {
 
 2687                    $menutpl->setCurrentBlock(
'linkbar');
 
 2688                    $menutpl->setVariable(
'LINKBAR', $linkbar);
 
 2689                    $menutpl->parseCurrentBlock();
 
 2693            $this->tpl->setVariable(
'THREAD_MENU', $menutpl->get());
 
 2697            $render_drafts = 
false;
 
 2698            $draftsObjects = 
null;
 
 2702                if (count($draftsObjects) > 0) {
 
 2703                    $render_drafts = 
true;
 
 2707            foreach ($subtree_nodes as $node) {
 
 2709                $this->ctrl->clearParameters($this);
 
 2711                if ($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId()) {
 
 2715                if ($firstNodeInThread->getId() != $this->objCurrentPost->getId() && $posNum > $pageHits && $z >= ($Start + $pageHits)) {
 
 2717                    if ($this->objCurrentPost->getId() && $jump < 1) {
 
 2718                        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 2719                        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 2720                        $this->ctrl->setParameter($this, 
'offset', ($Start + $pageHits));
 
 2721                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 2722                        $this->ctrl->redirect($this, 
'viewThread', $this->objCurrentPost->getId());
 
 2728                if (($posNum > $pageHits && $z >= $Start) || $posNum <= $pageHits) {
 
 2730                        # actions for "active" post
 
 2731                        if ($this->is_moderator || $node->isActivated() || $node->isOwner($this->user->getId())) {
 
 2732                            if (!$this->objCurrentTopic->isClosed() && in_array($this->requestAction, [
 
 2733                                'showreply', 
'showedit', 
'showdraft', 
'editdraft' 
 2735                                $this->renderPostingForm($frm, $node, $this->requestAction);
 
 2736                            } elseif (!$this->objCurrentTopic->isClosed() && $this->requestAction === 
'delete') {
 
 2738                                    $this->is_moderator ||
 
 2739                                    ($node->isOwner($this->user->getId()) && !$node->hasReplies()) &&
 
 2740                                    $this->user->getId() != ANONYMOUS_USER_ID
 
 2742                                    $this->tpl->setVariable(
'FORM', $this->getDeleteFormHTML());
 
 2744                            } elseif (!$this->objCurrentTopic->isClosed() && $this->requestAction === 
'censor') {
 
 2745                                if ($this->is_moderator) {
 
 2748                            } elseif (!$this->objCurrentTopic->isClosed() && $this->displayConfirmPostActivation()) {
 
 2749                                if ($this->is_moderator) {
 
 2756                    $this->
renderDraftContent($this->requestAction, $render_drafts, $node, $selected_draft_id);
 
 2762                if (!$this->objCurrentTopic->isClosed() && in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
 
 2763                    $this->renderPostingForm($frm, $firstNodeInThread, $this->requestAction);
 
 2765                $this->
renderDraftContent($this->requestAction, $render_drafts, $firstNodeInThread, $selected_draft_id);
 
 2770                in_array($this->ctrl->getCmd(), array(
'createTopLevelPost', 
'saveTopLevelPost')) &&
 
 2771                !$this->objCurrentTopic->isClosed() &&
 
 2772                $this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 2774                $this->objCurrentPost->setId($firstNodeInThread->getId());
 
 2777                if ($this->ctrl->getCmd() == 
'saveTopLevelPost') {
 
 2778                    $form->setValuesByPost();
 
 2780                $this->tpl->setVariable(
'BOTTOM_FORM', 
$form->getHTML());
 
 2783            $this->tpl->setCurrentBlock(
'posts_no');
 
 2784            $this->tpl->setVariable(
'TXT_MSG_NO_POSTS_AVAILABLE', $this->lng->txt(
'forums_posts_not_available'));
 
 2785            $this->tpl->parseCurrentBlock();
 
 2788        if ($bottom_toolbar_split_button_items) {
 
 2791            foreach ($bottom_toolbar_split_button_items as $item) {
 
 2793                    $bottom_split_button->setDefaultButton($item);
 
 2800            $bottom_toolbar->addStickyItem($bottom_split_button);
 
 2801            $this->toolbar->addStickyItem($bottom_split_button);
 
 2804        if ($bottom_toolbar_split_button_items) {
 
 2805            $bottom_toolbar->addSeparator();
 
 2809        $to_top_button->setCaption(
'top_of_page');
 
 2810        $to_top_button->setUrl(
'#frm_page_top');
 
 2811        $bottom_toolbar->addButtonInstance($to_top_button);
 
 2813            $this->tpl->setVariable(
'TOOLBAR_BOTTOM', $bottom_toolbar->getHTML());
 
 2816        $permalink = 
new ilPermanentLinkGUI(
'frm', $this->object->getRefId(), 
'_' . $this->objCurrentTopic->getId());
 
 2817        $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
 
 2819        $this->tpl->addOnLoadCode(
'$(".ilFrmPostContent img").each(function() { 
 2822                                maxWidth: $elm.attr("width") + "px",  
 2823                                maxHeight: $elm.attr("height")  + "px" 
 2825                        $elm.removeAttr("width"); 
 2826                        $elm.removeAttr("height"); 
 2834        $subject = $this->objCurrentPost->getSubject();
 
 2835        $re_txt = $this->lng->txt(
'post_reply');
 
 2837        $re_txt_with_num = str_replace(
':', 
'(', $re_txt);
 
 2838        $search_length = strlen($re_txt_with_num);
 
 2839        $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
 
 2842            $modified_subject = $subject;
 
 2843            if ($on_reply == 
true) {
 
 2845                $str_pos_start = strpos($subject, 
'(');
 
 2846                $str_pos_end = strpos($subject, 
')');
 
 2848                $length = ((int) $str_pos_end - (
int) $str_pos_start);
 
 2850                $txt_number = substr($subject, $str_pos_start, $length - 1);
 
 2852                if (is_numeric($txt_number)) {
 
 2853                    $re_count = (int) $txt_number + 1;
 
 2854                    $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
 
 2858            $re_count = substr_count($subject, $re_txt);
 
 2859            if ($re_count >= 1 && $on_reply == 
true) {
 
 2860                $subject = str_replace($re_txt, 
'', $subject);
 
 2864                $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count) . 
' ' . trim($subject);
 
 2865            } elseif ($re_count >= 1 && $on_reply == 
false) {
 
 2868                $modified_subject = sprintf($this->lng->txt(
'post_reply_count'), $re_count) . 
' ' . trim($subject);
 
 2869            } elseif ($re_count == 0) {
 
 2871                $modified_subject = $this->lng->txt(
'post_reply') . 
' ' . $this->objCurrentPost->getSubject();
 
 2874        return $modified_subject;
 
 2880        $add = $this->getUserProfileAdditional((
int) 
$_GET[
'ref_id'], (
int) 
$_GET[
'user']);
 
 2881        $profile_gui->setAdditional($add);
 
 2883        $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
 
 2886    protected function getUserProfileAdditional($a_forum_ref_id, $a_user_id)
 
 2888        if (!$this->access->checkAccess(
'read', 
'', $a_forum_ref_id)) {
 
 2889            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2896        if ($ref_obj->getType() == 
'frm') {
 
 2898            $frm = $forumObj->Forum;
 
 2899            $frm->setForumId($forumObj->getId());
 
 2900            $frm->setForumRefId($forumObj->getRefId());
 
 2906        if ($this->access->checkAccess(
'moderate_frm', 
'', $a_forum_ref_id)) {
 
 2907            $numPosts = $frm->countUserArticles(addslashes($a_user_id));
 
 2909            $numPosts = $frm->countActiveUserArticles(addslashes($a_user_id));
 
 2912        return array($this->lng->txt(
'forums_posts') => $numPosts);
 
 2917        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2918            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2923        if (isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids'])) {
 
 2924            if (isset(
$_POST[
'selected_cmd']) && 
$_POST[
'selected_cmd'] == 
'move') {
 
 2925                if ($this->is_moderator) {
 
 2929            } elseif (
$_POST[
'selected_cmd'] == 
'enable_notifications' && $this->
settings->get(
'forum_notification') != 0) {
 
 2933                    $tmp_obj->enableNotification($this->
user->getId());
 
 2936                $this->ctrl->redirect($this, 
'showThreads');
 
 2937            } elseif (
$_POST[
'selected_cmd'] == 
'disable_notifications' && $this->
settings->get(
'forum_notification') != 0) {
 
 2941                    $tmp_obj->disableNotification($this->
user->getId());
 
 2944                $this->ctrl->redirect($this, 
'showThreads');
 
 2945            } elseif (
$_POST[
'selected_cmd'] == 
'close') {
 
 2946                if ($this->is_moderator) {
 
 2953                ilUtil::sendSuccess($this->lng->txt(
'selected_threads_closed'), 
true);
 
 2954                $this->ctrl->redirect($this, 
'showThreads');
 
 2955            } elseif (
$_POST[
'selected_cmd'] == 
'reopen') {
 
 2956                if ($this->is_moderator) {
 
 2964                ilUtil::sendSuccess($this->lng->txt(
'selected_threads_reopened'), 
true);
 
 2965                $this->ctrl->redirect($this, 
'showThreads');
 
 2966            } elseif (
$_POST[
'selected_cmd'] == 
'makesticky') {
 
 2967                if ($this->is_moderator) {
 
 2968                    $message = $this->lng->txt(
'sel_threads_make_sticky');
 
 2973                        $makeSticky = $tmp_obj->makeSticky();
 
 2976                            $message = $this->lng->txt(
'sel_threads_already_sticky');
 
 2983                $this->ctrl->redirect($this, 
'showThreads');
 
 2984            } elseif (
$_POST[
'selected_cmd'] == 
'unmakesticky') {
 
 2985                if ($this->is_moderator) {
 
 2986                    $message = $this->lng->txt(
'sel_threads_make_unsticky');
 
 2990                        $unmakeSticky = $tmp_obj->unmakeSticky();
 
 2991                        if (!$unmakeSticky) {
 
 2992                            $message = $this->lng->txt(
'sel_threads_already_unsticky');
 
 3000                $this->ctrl->redirect($this, 
'showThreads');
 
 3001            } elseif (
$_POST[
'selected_cmd'] == 
'editThread') {
 
 3002                if ($this->is_moderator) {
 
 3003                    $count = count(
$_POST[
'thread_ids']);
 
 3006                        $this->ctrl->redirect($this, 
'showThreads');
 
 3008                        foreach (
$_POST[
'thread_ids'] as $thread_id) {
 
 3014                $this->ctrl->redirect($this, 
'showThreads');
 
 3015            } elseif (
$_POST[
'selected_cmd'] == 
'html') {
 
 3016                $this->ctrl->setCmd(
'exportHTML');
 
 3017                $this->ctrl->setCmdClass(
'ilForumExportGUI');
 
 3019            } elseif (
$_POST[
'selected_cmd'] == 
'confirmDeleteThreads') {
 
 3021            } elseif (
$_POST[
'selected_cmd'] == 
'merge') {
 
 3024                ilUtil::sendInfo($this->lng->txt(
'topics_please_select_one_action'), 
true);
 
 3025                $this->ctrl->redirect($this, 
'showThreads');
 
 3029            $this->ctrl->redirect($this, 
'showThreads');
 
 3035        if (!$this->is_moderator) {
 
 3036            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3039        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3040            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3043        $threads2move = 
$_SESSION[
'threads2move'];
 
 3044        if (!is_array($threads2move) || !count($threads2move)) {
 
 3046            $this->ctrl->redirect($this, 
'showThreads');
 
 3049        if (!$this->access->checkAccess(
'read', 
'', (
int) 
$_POST[
'frm_ref_id'])) {
 
 3050            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3054        array_walk($threads2move, 
function ($threadId) use (&$threads) {
 
 3055            $thread = new \ilForumTopic($threadId);
 
 3058            $threads[] = $threadId;
 
 3061        if (isset(
$_POST[
'frm_ref_id']) && (int) 
$_POST[
'frm_ref_id']) {
 
 3062            $errorMessages = $this->
object->Forum->moveThreads(
 
 3064                $this->
object->getRefId(),
 
 3065                $this->ilObjDataCache->lookupObjId(
$_POST[
'frm_ref_id'])
 
 3068            if (array() !== $errorMessages) {
 
 3070                    implode(
"<br><br>", $errorMessages),
 
 3073                return $this->ctrl->redirectByClass(
'ilObjForumGUI', 
'showThreads');
 
 3078            $this->ctrl->redirect($this, 
'showThreads');
 
 3088        $this->ctrl->redirect($this, 
'showThreads');
 
 3093        if (!$this->is_moderator) {
 
 3094            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3097        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3098            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3101        $threads2move = 
$_SESSION[
'threads2move'];
 
 3102        if (!is_array($threads2move) || !count($threads2move)) {
 
 3104            $this->ctrl->redirect($this, 
'showThreads');
 
 3109        array_walk($threads2move, 
function ($threadId) use (&$threads, $isModerator) {
 
 3110            $thread = new \ilForumTopic($threadId, $isModerator);
 
 3113            $threads[] = $thread;
 
 3117        $exp->setPathOpen($this->object->getRefId());
 
 3118        $exp->setNodeSelected(isset(
$_POST[
'frm_ref_id']) && (
int) 
$_POST[
'frm_ref_id'] ? (
int) 
$_POST[
'frm_ref_id'] : 0);
 
 3119        $exp->setCurrentFrmRefId($this->object->getRefId());
 
 3120        $exp->setHighlightedNode($this->object->getRefId());
 
 3121        if (!$exp->handleCommand()) {
 
 3122            $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_move.html', 
'Modules/Forum');
 
 3125                $this->toolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this));
 
 3129            $tblThr->setId(
'il_frm_thread_move_table_' . $this->object->getRefId());
 
 3130            $tblThr->setTitle($this->lng->txt(
'move_chosen_topics'));
 
 3131            $tblThr->addColumn($this->lng->txt(
'subject'), 
'top_name', 
'100%');
 
 3132            $tblThr->disable(
'header');
 
 3133            $tblThr->disable(
'footer');
 
 3134            $tblThr->disable(
'linkbar');
 
 3135            $tblThr->disable(
'sort');
 
 3136            $tblThr->disable(
'linkbar');
 
 3137            $tblThr->setLimit(PHP_INT_MAX);
 
 3138            $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html', 
'Modules/Forum');
 
 3139            $tblThr->setDefaultOrderField(
'is_sticky');
 
 3142            foreach ($threads as $thread) {
 
 3143                $result[$counter][
'num'] = $counter + 1;
 
 3144                $result[$counter][
'thr_subject'] = $thread->getSubject();
 
 3148            $this->tpl->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
 
 3150            $this->tpl->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
 
 3151            $this->tpl->setVariable(
'CMD_SUBMIT', 
'performMoveThreads');
 
 3152            $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'move'));
 
 3153            $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this, 
'performMoveThreads'));
 
 3161        if ($this->objProperties->isAnonymized() && (!$this->is_moderator || !$this->objProperties->getMarkModeratorPosts())) {
 
 3169        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3170            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3173        $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()[
'draft_ids'] ?? []));
 
 3174        if (0 === count($draftIds)) {
 
 3175            $draftIds = array_filter([(
int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0)]);
 
 3179        $checkedDraftIds = [];
 
 3180        foreach ($draftIds as $draftId) {
 
 3181            if (array_key_exists($draftId, $instances)) {
 
 3182                $checkedDraftIds[] = $draftId;
 
 3183                $draft = $instances[$draftId];
 
 3187                $draftFileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
 
 3188                $draftFileData->delete();
 
 3190                $GLOBALS[
'ilAppEventHandler']->raise(
 
 3194                    'draftObj' => $draft,
 
 3195                    'obj_id' => $this->object->getId(),
 
 3196                    'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
 
 3200                $draft->deleteDraft();
 
 3204        if (count($checkedDraftIds) > 1) {
 
 3209        $this->ctrl->redirect($this, 
'showThreads');
 
 3218        $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 3219        $allowNotification = !$this->objProperties->isAnonymized();
 
 3221        $mail = new \ilMail($this->
user->getId());
 
 3222        if (!$this->rbac->system()->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId())) {
 
 3223            $allowNotification = 
false;
 
 3226        $form = new \ilForumThreadFormGUI(
 
 3228            $this->objProperties,
 
 3242        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3243            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3246        if (!$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
 
 3247            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3250        $templateForWidthHandling = new \ilTemplate(
'tpl.create_thread_form.html', 
true, 
true, 
'Modules/Forum');
 
 3252        $templateForWidthHandling->parseCurrentBlock();
 
 3254        $this->tpl->setContent($templateForWidthHandling->get());
 
 3265            !$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
 
 3266            !$this->access->checkAccess(
'read', 
'', $this->object->getRefId())
 
 3268            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3271        $frm = $this->
object->Forum;
 
 3272        $frm->setForumId($this->object->getId());
 
 3273        $frm->setForumRefId($this->object->getRefId());
 
 3274        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 3275        $topicData = $frm->getOneTopic();
 
 3278        if (
$form->checkInput()) {
 
 3281            $userIdForDisplayPurposes = $this->
user->getId();
 
 3283                $userIdForDisplayPurposes = 0;
 
 3288                ($this->objProperties->isPostActivationEnabled() && !$this->is_moderator) ||
 
 3289                $this->objCurrentPost->isAnyParentDeactivated()
 
 3294            if ($createFromDraft) {
 
 3295                $newThread = new \ilForumTopic(0, 
true, 
true);
 
 3296                $newThread->setForumId($topicData[
'top_pk']);
 
 3302                $newPost = $frm->generateThread(
 
 3311                $newThread = new \ilForumTopic(0, 
true, 
true);
 
 3312                $newThread->setForumId($topicData[
'top_pk']);
 
 3313                $newThread->setThrAuthorId($this->
user->getId());
 
 3314                $newThread->setDisplayUserId($userIdForDisplayPurposes);
 
 3316                $newThread->setUserAlias($userAlias);
 
 3318                $newPost = $frm->generateThread(
 
 3321                    $form->getItemByPostVar(
'notify') ? (
int) 
$form->getInput(
'notify') : 0,
 
 3327            if ($this->objProperties->isFileUploadAllowed()) {
 
 3328                $file = $_FILES[
'userfile'];
 
 3329                if (is_array($file) && !empty($file)) {
 
 3330                    $fileData = new \ilFileDataForum($this->object->getId(), $newPost);
 
 3331                    $fileData->storeUploadedFile($file);
 
 3335            $frm->setDbTable(
'frm_data');
 
 3336            $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
 
 3337            $frm->updateVisits($topicData[
'top_pk']);
 
 3339            if ($createFromDraft) {
 
 3344            foreach ($mediaObjects as $mob) {
 
 3352                $draftHistory = new \ilForumDraftsHistory();
 
 3353                $draftHistory->deleteHistoryByDraftIds([$draft->
getDraftId()]);
 
 3354                if ($this->objProperties->isFileUploadAllowed()) {
 
 3355                    $forumFileData = new \ilFileDataForum($this->object->getId(), $newPost);
 
 3356                    $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->
getDraftId());
 
 3357                    $draftFileData->moveFilesOfDraft($forumFileData->getForumPath(), $newPost);
 
 3362            $GLOBALS[
'ilAppEventHandler']->raise(
 
 3366                    'ref_id' => $this->object->getRefId(),
 
 3368                    'notify_moderators' => !$status
 
 3372            \ilUtil::sendSuccess($this->lng->txt(
'forums_thread_new_entry'), 
true);
 
 3373            $this->ctrl->redirect($this);
 
 3376        $form->setValuesByPost();
 
 3377        if (!$this->objProperties->isAnonymized()) {
 
 3378            $form->getItemByPostVar(
'alias')->setValue($this->
user->getLogin());
 
 3381        $this->tpl->setContent(
$form->getHTML());
 
 3387            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3390        $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 3393        if ((
int) $draft->getDraftId() <= 0) {
 
 3394            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3402        $draft = new \ilForumPostDraft();
 
 3404            $draftId = (int) ($this->httpRequest->getParsedBody()[
'draft_id'] ?? 0);
 
 3415        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3416            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3419        $frm = $this->
object->Forum;
 
 3420        $frm->setForumId($this->object->getId());
 
 3421        $frm->enableForumNotification($this->
user->getId());
 
 3423        if ((
int) $this->objCurrentTopic->getId() > 0) {
 
 3424            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 3426            $this->ctrl->redirect($this, 
'viewThread');
 
 3435        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3436            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3439        $frm = $this->
object->Forum;
 
 3440        $frm->setForumId($this->object->getId());
 
 3441        $frm->disableForumNotification($this->
user->getId());
 
 3443        if ((
int) $this->objCurrentTopic->getId() > 0) {
 
 3444            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 3446            $this->ctrl->redirect($this, 
'viewThread');
 
 3458        $column_gui->
setBlockProperty(
'news', 
'title', $this->lng->txt(
'frm_latest_postings'));
 
 3462        if ($this->access->checkAccess(
'write', 
'', $this->object->getRefId())) {
 
 3463            $news_set = new \ilSetting(
'news');
 
 3464            if ($news_set->get(
'enable_rss_for_internal')) {
 
 3466                $column_gui->
setBlockProperty(
'news', 
'public_notifications_option', 
true);
 
 3477            $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this), 
'', $this->object->getRefId());
 
 3483        $a_text = str_replace(
"<", 
"<", $a_text);
 
 3484        $a_text = str_replace(
">", 
">", $a_text);
 
 3485        if ($a_stripslashes) {
 
 3494        $a_text = str_replace(
"<", 
"<", $a_text);
 
 3495        $a_text = str_replace(
">", 
">", $a_text);
 
 3503            !$this->access->checkAccess(
'visible', 
'', $this->object->getRefId()) &&
 
 3504            !$this->access->checkAccess(
'read', 
'', $this->object->getRefId())
 
 3506            $this->
error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
 
 3509        $info = new \ilInfoScreenGUI($this);
 
 3510        $info->enablePrivateNotes();
 
 3511        $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
 
 3512        $this->ctrl->forwardCommand(
$info);
 
 3520        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3521            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3524        if ((
int) $this->objCurrentPost->getId() > 0) {
 
 3527            $this->
object->markPostUnread($this->
user->getId(), (
int) $this->objCurrentPost->getId());
 
 3529        $this->viewThreadObject();
 
 3537        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3538            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3541        if ((
int) $this->objCurrentTopic->getId() > 0 && (
int) $this->objCurrentPost->getId() > 0) {
 
 3544            $this->
object->markPostRead(
 
 3545                $this->
user->getId(),
 
 3546                (
int) $this->objCurrentTopic->getId(),
 
 3547                (
int) $this->objCurrentPost->getId()
 
 3550        $this->viewThreadObject();
 
 3558        $lg = parent::initHeaderAction();
 
 3560        if ((
int) $this->objCurrentTopic->getId() > 0) {
 
 3561            $container_obj = 
null; 
 
 3562            $lg->setContainerObject($container_obj);
 
 3569        if ($this->
user->isAnonymous() || !$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3573        $frm = $this->
object->Forum;
 
 3574        $frm->setForumId($this->object->getId());
 
 3575        $frm->setForumRefId($this->object->getRefId());
 
 3576        $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 3578        $isForumNotificationEnabled = $frm->isForumNotificationEnabled($this->
user->getId());
 
 3581        if ((
int) $this->objCurrentTopic->getId() > 0) {
 
 3582            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 3587            if ($isForumNotificationEnabled && $userMayDisableNotifications) {
 
 3588                $lg->addCustomCommand(
 
 3589                    $this->ctrl->getLinkTarget($this, 
'disableForumNotification'),
 
 3590                    'forums_disable_forum_notification' 
 3592            } elseif (!$isForumNotificationEnabled) {
 
 3593                $lg->addCustomCommand(
 
 3594                    $this->ctrl->getLinkTarget($this, 
'enableForumNotification'),
 
 3595                    'forums_enable_forum_notification' 
 3598        } elseif ($isForumNotificationEnabled) {
 
 3599            $lg->addCustomCommand(
 
 3600                $this->ctrl->getLinkTarget($this, 
'disableForumNotification'),
 
 3601                'forums_disable_forum_notification' 
 3604            $lg->addCustomCommand(
 
 3605                $this->ctrl->getLinkTarget($this, 
'enableForumNotification'),
 
 3606                'forums_enable_forum_notification' 
 3610        $isThreadNotificationEnabled = 
false;
 
 3611        if ((
int) $this->objCurrentTopic->getId() > 0) {
 
 3612            $isThreadNotificationEnabled = $this->objCurrentTopic->isNotificationEnabled($this->
user->getId());
 
 3613            if ($isThreadNotificationEnabled) {
 
 3614                $lg->addCustomCommand(
 
 3615                    $this->ctrl->getLinkTarget($this, 
'toggleThreadNotification'),
 
 3616                    'forums_disable_notification' 
 3619                $lg->addCustomCommand(
 
 3620                    $this->ctrl->getLinkTarget($this, 
'toggleThreadNotification'),
 
 3621                    'forums_enable_notification' 
 3625        $this->ctrl->setParameter($this, 
'thr_pk', 
'');
 
 3627        if ($isForumNotificationEnabled || $isThreadNotificationEnabled) {
 
 3631                $this->lng->txt(
'frm_notification_activated')
 
 3637                $this->lng->txt(
'frm_notification_deactivated')
 
 3646        if ($this->objProperties->getNotificationType() == 
'default') {
 
 3650        if ($this->objProperties->isUserToggleNoti() == 0) {
 
 3656            $frm_noti->setUserId($this->
user->getId());
 
 3658            $user_toggle = (int) $frm_noti->isUserToggleNotification();
 
 3659            if ($user_toggle == 0 && $this->objProperties->isUserToggleNoti() == 0) {
 
 3669        $grpRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 
'grp');
 
 3670        $crsRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 
'crs');
 
 3672        return ($grpRefId > 0 || $crsRefId > 0);
 
 3680        if (!(
int) $this->
settings->get(
'disable_my_offers')) {
 
 3682            \ilUtil::sendSuccess($this->lng->txt(
'added_to_desktop'));
 
 3693        if (!(
int) $this->
settings->get(
'disable_my_offers')) {
 
 3695            \ilUtil::sendSuccess($this->lng->txt(
'removed_from_desktop'));
 
 3703        if (!$this->is_moderator) {
 
 3704            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3707        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3708            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3711        $threadIdToSortValueMap = (array) ($this->httpRequest->getParsedBody()[
'thread_sorting'] ?? []);
 
 3713        array_walk($threadIdToSortValueMap, 
function ($sortValue, $threadId) {
 
 3717        foreach ($threadIdToSortValueMap as $threadId => $sortValue) {
 
 3718            $sortValue = str_replace(
',', 
'.', $sortValue);
 
 3719            $sortValue = (float) $sortValue * 100;
 
 3720            $this->
object->setThreadSorting((
int) $threadId, $sortValue);
 
 3723        \ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'), 
true);
 
 3724        $this->ctrl->redirect($this, 
'showThreads');
 
 3732        if (!$this->is_moderator) {
 
 3733            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3736        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3737            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3740        $threadIdToMerge = (int) ($this->httpRequest->getQueryParams()[
'merge_thread_id'] ?? 0);
 
 3741        if (!($threadIdToMerge > 0)) {
 
 3742            $threadIds = array_values(
 
 3743                array_filter(array_map(
'intval', (array) $this->httpRequest->getParsedBody()[
'thread_ids'] ?? []))
 
 3745            if (1 === count($threadIds)) {
 
 3746                $threadIdToMerge = current($threadIds);
 
 3754        $frm = $this->
object->Forum;
 
 3755        $frm->setForumId($this->object->getId());
 
 3756        $frm->setForumRefId($this->object->getRefId());
 
 3766        $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 3768        $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_liste.html', 
'Modules/Forum');
 
 3770        $topicData = $frm->getOneTopic();
 
 3772            $this->ctrl->setParameter($this, 
'merge_thread_id', $threadIdToMerge);
 
 3773            $tbl = new \ilForumTopicTableGUI(
 
 3777                (
int) $this->httpRequest->getQueryParams()[
'ref_id'],
 
 3779                $this->is_moderator,
 
 3780                $this->settings->get(
'forum_overview')
 
 3782            $tbl->setSelectedThread($threadToMerge);
 
 3783            $tbl->setMapper($frm)->fetchData();
 
 3785            $this->tpl->setVariable(
'THREADS_TABLE', 
$tbl->getHTML());
 
 3797        if (!$this->is_moderator) {
 
 3798            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3801        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3802            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3805        $sourceThreadId = (int) ($this->httpRequest->getQueryParams()[
'merge_thread_id'] ?? 0);
 
 3806        $targetThreadIds = array_values(
 
 3807            array_filter(array_map(
'intval', (array) $this->httpRequest->getParsedBody()[
'thread_ids'] ?? []))
 
 3810        if (!($sourceThreadId > 0) || 1 !== count($targetThreadIds)) {
 
 3816        $targetThreadId = current($targetThreadIds);
 
 3817        if ($sourceThreadId == $targetThreadId) {
 
 3825            $this->ctrl->clearParameters($this);
 
 3839        $c_gui->setFormAction($this->ctrl->getFormAction($this, 
'performMergeThreads'));
 
 3840        $c_gui->setHeaderText($this->lng->txt(
'frm_sure_merge_threads'));
 
 3841        $c_gui->setCancel($this->lng->txt(
'cancel'), 
'showThreads');
 
 3842        $c_gui->setConfirm($this->lng->txt(
'confirm'), 
'performMergeThreads');
 
 3854        $this->tpl->setContent($c_gui->getHTML());
 
 3862        if (!$this->is_moderator) {
 
 3863            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3866        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3867            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3870        $threadIds = array_values(
 
 3871            array_filter(array_map(
'intval', (array) $this->httpRequest->getParsedBody()[
'thread_ids'] ?? []))
 
 3873        if (2 !== count($threadIds)) {
 
 3879        if ((
int) $threadIds[0] === (
int) $threadIds[1]) {
 
 3886            $frm = new \ilForum();
 
 3887            $frm->setForumId($this->object->getId());
 
 3888            $frm->setForumRefId($this->object->getRefId());
 
 3893            $frm->mergeThreads((
int) $threadIds[0], (
int) $threadIds[1]);
 
 3894            \ilUtil::sendSuccess($this->lng->txt(
'merged_threads_successfully'));
 
 3908        if (!$this->ctrl->isAsynch()) {
 
 3909            $content = implode(
'', [
 
 3914        $this->tpl->setRightContent($content);
 
 3922        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3923            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3926        $draftId = $this->httpRequest->getQueryParams()[
'draft_id'] ?? 0;
 
 3928        if ($draft->getPostAuthorId() == $this->user->getId()) {
 
 3929            $fileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
 
 3930            if (!$fileData->deliverZipFile()) {
 
 3931                $this->ctrl->redirect($this);
 
 3941        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3942            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3947        $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
 
 3948        if (!$fileData->deliverZipFile()) {
 
 3949            $this->ctrl->redirect($this);
 
 3959            !$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
 
 3960            !$this->access->checkAccess(
'read', 
'', $this->object->getRefId()) ||
 
 3963            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3966        $frm = $this->
object->Forum;
 
 3967        $frm->setForumId($this->object->getId());
 
 3968        $frm->setForumRefId($this->object->getRefId());
 
 3970        $draft = new \ilForumPostDraft();
 
 3971        $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 3973            $draft = $draft->newInstanceByDraftId($draftId);
 
 3976        $historyCheck = (int) ($this->httpRequest->getQueryParams()[
'hist_check'] ?? 1);
 
 3983            $form->setValuesByArray([
 
 3984                'alias' => $draft->getPostUserAlias(),
 
 3985                'subject' => $draft->getPostSubject(),
 
 3987                'notify' => $draft->getNotify() ? 
true : 
false,
 
 3992            $this->ctrl->setParameter($this, 
'draft_id', $draftId);
 
 3995        $this->tpl->setContent(
$form->getHTML() . $this->modal_history);
 
 4000        $historyId = (int) ($this->httpRequest->getQueryParams()[
'history_id'] ?? 0);
 
 4001        $history = new \ilForumDraftsHistory($historyId);
 
 4003        $draft = $history->rollbackAutosave();
 
 4004        if ($draft->getThreadId() == 0 && $draft->getPostId() == 0) {
 
 4005            $this->ctrl->setParameter($this, 
'draft_id', $history->getDraftId());
 
 4006            $this->ctrl->redirect($this, 
'editThreadDraft');
 
 4009        $this->ctrl->clearParameters($this);
 
 4010        $this->ctrl->setParameter($this, 
'pos_pk', $draft->getPostId());
 
 4011        $this->ctrl->setParameter($this, 
'thr_pk', $draft->getThreadId());
 
 4012        $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 4013        $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 4018        $this->ctrl->redirect($this, 
'viewThread');
 
 4024            !$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
 
 4025            !$this->access->checkAccess(
'read', 
'', $this->object->getRefId()) ||
 
 4028            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4031        $autoSavedDraftId = (int) ($this->httpRequest->getParsedBody()[
'draft_id'] ?? 0);
 
 4032        if ($autoSavedDraftId <= 0) {
 
 4033            $autoSavedDraftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 4036        $frm = $this->
object->Forum;
 
 4037        $frm->setForumId($this->object->getId());
 
 4038        $frm->setForumRefId($this->object->getRefId());
 
 4039        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 4040        $topicData = $frm->getOneTopic();
 
 4043        if (
$form->checkInput()) {
 
 4046            if (0 === $autoSavedDraftId) {
 
 4047                $draft = new \ilForumPostDraft();
 
 4052            $draft->setForumId($topicData[
'top_pk']);
 
 4053            $draft->setThreadId(0);
 
 4054            $draft->setPostId(0);
 
 4058            $draft->setPostUserAlias($userAlias);
 
 4059            $draft->setNotify((
int) 
$form->getInput(
'notify'));
 
 4060            $draft->setPostAuthorId($this->
user->getId());
 
 4061            $draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4063            if (0 === $autoSavedDraftId) {
 
 4064                $draftId = $draft->saveDraft();
 
 4066                $draft->updateDraft();
 
 4067                $draftId = $draft->getDraftId();
 
 4070            $GLOBALS[
'ilAppEventHandler']->raise(
 
 4074                'draftObj' => $draft,
 
 4075                'obj_id' => $this->object->getId(),
 
 4076                'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
 
 4082            $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draftId);
 
 4084            $files2delete = 
$form->getInput(
'del_file');
 
 4085            if (is_array($files2delete) && count($files2delete) > 0) {
 
 4086                $draftFileData->unlinkFilesByMD5Filenames($files2delete);
 
 4089            if ($this->objProperties->isFileUploadAllowed()) {
 
 4090                $file = $_FILES[
'userfile'];
 
 4091                if (is_array($file) && !empty($file)) {
 
 4092                    $draftFileData->storeUploadedFile($file);
 
 4096            \ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'), 
true);
 
 4097            $this->ctrl->clearParameters($this);
 
 4098            $this->ctrl->redirect($this, 
'showThreads');
 
 4101        $this->requestAction = substr($this->requestAction, 6); 
 
 4102        $form->setValuesByPost();
 
 4103        $this->ctrl->setParameter($this, 
'draft_id', $autoSavedDraftId);
 
 4104        $this->tpl->setContent(
$form->getHTML());
 
 4110            !$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) ||
 
 4111            !$this->access->checkAccess(
'read', 
'', $this->object->getRefId()) ||
 
 4114            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4117        $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 4118        if ($draftId <= 0) {
 
 4119            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->
error->MESSAGE);
 
 4123        if (
$form->checkInput()) {
 
 4131            $draft->setPostUserAlias($userAlias);
 
 4132            $draft->setNotify((
int) 
$form->getInput(
'notify'));
 
 4133            $draft->setPostAuthorId($this->
user->getId());
 
 4134            $draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4135            $draft->updateDraft();
 
 4137            $GLOBALS[
'ilAppEventHandler']->raise(
 
 4141                    'draftObj' => $draft,
 
 4142                    'obj_id' => $this->object->getId(),
 
 4143                    'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
 
 4148                $form->getInput(
'message'),
 
 4150                $draft->getDraftId(),
 
 4152                $draft->getDraftId()
 
 4155            $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
 
 4157            $files2delete = 
$form->getInput(
'del_file');
 
 4158            if (is_array($files2delete) && count($files2delete) > 0) {
 
 4159                $draftFileData->unlinkFilesByMD5Filenames($files2delete);
 
 4162            if ($this->objProperties->isFileUploadAllowed()) {
 
 4163                $file = $_FILES[
'userfile'];
 
 4164                if (is_array($file) && !empty($file)) {
 
 4165                    $draftFileData->storeUploadedFile($file);
 
 4169            \ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'), 
true);
 
 4170            $this->ctrl->clearParameters($this);
 
 4171            $this->ctrl->redirect($this, 
'showThreads');
 
 4174        $form->setValuesByPost();
 
 4175        $this->ctrl->setParameter($this, 
'hist_check', 0);
 
 4176        $this->ctrl->setParameter($this, 
'draft_id', $draftId);
 
 4180    public function saveAsDraftObject()
 
 4182        if (!$this->objCurrentTopic->getId()) {
 
 4184            $this->ctrl->redirect($this);
 
 4187        if ($this->objCurrentTopic->isClosed()) {
 
 4189            $this->ctrl->redirect($this);
 
 4192        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 4193            $_POST[
'del_file'] = array();
 
 4196        $autosave_draft_id = 0;
 
 4198            $autosave_draft_id = (int) 
$_POST[
'draft_id'];
 
 4201        if ($oReplyEditForm->checkInput()) {
 
 4202            if (!$this->objCurrentPost->getId()) {
 
 4203                $this->requestAction = 
'';
 
 4205                $this->viewThreadObject();
 
 4216            $forumObj = $oForumObjects[
'forumObj'];
 
 4220            $frm = $oForumObjects[
'frm'];
 
 4221            $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 4222            $topicData = $frm->getOneTopic();
 
 4225            if ($this->requestAction == 
'ready_showreply') {
 
 4226                if (!$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 4227                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4232                if ($autosave_draft_id == 0) {
 
 4237                $draftObj->setForumId($topicData[
'top_pk']);
 
 4238                $draftObj->setThreadId($this->objCurrentTopic->getId());
 
 4239                $draftObj->setPostId($this->objCurrentPost->getId());
 
 4241                $draftObj->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
 
 4243                $draftObj->setPostUserAlias($user_alias);
 
 4244                $draftObj->setNotify((
int) $oReplyEditForm->getInput(
'notify'));
 
 4245                $draftObj->setPostNotify((
int) $oReplyEditForm->getInput(
'notify_post'));
 
 4247                $draftObj->setPostAuthorId($this->
user->getId());
 
 4248                $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4250                if ($autosave_draft_id == 0) {
 
 4251                    $draft_id = $draftObj->saveDraft();
 
 4253                    $draftObj->updateDraft();
 
 4254                    $draft_id = $draftObj->getDraftId();
 
 4259                    $GLOBALS[
'ilAppEventHandler']->raise(
 
 4262                        array(
'draftObj' => $draftObj,
 
 4263                                  'obj_id' => $this->object->getId(),
 
 4264                                  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4268                if ($this->objProperties->isFileUploadAllowed()) {
 
 4269                    $file = $_FILES[
'userfile'];
 
 4270                    if (is_array($file) && !empty($file)) {
 
 4272                        $oFDForumDrafts->storeUploadedFile($file);
 
 4279                $_SESSION[
'frm'][(int) 
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
 
 4281                ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'), 
true);
 
 4282                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4283                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4284                $this->ctrl->redirect($this, 
'viewThread');
 
 4287            $oReplyEditForm->setValuesByPost();
 
 4288            $this->requestAction = substr($this->requestAction, 6);
 
 4290        return $this->viewThreadObject();
 
 4296            $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 4302        $this->viewThreadObject();
 
 4308    public function updateDraftObject()
 
 4310        if (!$this->objCurrentTopic->getId()) {
 
 4312            $this->ctrl->redirect($this);
 
 4315        if ($this->objCurrentTopic->isClosed()) {
 
 4317            $this->ctrl->redirect($this);
 
 4320        if (!$this->objCurrentPost->getId()) {
 
 4321            $this->requestAction = 
'';
 
 4323            $this->viewThreadObject();
 
 4327        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 4328            $_POST[
'del_file'] = array();
 
 4332        if ($oReplyEditForm->checkInput()) {
 
 4340            $forumObj = $oForumObjects[
'forumObj'];
 
 4342            if (!$this->
user->isAnonymous() && in_array($this->requestAction, [
'showdraft', 
'editdraft'])) {
 
 4343                if (!$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 4344                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4352                $update_draft->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
 
 4354                $update_draft->setPostUserAlias($user_alias);
 
 4355                $update_draft->setNotify((
int) $oReplyEditForm->getInput(
'notify'));
 
 4356                $update_draft->setUpdateUserId($this->
user->getId());
 
 4357                $update_draft->setPostAuthorId($this->
user->getId());
 
 4358                $update_draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4360                $update_draft->updateDraft();
 
 4363                    $GLOBALS[
'ilAppEventHandler']->raise(
 
 4366                        array(
'draftObj' => $update_draft,
 
 4367                              'obj_id' => $this->object->getId(),
 
 4368                              'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4374                foreach ($uploadedObjects as $mob) {
 
 4382                $file2delete = $oReplyEditForm->getInput(
'del_file');
 
 4383                if (is_array($file2delete) && count($file2delete)) {
 
 4384                    $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
 
 4387                if ($this->objProperties->isFileUploadAllowed()) {
 
 4388                    $file = $_FILES[
'userfile'];
 
 4389                    if (is_array($file) && !empty($file)) {
 
 4390                        $oFDForumDrafts->storeUploadedFile($file);
 
 4394                $_SESSION[
'frm'][(int) 
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
 
 4395                ilUtil::sendSuccess($this->lng->txt(
'save_draft_successfully'), 
true);
 
 4397            $this->ctrl->clearParameters($this);
 
 4398            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4399            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4400            $this->ctrl->setParameter($this, 
'draft_id', $update_draft->getDraftId());
 
 4402            $this->ctrl->clearParameters($this);
 
 4403            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4404            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4405            $this->ctrl->setParameter($this, 
'draft_id', (
int) 
$_GET[
'draft_id']);
 
 4406            $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 4407            $oReplyEditForm->setValuesByPost();
 
 4408            return $this->viewThreadObject();
 
 4410        $this->ctrl->clearParameters($this);
 
 4411        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4412        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4413        $this->ctrl->redirect($this, 
'viewThread');
 
 4426        foreach ($oldMediaObjects as $oldMob) {
 
 4428            foreach ($curMediaObjects as $curMob) {
 
 4429                if ($oldMob == $curMob) {
 
 4450            !$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id']) ||
 
 4451            $this->user->isAnonymous() ||
 
 4453            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4456        $post_id = $this->objCurrentPost->getId();
 
 4458            $draft_id_to_delete = (int) 
$_GET[
'draft_id'];
 
 4461            if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete)) {
 
 4462                $this->ctrl->clearParameters($this);
 
 4463                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4464                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4465                $this->ctrl->redirect($this, 
'viewThread');
 
 4469        $this->
deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
 
 4472        $objFileDataForumDrafts->delete();
 
 4475            $GLOBALS[
'ilAppEventHandler']->raise(
 
 4478                array(
'draftObj' => $draft_obj,
 
 4479                      'obj_id' => $this->object->getId(),
 
 4480                      'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4483        $draft_obj->deleteDraft();
 
 4485        ilUtil::sendSuccess($this->lng->txt(
'delete_draft_successfully'), 
true);
 
 4486        $this->ctrl->clearParameters($this);
 
 4487        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4488        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4489        $this->ctrl->redirect($this, 
'viewThread');
 
 4494        $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 4496            $this->requestAction !== 
'ready_showreply' &&
 
 4497            $this->access->checkAccess(
'read', 
'', $this->object->getRefId()) &&
 
 4498            $this->access->checkAccess(
'add_reply', 
'', $this->object->getRefId())
 
 4500            $action = new \ilForumAutoSaveAsyncDraftAction(
 
 4503                $this->objProperties,
 
 4504                $this->objCurrentTopic,
 
 4505                $this->objCurrentPost,
 
 4506                function (
string $message) : 
string {
 
 4514            echo json_encode(
$action->executeAndGetResponseObject());
 
 4522        $draftId = (int) ($this->httpRequest->getQueryParams()[
'draft_id'] ?? 0);
 
 4524            $this->requestAction !== 
'ready_showreply' &&
 
 4525            $this->access->checkAccess(
'read', 
'', $this->object->getRefId()) &&
 
 4526            $this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())
 
 4528            $action = new \ilForumAutoSaveAsyncDraftAction(
 
 4531                $this->objProperties,
 
 4532                $this->objCurrentTopic,
 
 4533                $this->objCurrentPost,
 
 4534                function (
string $message) : 
string {
 
 4542            echo json_encode(
$action->executeAndGetResponseObject());
 
 4560            if ($this->objCurrentPost->getId() != $node->
getId() || (
 
 4563                if ($this->is_moderator || $node->
isActivated() || $node->
isOwner($this->user->getId())) {
 
 4565                    if (!$this->objCurrentTopic->isClosed() && $node->
isActivated() &&
 
 4566                        $this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id']) &&
 
 4569                        $this->ctrl->setParameter($this, 
'action', 
'showreply');
 
 4570                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4571                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 4572                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4573                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 4575                        if (!isset($draftsObjects[$node->
getId()])) {
 
 4576                            $actions[
'reply_to_postings'] = $this->ctrl->getLinkTarget(
 
 4577                                $this, 
'viewThread',
 
 4578                                'reply_' . $node->
getId()
 
 4582                        $this->ctrl->clearParameters($this);
 
 4586                    if (!$this->objCurrentTopic->isClosed() &&
 
 4587                        ($node->
isOwner($this->user->getId()) || $this->is_moderator) &&
 
 4589                        $this->user->getId() != ANONYMOUS_USER_ID
 
 4591                        $this->ctrl->setParameter($this, 
'action', 
'showedit');
 
 4592                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4593                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 4594                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 4595                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4597                        $actions[
'edit'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 4599                        $this->ctrl->clearParameters($this);
 
 4603                    if ($this->
user->getId() != ANONYMOUS_USER_ID && !$node->
isPostRead()) {
 
 4604                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4605                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 4606                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 4607                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4608                        $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 4610                        $actions[
'frm_mark_as_read'] = $this->ctrl->getLinkTarget($this, 
'markPostRead', $node->
getId());
 
 4612                        $this->ctrl->clearParameters($this);
 
 4616                    if ($this->
user->getId() != ANONYMOUS_USER_ID &&
 
 4619                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4620                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 4621                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 4622                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4623                        $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 4625                        $actions[
'frm_mark_as_unread'] = $this->ctrl->getLinkTarget($this, 
'markPostUnread', $node->
getId());
 
 4627                        $this->ctrl->clearParameters($this);
 
 4632                        $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'print_post', $node->
getId());
 
 4633                        $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'top_pk', $node->
getForumId());
 
 4634                        $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'thr_pk', $node->
getThreadId());
 
 4636                        $actions[
'print'] = $this->ctrl->getLinkTargetByClass(
'ilforumexportgui', 
'printPost');
 
 4638                        $this->ctrl->clearParameters($this);
 
 4641                    # buttons for every post except the "active" 
 4642                    if (!$this->objCurrentTopic->isClosed() &&
 
 4643                        ($this->is_moderator ||
 
 4645                        $this->user->getId() != ANONYMOUS_USER_ID
 
 4648                        $this->ctrl->setParameter($this, 
'action', 
'delete');
 
 4649                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4650                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 4651                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 4652                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4654                        $actions[
'delete'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 4656                        $this->ctrl->clearParameters($this);
 
 4659                    if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
 
 4661                        $this->ctrl->setParameter($this, 
'action', 
'censor');
 
 4662                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4663                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 4664                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 4665                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4667                            $actions[
'frm_revoke_censorship'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 4669                            $actions[
'frm_censorship'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 4672                        $this->ctrl->clearParameters($this);
 
 4675                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4676                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 4677                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 4678                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4681                            $actions[
'activate_post'] = $this->ctrl->getLinkTarget($this, 
'askForPostActivation', $node->
getId());
 
 4684                        $this->ctrl->clearParameters($this);
 
 4689            if (!isset($draft)) {
 
 4691                $draft = $draftsObjects[$node->
getId()];
 
 4694            $this->ctrl->setParameter($this, 
'action', 
'publishdraft');
 
 4695            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4696            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 4697            $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 4698            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 4699            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4700            $actions[
'publish'] = $this->ctrl->getLinkTarget($this, 
'publishSelectedDraft', $node->
getId());
 
 4701            $this->ctrl->clearParameters($this);
 
 4703            $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 4704            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4705            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 4706            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 4707            $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 4708            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4709            $actions[
'edit'] = $this->ctrl->getLinkTarget($this, 
'editDraft', 
'draft_edit_' . $draft->getDraftId());
 
 4710            $this->ctrl->clearParameters($this);
 
 4712            $this->ctrl->setParameter($this, 
'action', 
'deletedraft');
 
 4713            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 4714            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 4715            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 4716            $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 4717            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4718            $actions[
'delete'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 4719            $this->ctrl->clearParameters($this);
 
 4721            if (isset(
$_GET[
'draft_id']) && 
$action === 
'editdraft') {
 
 4726        $this->tpl->setCurrentBlock(
'posts_row');
 
 4734                    $sb_item->setCaption($lng_id);
 
 4735                    $sb_item->setUrl(
$url);
 
 4737                    $action_button->setDefaultButton($sb_item);
 
 4741                    $sb_item->setCaption($lng_id);
 
 4742                    $sb_item->setUrl(
$url);
 
 4749                $this->tpl->setVariable(
'COMMANDS', $action_button->render());
 
 4750            } elseif (!in_array(
$action, [
'deletedraft', 
'editdraft']) && !$this->objCurrentTopic->isClosed()) {
 
 4751                $this->tpl->setVariable(
'COMMANDS', $action_button->render());
 
 4764            !$this->access->checkAccess(
'add_reply', 
'', $this->object->getRefId()) || $this->user->isAnonymous() ||
 
 4767            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4784        if (is_array($draftsFromHistory) && 
sizeof($draftsFromHistory) > 0) {
 
 4786            $modal->setHeading($this->lng->txt(
'restore_draft_from_autosave'));
 
 4787            $modal->setId(
'frm_autosave_restore');
 
 4788            $form_tpl = new \ilTemplate(
'tpl.restore_thread_draft.html', 
true, 
true, 
'Modules/Forum');
 
 4790            foreach ($draftsFromHistory as 
$key => $history_instance) {
 
 4792                $accordion->setId(
'acc_' . $history_instance->getHistoryId());
 
 4794                $form_tpl->setCurrentBlock(
'list_item');
 
 4798                $this->ctrl->setParameter($this, 
'history_id', $history_instance->getHistoryId());
 
 4799                $header = $history_date . 
' - ' . $history_instance->getPostSubject();
 
 4801                    $this->uiFactory->button()->standard(
 
 4802                        $this->lng->txt(
'restore'),
 
 4803                        $this->ctrl->getLinkTarget($this, 
'restoreFromHistory')
 
 4807                $form_tpl->setVariable(
'ACC_AUTO_SAVE', $accordion->getHtml());
 
 4808                $form_tpl->parseCurrentBlock();
 
 4811            $form_tpl->setVariable(
'RESTORE_DATA_EXISTS', 
'found_threat_history_to_restore');
 
 4812            $modal->setBody($form_tpl->get());
 
 4814            $this->modal_history = $modal->getHTML();
 
 4825        if ($this->
user->isAnonymous() && !$this->user->isCaptchaVerified() && \ilCaptchaUtil::isActiveForForum()) {
 
 4826            $this->
user->setCaptchaVerified(
true);
 
 4840                (!$this->is_moderator && !$node->
isOwner($this->user->getId()) || $this->user->isAnonymous()) || $node->
isCensored()
 
 4843            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->getMessage());
 
 4844        } elseif (
$action == 
'showreply' && !$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 4845            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->getMessage());
 
 4848        $this->tpl->setVariable(
'REPLY_ANKER', 
'reply_' . $this->objCurrentPost->getId());
 
 4850        if ($action !== 
'editdraft') {
 
 4851            switch ($this->objProperties->getSubjectSetting()) {
 
 4852                case 'add_re_to_subject':
 
 4856                case 'preset_subject':
 
 4857                    $subject = $this->objCurrentPost->getSubject();
 
 4860                case 'empty_subject':
 
 4869                if ($this->ctrl->getCmd() == 
'savePost' || $this->ctrl->getCmd() == 
'saveAsDraft') {
 
 4870                    $oEditReplyForm->setValuesByPost();
 
 4872                    if ($this->ctrl->getCmd() == 
'quotePost') {
 
 4880                        $oEditReplyForm->setValuesByPost();
 
 4881                        $oEditReplyForm->getItemByPostVar(
'message')->setValue(
 
 4886                                    $authorinfo->getAuthorName()
 
 4887                                ) . 
"\n" . $oEditReplyForm->getInput(
'message'),
 
 4892                        $oEditReplyForm->setValuesByArray(array(
 
 4894                            'subject' => $subject,
 
 4898                            'del_file' => array()
 
 4903                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4904                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4906                $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html', 
true, 
true, 
'Modules/Forum');
 
 4907                $jsTpl->setVariable(
 
 4908                    'IL_FRM_QUOTE_CALLBACK_SRC',
 
 4909                    $this->ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
 
 4911                $this->ctrl->clearParameters($this);
 
 4912                $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
 
 4916                if ($this->ctrl->getCmd() == 
'savePost') {
 
 4917                    $oEditReplyForm->setValuesByPost();
 
 4919                    $oEditReplyForm->setValuesByArray(array(
 
 4921                        'subject' => $this->objCurrentPost->getSubject(),
 
 4923                            $this->objCurrentPost->getMessage(),
 
 4926                        'notify' => $this->objCurrentPost->isNotificationEnabled() ? 
true : 
false,
 
 4928                        'del_file' => array()
 
 4932                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getParentId());
 
 4933                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4934                $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html', 
true, 
true, 
'Modules/Forum');
 
 4935                $jsTpl->setVariable(
 
 4936                    'IL_FRM_QUOTE_CALLBACK_SRC',
 
 4937                    $this->ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
 
 4939                $this->ctrl->clearParameters($this);
 
 4940                $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
 
 4944                if (in_array($this->ctrl->getCmd(), array(
'saveDraft', 
'updateDraft', 
'publishDraft'))) {
 
 4945                    $oEditReplyForm->setValuesByPost();
 
 4947                    if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 4952                            $this->
user->getId(),
 
 4953                            $this->objCurrentPost->getId(),
 
 4954                            (
int) 
$_GET[
'draft_id']
 
 4956                        $oEditReplyForm->setValuesByArray(array(
 
 4957                            'alias' => $draftObject->getPostUserAlias(),
 
 4958                            'subject' => $draftObject->getPostSubject(),
 
 4960                                $draftObject->getPostMessage(),
 
 4963                            'notify' => $draftObject->getNotify() ? 
true : 
false,
 
 4965                            'del_file' => array()
 
 4970                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4971                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4973                $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html', 
true, 
true, 
'Modules/Forum');
 
 4974                $jsTpl->setVariable(
 
 4975                    'IL_FRM_QUOTE_CALLBACK_SRC',
 
 4976                    $this->ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
 
 4978                $this->ctrl->clearParameters($this);
 
 4979                $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
 
 4982        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4983        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4984        $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 4985        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 4986        $this->ctrl->setParameter($this, 
'action', 
$_GET[
'action']);
 
 4987        if (
$action !== 
'editdraft') {
 
 4988            $this->tpl->setVariable(
'FORM', $oEditReplyForm->getHTML());
 
 4990        $this->ctrl->clearParameters($this);
 
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
Accordion user interface class.
Column user interface class.
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
News settings for containers.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static addToDesktop()
Add desktop item @access public.
static removeFromDesktop()
Remove item from personal desktop @access public.
Base class for ILIAS Exception handling.
Export User Interface Class.
This class handles all operations on files for the drafts of a forum object.
This class handles all operations on files for the forum object.
Class ilForumDraftHistory.
static getInstancesByDraftId($draft_id)
Class ilForumDraftsTableGUI.
Class ilForumExplorerGUI.
Forum export to HTML and Print.
Class ilForumModeratorsGUI.
ilForumMoveTopicsExplorer
Class ilForumNotification.
static lookupAutosaveInterval()
static isAutoSavePostDraftAllowed()
static newInstanceByDraftId($draft_id)
static isSavePostDraftAllowed()
static getInstancesByUserIdAndThreadId($user_id, $thread_id)
static getDraftInstancesByUserId($user_id)
static createDraftBackup($draft_id)
static getThreadDraftData($post_author_id, $forum_id)
setChangeDate($a_changedate)
static getInstance($a_obj_id=0)
Class ilForumSettingsGUI.
Class ilForumStatisticsTableGUI.
Class ilForumTopicTableGUI.
static lookupForumIdByTopicId($a_topic_id)
static _lookupDate($thread_id)
static _lookupTitle($a_topic_id)
Looks up the title/subject of a topic/thread.
static getPublicUserAlias($user_alias, $is_anonymized=false)
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)
Class Forum core functions for forum.
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
prepareText($text, $edit=0, $quote_user='', $type='')
prepares given string @access public
static _lookupObjIdForForumId($a_for_id)
static get($a_glyph, $a_text="")
Get glyph html.
Online help application class.
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static getInstance()
Get instance.
Navigation History of Repository Items.
addItem( $a_ref_id, $a_link, $a_type, $a_title="", $a_sub_obj_id="", $a_goto_link="")
Add an item to the stack.
static getFirstNewsIdForContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
This class represents a non editable value in a property form.
static _getRichTextEditorUserState()
Gets the state of the rich text editor visibility for the current user.
static _setRichTextEditorUserState($a_state)
Sets the state of the rich text editor visibility for the current user.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
getThreadEditingForm($a_thread_id)
doCaptchaCheck()
Performs a CAPTCHA check for anonymous users if the CAPTCHA should be used for forums in the public a...
publishDraftObject($use_replyform=true)
saveThreadAsDraftObject()
disableForumNotificationObject()
cancelMoveThreadsObject()
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.ilObjectListGUI
getModifiedReOnSubject($on_reply=false)
displayConfirmPostActivation()
$display_confirm_post_activation
toggleThreadNotificationObject()
executeCommand()
execute command
removeFromDeskObject()
Remove from desktop @access public.
buildThreadForm($isDraft=false)
getTabs()
get tabs abstract method.
getSubTabs($subtab='showThreads')
isUserAllowedToDeactivateNotification()
getEditFormCustomValues(array &$a_values)
static _goto($a_target, $a_thread=0, $a_posting=0)
autosaveDraftAsyncObject()
publishSelectedDraftObject()
editThreadDraftObject(\ilPropertyFormGUI $form=null)
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
autosaveThreadDraftAsyncObject()
performMergeThreadsObject()
hideToolbar($a_flag=null)
setColumnSettings(ilColumnGUI $column_gui)
May be overwritten in subclasses.
renderSplitButton(string $action, $is_post=true, ilForumPost $node, $Start=0, ilForumPostDraft $draft=null)
deliverDraftZipFileObject()
restoreFromHistoryObject()
addToDeskObject()
Add desktop item @access public.
confirmMergeThreadsObject()
isWritingWithPseudonymAllowed()
renderPostContent(ilForumPost $node, string $action, $Start, $z)
handleFormInput($a_text, $a_stripslashes=true)
updateCustom(ilPropertyFormGUI $a_form)
createThread(\ilForumPostDraft $draft, bool $createFromDraft=false)
Refactored thread creation to method, refactoring to a separate class should be done in next refactor...
deletePostingDraftObject()
createTopLevelPostObject()
performDeleteThreadsObject()
confirmDeleteThreadDraftsObject()
publishThreadDraftObject()
decorateWithAutosave(\ilPropertyFormGUI $form)
afterSave(ilObject $a_new_object)
editThreadObject($threadId, ilPropertyFormGUI $form=null)
performThreadsActionObject()
askForPostActivationObject()
enableForumNotificationObject()
performPostActivationObject()
setDisplayConfirmPostActivation($status=0)
deleteSelectedDraft(ilForumPostDraft $draft_obj=null)
performMoveThreadsObject()
deleteThreadDraftsObject()
saveThreadSortingObject()
updateThreadDraftObject()
initEditCustomForm(ilPropertyFormGUI $a_form)
prepareFormOutput($a_text)
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
checkDraftAccess(int $draftId)
renderDraftContent(string $action, bool $render_drafts, $node, $edit_draft_id=null)
static lookupForumIdByRefId($ref_id)
static lookupForumIdByObjId($obj_id)
GUI class for the workflow of copying objects.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
getRightColumnHTML()
Display right column.
getCenterColumnHTML()
Get center column.
getCreationMode()
get creation mode
addHeaderAction()
Add header action menu.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
getRefId()
get reference id @access public
static _getAllReferences($a_id)
get all reference ids of object
getId()
get object id @access public
Class for permanent links.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
GUI class for public user profile presentation.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
static _getRTEClassname()
static getOverallRatingForObject($a_obj_id, $a_obj_type, $a_sub_obj_id=null, $a_sub_obj_type=null, $a_category_id=null)
Get overall rating for an object.
static getSearchBlockHTML($a_title)
Get standar search block html.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static Linkbar($AScript, $AHits, $ALimit, $AOffset, $AParams=array(), $ALayout=array(), $prefix='')
Linkbar Diese Funktion erzeugt einen typischen Navigationsbalken mit "Previous"- und "Next"-Links und...
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static infoPanel($a_keep=true)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
This is how the factory for UI elements looks.
An entity that renders components to a string output.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
catch(Exception $e) $message
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
if(isset($_POST['submit'])) $form