4require_once 
'Modules/Forum/classes/class.ilForumSettingsGUI.php';
 
    5require_once 
'Services/Object/classes/class.ilObjectGUI.php';
 
    6require_once 
'Services/Table/classes/class.ilTable2GUI.php';
 
    7require_once 
'Modules/Forum/classes/class.ilForumProperties.php';
 
    8require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
    9require_once 
'Modules/Forum/classes/class.ilForumPost.php';
 
   10require_once 
'Modules/Forum/classes/class.ilForum.php';
 
   11require_once 
'Modules/Forum/classes/class.ilForumTopic.php';
 
   12require_once 
'Services/RTE/classes/class.ilRTE.php';
 
   13require_once 
'Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
 
   14require_once 
'Modules/Forum/classes/class.ilForumMailNotification.php';
 
   15require_once 
'Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
 
   16require_once 
'Modules/Forum/classes/class.ilForumPostDraft.php';
 
   17require_once 
'./Modules/Forum/classes/class.ilFileDataForumDrafts.php';
 
   18require_once 
'./Modules/Forum/classes/class.ilForumUtil.php';
 
   19require_once 
'./Modules/Forum/classes/class.ilForumDraftsHistory.php';
 
   20require_once 
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
 
  122    public function __construct($a_data, $a_id, $a_call_by_reference = 
true, $a_prepare_output = 
true)
 
  126        $this->ctrl = 
$DIC->ctrl();
 
  127        $this->ctrl->saveParameter($this, array(
'ref_id', 
'cmdClass'));
 
  129        $this->tpl = 
$DIC->ui()->mainTemplate();
 
  130        $this->lng = 
$DIC->language();
 
  132        $this->access = 
$DIC->access();
 
  133        $this->ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  134        $this->tabs = 
$DIC->tabs();
 
  135        $this->
error = $DIC[
'ilErr'];
 
  137        $this->
user = $DIC->user();
 
  139        $this->toolbar = 
$DIC->toolbar();
 
  140        $this->repositoryTree = 
$DIC->repositoryTree();
 
  142        $this->rbac = 
$DIC->rbac();
 
  143        $this->locator = 
$DIC[
'ilLocator'];
 
  146        parent::__construct($a_data, $a_id, $a_call_by_reference, 
false);
 
  148        $this->lng->loadLanguageModule(
'forum');
 
  156        $this->is_moderator = $this->access->checkAccess(
'moderate_frm', 
'', 
$_GET[
'ref_id']);
 
  159        $this->objCurrentTopic = 
new ilForumTopic((
int) 
$_GET[
'thr_pk'], $this->is_moderator);
 
  162        $this->objCurrentPost = 
new ilForumPost((
int) 
$_GET[
'pos_pk'], $this->is_moderator);
 
  164        $this->forum_overview_setting = $this->
settings->get(
'forum_overview');
 
  170        if (!is_array(
$sess)) {
 
  175        if (isset(
$_GET[
'thr_fk']) && !is_array(
$sess[(
int) 
$_GET[
'thr_fk']])) {
 
  188        if ((
int) $thread->
getForumId() !== (
int) $forumId) {
 
  189            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  201            $this->tpl->addJavascript(
'./Modules/Forum/js/autosave.js');
 
  202            $autosave_cmd = 
'autosaveDraftAsync';
 
  203            if ($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0) {
 
  204                $autosave_cmd = 
'autosaveThreadDraftAsync';
 
  206            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
  207            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
  208            $draft_id = 
$_GET[
'draft_id'] > 0 ?  
$_GET[
'draft_id']: 0;
 
  209            $this->ctrl->setParameter($this, 
'draft_id', $draft_id);
 
  210            $this->ctrl->setParameter($this, 
'action', 
$_GET[
'action']);
 
  211            $this->tpl->addOnLoadCode(
"il.Language.setLangVar('saving', " . json_encode($this->lng->txt(
'saving')) . 
");");
 
  213            $this->tpl->addOnLoadCode(
'il.ForumDraftsAutosave.init(' . json_encode(array(
 
  215                    'draft_id' => $draft_id,
 
  216                    'interval'        => $interval * 1000,
 
  217                    'url'             => $this->ctrl->getFormAction($this, $autosave_cmd, 
'', 
true, 
false),
 
  218                    'selectors'       => array(
 
  219                        'form' => 
'#form_' . 
$form->getId()
 
  245            strtolower($this->ctrl->getCmd()),
 
  246            array_map(
'strtolower', array(
'createTopLevelPost', 
'quoteTopLevelPost', 
'saveTopLevelPost'))
 
  252        $next_class = $this->ctrl->getNextClass($this);
 
  253        $cmd = $this->ctrl->getCmd();
 
  255        $exclude_cmds = array(
 
  256            'viewThread', 
'markPostUnread',
'markPostRead', 
'showThreadNotification',
 
  257            'performPostActivation',
 
  258            'askForPostActivation', 
'askForPostDeactivation',
 
  259            'toggleThreadNotification', 
'toggleThreadNotificationTab',
 
  260            'toggleStickiness', 
'cancelPost', 
'savePost', 
'saveTopLevelPost', 
'createTopLevelPost', 
'quoteTopLevelPost', 
'quotePost', 
'getQuotationHTMLAsynch',
 
  261            'autosaveDraftAsync', 
'autosaveThreadDraftAsync',
 
  262            'saveAsDraft', 
'editDraft', 
'updateDraft', 
'deliverDraftZipFile', 
'deliverZipFile', 
'cancelDraft',
 
  263            'publishThreadDraft', 
'deleteThreadDrafts' 
  266        if (!in_array($cmd, $exclude_cmds)) {
 
  271        if (!$this->
getCreationMode() && !$this->ctrl->isAsynch() && $this->access->checkAccess(
'read', 
'', 
$_GET[
'ref_id'])) {
 
  274                'ilias.php?baseClass=ilRepositoryGUI&cmd=showThreads&ref_id=' . 
$_GET[
'ref_id'],
 
  279        switch ($next_class) {
 
  280            case 'ilforumsettingsgui':
 
  285            case 'ilrepositoryobjectsearchgui':
 
  288                $this->tabs->activateTab(
"forums_threads");
 
  289                $this->ctrl->setReturn($this, 
'view');
 
  290                include_once 
'./Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
 
  292                    $this->object->getRefId(),
 
  296                $this->ctrl->forwardCommand($search_gui);
 
  299            case 'ilpermissiongui':
 
  300                require_once 
'Services/AccessControl/classes/class.ilPermissionGUI.php';
 
  302                $this->ctrl->forwardCommand($perm_gui);
 
  305            case 'ilforumexportgui':
 
  306                require_once 
'Modules/Forum/classes/class.ilForumExportGUI.php';
 
  308                $this->ctrl->forwardCommand($fex_gui);
 
  312            case 'ilforummoderatorsgui':
 
  313                require_once 
'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
 
  315                $this->ctrl->forwardCommand($fm_gui);
 
  318            case 'ilinfoscreengui':
 
  326            case 'ilpublicuserprofilegui':
 
  327                include_once 
'Services/User/classes/class.ilPublicUserProfileGUI.php';
 
  329                $add = $this->getUserProfileAdditional((
int) 
$_GET[
'ref_id'], (
int) 
$_GET[
'user']);
 
  330                $profile_gui->setAdditional($add);
 
  331                $ret = $this->ctrl->forwardCommand($profile_gui);
 
  332                $this->tpl->setContent(
$ret);
 
  335            case 'ilobjectcopygui':
 
  336                include_once 
'Services/Object/classes/class.ilObjectCopyGUI.php';
 
  339                $this->ctrl->forwardCommand($cp);
 
  343                $this->tabs->activateTab(
'export');
 
  344                include_once 
'Services/Export/classes/class.ilExportGUI.php';
 
  346                $exp->addFormat(
'xml');
 
  347                $this->ctrl->forwardCommand($exp);
 
  351                if (!$this->objProperties->isIsThreadRatingEnabled() || $this->user->isAnonymous()) {
 
  352                    $this->
error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
 
  355                if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  356                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  361                require_once 
'Services/Rating/classes/class.ilRatingGUI.php';
 
  363                $rating_gui->setObject($this->object->getId(), $this->object->getType(), $this->objCurrentTopic->getId(), 
'thread');
 
  365                $this->ctrl->setParameter($this, 
'thr_pk', (
int) $this->objCurrentTopic->getId());
 
  366                $this->ctrl->forwardCommand($rating_gui);
 
  369                $this->objCurrentTopic->setAverageRating($avg[
'avg']);
 
  370                $this->objCurrentTopic->update();
 
  372                $this->ctrl->redirect($this, 
"showThreads");
 
  375            case 'ilcommonactiondispatchergui':
 
  376                include_once 
'Services/Object/classes/class.ilCommonActionDispatcherGUI.php';
 
  378                $this->ctrl->forwardCommand($gui);
 
  390                if (isset(
$_POST[
'select_cmd2'])) {
 
  394                if (isset(
$_POST[
'selected_cmd']) && 
$_POST[
'selected_cmd'] != 
null) {
 
  395                    $member_cmd = array(
'enableAdminForceNoti', 
'disableAdminForceNoti', 
'enableHideUserToggleNoti', 
'disableHideUserToggleNoti');
 
  396                    in_array(
$_POST[
'selected_cmd'], $member_cmd) ? $cmd = 
$_POST[
'selected_cmd'] : $cmd = 
'performThreadsAction';
 
  397                } elseif (!$cmd && !
$_POST[
'selected_cmd']) {
 
  398                    $cmd = 
'showThreads';
 
  408        if ($cmd != 
'viewThreadObject' && $cmd != 
'showUserObject') {
 
  418        $this->ctrl->setCmd(
'showSummary');
 
  419        $this->ctrl->setCmdClass(
'ilinfoscreengui');
 
  429        $this->forum_settings_gui->getCustomForm($a_form);
 
  437        $this->forum_settings_gui->getCustomValues($a_values);
 
  445        $this->forum_settings_gui->updateCustomValues($a_form);
 
  455        $this->ctrl->setParameter($this, 
'thr_pk', $a_thread_id);
 
  456        $form->setFormAction($this->ctrl->getFormAction($this, 
'updateThread'));
 
  459        $ti_prop->setRequired(
true);
 
  460        $ti_prop->setMaxLength(255);
 
  461        $ti_prop->setSize(50);
 
  462        $form->addItem($ti_prop);
 
  464        $form->addCommandButton(
'updateThread', $this->lng->txt(
'save'));
 
  465        $form->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
 
  476        if (!$this->is_moderator) {
 
  477            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  480        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  481            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  484        $thread = new \ilForumTopic($a_thread_id);
 
  487        $this->tabs->activateTab(
'forums_threads');
 
  491            $form->setValuesByArray(array(
 
  492                'title' => $thread->getSubject()
 
  496        $this->tpl->setContent(
$form->getHTML());
 
  504        if (!$this->is_moderator) {
 
  505            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  508        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  509            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  512        if (!$this->objCurrentTopic->getId()) {
 
  520        if (!
$form->checkInput()) {
 
  521            $form->setValuesByPost();
 
  526        $this->objCurrentTopic->setSubject(
$form->getInput(
'title'));
 
  527        $this->objCurrentTopic->updateThreadTitle();
 
  535        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  536            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  539        $this->
object->markAllThreadsRead($this->
user->getId());
 
  560        if ($this->objProperties->getThreadSorting() == 1 && $this->is_moderator) {
 
  561            $this->tabs->addSubTabTarget(
'show', $this->ctrl->getLinkTarget($this, 
'showThreads'), 
'showThreads', get_class($this), 
'', $subtab==
'showThreads'? 
true : 
false);
 
  562            $this->tabs->addSubTabTarget(
'sorting_header', $this->ctrl->getLinkTarget($this, 
'sortThreads'), 
'sortThreads', get_class($this), 
'', $subtab==
'sortThreads'? 
true : 
false);
 
  568        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
  569            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
  572        $cmd = $this->ctrl->getCmd();
 
  573        $frm = $this->
object->Forum;
 
  574        $frm->setForumId($this->object->getId());
 
  575        $frm->setForumRefId($this->object->getRefId());
 
  576        $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
  578        $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_liste.html', 
'Modules/Forum');
 
  580        if ((
int) strlen($this->confirmation_gui_html)) {
 
  581            $this->tpl->setVariable(
'CONFIRMATION_GUI', $this->confirmation_gui_html);
 
  585        if ($this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId()) && !$this->hideToolbar()) {
 
  586            require_once 
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
 
  588            $btn->setUrl($this->ctrl->getLinkTarget($this, 
'createThread'));
 
  589            $btn->setCaption(
'forums_new_thread');
 
  590            $this->toolbar->addStickyItem($btn);
 
  594        include_once 
'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
 
  595        if ($this->
user->getId() != ANONYMOUS_USER_ID && !(
int) strlen($this->confirmation_gui_html)) {
 
  596            $this->toolbar->addButton(
 
  597                $this->lng->txt(
'forums_mark_read'),
 
  598                $this->ctrl->getLinkTarget($this, 
'markAllRead'),
 
  602            $this->ctrl->clearParameters($this);
 
  606            include_once 
'./Modules/Forum/classes/class.ilForumDraftsTableGUI.php';
 
  609            if (count($draft_instances)> 0) {
 
  610                foreach ($draft_instances as $draft) {
 
  611                    $drafts_tbl->fillRow($draft);
 
  613                $drafts_tbl->setData($draft_instances);
 
  614                $this->tpl->setVariable(
'THREADS_DRAFTS_TABLE', $drafts_tbl->getHTML());
 
  619        $topicData = $frm->getOneTopic();
 
  622            $frm->setDbTable(
'frm_data');
 
  623            $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
 
  624            $frm->updateVisits($topicData[
'top_pk']);
 
  626            include_once 
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
 
  627            if (!in_array($cmd, array(
'showThreads', 
'sortThreads'))) {
 
  628                $cmd = 
'showThreads';
 
  633            $tbl->setMapper($frm)->fetchData();
 
  634            $this->tpl->setVariable(
'THREADS_TABLE', 
$tbl->getHTML());
 
  638        include_once 
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
 
  640        $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
 
  650        $frm = $this->
object->Forum;
 
  653        $drafts         = $draftsObjects[$node->getId()];
 
  655        if ($render_drafts && is_array($drafts)) {
 
  656            foreach ($drafts as $draft) {
 
  661                if (isset($edit_draft_id) && $edit_draft_id == $node->getId()) {
 
  667                $filesOfDraft = $tmp_file_obj->getFilesOfPost();
 
  668                ksort($filesOfDraft);
 
  670                if (count($filesOfDraft)) {
 
  671                    if (
$_GET[
'action'] != 
'showdraft' || 
$_GET[
'action'] == 
'editdraft') {
 
  672                        foreach ($filesOfDraft as 
$file) {
 
  673                            $this->tpl->setCurrentBlock(
'attachment_download_row');
 
  674                            $this->ctrl->setParameter($this, 
'draft_id', $tmp_file_obj->getDraftId());
 
  675                            $this->ctrl->setParameter($this, 
'file', 
$file[
'md5']);
 
  676                            $this->tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
  677                            $this->tpl->setVariable(
'TXT_FILENAME', 
$file[
'name']);
 
  678                            $this->ctrl->setParameter($this, 
'file', 
'');
 
  679                            $this->ctrl->setParameter($this, 
'draft_id', 
'');
 
  680                            $this->ctrl->clearParameters($this);
 
  681                            $this->tpl->parseCurrentBlock();
 
  684                        $this->tpl->setCurrentBlock(
'attachments');
 
  685                        $this->tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt(
'forums_attachments'));
 
  686                        include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  688                        if (count($filesOfDraft) > 1) {
 
  690                            $download_zip_button->setCaption($this->lng->txt(
'download'), 
false);
 
  691                            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
  692                            $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 
'deliverDraftZipFile'));
 
  693                            $this->ctrl->setParameter($this, 
'draft_id', 
'');
 
  694                            $this->tpl->setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
 
  696                        $this->tpl->parseCurrentBlock();
 
  706                $rowCol = 
'tblrowmarked';
 
  708                $this->tpl->setVariable(
'ROWCOL', 
' ' . $rowCol);
 
  711                $this->ctrl->setParameter($this, 
'pos_pk', $node->getId());
 
  712                $this->ctrl->setParameter($this, 
'thr_pk', $node->getThreadId());
 
  713                $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
  715                $backurl = urlencode($this->ctrl->getLinkTarget($this, 
'viewThread', $node->getId()));
 
  717                $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  718                $this->ctrl->setParameter($this, 
'thr_pk', $node->getThreadId());
 
  719                $this->ctrl->setParameter($this, 
'user', $draft->getPostDisplayUserId());
 
  721                require_once 
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
 
  723                    $draft->getPostAuthorId(),
 
  724                    $draft->getPostDisplayUserId(),
 
  725                    $draft->getPostUserAlias(),
 
  728                        'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
  732                $this->ctrl->clearParameters($this);
 
  734                if ($authorinfo->hasSuffix()) {
 
  735                    $this->tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
 
  736                    $this->tpl->setVariable(
'USR_NAME', $draft->getPostUserAlias());
 
  738                    $this->tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
  739                    if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
 
  740                        $this->tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
 
  743                $this->tpl->setVariable(
'DRAFT_ANCHOR', 
'draft_' . $draft->getDraftId());
 
  745                $this->tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
 
  747                    if ($authorinfo->getAuthor()->getGender() == 
'f') {
 
  748                        $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
 
  749                    } elseif ($authorinfo->getAuthor()->getGender() == 
'm') {
 
  750                        $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
 
  751                    } elseif ($authorinfo->getAuthor()->getGender() == 
'n') {
 
  752                        $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_n'));
 
  757                if ($draft->getUpdateUserId() > 0) {
 
  758                    $spanClass = 
'small';
 
  761                        $spanClass = 
'moderator_small';
 
  764                    $draft->setPostUpdate($draft->getPostUpdate());
 
  766                    $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  767                    $this->ctrl->setParameter($this, 
'thr_pk', $node->getThreadId());
 
  768                    $this->ctrl->setParameter($this, 
'user', $node->getUpdateUserId());
 
  769                    $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
  770                    require_once 
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
 
  772                        $draft->getPostAuthorId(),
 
  773                        $draft->getUpdateUserId(),
 
  774                        $draft->getPostUserAlias(),
 
  777                            'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
  781                    $this->ctrl->clearParameters($this);
 
  783                    $this->tpl->setVariable(
'POST_UPDATE_TXT', $this->lng->txt(
'edited_on') . 
': ' . $frm->convertDate($draft->getPostUpdate()) . 
' - ' . strtolower($this->lng->txt(
'by')));
 
  784                    $this->tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
  785                    if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
 
  786                        $this->tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
 
  792                $draft->setPostMessage($frm->prepareText($draft->getPostMessage()));
 
  794                $this->tpl->setVariable(
'SUBJECT', $draft->getPostSubject());
 
  795                $this->tpl->setVariable(
'POST_DATE', $frm->convertDate($draft->getPostDate()));
 
  797                if (!$node->isCensored() ||
 
  798                    ($this->objCurrentPost->getId() == $node->getId() && 
$_GET[
'action'] == 
'censor')
 
  803                        $spanClass = 
'moderator';
 
  806                    if ($draft->getPostMessage() == strip_tags($draft->getPostMessage())) {
 
  808                        $draft->setPostMessage(nl2br($draft->getPostMessage()));
 
  811                    if ($spanClass != 
"") {
 
  817                if (!$this->objCurrentTopic->isClosed() && 
$_GET[
'action'] == 
'deletedraft') {
 
  818                    if ($this->
user->getId() != ANONYMOUS_USER_ID && $draft->getDraftId() == (
int) 
$_GET[
'draft_id']) {
 
  820                        $this->tpl->setVariable(
'FORM', $this->getDeleteDraftFormHTML());
 
  822                } elseif (
$_GET[
'action'] == 
'editdraft' && $draft->getDraftId() == (
int) 
$_GET[
'draft_id']) {
 
  824                    $this->tpl->setVariable(
'EDIT_DRAFT_ANCHOR', 
'draft_edit_' . $draft->getDraftId());
 
  825                    $this->tpl->setVariable(
'DRAFT_FORM', $oEditReplyForm->getHTML() . $this->modal_history);
 
  828                $this->tpl->parseCurrentBlock();
 
  843        $frm = $this->
object->Forum;
 
  848        $filesOfPost = $tmp_file_obj->getFilesOfPost();
 
  850        if (count($filesOfPost)) {
 
  851            if ($node->
getId() != $this->objCurrentPost->getId() || 
$_GET[
'action'] != 
'showedit') {
 
  852                foreach ($filesOfPost as 
$file) {
 
  853                    $this->tpl->setCurrentBlock(
'attachment_download_row');
 
  854                    $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
  855                    $this->ctrl->setParameter($this, 
'file', 
$file[
'md5']);
 
  856                    $this->tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
  857                    $this->tpl->setVariable(
'TXT_FILENAME', 
$file[
'name']);
 
  858                    $this->ctrl->clearParameters($this);
 
  859                    $this->tpl->parseCurrentBlock();
 
  861                $this->tpl->setCurrentBlock(
'attachments');
 
  862                $this->tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt(
'forums_attachments'));
 
  863                include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
 
  865                if (count($filesOfPost) > 1) {
 
  867                    $download_zip_button->setCaption($this->lng->txt(
'download'), 
false);
 
  868                    $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
  869                    $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 
'deliverZipFile'));
 
  871                    $this->tpl->setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
 
  874                $this->tpl->parseCurrentBlock();
 
  881        $this->tpl->setVariable(
'POST_ANKER', $node->
getId());
 
  884        $this->tpl->setVariable(
'TXT_PERMA_LINK', $this->lng->txt(
'perma_link'));
 
  885        $this->tpl->setVariable(
'PERMA_TARGET', 
'_top');
 
  887        if (!$node->
isActivated() && !$this->objCurrentTopic->isClosed() && $this->is_moderator) {
 
  888            $rowCol = 
'ilPostingNeedsActivation';
 
  889        } elseif ($this->objProperties->getMarkModeratorPosts() == 1) {
 
  891                $rowCol = 
'ilModeratorPosting';
 
  893                $rowCol = 
'ilModeratorPosting';
 
  901            $_GET[
'action'] != 
'delete' && 
$_GET[
'action'] != 
'censor' &&
 
  904            || $this->objCurrentPost->getId() != $node->
getId()
 
  906            $this->tpl->setVariable(
'ROWCOL', 
' ' . $rowCol);
 
  909            $rowCol = 
'tblrowmarked';
 
  915            if (
$_GET[
'action'] != 
'censor') {
 
  916                $this->tpl->setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
 
  920            $rowCol = 
'tblrowmarked';
 
  924        $this->tpl->setVariable(
'ROWCOL', 
' ' . $rowCol);
 
  927            $this->tpl->setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
 
  931        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
  932        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
  933        $backurl = urlencode($this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId()));
 
  934        $this->ctrl->clearParameters($this);
 
  936        $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  937        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
  940        require_once 
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
 
  947                'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
  951        $this->ctrl->clearParameters($this);
 
  953        if ($authorinfo->hasSuffix()) {
 
  954            $this->tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
 
  955            $this->tpl->setVariable(
'USR_NAME', $node->
getUserAlias());
 
  957            $this->tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
  958            if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
 
  959                $this->tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
 
  963        $this->tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
 
  965            if ($authorinfo->getAuthor()->getGender() == 
'f') {
 
  966                $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
 
  967            } elseif ($authorinfo->getAuthor()->getGender() == 
'm') {
 
  968                $this->tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
 
  974            $spanClass = 
'small';
 
  977                $spanClass = 
'moderator_small';
 
  982            $this->ctrl->setParameter($this, 
'backurl', $backurl);
 
  983            $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
  991            require_once 
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
 
  998                    'href' => $this->ctrl->getLinkTarget($this, 
'showUser')
 
 1002            $this->ctrl->clearParameters($this);
 
 1004            $this->tpl->setVariable(
'POST_UPDATE_TXT', $this->lng->txt(
'edited_on') . 
': ' . $frm->convertDate($node->
getChangeDate()) . 
' - ' . strtolower($this->lng->txt(
'by')));
 
 1005            $this->tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
 
 1006            if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
 
 1007                $this->tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
 
 1015        if ($this->
user->getId() == ANONYMOUS_USER_ID ||
 
 1018            $this->tpl->setVariable(
'SUBJECT', $node->
getSubject());
 
 1020            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 1021            $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 1022            $this->ctrl->setParameter($this, 
'offset', $Start);
 
 1023            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1024            $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 1025            $mark_post_target = $this->ctrl->getLinkTarget($this, 
'markPostRead', $node->
getId());
 
 1027            $this->tpl->setVariable(
'SUBJECT', 
"<a href=\"" . $mark_post_target . 
"\"><b>" . $node->
getSubject() . 
"</b></a>");
 
 1030        $this->tpl->setVariable(
'POST_DATE', $frm->convertDate($node->
getCreateDate()));
 
 1033            ($this->objCurrentPost->getId() == $node->
getId() && 
$_GET[
'action'] == 
'censor')
 
 1037                $spanClass = 
'moderator';
 
 1045            if ($spanClass != 
"") {
 
 1051            $this->tpl->setVariable(
'POST', 
"<span class=\"moderator\">" . nl2br($node->
getCensorshipComment()) . 
"</span>");
 
 1054        $this->tpl->parseCurrentBlock();
 
 1064        $this->create_form_gui->setTableWidth(
'600px');
 
 1066        $this->create_form_gui->setTitle($this->lng->txt(
'frm_new'));
 
 1070        $this->ctrl->setParameter($this, 
'new_type', $object_type);
 
 1071        $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this, 
'save'));
 
 1074        $title_gui = 
new ilTextInputGUI($this->lng->txt(
'title'), 
'title');
 
 1077        $this->create_form_gui->addItem($title_gui);
 
 1081        $description_gui->setCols(40);
 
 1082        $description_gui->setRows(2);
 
 1083        $this->create_form_gui->addItem($description_gui);
 
 1086        $this->forum_settings_gui->getCustomForm($this->create_form_gui);
 
 1089        $sort_man = 
new ilCheckboxInputGUI($this->lng->txt(
'sorting_manual_sticky'), 
'thread_sorting');
 
 1090        $sort_man->setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
 
 1091        $sort_man->setValue(1);
 
 1092        $this->create_form_gui->addItem($sort_man);
 
 1097        $view_group_gui->addOption($view_hir);
 
 1099        $view_group_gui->addOption($view_dat);
 
 1100        $this->create_form_gui->addItem($view_group_gui);
 
 1103        $view_direction_group_gui->addOption($view_desc);
 
 1105        $view_direction_group_gui->addOption($view_asc);
 
 1106        $view_dat->addSubItem($view_direction_group_gui);
 
 1109        $anonymize_gui = 
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'), 
'anonymized');
 
 1110        $anonymize_gui->setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
 
 1111        $anonymize_gui->setValue(1);
 
 1113        if ($this->
settings->get(
'enable_anonymous_fora', 
false)) {
 
 1114            $anonymize_gui->setDisabled(
true);
 
 1116        $this->create_form_gui->addItem($anonymize_gui);
 
 1119        $statistics_gui = 
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'), 
'statistics_enabled');
 
 1120        $statistics_gui->setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
 
 1121        $statistics_gui->setValue(1);
 
 1122        if (!$this->
settings->get(
'enable_fora_statistics', 
false)) {
 
 1123            $statistics_gui->setDisabled(
true);
 
 1125        $this->create_form_gui->addItem($statistics_gui);
 
 1127        $cb_prop = 
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'), 
'post_activation');
 
 1128        $cb_prop->setValue(
'1');
 
 1129        $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
 
 1130        $this->create_form_gui->addItem($cb_prop);
 
 1132        $this->create_form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
 
 1133        $this->create_form_gui->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
 
 1148        $this->ctrl->setParameter($this, 
'ref_id', $forumObj->
getRefId());
 
 1149        ilUtil::redirect($this->ctrl->getLinkTarget($this, 
'createThread', 
'', 
false, 
false));
 
 1154        $this->
ilHelp->setScreenIdComponent(
"frm");
 
 1156        $this->ctrl->setParameter($this, 
'ref_id', $this->ref_id);
 
 1159            '', 
'showThreads', 
'view', 
'markAllRead',
 
 1160            'enableForumNotification', 
'disableForumNotification', 
'moveThreads', 
'performMoveThreads',
 
 1161            'cancelMoveThreads', 
'performThreadsAction', 
'createThread', 
'addThread',
 
 1162            'showUser', 
'confirmDeleteThreads',
 
 1163            'merge',
'mergeThreads', 
'cancelMergeThreads', 
'performMergeThreads' 
 1166        (in_array($this->ctrl->getCmd(), $active)) ? $force_active = 
true : $force_active = 
false;
 
 1167        $this->tabs->addTarget(
'forums_threads', $this->ctrl->getLinkTarget($this, 
'showThreads'), $this->ctrl->getCmd(), get_class($this), 
'', $force_active);
 
 1170        if ($this->access->checkAccess(
'visible', 
'', $this->ref_id) || $this->access->checkAccess(
'read', 
'', $this->ref_id)) {
 
 1171            $force_active = ($this->ctrl->getNextClass() == 
'ilinfoscreengui' || strtolower(
$_GET[
'cmdClass']) == 
'ilnotegui') ? 
true : 
false;
 
 1172            $this->tabs->addTarget(
 
 1174                $this->ctrl->getLinkTargetByClass(array(
'ilobjforumgui', 
'ilinfoscreengui'), 
'showSummary'),
 
 1175                array(
'showSummary', 
'infoScreen'),
 
 1182        if ($this->access->checkAccess(
'write', 
'', $this->ref_id)) {
 
 1183            $force_active = ($this->ctrl->getCmd() == 
'edit') ? 
true    : 
false;
 
 1184            $this->tabs->addTarget(
'settings', $this->ctrl->getLinkTarget($this, 
'edit'), 
'edit', get_class($this), 
'', $force_active);
 
 1187        if ($this->access->checkAccess(
'write', 
'', $this->ref_id)) {
 
 1188            $this->tabs->addTarget(
'frm_moderators', $this->ctrl->getLinkTargetByClass(
'ilForumModeratorsGUI', 
'showModerators'), 
'showModerators', get_class($this));
 
 1191        if ($this->
settings->get(
'enable_fora_statistics', 
false) &&
 
 1192           ($this->objProperties->isStatisticEnabled() || $this->access->checkAccess(
'write', 
'', $this->ref_id))) {
 
 1193            $force_active = ($this->ctrl->getCmd() == 
'showStatistics') ? 
true  : 
false;
 
 1194            $this->tabs->addTarget(
'frm_statistics', $this->ctrl->getLinkTarget($this, 
'showStatistics'), 
'showStatistics', get_class($this), 
'', $force_active); 
 
 1197        if ($this->access->checkAccess(
'write', 
'', $this->object->getRefId())) {
 
 1198            $this->tabs->addTarget(
'export', $this->ctrl->getLinkTargetByClass(
'ilexportgui', 
''), 
'', 
'ilexportgui');
 
 1201        if ($this->access->checkAccess(
'edit_permission', 
'', $this->ref_id)) {
 
 1202            $this->tabs->addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'), 
'perm'), array(
'perm', 
'info', 
'owner'), 
'ilpermissiongui');
 
 1209        if (!$this->
settings->get(
'enable_fora_statistics', 
false)) {
 
 1210            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1214        if (!$this->access->checkAccess(
'read', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 1215            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1219        if (!$this->objProperties->isStatisticEnabled()) {
 
 1221            if ($this->access->checkAccess(
'write', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 1222                ilUtil::sendInfo($this->lng->txt(
'frm_statistics_disabled_for_participants'));
 
 1224                $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1228        $this->
object->Forum->setForumId($this->object->getId());
 
 1230        require_once 
'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
 
 1233        $tbl->setId(
'il_frm_statistic_table_' . (
int) (
int) 
$_GET[
'ref_id']);
 
 1234        $tbl->setTitle($this->lng->txt(
'statistic'), 
'icon_usr.svg', $this->lng->txt(
'obj_' . $this->object->getType()));
 
 1236        $data = $this->
object->Forum->getUserStatistic($this->is_moderator);
 
 1249        $this->tpl->setContent(
$tbl->getHTML());
 
 1252    public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
 
 1256        $ilAccess = 
$DIC->access();
 
 1260        if ($ilAccess->checkAccess(
'read', 
'', $a_target)) {
 
 1261            if ($a_thread != 0) {
 
 1263                if ($objTopic->getFrmObjId() &&
 
 1266                    foreach ($ref_ids as 
$ref_id) {
 
 1267                        if ($ilAccess->checkAccess(
'read', 
'', 
$ref_id)) {
 
 1273                    if (isset($new_ref_id) && $new_ref_id != $a_target) {
 
 1274                        ilUtil::redirect(ILIAS_HTTP_PATH . 
"/goto.php?target=frm_" . $new_ref_id . 
"_" . $a_thread . 
"_" . $a_posting);
 
 1278                $_GET[
'ref_id'] = $a_target;
 
 1279                $_GET[
'pos_pk'] = $a_posting;
 
 1280                $_GET[
'thr_pk'] = $a_thread;
 
 1281                $_GET[
'anchor'] = $a_posting;
 
 1282                $_GET[
'cmdClass'] = 
'ilObjForumGUI';
 
 1283                $_GET[
'cmd'] = 
'viewThread';
 
 1284                $_GET[
'baseClass'] = 
'ilRepositoryGUI';
 
 1286                include_once(
'ilias.php');
 
 1289                $_GET[
'ref_id'] = $a_target;
 
 1290                $_GET[
'baseClass'] = 
'ilRepositoryGUI';
 
 1291                include_once(
'ilias.php');
 
 1294        } elseif ($ilAccess->checkAccess(
'read', 
'', ROOT_FOLDER_ID)) {
 
 1295            $_GET[
'target'] = 
'';
 
 1296            $_GET[
'ref_id'] = ROOT_FOLDER_ID;
 
 1298                $lng->txt(
'msg_no_perm_read_item'),
 
 1301            $_GET[
'baseClass'] = 
'ilRepositoryGUI';
 
 1302            include(
'ilias.php');
 
 1311        if (!$this->is_moderator) {
 
 1312            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1315        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1316            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1319        if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
 
 1324        require_once 
'Modules/Forum/classes/class.ilObjForum.php';
 
 1325        $forumObj = 
new ilObjForum($this->object->getRefId());
 
 1326        $this->objProperties->setObjId($forumObj->getId());
 
 1330        $success_message = 
"forums_thread_deleted";
 
 1331        if (count(
$_POST[
'thread_ids']) > 1) {
 
 1332            $success_message = 
"forums_threads_deleted";
 
 1336        if (isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids'])) {
 
 1337            $threadIds = 
$_POST[
'thread_ids'];
 
 1341        array_walk($threadIds, 
function ($threadId) use (&$threads) {
 
 1342            $thread = new \ilForumTopic($threadId);
 
 1345            $threads[] = $thread;
 
 1348        foreach ($threads as $thread) {
 
 1349            $frm->setForumId($forumObj->getId());
 
 1350            $frm->setForumRefId($forumObj->getRefId());
 
 1352            $first_node = $frm->getFirstPostNode($thread->getId());
 
 1353            if ((
int) $first_node[
'pos_pk']) {
 
 1354                $frm->deletePost($first_node[
'pos_pk']);
 
 1358        $this->ctrl->redirect($this, 
'showThreads');
 
 1363        if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
 
 1368        if (!$this->is_moderator) {
 
 1369            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1372        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1373            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1377        array_walk(
$_POST[
'thread_ids'], 
function ($threadId) use (&$threads) {
 
 1378            $thread = new \ilForumTopic($threadId);
 
 1381            $threads[] = $thread;
 
 1384        include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
 
 1387        $c_gui->setFormAction($this->ctrl->getFormAction($this, 
'performDeleteThreads'));
 
 1388        $c_gui->setHeaderText($this->lng->txt(
'frm_sure_delete_threads'));
 
 1389        $c_gui->setCancel($this->lng->txt(
'cancel'), 
'showThreads');
 
 1390        $c_gui->setConfirm($this->lng->txt(
'confirm'), 
'performDeleteThreads');
 
 1392        foreach ($threads as $thread) {
 
 1393            $c_gui->addItem(
'thread_ids[]', $thread->getId(), $thread->getSubject());
 
 1396        $this->confirmation_gui_html = $c_gui->getHTML();
 
 1400        return $this->tpl->setContent($c_gui->getHTML());
 
 1405        if (!isset(
$_POST[
'draft_ids']) || !is_array(
$_POST[
'draft_ids'])) {
 
 1410        include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
 
 1413        $c_gui->setFormAction($this->ctrl->getFormAction($this, 
'deleteThreadDrafts'));
 
 1414        $c_gui->setHeaderText($this->lng->txt(
'sure_delete_drafts'));
 
 1415        $c_gui->setCancel($this->lng->txt(
'cancel'), 
'showThreads');
 
 1416        $c_gui->setConfirm($this->lng->txt(
'confirm'), 
'deleteThreadDrafts');
 
 1418        foreach (
$_POST[
'draft_ids'] as $draft_id) {
 
 1419            if (array_key_exists($draft_id, $instances)) {
 
 1420                $c_gui->addItem(
'draft_ids[]', $draft_id, $instances[$draft_id]->getPostSubject());
 
 1424        $this->confirmation_gui_html = $c_gui->getHTML();
 
 1428        return $this->tpl->setContent($c_gui->getHTML());
 
 1431    public function prepareThreadScreen(
ilObjForum $a_forum_obj)
 
 1433        $this->
ilHelp->setScreenIdComponent(
"frm");
 
 1435        $this->tpl->getStandardTemplate();
 
 1441        $this->tabs->setBackTarget($this->lng->txt(
'all_topics'), 
'ilias.php?baseClass=ilRepositoryGUI&ref_id=' . 
$_GET[
'ref_id']);
 
 1444        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 1445        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1447        $this->tabs->addTarget(
'sort_by_posts', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 1450        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 1451        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1453        $this->tabs->addTarget(
'order_by_date', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 1455        $this->ctrl->clearParameters($this);
 
 1458            $this->tabs->activateTab(
'sort_by_posts');
 
 1460            $this->tabs->activateTab(
'order_by_date');
 
 1466        $frm = $a_forum_obj->Forum;
 
 1467        $frm->setForumId($a_forum_obj->
getId());
 
 1472        if (!$this->is_moderator) {
 
 1473            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1476        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1477            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1482        $this->objCurrentPost->activatePost();
 
 1483        $GLOBALS[
'ilAppEventHandler']->raise(
 
 1487                'ref_id'            => $this->object->getRefId(),
 
 1488                'post'              => $this->objCurrentPost
 
 1493        $this->viewThreadObject();
 
 1498        if (!$this->is_moderator) {
 
 1499            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1502        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1503            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1508        $this->viewThreadObject();
 
 1513        $this->display_confirm_post_activation = $status;
 
 1523        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1524            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1529        if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
 
 1530            $this->objCurrentTopic->disableNotification($this->
user->getId());
 
 1533            $this->objCurrentTopic->enableNotification($this->
user->getId());
 
 1537        $this->viewThreadObject();
 
 1542        if (!$this->is_moderator) {
 
 1543            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1546        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1547            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1552        if ($this->objCurrentTopic->isSticky()) {
 
 1553            $this->objCurrentTopic->unmakeSticky();
 
 1555            $this->objCurrentTopic->makeSticky();
 
 1558        $this->viewThreadObject();
 
 1563        $_GET[
'action'] = 
'';
 
 1564        if (isset(
$_POST[
'draft_id']) && (
int) 
$_POST[
'draft_id'] > 0) {
 
 1566            $draft->deleteDraftsByDraftIds(array( (
int) 
$_POST[
'draft_id']));
 
 1569        $this->viewThreadObject();
 
 1574        $_GET[
'action'] = 
'';
 
 1575        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 1578                $history_obj->getFirstAutosaveByDraftId((
int) 
$_GET[
'draft_id']);
 
 1580                $draft->setPostSubject($history_obj->getPostSubject());
 
 1581                $draft->setPostMessage($history_obj->getPostMessage());
 
 1584                    $history_obj->getPostMessage(),
 
 1586                    $history_obj->getHistoryId(),
 
 1588                    $draft->getDraftId()
 
 1591                $draft->updateDraft();
 
 1593                $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
 
 1596        $this->ctrl->clearParameters($this);
 
 1597        $this->viewThreadObject();
 
 1600    public function getDeleteFormHTML()
 
 1603        $form_tpl = 
new ilTemplate(
'tpl.frm_delete_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1605        $form_tpl->setVariable(
'ANKER', $this->objCurrentPost->getId());
 
 1606        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1607        $form_tpl->setVariable(
'TXT_DELETE', $this->lng->txt(
'forums_info_delete_post'));
 
 1608        $this->ctrl->setParameter($this, 
'action', 
'ready_delete');
 
 1609        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1610        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1611        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1612        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 1613        $this->ctrl->clearParameters($this);
 
 1614        $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1615        $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'confirm'));
 
 1617        return $form_tpl->get();
 
 1619    public function getDeleteDraftFormHTML()
 
 1622        $form_tpl = 
new ilTemplate(
'tpl.frm_delete_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1624        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1625        $form_tpl->setVariable(
'TXT_DELETE', $this->lng->txt(
'forums_info_delete_draft'));
 
 1626        $this->ctrl->setParameter($this, 
'action', 
'ready_delete_draft');
 
 1627        $this->ctrl->setParameter($this, 
'draft_id', (
int) 
$_GET[
'draft_id']);
 
 1628        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1629        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1630        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1631        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 1632        $this->ctrl->clearParameters($this);
 
 1633        $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1634        $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'confirm'));
 
 1636        return $form_tpl->get();
 
 1641        $form_tpl = 
new ilTemplate(
'tpl.frm_activation_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1643        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1644        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1645        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1646        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this, 
'performPostActivation'));
 
 1647        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1648        $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
 
 1649        $form_tpl->setVariable(
'TXT_ACT', $this->lng->txt(
'activate_post_txt'));
 
 1650        $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'activate_only_current'));
 
 1651        $form_tpl->setVariable(
'CMD_CONFIRM', 
'performPostActivation');
 
 1652        $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1653        $form_tpl->setVariable(
'CMD_CANCEL', 
'viewThread');
 
 1654        $this->ctrl->clearParameters($this);
 
 1656        return $form_tpl->get();
 
 1661        $frm = $this->
object->Forum;
 
 1662        $form_tpl = 
new ilTemplate(
'tpl.frm_censorship_post_form.html', 
true, 
true, 
'Modules/Forum');
 
 1664        $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
 
 1665        $form_tpl->setVariable(
'SPACER', 
'<hr noshade="noshade" width="100%" size="1" align="center" />');
 
 1666        $this->ctrl->setParameter($this, 
'action', 
'ready_censor');
 
 1667        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1668        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1669        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1670        $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 1671        $this->ctrl->clearParameters($this);
 
 1672        $form_tpl->setVariable(
'TXT_CENS_MESSAGE', $this->lng->txt(
'forums_the_post'));
 
 1673        $form_tpl->setVariable(
'TXT_CENS_COMMENT', $this->lng->txt(
'forums_censor_comment') . 
':');
 
 1674        $form_tpl->setVariable(
'CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
 
 1676        if ($this->objCurrentPost->isCensored()) {
 
 1677            $form_tpl->setVariable(
'TXT_CENS', $this->lng->txt(
'forums_info_censor2_post'));
 
 1678            $form_tpl->setVariable(
'YES_BUTTON', $this->lng->txt(
'confirm'));
 
 1679            $form_tpl->setVariable(
'NO_BUTTON', $this->lng->txt(
'cancel'));
 
 1681            $form_tpl->setVariable(
'TXT_CENS', $this->lng->txt(
'forums_info_censor_post'));
 
 1682            $form_tpl->setVariable(
'CANCEL_BUTTON', $this->lng->txt(
'cancel'));
 
 1683            $form_tpl->setVariable(
'CONFIRM_BUTTON', $this->lng->txt(
'confirm'));
 
 1686        return $form_tpl->get();
 
 1692    private function initReplyEditForm()
 
 1700        $frm = $oForumObjects[
'frm'];
 
 1701        $oFDForum = $oForumObjects[
'file_obj'];
 
 1703        require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
 1705        $this->replyEditForm->setId(
'id_showreply');
 
 1706        $this->replyEditForm->setTableWidth(
'100%');
 
 1707        $cancel_cmd = 
'cancelPost';
 
 1708        if (
$_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'ready_showreply') {
 
 1709            $this->ctrl->setParameter($this, 
'action', 
'ready_showreply');
 
 1710        } elseif (
$_GET[
'action'] == 
'showdraft' || 
$_GET[
'action'] == 
'editdraft') {
 
 1711            $this->ctrl->setParameter($this, 
'action', 
$_GET[
'action']);
 
 1712            $this->ctrl->setParameter($this, 
'draft_id', (
int) 
$_GET[
'draft_id']);
 
 1714            $this->ctrl->setParameter($this, 
'action', 
'ready_showedit');
 
 1717        $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 1718        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1719        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1720        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 1722            $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this, 
'saveTopLevelPost'), 
'frm_page_bottom');
 
 1723        } elseif (
$_GET[
'action'] == 
'publishDraft' || 
$_GET[
'action'] == 
'editdraft') {
 
 1724            $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this, 
'publishDraft'), $this->objCurrentPost->getId());
 
 1726            $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this, 
'savePost'), $this->objCurrentPost->getId());
 
 1728        $this->ctrl->clearParameters($this);
 
 1730        if (
$_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'ready_showreply') {
 
 1731            $this->replyEditForm->setTitle($this->lng->txt(
'forums_your_reply'));
 
 1732        } elseif (
$_GET[
'action'] == 
'showdraft' || 
$_GET[
'action'] == 
'editdraft') {
 
 1733            $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_draft'));
 
 1735            $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_post'));
 
 1740          && in_array(
$_GET[
'action'], array(
'showreply', 
'ready_showreply'))) {
 
 1741            $oAnonymousNameGUI = 
new ilTextInputGUI($this->lng->txt(
'forums_your_name'), 
'alias');
 
 1742            $oAnonymousNameGUI->setMaxLength(64);
 
 1743            $oAnonymousNameGUI->setInfo($this->lng->txt(
'forums_use_alias'));
 
 1745            $this->replyEditForm->addItem($oAnonymousNameGUI);
 
 1749        $oSubjectGUI = 
new ilTextInputGUI($this->lng->txt(
'forums_subject'), 
'subject');
 
 1750        $oSubjectGUI->setMaxLength(255);
 
 1751        $oSubjectGUI->setRequired(
true);
 
 1753        if ($this->objProperties->getSubjectSetting() == 
'empty_subject') {
 
 1754            $oSubjectGUI->setInfo($this->lng->txt(
'enter_new_subject'));
 
 1757        $this->replyEditForm->addItem($oSubjectGUI);
 
 1761            $_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'ready_showreply' ? $this->lng->txt(
'forums_your_reply') : $this->lng->txt(
'forums_edit_post'),
 
 1764        $oPostGUI->setRequired(
true);
 
 1765        $oPostGUI->setRows(15);
 
 1766        $oPostGUI->setUseRte(
true);
 
 1767        $oPostGUI->addPlugin(
'latex');
 
 1768        $oPostGUI->addButton(
'latex');
 
 1769        $oPostGUI->addButton(
'pastelatex');
 
 1770        $oPostGUI->addPlugin(
'ilfrmquote');
 
 1773        if (
$_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'showdraft') {
 
 1774            $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
 
 1776        $oPostGUI->removePlugin(
'advlink');
 
 1777        $oPostGUI->setRTERootBlockElement(
'');
 
 1778        $oPostGUI->usePurifier(
true);
 
 1779        $oPostGUI->disableButtons(array(
 
 1796        if (
$_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'ready_showreply' || 
$_GET[
'action'] == 
'showdraft' || 
$_GET[
'action'] == 
'editdraft') {
 
 1797            $oPostGUI->setRTESupport($this->
user->getId(), 
'frm~', 
'frm_post', 
'tpl.tinymce_frm_post.html', 
false, 
'3.5.11');
 
 1799            $oPostGUI->setRTESupport($this->objCurrentPost->getId(), 
'frm', 
'frm_post', 
'tpl.tinymce_frm_post.html', 
false, 
'3.5.11');
 
 1802        require_once 
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
 
 1805        $this->replyEditForm->addItem($oPostGUI);
 
 1808        include_once 
'Services/Mail/classes/class.ilMail.php';
 
 1810        if ($this->rbac->system()->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
 
 1811           !$frm->isThreadNotificationEnabled($this->user->getId(), $this->objCurrentPost->getThreadId()) &&
 
 1812           !$this->objProperties->isAnonymized()) {
 
 1813            $oNotificationGUI = 
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'), 
'notify');
 
 1814            $oNotificationGUI->setInfo($this->lng->txt(
'forum_notify_me'));
 
 1816            $this->replyEditForm->addItem($oNotificationGUI);
 
 1819        if ($this->objProperties->isFileUploadAllowed()) {
 
 1820            $oFileUploadGUI = 
new ilFileWizardInputGUI($this->lng->txt(
'forums_attachments_add'), 
'userfile');
 
 1821            $oFileUploadGUI->setFilenames(array(0 => 
''));
 
 1822            $this->replyEditForm->addItem($oFileUploadGUI);
 
 1825        require_once 
'Services/Captcha/classes/class.ilCaptchaUtil.php';
 
 1827            $this->
user->isAnonymous() &&
 
 1828            !$this->user->isCaptchaVerified() &&
 
 1829            ilCaptchaUtil::isActiveForForum()
 
 1831            require_once 
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
 
 1832            $captcha = 
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'), 
'captcha_code');
 
 1833            $captcha->setRequired(
true);
 
 1834            $this->replyEditForm->addItem($captcha);
 
 1837        $attachments_of_node = $oFDForum->getFilesOfPost();
 
 1838        if (count($attachments_of_node) && (
$_GET[
'action'] == 
'showedit' || 
$_GET[
'action'] == 
'ready_showedit')) {
 
 1840            foreach ($oFDForum->getFilesOfPost() as 
$file) {
 
 1842                $oAttachmentGUI->setValue(
$file[
'md5']);
 
 1843                $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
 
 1845            $this->replyEditForm->addItem($oExistingAttachmentsGUI);
 
 1849            if (
$_GET[
'action'] == 
'showdraft' || 
$_GET[
'action'] == 
'editdraft') {
 
 1852                $this->replyEditForm->addItem($draftInfoGUI);
 
 1853            } elseif (
$_GET[
'action'] != 
'showedit' && 
$_GET[
'action'] != 
'ready_showedit') {
 
 1856                $this->replyEditForm->addItem($draftInfoGUI);
 
 1859            $selected_draft_id = (int) 
$_GET[
'draft_id'];
 
 1860            $draftObj = 
new ilForumPostDraft($this->
user->getId(), $this->objCurrentPost->getId(), $selected_draft_id);
 
 1861            if ($draftObj->getDraftId() > 0) {
 
 1863                if (count($oFDForumDrafts->getFilesOfPost())) {
 
 1865                    foreach ($oFDForumDrafts->getFilesOfPost() as 
$file) {
 
 1867                        $oAttachmentGUI->setValue(
$file[
'md5']);
 
 1868                        $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
 
 1870                    $this->replyEditForm->addItem($oExistingAttachmentsGUI);
 
 1876            $this->replyEditForm->addCommandButton(
'saveTopLevelPost', $this->lng->txt(
'create'));
 
 1878            $this->replyEditForm->addCommandButton(
'publishDraft', $this->lng->txt(
'publish'));
 
 1880            $this->replyEditForm->addCommandButton(
'savePost', $this->lng->txt(
'save'));
 
 1883        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id']> 0) {
 
 1884            $auto_save_draft_id = (int) 
$_GET[
'draft_id'];
 
 1886        $hidden_draft_id->setValue($auto_save_draft_id);
 
 1887        $this->replyEditForm->addItem($hidden_draft_id);
 
 1889        if (
$_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'ready_showreply' || 
$_GET[
'action'] == 
'editdraft') {
 
 1890            include_once 
'Services/RTE/classes/class.ilRTE.php';
 
 1893            if (array_key_exists(
'show_rte', 
$_POST)) {
 
 1899                    $this->replyEditForm->addCommandButton(
'quoteTopLevelPost', $this->lng->txt(
'forum_add_quote'));
 
 1901                    $this->replyEditForm->addCommandButton(
'quotePost', $this->lng->txt(
'forum_add_quote'));
 
 1905            if (!$this->
user->isAnonymous()
 
 1906                && ($_GET[
'action'] == 
'editdraft' || 
$_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'ready_showreply')
 
 1913                if (
$_GET[
'action'] == 
'editdraft') {
 
 1914                    $this->replyEditForm->addCommandButton(
'updateDraft', $this->lng->txt(
'save_message'));
 
 1916                    $this->replyEditForm->addCommandButton(
'saveAsDraft', $this->lng->txt(
'save_message'));
 
 1919                $cancel_cmd = 
'cancelDraft';
 
 1922        $this->replyEditForm->addCommandButton($cancel_cmd, $this->lng->txt(
'cancel'));
 
 1930        if (
null === $this->replyEditForm) {
 
 1931            $this->initReplyEditForm();
 
 1942        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0 && !$this->
user->isAnonymous()
 
 1948            $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 1949            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 1950            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 1951            $this->ctrl->setParameter($this, 
'draft_id', $draft_obj->getDraftId());
 
 1952            $this->ctrl->setParameter($this, 
'offset', 0);
 
 1953            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 1954            $this->ctrl->redirect($this, 
'editDraft');
 
 1956            $this->viewThreadObject();
 
 1966        $this->savePostObject();
 
 1981        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 1988        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 1989            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1992        if (!$this->access->checkAccess(
'add_reply', 
'', $this->object->getRefId())) {
 
 1993            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 1996        if (!$this->objCurrentTopic->getId()) {
 
 1998            $this->ctrl->redirect($this);
 
 2001        if ($this->objCurrentTopic->isClosed()) {
 
 2003            $this->ctrl->redirect($this);
 
 2006        if (!$this->objCurrentPost->getId()) {
 
 2007            $_GET[
'action'] = 
'';
 
 2009            $this->viewThreadObject();
 
 2013        $post_id = $this->objCurrentPost->getId();
 
 2017        if ($use_replyform) {
 
 2019            if (!$oReplyEditForm->checkInput() && !$draft_obj instanceof 
ilForumPostDraft) {
 
 2020                $oReplyEditForm->setValuesByPost();
 
 2021                return $this->viewThreadObject();
 
 2023            $post_subject = $oReplyEditForm->getInput(
'subject');
 
 2024            $post_message = $oReplyEditForm->getInput(
'message');
 
 2027            $post_subject = $draft_obj->getPostSubject();
 
 2028            $post_message = $draft_obj->getPostMessage();
 
 2032        if ($draft_obj->getDraftId() > 0) {
 
 2035            $frm = $oForumObjects[
'frm'];
 
 2036            $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 2040            $send_activation_mail = 0;
 
 2042            if ($this->objProperties->isPostActivationEnabled()) {
 
 2043                if (!$this->is_moderator) {
 
 2045                    $send_activation_mail = 1;
 
 2046                } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
 
 2051            $newPost = $frm->generatePost(
 
 2052                $draft_obj->getForumId(),
 
 2053                $draft_obj->getThreadId(),
 
 2054                $this->user->getId(),
 
 2055                $draft_obj->getPostDisplayUserId(),
 
 2057                $draft_obj->getPostId(),
 
 2058                (
int) $draft_obj->getNotify(),
 
 2059                $this->handleFormInput($post_subject, 
false),
 
 2060                $draft_obj->getPostUserAlias(),
 
 2063                $send_activation_mail
 
 2066            $this->
object->markPostRead($this->
user->getId(), (
int) $this->objCurrentTopic->getId(), (
int) $this->objCurrentPost->getId());
 
 2070            foreach ($uploadedObjects as $mob) {
 
 2076            if ($this->objProperties->isFileUploadAllowed()) {
 
 2077                $file = $_FILES[
'userfile'];
 
 2079                    $tmp_file_obj = 
new ilFileDataForum($this->object->getId(), $newPost);
 
 2080                    $tmp_file_obj->storeUploadedFile(
$file);
 
 2087                $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
 
 2088                $oFDForumDrafts->delete();
 
 2092                $GLOBALS[
'ilAppEventHandler']->raise(
 
 2095                    array(
'draftObj' => $draft_obj,
 
 2096                          'obj_id' => $this->object->getId(),
 
 2097                          'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 2100            $draft_obj->deleteDraft();
 
 2102            $GLOBALS[
'ilAppEventHandler']->raise(
 
 2106                    'ref_id'            => $this->object->getRefId(),
 
 2108                    'notify_moderators' => (
bool) $send_activation_mail
 
 2113            if (!$this->is_moderator && !$status) {
 
 2114                $message .= $this->lng->txt(
'forums_post_needs_to_be_activated');
 
 2116                $message .= $this->lng->txt(
'forums_post_new_entry');
 
 2119            $_SESSION[
'frm'][(int) 
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
 
 2121            $this->ctrl->clearParameters($this);
 
 2123            $this->ctrl->setParameter($this, 
'pos_pk', $newPost);
 
 2124            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2126            $this->ctrl->redirect($this, 
'viewThread');
 
 2133    public function savePostObject()
 
 2135        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2136            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2139        if (!$this->objCurrentTopic->getId()) {
 
 2141            $this->ctrl->redirect($this);
 
 2144        if ($this->objCurrentTopic->isClosed()) {
 
 2146            $this->ctrl->redirect($this);
 
 2151        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 2152            $_POST[
'del_file'] = array();
 
 2156        if ($oReplyEditForm->checkInput()) {
 
 2157            if (!$this->objCurrentPost->getId()) {
 
 2158                $_GET[
'action'] = 
'';
 
 2160                $this->viewThreadObject();
 
 2171            $forumObj = $oForumObjects[
'forumObj'];
 
 2175            $frm = $oForumObjects[
'frm'];
 
 2176            $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 2177            $topicData = $frm->getOneTopic();
 
 2180            if (
$_GET[
'action'] == 
'ready_showreply') {
 
 2181                if (!$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 2182                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2187                $send_activation_mail = 0;
 
 2189                if ($this->objProperties->isPostActivationEnabled()) {
 
 2190                    if (!$this->is_moderator) {
 
 2192                        $send_activation_mail = 1;
 
 2193                    } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
 
 2199                    if (!strlen($oReplyEditForm->getInput(
'alias'))) {
 
 2200                        $user_alias = $this->lng->txt(
'forums_anonymous');
 
 2202                        $user_alias = $oReplyEditForm->getInput(
'alias');
 
 2204                    $display_user_id = 0;
 
 2206                    $user_alias = $this->
user->getLogin();
 
 2207                    $display_user_id = $this->
user->getId();
 
 2210                $newPost = $frm->generatePost(
 
 2211                    $topicData[
'top_pk'],
 
 2212                    $this->objCurrentTopic->getId(),
 
 2213                    $this->user->getId(),
 
 2216                    $this->objCurrentPost->getId(),
 
 2217                    (
int) $oReplyEditForm->getInput(
'notify'),
 
 2218                    $this->handleFormInput($oReplyEditForm->getInput(
'subject'), 
false),
 
 2222                    $send_activation_mail
 
 2228                        $draft_id = 
$_POST[
'draft_id']; 
 
 2230                    $draft_obj = 
new ilForumPostDraft($this->
user->getId(), $this->objCurrentPost->getId(), $draft_id);
 
 2232                        $draft_obj->deleteDraft();
 
 2237                $this->
object->markPostRead($this->
user->getId(), (
int) $this->objCurrentTopic->getId(), (
int) $this->objCurrentPost->getId());
 
 2242                if ($this->objProperties->isFileUploadAllowed()) {
 
 2244                    $file     = $_FILES[
'userfile'];
 
 2246                        $oFDForum->storeUploadedFile(
$file);
 
 2250                $GLOBALS[
'ilAppEventHandler']->raise(
 
 2254                        'ref_id'            => $this->object->getRefId(),
 
 2256                        'notify_moderators' => (
bool) $send_activation_mail
 
 2261                if (!$this->is_moderator && !$status) {
 
 2262                    $message .= $this->lng->txt(
'forums_post_needs_to_be_activated');
 
 2264                    $message .= $this->lng->txt(
'forums_post_new_entry');
 
 2268                $this->ctrl->clearParameters($this);
 
 2269                $this->ctrl->setParameter($this, 
'post_created_below', $this->objCurrentPost->getId());
 
 2270                $this->ctrl->setParameter($this, 
'pos_pk', $newPost);
 
 2271                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2272                $this->ctrl->redirect($this, 
'viewThread');
 
 2274                if ((!$this->is_moderator &&
 
 2275                   !$this->objCurrentPost->isOwner($this->user->getId())) || $this->objCurrentPost->isCensored() ||
 
 2276                   $this->user->getId() == ANONYMOUS_USER_ID) {
 
 2277                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2283                include_once 
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
 
 2286                foreach ($oldMediaObjects as $oldMob) {
 
 2288                    foreach ($curMediaObjects as $curMob) {
 
 2289                        if ($oldMob == $curMob) {
 
 2304                $old_status_was_active = $this->objCurrentPost->isActivated();
 
 2308                $send_activation_mail = 0;
 
 2310                if ($this->objProperties->isPostActivationEnabled()) {
 
 2311                    if (!$this->is_moderator) {
 
 2313                        $send_activation_mail = 1;
 
 2314                    } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
 
 2318                $this->objCurrentPost->setStatus($status);
 
 2320                $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
 
 2322                $this->objCurrentPost->setNotification((
int) $oReplyEditForm->getInput(
'notify'));
 
 2323                $this->objCurrentPost->setChangeDate(
date(
'Y-m-d H:i:s'));
 
 2324                $this->objCurrentPost->setUpdateUserId($this->
user->getId());
 
 2327                if ($this->objCurrentPost->update()) {
 
 2328                    $this->objCurrentPost->reload();
 
 2331                    include_once 
'Services/News/classes/class.ilNewsItem.php';
 
 2336                        $this->objCurrentPost->getId(),
 
 2341                        $news_item->setTitle($this->objCurrentPost->getSubject());
 
 2342                        $news_item->setContent(
 
 2344                            $this->objCurrentPost->getMessage(),
 
 2349                        if ($this->objCurrentPost->getMessage() != strip_tags($this->objCurrentPost->getMessage())) {
 
 2350                            $news_item->setContentHtml(
true);
 
 2352                            $news_item->setContentHtml(
false);
 
 2354                        $news_item->update();
 
 2357                    $oFDForum = $oForumObjects[
'file_obj'];
 
 2359                    if ($this->objProperties->isFileUploadAllowed()) {
 
 2360                        $file = $_FILES[
'userfile'];
 
 2362                            $oFDForum->storeUploadedFile(
$file);
 
 2366                    $file2delete = $oReplyEditForm->getInput(
'del_file');
 
 2367                    if (is_array($file2delete) && count($file2delete)) {
 
 2368                        $oFDForum->unlinkFilesByMD5Filenames($file2delete);
 
 2371                    $GLOBALS[
'ilAppEventHandler']->raise(
 
 2375                            'ref_id'                => $this->object->getRefId(),
 
 2376                            'post'                  => $this->objCurrentPost,
 
 2377                            'notify_moderators'     => (
bool) $send_activation_mail,
 
 2378                            'old_status_was_active' => (
bool) $old_status_was_active
 
 2385                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 2386                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2387                $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 2388                $this->ctrl->redirect($this, 
'viewThread');
 
 2391            $_GET[
'action'] = substr(
$_GET[
'action'], 6);
 
 2393        return $this->viewThreadObject();
 
 2398        if (
null === $a_flag) {
 
 2408        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2409            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2412        if (!is_array(
$_POST[
'del_file'])) {
 
 2413            $_POST[
'del_file'] = array();
 
 2416        if ($this->objCurrentTopic->isClosed()) {
 
 2417            $_GET[
'action'] = 
'';
 
 2418            return $this->viewThreadObject();
 
 2424        $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
 
 2425        $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
 
 2427        $oReplyEditForm->checkInput();
 
 2430        $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
 
 2431        $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
 
 2433        $_GET[
'action'] = 
'showreply';
 
 2435        $this->viewThreadObject();
 
 2438    public function getQuotationHTMLAsynchObject()
 
 2440        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2441            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2450        $frm = $oForumObjects[
'frm'];
 
 2452        require_once 
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
 
 2454            $this->objCurrentPost->getPosAuthorId(),
 
 2455            $this->objCurrentPost->getDisplayUserId(),
 
 2456            $this->objCurrentPost->getUserAlias(),
 
 2457            $this->objCurrentPost->getImportName()
 
 2467        if (
null === $this->forumObjects) {
 
 2469            $file_obj = 
new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
 
 2470            $frm = $forumObj->Forum;
 
 2471            $frm->setForumId($forumObj->getId());
 
 2472            $frm->setForumRefId($forumObj->getRefId());
 
 2474            $this->forumObjects[
'forumObj'] = $forumObj;
 
 2475            $this->forumObjects[
'frm'] = $frm;
 
 2476            $this->forumObjects[
'file_obj'] = $file_obj;
 
 2482    public function viewThreadObject()
 
 2485        $bottom_toolbar_split_button_items = array();
 
 2487        require_once 
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
 
 2488        $this->tpl->addCss(
'./Modules/Forum/css/forum_tree.css');
 
 2490            $_SESSION[
'viewmode'] = $this->objProperties->getDefaultView();
 
 2494        if (!isset(
$_SESSION[
'thread_control'][
'old'])) {
 
 2497        } elseif (isset(
$_SESSION[
'thread_control'][
'old']) && 
$_GET[
'thr_pk'] != 
$_SESSION[
'thread_control'][
'old']) {
 
 2512        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2513            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 2521        $forumObj = $oForumObjects[
'forumObj'];
 
 2525        $frm = $oForumObjects[
'frm'];
 
 2529        $file_obj = $oForumObjects[
'file_obj'];
 
 2532        if (isset(
$_GET[
'file'])) {
 
 2533            $file_obj_for_delivery = $file_obj;
 
 2537            $file_obj_for_delivery->deliverFile(
$_GET[
'file']);
 
 2538            unset($file_obj_for_delivery);
 
 2541        if (!$this->objCurrentTopic->getId()) {
 
 2542            $this->ctrl->redirect($this, 
'showThreads');
 
 2548        $append = 
'_' . $this->objCurrentTopic->getId() .
 
 2549            ($this->objCurrentPost->getId() ? 
'_' . $this->objCurrentPost->getId() : 
'');
 
 2550        $this->tpl->setLoginTargetPar(
'frm_' . 
$_GET[
'ref_id'] . $append);
 
 2553        if (
$_GET[
'action'] != 
'showreply' && 
$_GET[
'action'] != 
'showedit') {
 
 2555                include_once 
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
 
 2557                foreach (
$mobs as $mob) {
 
 2564            } 
catch (Exception $e) {
 
 2569            require_once 
'Modules/Forum/classes/class.ilForumExplorerGUI.php';
 
 2570            $exp = 
new ilForumExplorerGUI(
'frm_exp_' . $this->objCurrentTopic->getId(), $this, 
'viewThread');
 
 2571            $exp->setThread($this->objCurrentTopic);
 
 2572            if (!$exp->handleCommand()) {
 
 2573                $this->tpl->setLeftNavContent($exp->getHTML());
 
 2577        require_once 
'./Modules/Forum/classes/class.ilObjForum.php';
 
 2578        require_once 
'./Modules/Forum/classes/class.ilFileDataForum.php';
 
 2580        $this->lng->loadLanguageModule(
'forum');
 
 2584            $this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 2585            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 2590        $forumObj->updateLastAccess($this->
user->getId(), (
int) $this->objCurrentTopic->getId());
 
 2592        $this->prepareThreadScreen($forumObj);
 
 2594        $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_view.html', 
'Modules/Forum');
 
 2596        if (isset(
$_GET[
'anchor'])) {
 
 2597            $this->tpl->setVariable(
'JUMP2ANCHOR_ID', (
int) 
$_GET[
'anchor']);
 
 2601            $orderField = 
'frm_posts_tree.rgt';
 
 2602            $this->objCurrentTopic->setOrderDirection(
'DESC');
 
 2604            $orderField = 
'frm_posts.pos_date';
 
 2605            $this->objCurrentTopic->setOrderDirection(
 
 2612        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 2614        if (is_array($topicData = $frm->getOneTopic())) {
 
 2616            $this->objCurrentTopic->updateVisits();
 
 2618            $this->tpl->setTitle($this->lng->txt(
'forums_thread') . 
" \"" . $this->objCurrentTopic->getSubject() . 
"\"");
 
 2621            $this->locator->addRepositoryItems();
 
 2622            $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
""), 
"_top");
 
 2623            $this->tpl->setLocator();
 
 2628            $menutpl = 
new ilTemplate(
'tpl.forums_threads_menu.html', 
true, 
true, 
'Modules/Forum');
 
 2630            include_once(
"./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
 
 2633            if ($this->
user->getId() != ANONYMOUS_USER_ID &&
 
 2634                $forumObj->getCountUnread($this->user->getId(), (
int) $this->objCurrentTopic->getId())
 
 2636                $this->ctrl->setParameter($this, 
'mark_read', 
'1');
 
 2637                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 2640                $mark_thr_read_button->setCaption(
'forums_mark_read');
 
 2641                $mark_thr_read_button->setUrl($this->ctrl->getLinkTarget($this, 
'viewThread'));
 
 2644                $bottom_toolbar_split_button_items[] = $mark_thr_read_button;
 
 2646                $this->ctrl->clearParameters($this);
 
 2650            $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'print_thread', $this->objCurrentTopic->getId());
 
 2651            $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'thr_top_fk', $this->objCurrentTopic->getForumId());
 
 2655            $print_thr_button->setCaption(
'forums_print_thread');
 
 2656            $print_thr_button->setUrl($this->ctrl->getLinkTargetByClass(
'ilforumexportgui', 
'printThread'));
 
 2658            $bottom_toolbar_split_button_items[] = $print_thr_button;
 
 2660            $this->ctrl->clearParametersByClass(
'ilforumexportgui');
 
 2664            if ($_GET[
'mark_read']) {
 
 2665                $forumObj->markThreadRead($this->
user->getId(), (
int) $this->objCurrentTopic->getId());
 
 2670            if (
$_GET[
'action'] == 
'ready_delete' && 
$_POST[
'confirm'] != 
'') {
 
 2671                if (!$this->objCurrentTopic->isClosed() &&
 
 2672                   ($this->is_moderator ||
 
 2673                       ($this->objCurrentPost->isOwner($this->user->getId()) && !$this->objCurrentPost->hasReplies())) &&
 
 2674                   $this->user->getId() != ANONYMOUS_USER_ID) {
 
 2679                    $frm->setForumId($forumObj->getId());
 
 2680                    $frm->setForumRefId($forumObj->getRefId());
 
 2682                    $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
 
 2685                    if ($dead_thr == $this->objCurrentTopic->getId()) {
 
 2686                        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($forumObj->getId()));
 
 2688                        $topicData = $frm->getOneTopic();
 
 2692                        if ($topicData[
'top_num_threads'] > 0) {
 
 2693                            $this->ctrl->redirect($this, 
'showThreads');
 
 2695                            $this->ctrl->redirect($this, 
'createThread');
 
 2702            if (
$_GET[
'action'] == 
'ready_delete_draft' && 
$_POST[
'confirm'] != 
'') {
 
 2708            if (!$this->objCurrentTopic->isClosed() && 
$_GET[
'action'] == 
'ready_censor') {
 
 2711                if ((
$_POST[
'confirm'] != 
'' || 
$_POST[
'no_cs_change'] != 
'') && $_GET[
'action'] == 
'ready_censor') {
 
 2713                    $frm->postCensorship($cens_message, $this->objCurrentPost->getId(), 1);
 
 2715                } elseif ((
$_POST[
'cancel'] != 
'' || 
$_POST[
'yes_cs_change'] != 
'') && 
$_GET[
'action'] == 
'ready_censor') {
 
 2717                    $frm->postCensorship($cens_message, $this->objCurrentPost->getId());
 
 2723            $first_node = $this->objCurrentTopic->getFirstPostNode();
 
 2724            $this->objCurrentTopic->setOrderField($orderField);
 
 2725            $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
 
 2729                !$this->objCurrentTopic->isClosed() &&
 
 2730                $this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])
 
 2733                $reply_button->setPrimary(
true);
 
 2734                $reply_button->setCaption(
'add_new_answer');
 
 2735                $this->ctrl->setParameter($this, 
'action', 
'showreply');
 
 2736                $this->ctrl->setParameter($this, 
'pos_pk', $first_node->getId());
 
 2737                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 2738                $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 2739                $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 2741                $reply_button->setUrl($this->ctrl->getLinkTarget($this, 
'createTopLevelPost', 
'frm_page_bottom'));
 
 2743                $this->ctrl->clearParameters($this);
 
 2744                array_unshift($bottom_toolbar_split_button_items, $reply_button);
 
 2748            if (!$posNum = count($subtree_nodes)) {
 
 2752            $pageHits = $frm->getPageHits();
 
 2757            if ($posNum > $pageHits) {
 
 2759                    'ref_id'            => 
$_GET[
'ref_id'],
 
 2760                    'thr_pk'            => $this->objCurrentTopic->getId(),
 
 2761                    'orderby'           => 
$_GET[
'orderby']
 
 2764                if (!
$_GET[
'offset']) {
 
 2767                    $Start = 
$_GET[
'offset'];
 
 2770                $linkbar = 
ilUtil::Linkbar($this->ctrl->getLinkTarget($this, 
'viewThread'), $posNum, $pageHits, $Start, 
$params);
 
 2772                if ($linkbar != 
'') {
 
 2773                    $menutpl->setCurrentBlock(
'linkbar');
 
 2774                    $menutpl->setVariable(
'LINKBAR', $linkbar);
 
 2775                    $menutpl->parseCurrentBlock();
 
 2779            $this->tpl->setVariable(
'THREAD_MENU', $menutpl->get());
 
 2783            $render_drafts = 
false;
 
 2784            $draftsObjects = 
null;
 
 2788                if (count($draftsObjects) > 0) {
 
 2789                    $render_drafts = 
true;
 
 2794            foreach ($subtree_nodes as $node) {
 
 2799                $this->ctrl->clearParameters($this);
 
 2801                if ($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId()) {
 
 2805                if ($posNum > $pageHits && $z >= ($Start + $pageHits)) {
 
 2807                    if ($this->objCurrentPost->getId() && $jump < 1) {
 
 2808                        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 2809                        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 2810                        $this->ctrl->setParameter($this, 
'offset', ($Start + $pageHits));
 
 2811                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 2812                        $this->ctrl->redirect($this, 
'viewThread', $this->objCurrentPost->getId());
 
 2818                if (($posNum > $pageHits && $z >= $Start) || $posNum <= $pageHits) {
 
 2821                        # actions for "active" post
 
 2822                        if ($this->is_moderator || $node->isActivated() || $node->isOwner($this->user->getId())) {
 
 2825                                !$this->objCurrentTopic->isClosed() && (
 
 2826                                    $_GET[
'action'] == 
'showreply' || 
$_GET[
'action'] == 
'showedit' ||
 
 2827                                    $_GET[
'action'] == 
'showdraft'|| 
$_GET[
'action'] == 
'editdraft' 
 2829                                if (
$_GET[
'action'] == 
'showedit' &&
 
 2830                                  ((!$this->is_moderator &&
 
 2831                                   !$node->isOwner($this->user->getId()) || $this->user->getId() == ANONYMOUS_USER_ID) || $node->isCensored())) {
 
 2832                                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->getMessage());
 
 2833                                } elseif (
$_GET[
'action'] == 
'showreply' && !$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 2834                                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->getMessage());
 
 2837                                $this->tpl->setVariable(
'REPLY_ANKER', $this->objCurrentPost->getId());
 
 2839                                if ($_GET[
'action'] != 
'editdraft') {
 
 2840                                    switch ($this->objProperties->getSubjectSetting()) {
 
 2841                                    case 'add_re_to_subject':
 
 2845                                    case 'preset_subject':
 
 2846                                        $subject = $this->objCurrentPost->getSubject();
 
 2849                                    case 'empty_subject':
 
 2855                                switch (
$_GET[
'action']) {
 
 2857                                        if ($this->ctrl->getCmd() == 
'savePost' || $this->ctrl->getCmd() == 
'saveAsDraft') {
 
 2858                                            $oEditReplyForm->setValuesByPost();
 
 2859                                        } elseif ($this->ctrl->getCmd() == 
'quotePost') {
 
 2860                                            require_once 
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
 
 2862                                                $node->getPosAuthorId(),
 
 2863                                                $node->getDisplayUserId(),
 
 2864                                                $node->getUserAlias(),
 
 2865                                                $node->getImportName()
 
 2868                                            $oEditReplyForm->setValuesByPost();
 
 2869                                            $oEditReplyForm->getItemByPostVar(
'message')->setValue(
 
 2871                                                    $frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()) . 
"\n" . $oEditReplyForm->getInput(
'message'),
 
 2876                                            $oEditReplyForm->setValuesByArray(array(
 
 2878                                                'subject' => $subject,
 
 2882                                                'del_file' => array()
 
 2886                                        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 2887                                        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2889                                        $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html', 
true, 
true, 
'Modules/Forum');
 
 2890                                        $jsTpl->setVariable(
 
 2891                                            'IL_FRM_QUOTE_CALLBACK_SRC',
 
 2892                                            $this->ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true)
 
 2894                                        $this->ctrl->clearParameters($this);
 
 2895                                        $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
 
 2899                                        if ($this->ctrl->getCmd() == 
'savePost') {
 
 2900                                            $oEditReplyForm->setValuesByPost();
 
 2902                                            $oEditReplyForm->setValuesByArray(array(
 
 2904                                                'subject' => $this->objCurrentPost->getSubject(),
 
 2906                                                'notify' => $this->objCurrentPost->isNotificationEnabled() ? 
true : 
false,
 
 2908                                                'del_file' => array()
 
 2914                                        if (in_array($this->ctrl->getCmd(), array(
'saveDraft', 
'updateDraft', 
'publishDraft' ))) {
 
 2915                                            $oEditReplyForm->setValuesByPost();
 
 2917                                            if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 2922                                                $oEditReplyForm->setValuesByArray(array(
 
 2923                                                    'alias'    => $draftObject->getPostUserAlias(),
 
 2924                                                    'subject'  => $draftObject->getPostSubject(),
 
 2926                                                    'notify'   => $draftObject->getNotify() ? 
true : 
false,
 
 2928                                                    'del_file' => array()
 
 2931                                                $edit_draft_id = $draftObject->getDraftId();
 
 2936                                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 2937                                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 2938                                $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 2939                                $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 2940                                $this->ctrl->setParameter($this, 
'action', 
$_GET[
'action']);
 
 2941                                if (
$_GET[
'action'] != 
'editdraft') {
 
 2942                                    $this->tpl->setVariable(
'FORM', $oEditReplyForm->getHTML());
 
 2944                                $this->ctrl->clearParameters($this);
 
 2946                            elseif (!$this->objCurrentTopic->isClosed() && 
$_GET[
'action'] == 
'delete') {
 
 2947                                if ($this->is_moderator ||
 
 2948                                   ($node->isOwner($this->user->getId()) && !$node->hasReplies()) &&
 
 2949                                   $this->user->getId() != ANONYMOUS_USER_ID) {
 
 2951                                    $this->tpl->setVariable(
'FORM', $this->getDeleteFormHTML());
 
 2955                            elseif (!$this->objCurrentTopic->isClosed() && 
$_GET[
'action'] == 
'censor') {
 
 2956                                if ($this->is_moderator) {
 
 2960                            } elseif (!$this->objCurrentTopic->isClosed() && $this->displayConfirmPostActivation()) {
 
 2961                                if ($this->is_moderator) {
 
 2974            $first_node = $this->objCurrentTopic->getFirstPostNode();
 
 2977                in_array($this->ctrl->getCmd(), array(
'createTopLevelPost', 
'saveTopLevelPost', 
'quoteTopLevelPost')) &&
 
 2978                !$this->objCurrentTopic->isClosed() &&
 
 2979                $this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 2981                $this->objCurrentPost->setId($first_node->getId());
 
 2984                if ($this->ctrl->getCmd() == 
'saveTopLevelPost') {
 
 2985                    $form->setValuesByPost();
 
 2986                } elseif ($this->ctrl->getCmd() == 
'quoteTopLevelPost') {
 
 2987                    require_once 
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
 
 2989                        $first_node->getPosAuthorId(),
 
 2990                        $first_node->getDisplayUserId(),
 
 2991                        $first_node->getUserAlias(),
 
 2992                        $first_node->getImportName()
 
 2995                    $form->setValuesByPost();
 
 2996                    $form->getItemByPostVar(
'message')->setValue(
 
 2998                            $frm->prepareText($first_node->getMessage(), 1, $authorinfo->getAuthorName()) . 
"\n" . 
$form->getInput(
'message'),
 
 3003                $this->ctrl->setParameter($this, 
'pos_pk', $first_node->getId());
 
 3004                $this->ctrl->setParameter($this, 
'thr_pk', $first_node->getThreadId());
 
 3005                $jsTpl = 
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html', 
true, 
true, 
'Modules/Forum');
 
 3006                $jsTpl->setVariable(
'IL_FRM_QUOTE_CALLBACK_SRC', $this->ctrl->getLinkTarget($this, 
'getQuotationHTMLAsynch', 
'', 
true));
 
 3007                $this->ctrl->clearParameters($this);
 
 3008                $this->tpl->setVariable(
'BOTTOM_FORM_ADDITIONAL_JS', $jsTpl->get());
 
 3010                $this->tpl->setVariable(
'BOTTOM_FORM', 
$form->getHTML());
 
 3013            $this->tpl->setCurrentBlock(
'posts_no');
 
 3014            $this->tpl->setVariable(
'TXT_MSG_NO_POSTS_AVAILABLE', $this->lng->txt(
'forums_posts_not_available'));
 
 3015            $this->tpl->parseCurrentBlock();
 
 3018        if ($bottom_toolbar_split_button_items) {
 
 3021            foreach ($bottom_toolbar_split_button_items as $item) {
 
 3023                    $bottom_split_button->setDefaultButton($item);
 
 3030            $bottom_toolbar->addStickyItem($bottom_split_button);
 
 3031            $this->toolbar->addStickyItem($bottom_split_button);
 
 3034        if ($bottom_toolbar_split_button_items) {
 
 3035            $bottom_toolbar->addSeparator();
 
 3039        $to_top_button->setCaption(
'top_of_page');
 
 3040        $to_top_button->setUrl(
'#frm_page_top');
 
 3041        $bottom_toolbar->addButtonInstance($to_top_button);
 
 3042        $this->tpl->setVariable(
'TOOLBAR_BOTTOM', $bottom_toolbar->getHTML());
 
 3044        include_once 
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
 
 3045        $permalink = 
new ilPermanentLinkGUI(
'frm', $this->object->getRefId(), 
'_' . $this->objCurrentTopic->getId());
 
 3046        $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
 
 3048        $this->tpl->addOnLoadCode(
'$(".ilFrmPostContent img").each(function() { 
 3051                                maxWidth: $elm.attr("width") + "px",  
 3052                                maxHeight: $elm.attr("height")  + "px" 
 3054                        $elm.removeAttr("width"); 
 3055                        $elm.removeAttr("height"); 
 3063        $subject = $this->objCurrentPost->getSubject();
 
 3064        $re_txt = $this->lng->txt(
'post_reply');
 
 3066        $re_txt_with_num = str_replace(
':', 
'(', $re_txt);
 
 3067        $search_length = strlen($re_txt_with_num);
 
 3068        $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
 
 3071            $modified_subject = $subject;
 
 3072            if ($on_reply == 
true) {
 
 3074                $str_pos_start = strpos($subject, 
'(');
 
 3075                $str_pos_end   = strpos($subject, 
')');
 
 3077                $length        = ((int) $str_pos_end - (
int) $str_pos_start);
 
 3079                $txt_number = substr($subject, $str_pos_start, $length - 1);
 
 3081                if (is_numeric($txt_number)) {
 
 3082                    $re_count         = (int) $txt_number + 1;
 
 3083                    $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
 
 3087            $re_count = substr_count($subject, $re_txt);
 
 3088            if ($re_count >= 1 && $on_reply == 
true) {
 
 3089                $subject = str_replace($re_txt, 
'', $subject);
 
 3093                $modified_subject = 
sprintf($this->lng->txt(
'post_reply_count'), $re_count) . 
' ' . trim($subject);
 
 3094            } elseif ($re_count >= 1 && $on_reply == 
false) {
 
 3097                $modified_subject = 
sprintf($this->lng->txt(
'post_reply_count'), $re_count) . 
' ' . trim($subject);
 
 3098            } elseif ($re_count == 0) {
 
 3100                $modified_subject = $this->lng->txt(
'post_reply') . 
' ' . $this->objCurrentPost->getSubject();
 
 3103        return $modified_subject;
 
 3108        include_once 
'Services/User/classes/class.ilPublicUserProfileGUI.php';
 
 3110        $add = $this->getUserProfileAdditional((
int) 
$_GET[
'ref_id'], (
int) 
$_GET[
'user']);
 
 3111        $profile_gui->setAdditional($add);
 
 3113        $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
 
 3116    protected function getUserProfileAdditional($a_forum_ref_id, $a_user_id)
 
 3118        if (!$this->access->checkAccess(
'read', 
'', $a_forum_ref_id)) {
 
 3119            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3122        $this->lng->loadLanguageModule(
'forum');
 
 3128        if ($ref_obj->getType() == 
'frm') {
 
 3130            $frm = $forumObj->Forum;
 
 3131            $frm->setForumId($forumObj->getId());
 
 3132            $frm->setForumRefId($forumObj->getRefId());
 
 3138        if ($this->access->checkAccess(
'moderate_frm', 
'', $a_forum_ref_id)) {
 
 3139            $numPosts = $frm->countUserArticles(addslashes($a_user_id));
 
 3141            $numPosts = $frm->countActiveUserArticles(addslashes($a_user_id));
 
 3144        return array($this->lng->txt(
'forums_posts') => $numPosts);
 
 3149        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3150            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3155        if (isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids'])) {
 
 3156            if (isset(
$_POST[
'selected_cmd']) && 
$_POST[
'selected_cmd'] == 
'move') {
 
 3157                if ($this->is_moderator) {
 
 3161            } elseif (
$_POST[
'selected_cmd'] == 
'enable_notifications' && $this->
settings->get(
'forum_notification') != 0) {
 
 3165                    $tmp_obj->enableNotification($this->
user->getId());
 
 3168                $this->ctrl->redirect($this, 
'showThreads');
 
 3169            } elseif (
$_POST[
'selected_cmd'] == 
'disable_notifications' && $this->
settings->get(
'forum_notification') != 0) {
 
 3173                    $tmp_obj->disableNotification($this->
user->getId());
 
 3176                $this->ctrl->redirect($this, 
'showThreads');
 
 3177            } elseif (
$_POST[
'selected_cmd'] == 
'close') {
 
 3178                if ($this->is_moderator) {
 
 3186                $this->ctrl->redirect($this, 
'showThreads');
 
 3187            } elseif (
$_POST[
'selected_cmd'] == 
'reopen') {
 
 3188                if ($this->is_moderator) {
 
 3197                $this->ctrl->redirect($this, 
'showThreads');
 
 3198            } elseif (
$_POST[
'selected_cmd'] == 
'makesticky') {
 
 3199                if ($this->is_moderator) {
 
 3200                    $message = $this->lng->txt(
'sel_threads_make_sticky');
 
 3205                        $makeSticky =  $tmp_obj->makeSticky();
 
 3208                            $message = $this->lng->txt(
'sel_threads_already_sticky');
 
 3215                $this->ctrl->redirect($this, 
'showThreads');
 
 3216            } elseif (
$_POST[
'selected_cmd'] == 
'unmakesticky') {
 
 3217                if ($this->is_moderator) {
 
 3218                    $message = $this->lng->txt(
'sel_threads_make_unsticky');
 
 3222                        $unmakeSticky = $tmp_obj->unmakeSticky();
 
 3223                        if (!$unmakeSticky) {
 
 3224                            $message = $this->lng->txt(
'sel_threads_already_unsticky');
 
 3232                $this->ctrl->redirect($this, 
'showThreads');
 
 3233            } elseif (
$_POST[
'selected_cmd'] == 
'editThread') {
 
 3234                if ($this->is_moderator) {
 
 3235                    $count = count(
$_POST[
'thread_ids']);
 
 3238                        $this->ctrl->redirect($this, 
'showThreads');
 
 3240                        foreach (
$_POST[
'thread_ids'] as $thread_id) {
 
 3246                $this->ctrl->redirect($this, 
'showThreads');
 
 3247            } elseif (
$_POST[
'selected_cmd'] == 
'html') {
 
 3248                $this->ctrl->setCmd(
'exportHTML');
 
 3249                $this->ctrl->setCmdClass(
'ilForumExportGUI');
 
 3251            } elseif (
$_POST[
'selected_cmd'] == 
'confirmDeleteThreads') {
 
 3253            } elseif (
$_POST[
'selected_cmd'] == 
'merge') {
 
 3256                ilUtil::sendInfo($this->lng->txt(
'topics_please_select_one_action'), 
true);
 
 3257                $this->ctrl->redirect($this, 
'showThreads');
 
 3261            $this->ctrl->redirect($this, 
'showThreads');
 
 3267        if (!$this->is_moderator) {
 
 3268            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3271        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3272            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3275        $threads2move = 
$_SESSION[
'threads2move'];
 
 3276        if (!is_array($threads2move) || !count($threads2move)) {
 
 3278            $this->ctrl->redirect($this, 
'showThreads');
 
 3281        if (!$this->access->checkAccess(
'read', 
'', (
int) 
$_POST[
'frm_ref_id'])) {
 
 3282            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3286        array_walk($threads2move, 
function ($threadId) use (&$threads) {
 
 3287            $thread = new \ilForumTopic($threadId);
 
 3290            $threads[] = $threadId;
 
 3293        if (isset(
$_POST[
'frm_ref_id']) && (int) 
$_POST[
'frm_ref_id']) {
 
 3294            $errorMessages = $this->
object->Forum->moveThreads(
 
 3296                $this->
object->getRefId(),
 
 3297                $this->ilObjDataCache->lookupObjId(
$_POST[
'frm_ref_id'])
 
 3300            if (array() !== $errorMessages) {
 
 3302                    implode(
"<br><br>", $errorMessages),
 
 3305                return $this->ctrl->redirectByClass(
'ilObjForumGUI', 
'showThreads');
 
 3310            $this->ctrl->redirect($this, 
'showThreads');
 
 3320        $this->ctrl->redirect($this, 
'showThreads');
 
 3325        if (!$this->is_moderator) {
 
 3326            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3329        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3330            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3333        $threads2move = 
$_SESSION[
'threads2move'];
 
 3334        if (!is_array($threads2move) || !count($threads2move)) {
 
 3336            $this->ctrl->redirect($this, 
'showThreads');
 
 3339        require_once 
'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php';
 
 3343        array_walk($threads2move, 
function ($threadId) use (&$threads, $isModerator) {
 
 3344            $thread = new \ilForumTopic($threadId, $isModerator);
 
 3347            $threads[] = $thread;
 
 3351        $exp->setPathOpen($this->object->getRefId());
 
 3352        $exp->setNodeSelected(isset(
$_POST[
'frm_ref_id']) && (
int) 
$_POST[
'frm_ref_id'] ? (
int) 
$_POST[
'frm_ref_id'] : 0);
 
 3353        $exp->setCurrentFrmRefId($this->object->getRefId());
 
 3354        $exp->setHighlightedNode($this->object->getRefId());
 
 3355        if (!$exp->handleCommand()) {
 
 3356            $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_move.html', 
'Modules/Forum');
 
 3359                $this->toolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this));
 
 3363            $tblThr->setId(
'il_frm_thread_move_table_' . $this->object->getRefId());
 
 3364            $tblThr->setTitle($this->lng->txt(
'move_chosen_topics'));
 
 3365            $tblThr->addColumn($this->lng->txt(
'subject'), 
'top_name', 
'100%');
 
 3366            $tblThr->disable(
'header');
 
 3367            $tblThr->disable(
'footer');
 
 3368            $tblThr->disable(
'linkbar');
 
 3369            $tblThr->disable(
'sort');
 
 3370            $tblThr->disable(
'linkbar');
 
 3371            $tblThr->setLimit(PHP_INT_MAX);
 
 3372            $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html', 
'Modules/Forum');
 
 3373            $tblThr->setDefaultOrderField(
'is_sticky');
 
 3376            foreach ($threads as $thread) {
 
 3382            $this->tpl->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
 
 3384            $this->tpl->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
 
 3385            $this->tpl->setVariable(
'CMD_SUBMIT', 
'performMoveThreads');
 
 3386            $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'move'));
 
 3387            $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this, 
'performMoveThreads'));
 
 3395        if ($this->objProperties->isAnonymized()
 
 3396        && (!$this->is_moderator || ($this->is_moderator && !$this->objProperties->getMarkModeratorPosts()))) {
 
 3405        if ($edit_draft == 
true) {
 
 3406            $this->create_topic_form_gui->setTitle($this->lng->txt(
'edit_thread_draft'));
 
 3408            $this->create_topic_form_gui->setTitle($this->lng->txt(
'forums_new_thread'));
 
 3411        $this->create_topic_form_gui->setTableWidth(
'100%');
 
 3414        $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 
'addThread'));
 
 3417            $alias_gui = 
new ilTextInputGUI($this->lng->txt(
'forums_your_name'), 
'alias');
 
 3418            $alias_gui->setInfo($this->lng->txt(
'forums_use_alias'));
 
 3419            $alias_gui->setMaxLength(255);
 
 3420            $alias_gui->setSize(50);
 
 3421            $this->create_topic_form_gui->addItem($alias_gui);
 
 3424            $alias_gui->setValue($this->
user->getLogin());
 
 3425            $this->create_topic_form_gui->addItem($alias_gui);
 
 3429        $subject_gui = 
new ilTextInputGUI($this->lng->txt(
'forums_thread'), 
'subject');
 
 3430        $subject_gui->setMaxLength(255);
 
 3431        $subject_gui->setSize(50);
 
 3432        $subject_gui->setRequired(
true);
 
 3433        $this->create_topic_form_gui->addItem($subject_gui);
 
 3437        $post_gui->setCols(50);
 
 3438        $post_gui->setRows(15);
 
 3439        $post_gui->setRequired(
true);
 
 3440        $post_gui->setUseRte(
true);
 
 3441        $post_gui->addPlugin(
'latex');
 
 3442        $post_gui->addButton(
'latex');
 
 3443        $post_gui->addButton(
'pastelatex');
 
 3444        $post_gui->addPlugin(
'ilfrmquote');
 
 3449        $post_gui->removePlugin(
'advlink');
 
 3450        $post_gui->usePurifier(
true);
 
 3451        $post_gui->setRTERootBlockElement(
'');
 
 3452        $post_gui->setRTESupport($this->
user->getId(), 
'frm~', 
'frm_post', 
'tpl.tinymce_frm_post.html', 
false, 
'3.5.11');
 
 3453        $post_gui->disableButtons(array(
 
 3471        require_once 
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
 
 3473        $this->create_topic_form_gui->addItem($post_gui);
 
 3475        if ($this->objProperties->isFileUploadAllowed()) {
 
 3477            $fi->setFilenames(array(0 => 
''));
 
 3478            $this->create_topic_form_gui->addItem($fi);
 
 3479            if ($edit_draft == 
true) {
 
 3480                if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 3483                    if ($thread_draft->getDraftId() > 0) {
 
 3485                        if (count($oFDForumDrafts->getFilesOfPost())) {
 
 3487                            foreach ($oFDForumDrafts->getFilesOfPost() as 
$file) {
 
 3489                                $oAttachmentGUI->setValue(
$file[
'md5']);
 
 3490                                $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
 
 3492                            $this->create_topic_form_gui->addItem($oExistingAttachmentsGUI);
 
 3499        include_once 
'Services/Mail/classes/class.ilMail.php';
 
 3502        if ($this->rbac->system()->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
 
 3503            !$this->objProperties->isAnonymized()
 
 3506            $dir_notification_gui = 
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'), 
'notify');
 
 3507            $dir_notification_gui->setInfo($this->lng->txt(
'forum_notify_me'));
 
 3508            $dir_notification_gui->setValue(1);
 
 3509            $this->create_topic_form_gui->addItem($dir_notification_gui);
 
 3512        require_once 
'Services/Captcha/classes/class.ilCaptchaUtil.php';
 
 3514            $this->
user->isAnonymous() &&
 
 3515            !$this->user->isCaptchaVerified() &&
 
 3516            ilCaptchaUtil::isActiveForForum()
 
 3518            require_once 
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
 
 3519            $captcha = 
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'), 
'captcha_code');
 
 3520            $captcha->setRequired(
true);
 
 3521            $this->create_topic_form_gui->addItem($captcha);
 
 3525            if ($this->ctrl->getCmd() == 
'editThreadDraft') {
 
 3526                $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 3528                $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 
'updateThreadDraft'));
 
 3529                $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 3530                $this->create_topic_form_gui->addCommandButton(
'publishThreadDraft', $this->lng->txt(
'publish'));
 
 3531                $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 3532                $this->create_topic_form_gui->addCommandButton(
'updateThreadDraft', $this->lng->txt(
'save_message'));
 
 3534                $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 3535                $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 
'saveThreadAsDraft'));
 
 3536                $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 3537                $this->create_topic_form_gui->addCommandButton(
'addThread', $this->lng->txt(
'create'));
 
 3538                $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 3539                $this->create_topic_form_gui->addCommandButton(
'saveThreadAsDraft', $this->lng->txt(
'save_message'));
 
 3541            $this->create_topic_form_gui->addCommandButton(
'cancelDraft', $this->lng->txt(
'cancel'));
 
 3543            $this->create_topic_form_gui->addCommandButton(
'addThread', $this->lng->txt(
'create'));
 
 3544            $this->create_topic_form_gui->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
 
 3550        $draft_ids = array();
 
 3551        if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 3552            $draft_ids = array((
int) 
$_GET[
'draft_id']);
 
 3553        } elseif (isset(
$_POST[
'draft_ids']) && is_array(
$_POST[
'draft_ids'])) {
 
 3554            $draft_ids = 
$_POST[
'draft_ids'];
 
 3557        $checked_draft_ids = array();
 
 3558        foreach ($draft_ids as $draft_id) {
 
 3559            if (array_key_exists($draft_id, $instances)) {
 
 3560                $checked_draft_ids[] = $draft_id;
 
 3561                $draftObj = $instances[$draft_id];
 
 3567                $objFileDataForumDrafts->delete();
 
 3570                    $GLOBALS[
'ilAppEventHandler']->raise(
 
 3573                        array(
'draftObj' => $draftObj,
 
 3574                              'obj_id' => $this->object->getId(),
 
 3575                              'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 3579                $draftObj->deleteDraft();
 
 3583        if (count($checked_draft_ids) > 1) {
 
 3589        $this->ctrl->redirect($this, 
'showThreads');
 
 3594        $this->create_topic_form_gui->setValuesByArray(array(
 
 3604        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 3605            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3608        if (!$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
 
 3609            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3615        $create_form = 
new ilTemplate(
'tpl.create_thread_form.html', 
true, 
true, 
'Modules/Forum');
 
 3616        $create_form->setVariable(
'CREATE_FORM', $this->create_topic_form_gui->getHTML());
 
 3617        $create_form->parseCurrentBlock();
 
 3619        $this->tpl->setContent($create_form->get());
 
 3624        $frm = $this->
object->Forum;
 
 3625        $frm->setForumId($this->object->getId());
 
 3626        $frm->setForumRefId($this->object->getRefId());
 
 3628        if (!$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
 
 3629            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3632        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 3634        $topicData = $frm->getOneTopic();
 
 3637        if ($this->create_topic_form_gui->checkInput()) {
 
 3643                $this->objProperties->isPostActivationEnabled() &&
 
 3644                !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
 
 3649            if (isset(
$_GET[
'draft_id'])) {
 
 3650                $draft_id = (int) 
$_GET[
'draft_id'];
 
 3655            $newThread->setForumId($topicData[
'top_pk']);
 
 3656            $newThread->setThrAuthorId($draft_obj->getPostAuthorId());
 
 3657            $newThread->setDisplayUserId($draft_obj->getPostDisplayUserId());
 
 3658            $newThread->setSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'), 
false));
 
 3659            $newThread->setUserAlias($draft_obj->getPostUserAlias());
 
 3661            $newPostId = $frm->generateThread(
 
 3664                $draft_obj->getNotify(),
 
 3665                $draft_obj->getPostNotify(),
 
 3669            if ($this->objProperties->isFileUploadAllowed()) {
 
 3670                $file = $_FILES[
'userfile'];
 
 3672                    $tmp_file_obj = 
new ilFileDataForum($this->object->getId(), $newPostId);
 
 3673                    $tmp_file_obj->storeUploadedFile(
$file);
 
 3678            $frm->setDbTable(
'frm_data');
 
 3679            $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
 
 3680            $frm->updateVisits($topicData[
'top_pk']);
 
 3682            $frm->setMDB2WhereCondition(
 
 3683                'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
 
 3684                array(
'integer', 
'text'),
 
 3685                array($topicData[
'top_pk'], $this->create_topic_form_gui->getInput(
'subject'))
 
 3690            foreach ($uploadedObjects as $mob) {
 
 3697                $history_obj->deleteHistoryByDraftIds(array($draft_obj->getDraftId()));
 
 3699                if ($this->objProperties->isFileUploadAllowed()) {
 
 3704                    $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPostId);
 
 3706                $draft_obj->deleteDraft();
 
 3709            $GLOBALS[
'ilAppEventHandler']->raise(
 
 3713                    'ref_id'            => $this->object->getRefId(),
 
 3715                    'notify_moderators' => !$status
 
 3719            if (!$a_prevent_redirect) {
 
 3721                $this->ctrl->clearParameters($this);
 
 3722                $this->ctrl->redirect($this);
 
 3727            $this->create_topic_form_gui->setValuesByPost();
 
 3729            if (!$this->objProperties->isAnonymized()) {
 
 3730                $this->create_topic_form_gui->getItemByPostVar(
'alias')->setValue($this->
user->getLogin());
 
 3733            return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
 
 3738        $frm = $this->
object->Forum;
 
 3739        $frm->setForumId($this->object->getId());
 
 3740        $frm->setForumRefId($this->object->getRefId());
 
 3742        if (!$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
 
 3743            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 3746        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 3748        $topicData = $frm->getOneTopic();
 
 3751        if ($this->create_topic_form_gui->checkInput()) {
 
 3755                if (!strlen($this->create_topic_form_gui->getInput(
'alias'))) {
 
 3756                    $user_alias = $this->lng->txt(
'forums_anonymous');
 
 3758                    $user_alias = $this->create_topic_form_gui->getInput(
'alias');
 
 3760                $display_user_id = 0;
 
 3762                $user_alias = $this->
user->getLogin();
 
 3763                $display_user_id = $this->
user->getId();
 
 3768                $this->objProperties->isPostActivationEnabled() &&
 
 3769                !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
 
 3775            $newThread->setForumId($topicData[
'top_pk']);
 
 3776            $newThread->setThrAuthorId($this->
user->getId());
 
 3777            $newThread->setDisplayUserId($display_user_id);
 
 3778            $newThread->setSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'), 
false));
 
 3779            $newThread->setUserAlias($user_alias);
 
 3781            $newPost = $frm->generateThread(
 
 3784                $this->create_topic_form_gui->getItemByPostVar(
'notify') ? (
int) $this->create_topic_form_gui->getInput(
'notify') : 0,
 
 3789            if ($this->objProperties->isFileUploadAllowed()) {
 
 3790                $file = $_FILES[
'userfile'];
 
 3792                    $tmp_file_obj = 
new ilFileDataForum($this->object->getId(), $newPost);
 
 3793                    $tmp_file_obj->storeUploadedFile(
$file);
 
 3798            $frm->setDbTable(
'frm_data');
 
 3799            $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
 
 3800            $frm->updateVisits($topicData[
'top_pk']);
 
 3802            $frm->setMDB2WhereCondition(
 
 3803                'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
 
 3804                array(
'integer', 
'text'),
 
 3805                array($topicData[
'top_pk'], $this->create_topic_form_gui->getInput(
'subject'))
 
 3809            include_once 
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
 
 3811            foreach ($mediaObjects as $mob) {
 
 3819                if (isset(
$_POST[
'draft_id']) && 
$_POST[
'draft_id'] > 0) {
 
 3823                    $history_obj->deleteHistoryByDraftIds(array($draft_obj->getDraftId()));
 
 3825                    if ($this->objProperties->isFileUploadAllowed()) {
 
 3830                        $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
 
 3832                    $draft_obj->deleteDraft();
 
 3835            $GLOBALS[
'ilAppEventHandler']->raise(
 
 3839                    'ref_id'            => $this->object->getRefId(),
 
 3841                    'notify_moderators' => !$status
 
 3845            if (!$a_prevent_redirect) {
 
 3847                $this->ctrl->redirect($this);
 
 3852            $this->create_topic_form_gui->setValuesByPost();
 
 3854            if (!$this->objProperties->isAnonymized()) {
 
 3855                $this->create_topic_form_gui->getItemByPostVar(
'alias')->setValue($this->
user->getLogin());
 
 3858            return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
 
 3864        $frm = $this->
object->Forum;
 
 3865        $frm->setForumId($this->object->getId());
 
 3866        $frm->enableForumNotification($this->
user->getId());
 
 3868        if (!$this->objCurrentTopic->getId()) {
 
 3872            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 3873            ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_enabled'), 
true);
 
 3874            $this->ctrl->redirect($this, 
'viewThread');
 
 3880        $frm = $this->
object->Forum;
 
 3881        $frm->setForumId($this->object->getId());
 
 3882        $frm->disableForumNotification($this->
user->getId());
 
 3884        if (!$this->objCurrentTopic->getId()) {
 
 3888            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 3889            ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_disabled'), 
true);
 
 3890            $this->ctrl->redirect($this, 
'viewThread');
 
 3901        $column_gui->
setBlockProperty(
'news', 
'title', $this->lng->txt(
'frm_latest_postings'));
 
 3905        if ($this->access->checkAccess(
'write', 
'', $this->object->getRefId())) {
 
 3907            $enable_internal_rss = $news_set->get(
'enable_rss_for_internal');
 
 3908            if ($enable_internal_rss) {
 
 3910                $column_gui->
setBlockProperty(
'news', 
'public_notifications_option', 
true);
 
 3918        if (!
$_POST[
'clone_source']) {
 
 3920            if (isset(
$_SESSION[
'wizard_search_title'])) {
 
 3921                $this->searchCloneSourceObject();
 
 3927        $source_id = 
$_POST[
'clone_source'];
 
 3929        $new_type = $_REQUEST[
'new_type'];
 
 3930        $this->ctrl->setParameter($this, 
'clone_source', (
int) 
$_POST[
'clone_source']);
 
 3931        $this->ctrl->setParameter($this, 
'new_type', $new_type);
 
 3933        $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.frm_wizard_page.html', 
'Modules/Forum');
 
 3934        $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this));
 
 3936        $this->tpl->setVariable(
'ALT_IMG', $this->lng->txt(
'obj_' . $new_type));
 
 3937        $this->tpl->setVariable(
'TXT_DUPLICATE', $this->lng->txt(
'frm_wizard_page'));
 
 3938        $this->tpl->setVariable(
'INFO_THREADS', $this->lng->txt(
'fmr_copy_threads_info'));
 
 3939        $this->tpl->setVariable(
'THREADS', $this->lng->txt(
'forums_threads'));
 
 3941        $forum_id = $this->ilObjDataCache->lookupObjId((
int) 
$_POST[
'clone_source']);
 
 3943        foreach ($threads as $thread_id => 
$title) {
 
 3944            $this->tpl->setCurrentBlock(
'thread_row');
 
 3945            $this->tpl->setVariable(
'CHECK_THREAD', 
ilUtil::formCheckbox(0, 
'cp_options[' . $source_id . 
'][threads][]', $thread_id));
 
 3946            $this->tpl->setVariable(
'NAME_THREAD', 
$title);
 
 3947            $this->tpl->parseCurrentBlock();
 
 3949        $this->tpl->setVariable(
'SELECT_ALL', $this->lng->txt(
'select_all'));
 
 3950        $this->tpl->setVariable(
'JS_FIELD', 
'cp_options[' . $source_id . 
'][threads]');
 
 3951        $this->tpl->setVariable(
'BTN_COPY', $this->lng->txt(
'obj_' . $new_type . 
'_duplicate'));
 
 3952        if (isset(
$_SESSION[
'wizard_search_title'])) {
 
 3953            $this->tpl->setVariable(
'BACK_CMD', 
'searchCloneSource');
 
 3955            $this->tpl->setVariable(
'BACK_CMD', 
'create');
 
 3957        $this->tpl->setVariable(
'BTN_BACK', $this->lng->txt(
'btn_back'));
 
 3962        if ($this->
object instanceof 
ilObject) {
 
 3963            $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
''), 
'', $this->object->getRefId());
 
 3969        $a_text = str_replace(
"<", 
"<", $a_text);
 
 3970        $a_text = str_replace(
">", 
">", $a_text);
 
 3971        if ($a_stripslashes) {
 
 3980        $a_text = str_replace(
"<", 
"<", $a_text);
 
 3981        $a_text = str_replace(
">", 
">", $a_text);
 
 4001            !$this->access->checkAccess(
'visible', 
'', $this->object->getRefId()) &&
 
 4002            !$this->access->checkAccess(
'read', 
'', $this->object->getRefId())
 
 4004            $this->
error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
 
 4007        include_once 
'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
 
 4010        $info->enablePrivateNotes();
 
 4013        $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
 
 4016        $this->ctrl->forwardCommand(
$info);
 
 4021        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 4022            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4025        if ((
int) $this->objCurrentPost->getId() > 0) {
 
 4028            $this->
object->markPostUnread($this->
user->getId(), (
int) $this->objCurrentPost->getId());
 
 4030        $this->viewThreadObject();
 
 4035        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 4036            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4039        if ((
int) $this->objCurrentTopic->getId() > 0 && (
int) $this->objCurrentPost->getId() > 0) {
 
 4042            $this->
object->markPostRead(
 
 4043                $this->
user->getId(),
 
 4044                (
int) $this->objCurrentTopic->getId(),
 
 4045                (
int) $this->objCurrentPost->getId()
 
 4048        $this->viewThreadObject();
 
 4053        $lg = parent::initHeaderAction();
 
 4056        if ($this->objCurrentTopic->getId()) {
 
 4057            $container_obj = 
null;
 
 4058            $lg->setContainerObject($container_obj);
 
 4062            if ($this->
user->getId() != ANONYMOUS_USER_ID && $this->settings->get(
'forum_notification') != 0) {
 
 4065                $frm = $this->
object->Forum;
 
 4066                $frm->setForumId($this->object->getId());
 
 4067                $frm->setForumRefId($this->object->getRefId());
 
 4068                $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 4069                $frm_notificiation_enabled = $frm->isForumNotificationEnabled($this->
user->getId());
 
 4071                if ($this->objCurrentTopic->getId()) {
 
 4072                    $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 4078                        $frm_notificiation_enabled &&
 
 4079                        $is_user_allowed_to_deactivate_notification
 
 4081                        $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 
'disableForumNotification'), 
"forums_disable_forum_notification");
 
 4082                    } elseif (!$frm_notificiation_enabled) {
 
 4083                        $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 
'enableForumNotification'), 
"forums_enable_forum_notification");
 
 4086                    if ($frm_notificiation_enabled) {
 
 4087                        $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 
'disableForumNotification'), 
"forums_disable_forum_notification");
 
 4089                        $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 
'enableForumNotification'), 
"forums_enable_forum_notification");
 
 4093                $topic_notification_enabled = 
false;
 
 4094                if ($this->objCurrentTopic->getId()) {
 
 4095                    $topic_notification_enabled = $this->objCurrentTopic->isNotificationEnabled($this->
user->getId());
 
 4096                    if ($topic_notification_enabled) {
 
 4097                        $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 
'toggleThreadNotification'), 
"forums_disable_notification");
 
 4099                        $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 
'toggleThreadNotification'), 
"forums_enable_notification");
 
 4102                $this->ctrl->setParameter($this, 
'thr_pk', 
'');
 
 4104                if ($frm_notificiation_enabled || $topic_notification_enabled) {
 
 4108                        $this->lng->txt(
"frm_notification_activated")
 
 4114                        $this->lng->txt(
"frm_notification_deactivated")
 
 4125        if ($this->objProperties->getNotificationType() == 
'default') {
 
 4129        if ($this->objProperties->isUserToggleNoti() ==  0) {
 
 4134            include_once 
'Modules/Forum/classes/class.ilForumNotification.php';
 
 4137            $frm_noti->setUserId($this->
user->getId());
 
 4139            $user_toggle = (int) $frm_noti->isUserToggleNotification();
 
 4140            if ($user_toggle == 0 && $this->objProperties->isUserToggleNoti() == 0) {
 
 4151        $grp_ref_id = $this->repositoryTree->checkForParentType($this->object->getRefId(), 
'grp');
 
 4152        $crs_ref_id = $this->repositoryTree->checkForParentType($this->object->getRefId(), 
'crs');
 
 4154        if ($grp_ref_id == 0 && $crs_ref_id == 0) {
 
 4165        if ((
int) $this->
settings->get(
'disable_my_offers')) {
 
 4170        include_once 
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
 
 4181        if ((
int) $this->
settings->get(
'disable_my_offers')) {
 
 4186        include_once 
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
 
 4194        $_POST[
'thread_sorting'] ? $thread_sorting = 
$_POST[
'thread_sorting'] :$thread_sorting =  array();
 
 4196        if (!$this->is_moderator) {
 
 4197            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4200        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 4201            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4204        array_walk($thread_sorting, 
function ($sortValue, $threadId) {
 
 4208        foreach ($thread_sorting as $thr_pk=>$sorting_value) {
 
 4209            $sorting_value = str_replace(
',', 
'.', $sorting_value);
 
 4210            $sorting_value =  (float) $sorting_value * 100;
 
 4211            $this->
object->setThreadSorting($thr_pk, $sorting_value);
 
 4223        if (!$this->is_moderator) {
 
 4224            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4227        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 4228            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4231        $selected_thread_id = 0;
 
 4232        if (isset(
$_GET[
'merge_thread_id']) && (
int) 
$_GET[
'merge_thread_id']) {
 
 4233            $selected_thread_id = (int) 
$_GET[
'merge_thread_id'];
 
 4234        } elseif (isset(
$_POST[
'thread_ids']) && count((array) 
$_POST[
'thread_ids']) == 1) {
 
 4235            $selected_thread_id = (int) current(
$_POST[
'thread_ids']);
 
 4242        if ($selected_thread_id) {
 
 4243            $frm = $this->
object->Forum;
 
 4244            $frm->setForumId($this->object->getId());
 
 4245            $frm->setForumRefId($this->object->getRefId());
 
 4247            $selected_thread_obj = 
new ilForumTopic($selected_thread_id);
 
 4255            $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 4257            $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.forums_threads_liste.html', 
'Modules/Forum');
 
 4259            $topicData = $frm->getOneTopic();
 
 4261                include_once 
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
 
 4262                $this->ctrl->setParameter($this, 
'merge_thread_id', $selected_thread_id);
 
 4263                $tbl = 
new ilForumTopicTableGUI($this, 
'mergeThreads', 
'', (
int) 
$_GET[
'ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
 
 4264                $tbl->setSelectedThread($selected_thread_obj);
 
 4265                $tbl->setMapper($frm)->fetchData();
 
 4267                $this->tpl->setVariable(
'THREADS_TABLE', 
$tbl->getHTML());
 
 4281        if (!$this->is_moderator) {
 
 4282            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4285        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 4286            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4289        if (!isset(
$_GET[
'merge_thread_id']) || !(
int) 
$_GET[
'merge_thread_id'] || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 1) {
 
 4295        $source_thread_id = (int) 
$_GET[
'merge_thread_id'];
 
 4296        $target_thread_id = (int) current(
$_POST[
'thread_ids']);
 
 4298        if ($source_thread_id == $target_thread_id) {
 
 4306            $this->ctrl->clearParameters($this);
 
 4318        include_once 
'Services/Utilities/classes/class.ilConfirmationGUI.php';
 
 4321        $c_gui->setFormAction($this->ctrl->getFormAction($this, 
'performMergeThreads'));
 
 4322        $c_gui->setHeaderText($this->lng->txt(
'frm_sure_merge_threads'));
 
 4323        $c_gui->setCancel($this->lng->txt(
'cancel'), 
'showThreads');
 
 4324        $c_gui->setConfirm($this->lng->txt(
'confirm'), 
'performMergeThreads');
 
 4329        $this->tpl->setContent($c_gui->getHTML());
 
 4338        if (!$this->is_moderator) {
 
 4339            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4342        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 4343            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4346        if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 2) {
 
 4352        if ((
int) 
$_POST[
'thread_ids'][0] == (
int) 
$_POST[
'thread_ids'][1]) {
 
 4383        if (!
$GLOBALS[
'ilCtrl']->isAsynch()) {
 
 4384            require_once 
'Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
 
 4396        if ($draftObj->getPostAuthorId() == $this->user->getId()) {
 
 4398            if (!$tmp_file_obj->deliverZipFile()) {
 
 4399                $this->ctrl->redirect($this);
 
 4409        if (!$this->access->checkAccess(
'read', 
'', $this->object->getRefId())) {
 
 4410            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4415        $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
 
 4416        if (!$fileData->deliverZipFile()) {
 
 4417            $this->ctrl->redirect($this);
 
 4423        $frm = $this->
object->Forum;
 
 4424        $frm->setForumId($this->object->getId());
 
 4425        $frm->setForumRefId($this->object->getRefId());
 
 4427        if (!$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
 
 4428            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4432        if (array_key_exists(
'draft_id', 
$_GET)) {
 
 4433            $draft_id = (int) 
$_GET[
'draft_id'];
 
 4434            $thread_draft = $thread_draft->newInstanceByDraftId($draft_id);
 
 4437        if (!isset(
$_GET[
'hist_check']) || (int) 
$_GET[
'hist_check'] != 0) {
 
 4444            $this->create_topic_form_gui->setValuesByArray(
 
 4446                'alias' => $thread_draft->getPostUserAlias(),
 
 4447                'subject' => $thread_draft->getPostSubject(),
 
 4449                'notify' =>$thread_draft->getNotify() ? 
true : 
false,
 
 4451                'del_file' => array())
 
 4453            $this->tpl->setContent($this->create_topic_form_gui->getHTML() . $this->modal_history);
 
 4455            $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 4456            return $this->tpl->setContent(
$form->getHTML());
 
 4462        $history_id = ((int) 
$_GET[
'history_id']);
 
 4465        $draft = $history->rollbackAutosave();
 
 4467        if ($draft->getThreadId() == 0 && $draft->getPostId() == 0) {
 
 4468            $this->ctrl->setParameter($this, 
'draft_id', $history->getDraftId());
 
 4469            $this->ctrl->redirect($this, 
'editThreadDraft');
 
 4472        $this->ctrl->clearParameters($this);
 
 4473        $this->ctrl->setParameter($this, 
'pos_pk', $draft->getPostId());
 
 4474        $this->ctrl->setParameter($this, 
'thr_pk', $draft->getThreadId());
 
 4475        $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 4476        $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 4481        $this->ctrl->redirect($this, 
'viewThread');
 
 4486        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 4487            $_POST[
'del_file'] = array();
 
 4489        $autosave_draft_id = 0;
 
 4491            $autosave_draft_id = (int) 
$_POST[
'draft_id'];
 
 4492        } elseif (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 4493            $autosave_draft_id = (int) 
$_GET[
'draft_id'];
 
 4496        $frm = $this->
object->Forum;
 
 4497        $frm->setForumId($this->object->getId());
 
 4498        $frm->setForumRefId($this->object->getRefId());
 
 4500        if (!$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())) {
 
 4501            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->
error->MESSAGE);
 
 4504        $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 4506        $topicData = $frm->getOneTopic();
 
 4509        if ($this->create_topic_form_gui->checkInput()) {
 
 4514            if ($autosave_draft_id == 0) {
 
 4519            $draftObj->setForumId($topicData[
'top_pk']);
 
 4520            $draftObj->setThreadId(0);
 
 4521            $draftObj->setPostId(0);
 
 4523            $draftObj->setPostSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'), 
false));
 
 4525            $draftObj->setPostUserAlias($user_alias);
 
 4526            $draftObj->setNotify((
int) $this->create_topic_form_gui->getInput(
'notify'));
 
 4527            $draftObj->setPostAuthorId($this->
user->getId());
 
 4528            $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4530            if ($autosave_draft_id == 0) {
 
 4531                $draft_id = $draftObj->saveDraft();
 
 4533                $draftObj->updateDraft();
 
 4534                $draft_id = $draftObj->getDraftId();
 
 4538                $GLOBALS[
'ilAppEventHandler']->raise(
 
 4541                    array(
'draftObj' => $draftObj,
 
 4542                          'obj_id' => $this->object->getId(),
 
 4543                          'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4549            if ($this->objProperties->isFileUploadAllowed()) {
 
 4551                $file     = $_FILES[
'userfile'];
 
 4553                    $oFDForumDrafts->storeUploadedFile(
$file);
 
 4556                $file2delete = $this->create_topic_form_gui->getInput(
'del_file');
 
 4557                if (is_array($file2delete) && count($file2delete)) {
 
 4558                    $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
 
 4561            $this->ctrl->clearParameters($this);
 
 4563            $this->ctrl->redirect($this, 
'showThreads');
 
 4565            $_GET[
'action'] = substr(
$_GET[
'action'], 6);
 
 4566            $this->create_topic_form_gui->setValuesByPost();
 
 4567            $this->ctrl->setParameter($this, 
'draft_id', $autosave_draft_id);
 
 4568            return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
 
 4570        $this->ctrl->clearParameters($this);
 
 4571        $this->ctrl->redirect($this, 
'showThreads');
 
 4576        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 4577            $_POST[
'del_file'] = array();
 
 4580        $frm = $this->
object->Forum;
 
 4581        $frm->setForumId($this->object->getId());
 
 4582        $frm->setForumRefId($this->object->getRefId());
 
 4584        if (!$this->access->checkAccess(
'add_thread', 
'', $this->object->getRefId())
 
 4585        ||  !isset(
$_GET[
'draft_id']) || (
int) 
$_GET[
'draft_id'] <= 0) {
 
 4586            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4590        if ($this->create_topic_form_gui->checkInput()) {
 
 4596            $draftObj->setPostSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'), 
false));
 
 4598            $draftObj->setPostUserAlias($user_alias);
 
 4599            $draftObj->setNotify((
int) $this->create_topic_form_gui->getInput(
'notify'));
 
 4600            $draftObj->setPostAuthorId($this->
user->getId());
 
 4601            $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4603            $draftObj->updateDraft();
 
 4605                $GLOBALS[
'ilAppEventHandler']->raise(
 
 4608                    array(
'draftObj' => $draftObj,
 
 4609                          'obj_id' => $this->object->getId(),
 
 4610                          'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4615            ilForumUtil::moveMediaObjects($this->create_topic_form_gui->getInput(
'message'), 
'frm~d:html', $draftObj->getDraftId(), 
'frm~d:html', $draftObj->getDraftId());
 
 4617            if ($this->objProperties->isFileUploadAllowed()) {
 
 4619                $file     = $_FILES[
'userfile'];
 
 4621                    $oFDForumDrafts->storeUploadedFile(
$file);
 
 4624                $file2delete = $this->create_topic_form_gui->getInput(
'del_file');
 
 4625                if (is_array($file2delete) && count($file2delete)) {
 
 4626                    $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
 
 4631            $this->ctrl->clearParameters($this);
 
 4632            $this->ctrl->redirect($this, 
'showThreads');
 
 4634            $this->create_topic_form_gui->setValuesByPost();
 
 4635            $this->ctrl->setParameter($this, 
'hist_check', 0);
 
 4636            $this->ctrl->setParameter($this, 
'draft_id', 
$_GET[
'draft_id']);
 
 4640        $this->ctrl->clearParameters($this);
 
 4641        $this->ctrl->redirect($this, 
'showThreads');
 
 4644    public function saveAsDraftObject()
 
 4646        if (!$this->objCurrentTopic->getId()) {
 
 4648            $this->ctrl->redirect($this);
 
 4651        if ($this->objCurrentTopic->isClosed()) {
 
 4653            $this->ctrl->redirect($this);
 
 4656        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 4657            $_POST[
'del_file'] = array();
 
 4660        $autosave_draft_id = 0;
 
 4662            $autosave_draft_id = (int) 
$_POST[
'draft_id'];
 
 4665        if ($oReplyEditForm->checkInput()) {
 
 4666            if (!$this->objCurrentPost->getId()) {
 
 4667                $_GET[
'action'] = 
'';
 
 4669                $this->viewThreadObject();
 
 4680            $forumObj = $oForumObjects[
'forumObj'];
 
 4684            $frm = $oForumObjects[
'frm'];
 
 4685            $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
 
 4686            $topicData = $frm->getOneTopic();
 
 4689            if (
$_GET[
'action'] == 
'ready_showreply') {
 
 4690                if (!$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 4691                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4696                if ($autosave_draft_id == 0) {
 
 4701                $draftObj->setForumId($topicData[
'top_pk']);
 
 4702                $draftObj->setThreadId($this->objCurrentTopic->getId());
 
 4703                $draftObj->setPostId($this->objCurrentPost->getId());
 
 4705                $draftObj->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
 
 4707                $draftObj->setPostUserAlias($user_alias);
 
 4708                $draftObj->setNotify((
int) $oReplyEditForm->getInput(
'notify'));
 
 4709                $draftObj->setPostNotify((
int) $oReplyEditForm->getInput(
'notify_post'));
 
 4711                $draftObj->setPostAuthorId($this->
user->getId());
 
 4712                $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4714                if ($autosave_draft_id == 0) {
 
 4715                    $draft_id = $draftObj->saveDraft();
 
 4717                    $draftObj->updateDraft();
 
 4718                    $draft_id = $draftObj->getDraftId();
 
 4723                    $GLOBALS[
'ilAppEventHandler']->raise(
 
 4726                            array(
'draftObj'               => $draftObj,
 
 4727                                  'obj_id'                 => $this->object->getId(),
 
 4728                                  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4732                if ($this->objProperties->isFileUploadAllowed()) {
 
 4733                    $file = $_FILES[
'userfile'];
 
 4736                        $oFDForumDrafts->storeUploadedFile(
$file);
 
 4743                $_SESSION[
'frm'][(int) 
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
 
 4746                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4747                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4748                $this->ctrl->redirect($this, 
'viewThread');
 
 4751            $oReplyEditForm->setValuesByPost();
 
 4752            $_GET[
'action'] = substr(
$_GET[
'action'], 6);
 
 4754        return $this->viewThreadObject();
 
 4760            $draft_id = (int) 
$_GET[
'draft_id'];
 
 4766        $this->viewThreadObject();
 
 4773    public function updateDraftObject()
 
 4775        if (!$this->objCurrentTopic->getId()) {
 
 4777            $this->ctrl->redirect($this);
 
 4780        if ($this->objCurrentTopic->isClosed()) {
 
 4782            $this->ctrl->redirect($this);
 
 4785        if (!$this->objCurrentPost->getId()) {
 
 4786            $_GET[
'action'] = 
'';
 
 4788            $this->viewThreadObject();
 
 4792        if (!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file'])) {
 
 4793            $_POST[
'del_file'] = array();
 
 4797        if ($oReplyEditForm->checkInput()) {
 
 4805            $forumObj = $oForumObjects[
'forumObj'];
 
 4807            if (!$this->
user->isAnonymous() &&
 
 4808                ($_GET[
'action'] == 
'showdraft' || 
$_GET[
'action'] == 
'editdraft')) {
 
 4809                if (!$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id'])) {
 
 4810                    $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4818                $update_draft->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'), 
false));
 
 4820                $update_draft->setPostUserAlias($user_alias);
 
 4821                $update_draft->setNotify((
int) $oReplyEditForm->getInput(
'notify'));
 
 4822                $update_draft->setUpdateUserId($this->
user->getId());
 
 4823                $update_draft->setPostAuthorId($this->
user->getId());
 
 4824                $update_draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4826                $update_draft->updateDraft();
 
 4829                    $GLOBALS[
'ilAppEventHandler']->raise(
 
 4832                        array(
'draftObj' => $update_draft,
 
 4833                              'obj_id' => $this->object->getId(),
 
 4834                              'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4840                foreach ($uploadedObjects as $mob) {
 
 4846                if ($this->objProperties->isFileUploadAllowed()) {
 
 4848                    $file     = $_FILES[
'userfile'];
 
 4850                        $oFDForumDrafts->storeUploadedFile(
$file);
 
 4854                $file2delete = $oReplyEditForm->getInput(
'del_file');
 
 4855                if (is_array($file2delete) && count($file2delete)) {
 
 4856                    $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
 
 4859                $_SESSION[
'frm'][(int) 
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int) $this->objCurrentPost->getId();
 
 4862            $this->ctrl->clearParameters($this);
 
 4863            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4864            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4865            $this->ctrl->setParameter($this, 
'draft_id', $update_draft->getDraftId());
 
 4867            $this->ctrl->clearParameters($this);
 
 4868            $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4869            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4870            $this->ctrl->setParameter($this, 
'draft_id', (
int) 
$_GET[
'draft_id']);
 
 4871            $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 4872            $oReplyEditForm->setValuesByPost();
 
 4873            return $this->viewThreadObject();
 
 4875        $this->ctrl->clearParameters($this);
 
 4876        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4877        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4878        $this->ctrl->redirect($this, 
'viewThread');
 
 4889        include_once 
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
 
 4892        foreach ($oldMediaObjects as $oldMob) {
 
 4894            foreach ($curMediaObjects as $curMob) {
 
 4895                if ($oldMob == $curMob) {
 
 4916            !$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id']) ||
 
 4917            $this->user->isAnonymous() ||
 
 4919            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 4922        $post_id  = $this->objCurrentPost->getId();
 
 4924            $draft_id_to_delete = (int) 
$_GET[
'draft_id'];
 
 4927            if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete)) {
 
 4928                $this->ctrl->clearParameters($this);
 
 4929                $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4930                $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4931                $this->ctrl->redirect($this, 
'viewThread');
 
 4935        $this->
deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
 
 4939        $objFileDataForumDrafts->delete();
 
 4942            $GLOBALS[
'ilAppEventHandler']->raise(
 
 4945                array(
'draftObj' => $draft_obj,
 
 4946                      'obj_id' => $this->object->getId(),
 
 4947                      'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
 
 4951        $draft_obj->deleteDraft();
 
 4954        $this->ctrl->clearParameters($this);
 
 4955        $this->ctrl->setParameter($this, 
'pos_pk', $this->objCurrentPost->getId());
 
 4956        $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentPost->getThreadId());
 
 4957        $this->ctrl->redirect($this, 
'viewThread');
 
 4962        if ($this->
user->isAnonymous() || $_GET[
'action'] == 
'ready_showreply') {
 
 4966        $reponse           = 
new stdClass();
 
 4967        $reponse->draft_id = 0;
 
 4971            $current_post_id =$this->objCurrentPost->getId();
 
 4973            $replyform->checkInput();
 
 4975            $form_autosave_values[
'subject'] = $replyform->getInput(
'subject');
 
 4976            $form_autosave_values[
'message'] = $replyform->getInput(
'message');
 
 4977            $form_autosave_values[
'notify']  = $replyform->getInput(
'notify');
 
 4978            $form_autosave_values[
'alias']   = $replyform->getInput(
'alias');
 
 4980            if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 4981                $draft_id = (int) 
$_GET[
'draft_id'];
 
 4983                $draft_id = $replyform->getInput(
'draft_id');
 
 4987            if ((
int) $draft_id > 0) {
 
 4988                if (
$_GET[
'action'] == 
'showreply') {
 
 4990                    $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'], 
false));
 
 4993                    $draftObj->setPostUserAlias($user_alias);
 
 4994                    $draftObj->setNotify((
int) $form_autosave_values[
'notify']);
 
 4995                    $draftObj->setUpdateUserId($this->
user->getId());
 
 4996                    $draftObj->setPostAuthorId($this->
user->getId());
 
 4997                    $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 4999                    $draftObj->updateDraft();
 
 5005                    foreach ($uploadedObjects as $mob) {
 
 5010                    foreach ($oldMediaObjects as $mob) {
 
 5014                    foreach ($curMediaObjects as $mob) {
 
 5019                    $draftObj->setDraftId((
int) $draft_id);
 
 5020                    $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'], 
false));
 
 5022                    $draftObj->addDraftToHistory();
 
 5028                    foreach ($uploadedObjects as $mob) {
 
 5033                    foreach ($oldMediaObjects as $mob) {
 
 5037                    foreach ($curMediaObjects as $mob) {
 
 5044                $draftObj->setThreadId($this->objCurrentTopic->getId());
 
 5045                $draftObj->setPostId($current_post_id);
 
 5047                $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'], 
false));
 
 5050                $draftObj->setPostUserAlias($user_alias);
 
 5051                $draftObj->setNotify((
int) $form_autosave_values[
'notify']);
 
 5052                $draftObj->setPostAuthorId($this->
user->getId());
 
 5053                $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 5054                $draftObj->saveDraft();
 
 5060                foreach ($uploadedObjects as $mob) {
 
 5065                foreach ($oldMediaObjects as $mob) {
 
 5069                foreach ($curMediaObjects as $mob) {
 
 5075        $reponse->draft_id = $draftObj->getDraftId();
 
 5076        echo json_encode($reponse);
 
 5082        if ($this->
user->isAnonymous() || $_GET[
'action'] == 
'ready_showreply') {
 
 5086        $reponse           = 
new stdClass();
 
 5087        $reponse->draft_id = 0;
 
 5092            $current_post_id = 0;
 
 5095            $replyform->checkInput();
 
 5097            $form_autosave_values[
'subject'] = $replyform->getInput(
'subject');
 
 5098            $form_autosave_values[
'message'] = $replyform->getInput(
'message');
 
 5099            $form_autosave_values[
'notify']  = $replyform->getInput(
'notify');
 
 5100            $form_autosave_values[
'alias']   = $replyform->getInput(
'alias');
 
 5102            if (isset(
$_GET[
'draft_id']) && (
int) 
$_GET[
'draft_id'] > 0) {
 
 5103                $draft_id = (int) 
$_GET[
'draft_id'];
 
 5105                $draft_id = $replyform->getInput(
'draft_id');
 
 5108            if ((
int) $draft_id > 0) {
 
 5109                if (
$_GET[
'action'] == 
'showreply') {
 
 5111                    $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'], 
false));
 
 5113                    $draftObj->setPostUserAlias($user_alias);
 
 5114                    $draftObj->setNotify((
int) $form_autosave_values[
'notify']);
 
 5115                    $draftObj->setUpdateUserId($this->
user->getId());
 
 5116                    $draftObj->setPostAuthorId($this->
user->getId());
 
 5117                    $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 5119                    $draftObj->updateDraft();
 
 5125                    foreach ($uploadedObjects as $mob) {
 
 5130                    foreach ($oldMediaObjects as $mob) {
 
 5134                    foreach ($curMediaObjects as $mob) {
 
 5139                    $draftObj->setDraftId((
int) $draft_id);
 
 5140                    $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'], 
false));
 
 5142                    $draftObj->addDraftToHistory();
 
 5148                    foreach ($uploadedObjects as $mob) {
 
 5153                    foreach ($oldMediaObjects as $mob) {
 
 5157                    foreach ($curMediaObjects as $mob) {
 
 5164                $draftObj->setThreadId($this->objCurrentTopic->getId());
 
 5165                $draftObj->setPostId($current_post_id);
 
 5167                $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'], 
false));
 
 5170                $draftObj->setPostUserAlias($user_alias);
 
 5171                $draftObj->setNotify((
int) $form_autosave_values[
'notify']);
 
 5172                $draftObj->setPostAuthorId($this->
user->getId());
 
 5173                $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
 
 5174                $draftObj->saveDraft();
 
 5180                foreach ($uploadedObjects as $mob) {
 
 5185                foreach ($oldMediaObjects as $mob) {
 
 5189                foreach ($curMediaObjects as $mob) {
 
 5195        $reponse->draft_id = $draftObj->getDraftId();
 
 5196        echo json_encode($reponse);
 
 5211            if ($this->objCurrentPost->getId() != $node->
getId()
 
 5212                || (
$_GET[
'action'] != 
'showreply' &&
 
 5213                    $_GET[
'action'] != 
'showedit' &&
 
 5214                    $_GET[
'action'] != 
'censor' &&
 
 5215                    $_GET[
'action'] != 
'delete' &&
 
 5216                    !$this->displayConfirmPostActivation())
 
 5218                if ($this->is_moderator || $node->
isActivated() || $node->
isOwner($this->user->getId())) {
 
 5220                    if (!$this->objCurrentTopic->isClosed() && $node->
isActivated() &&
 
 5221                        $this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id']) &&
 
 5224                        $this->ctrl->setParameter($this, 
'action', 
'showreply');
 
 5225                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5226                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 5227                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5228                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 5230                        if (!isset($draftsObjects[$node->
getId()])) {
 
 5231                            $actions[
'reply_to_postings'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 5234                        $this->ctrl->clearParameters($this);
 
 5238                    if (!$this->objCurrentTopic->isClosed() &&
 
 5239                        ($node->
isOwner($this->user->getId()) || $this->is_moderator) &&
 
 5241                        $this->user->getId() != ANONYMOUS_USER_ID
 
 5243                        $this->ctrl->setParameter($this, 
'action', 
'showedit');
 
 5244                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5245                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 5246                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 5247                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5249                        $actions[
'edit'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 5251                        $this->ctrl->clearParameters($this);
 
 5255                    if ($this->
user->getId() != ANONYMOUS_USER_ID && !$node->
isPostRead()) {
 
 5256                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5257                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 5258                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 5259                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5260                        $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 5262                        $actions[
'frm_mark_as_read'] = $this->ctrl->getLinkTarget($this, 
'markPostRead', $node->
getId());
 
 5264                        $this->ctrl->clearParameters($this);
 
 5268                    if ($this->
user->getId() != ANONYMOUS_USER_ID &&
 
 5271                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5272                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 5273                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 5274                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5275                        $this->ctrl->setParameter($this, 
'viewmode', 
$_SESSION[
'viewmode']);
 
 5277                        $actions[
'frm_mark_as_unread'] = $this->ctrl->getLinkTarget($this, 
'markPostUnread', $node->
getId());
 
 5279                        $this->ctrl->clearParameters($this);
 
 5284                        $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'print_post', $node->
getId());
 
 5285                        $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'top_pk', $node->
getForumId());
 
 5286                        $this->ctrl->setParameterByClass(
'ilforumexportgui', 
'thr_pk', $node->
getThreadId());
 
 5288                        $actions[
'print'] = $this->ctrl->getLinkTargetByClass(
'ilforumexportgui', 
'printPost');
 
 5290                        $this->ctrl->clearParameters($this);
 
 5293                    # buttons for every post except the "active" 
 5294                    if (!$this->objCurrentTopic->isClosed() &&
 
 5295                        ($this->is_moderator ||
 
 5297                        $this->user->getId() != ANONYMOUS_USER_ID
 
 5300                        $this->ctrl->setParameter($this, 
'action', 
'delete');
 
 5301                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5302                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 5303                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 5304                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5306                        $actions[
'delete'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 5308                        $this->ctrl->clearParameters($this);
 
 5311                    if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
 
 5313                        $this->ctrl->setParameter($this, 
'action', 
'censor');
 
 5314                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5315                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 5316                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 5317                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5319                            $actions[
'frm_revoke_censorship'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 5321                            $actions[
'frm_censorship'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 5324                        $this->ctrl->clearParameters($this);
 
 5327                        $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5328                        $this->ctrl->setParameter($this, 
'thr_pk', $node->
getThreadId());
 
 5329                        $this->ctrl->setParameter($this, 
'offset', $Start);
 
 5330                        $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5333                            $actions[
'activate_post'] = $this->ctrl->getLinkTarget($this, 
'askForPostActivation', $node->
getId());
 
 5336                        $this->ctrl->clearParameters($this);
 
 5341            if (!isset($draft)) {
 
 5343                $draft         = $draftsObjects[$node->
getId()];
 
 5346            $this->ctrl->setParameter($this, 
'action', 
'publishdraft');
 
 5347            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5348            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 5349            $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 5350            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 5351            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5352            $actions[
'publish'] = $this->ctrl->getLinkTarget($this, 
'publishSelectedDraft', $node->
getId());
 
 5353            $this->ctrl->clearParameters($this);
 
 5355            $this->ctrl->setParameter($this, 
'action', 
'editdraft');
 
 5356            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5357            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 5358            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 5359            $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 5360            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5361            $actions[
'edit'] = $this->ctrl->getLinkTarget($this, 
'editDraft', 
'draft_edit_' . $draft->getDraftId());
 
 5362            $this->ctrl->clearParameters($this);
 
 5364            $this->ctrl->setParameter($this, 
'action', 
'deletedraft');
 
 5365            $this->ctrl->setParameter($this, 
'pos_pk', $node->
getId());
 
 5366            $this->ctrl->setParameter($this, 
'thr_pk', $this->objCurrentTopic->getId());
 
 5367            $this->ctrl->setParameter($this, 
'draft_id', $draft->getDraftId());
 
 5368            $this->ctrl->setParameter($this, 
'offset', (
int) 
$_GET[
'offset']);
 
 5369            $this->ctrl->setParameter($this, 
'orderby', 
$_GET[
'orderby']);
 
 5370            $actions[
'delete'] = $this->ctrl->getLinkTarget($this, 
'viewThread', $node->
getId());
 
 5371            $this->ctrl->clearParameters($this);
 
 5373            if (isset(
$_GET[
'draft_id']) && 
$_GET[
'action'] == 
'editdraft') {
 
 5378        $this->tpl->setCurrentBlock(
'posts_row');
 
 5380            require_once 
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
 
 5387                    $sb_item->setCaption($lng_id);
 
 5388                    $sb_item->setUrl(
$url);
 
 5390                    $action_button->setDefaultButton($sb_item);
 
 5394                    $sb_item->setCaption($lng_id);
 
 5395                    $sb_item->setUrl(
$url);
 
 5402                $this->tpl->setVariable(
'COMMANDS', $action_button->render());
 
 5404                if (
$_GET[
'action'] != 
'deletedraft' && 
$_GET[
'action'] != 
'editdraft' && !$this->objCurrentTopic->isClosed()) {
 
 5405                    $this->tpl->setVariable(
'COMMANDS', $action_button->render());
 
 5419        if (!$this->access->checkAccess(
'add_reply', 
'', (
int) 
$_GET[
'ref_id']) ||
 
 5420            $this->user->isAnonymous() ||
 
 5422            $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
 
 5432        require_once 
'./Services/jQuery/classes/class.iljQueryUtil.php';
 
 5438            if (is_array($history_instances) && 
sizeof($history_instances) > 0) {
 
 5439                require_once 
'Services/UIComponent/Modal/classes/class.ilModalGUI.php';
 
 5441                $modal->setHeading($this->lng->txt(
'restore_draft_from_autosave'));
 
 5442                $modal->setId(
'frm_autosave_restore');
 
 5443                $form_tpl = 
new ilTemplate(
'tpl.restore_thread_draft.html', 
true, 
true, 
'Modules/Forum');
 
 5444                include_once  
'./Services/Accordion/classes/class.ilAccordionGUI.php';
 
 5446                foreach ($history_instances as 
$key => $history_instance) {
 
 5448                    $acc_autosave->setId(
'acc_' . $history_instance->getHistoryId());
 
 5450                    $form_tpl->setCurrentBlock(
'list_item');
 
 5455                    $restore_btn->addCSSClass(
'restore_btn');
 
 5456                    $this->ctrl->setParameter($this, 
'history_id', $history_instance->getHistoryId());
 
 5457                    $restore_btn->setUrl($this->ctrl->getLinkTarget($this, 
'restoreFromHistory'));
 
 5458                    $restore_btn->setCaption($this->lng->txt(
'restore'), 
false);
 
 5460                    $acc_autosave->addItem($history_date . 
' - ' . $history_instance->getPostSubject(), $post_message . $restore_btn->render());
 
 5462                    $form_tpl->setVariable(
'ACC_AUTO_SAVE', $acc_autosave->getHtml());
 
 5463                    $form_tpl->parseCurrentBlock();
 
 5466                $form_tpl->setVariable(
'RESTORE_DATA_EXISTS', 
'found_threat_history_to_restore');
 
 5467                $modal->setBody($form_tpl->get());
 
 5469                $this->modal_history = $modal->getHTML();
 
 5478        require_once 
'Services/Captcha/classes/class.ilCaptchaUtil.php';
 
 5479        if ($this->
user->isAnonymous()
 
 5480            && !$this->user->isCaptchaVerified()
 
 5481            && ilCaptchaUtil::isActiveForForum()) {
 
 5482            $this->
user->setCaptchaVerified(
true);
 
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=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
static _getThreads($a_obj_id, $a_sort_mode=self::SORT_DATE)
Get thread infos of object.
static mergeThreads($obj_id, $source_id, $target_id)
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.
This class handles base functions for mail handling.
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.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
renderSplitButton($is_post=true, ilForumPost $node, $Start=0, ilForumPostDraft $draft=null)
afterSave(ilObject $forumObj)
getThreadEditingForm($a_thread_id)
publishThreadDraftObject($a_prevent_redirect=false)
addAutosave(ilPropertyFormGUI $form)
publishDraftObject($use_replyform=true)
saveThreadAsDraftObject()
disableForumNotificationObject()
editThreadObject($a_thread_id, ilPropertyFormGUI $form=null)
cancelMoveThreadsObject()
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.
quoteTopLevelPostObject()
getModifiedReOnSubject($on_reply=false)
displayConfirmPostActivation()
$display_confirm_post_activation
toggleThreadNotificationObject()
executeCommand()
execute command
renderDraftContent($render_drafts, $node, $edit_draft_id=null)
getTabs()
get tabs abstract method.
getSubTabs($subtab='showThreads')
isUserAllowedToDeactivateNotification()
cancelObject()
cancel action and go back to previous page @access public
getEditFormCustomValues(array &$a_values)
static _goto($a_target, $a_thread=0, $a_posting=0)
autosaveDraftAsyncObject()
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
publishSelectedDraftObject()
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
renderPostContent(ilForumPost $node, $Start, $z)
autosaveThreadDraftAsyncObject()
performMergeThreadsObject()
hideToolbar($a_flag=null)
setColumnSettings(ilColumnGUI $column_gui)
May be overwritten in subclasses.
initForumCreateForm($object_type)
editThreadDraftObject($form=null)
doHistoryCheck($draft_id)
deliverDraftZipFileObject()
addThreadObject($a_prevent_redirect=false)
restoreFromHistoryObject()
confirmMergeThreadsObject()
isWritingWithPseudonymAllowed()
checkDraftAccess($draft_id)
handleFormInput($a_text, $a_stripslashes=true)
updateCustom(ilPropertyFormGUI $a_form)
createTopLevelPostObject()
performDeleteThreadsObject()
confirmDeleteThreadDraftsObject()
performThreadsActionObject()
askForPostActivationObject()
enableForumNotificationObject()
performPostActivationObject()
setDisplayConfirmPostActivation($status=0)
deleteSelectedDraft(ilForumPostDraft $draft_obj=null)
performMoveThreadsObject()
setTopicCreateDefaultValues()
deleteThreadDraftsObject()
saveThreadSortingObject()
updateThreadDraftObject()
initEditCustomForm(ilPropertyFormGUI $a_form)
prepareFormOutput($a_text)
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
initTopicCreateForm($edit_draft=false)
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.
createObject()
create new object form
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
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()
This class represents an option in a radio group.
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 formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
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 sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
catch(Exception $e) $message
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file