4require_once
'Services/Object/classes/class.ilObjectGUI.php';
5require_once
'Services/Table/classes/class.ilTable2GUI.php';
6require_once
'Modules/Forum/classes/class.ilForumProperties.php';
7require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
8require_once
'Modules/Forum/classes/class.ilForumPost.php';
9require_once
'Modules/Forum/classes/class.ilForum.php';
10require_once
'Modules/Forum/classes/class.ilForumTopic.php';
11require_once
'Services/RTE/classes/class.ilRTE.php';
12require_once
'Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
13require_once
'Modules/Forum/classes/class.ilForumMailNotification.php';
14require_once
'Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
15require_once
'Modules/Forum/classes/class.ilForumPostDraft.php';
16require_once
'./Modules/Forum/classes/class.ilFileDataForumDrafts.php';
17require_once
'./Modules/Forum/classes/class.ilForumUtil.php';
18require_once
'./Modules/Forum/classes/class.ilForumDraftsHistory.php';
19require_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
118 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
128 $this->ctrl->saveParameter($this, array(
'ref_id',
'cmdClass'));
131 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
133 $this->lng->loadLanguageModule(
'forum');
141 $this->is_moderator = $ilAccess->checkAccess(
'moderate_frm',
'',
$_GET[
'ref_id']);
142 $this->access = $ilAccess;
148 $this->objCurrentTopic =
new ilForumTopic((
int)
$_GET[
'thr_pk'], $this->is_moderator);
151 $this->objCurrentPost =
new ilForumPost((
int)
$_GET[
'pos_pk'], $this->is_moderator);
154 $this->forum_overview_setting = $frma_set->get(
'forum_overview');
180 if ((
int)$thread->
getForumId() !== (
int)$forumId) {
181 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
194 $this->tpl->addJavascript(
'./Modules/Forum/js/autosave.js');
195 $autosave_cmd =
'autosaveDraftAsync';
196 if($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0)
198 $autosave_cmd =
'autosaveThreadDraftAsync';
200 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
201 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
202 $draft_id =
$_GET[
'draft_id'] > 0 ?
$_GET[
'draft_id']: 0;
203 $this->ctrl->setParameter($this,
'draft_id', $draft_id );
204 $this->ctrl->setParameter($this,
'action',
$_GET[
'action']);
205 $this->tpl->addOnLoadCode(
"il.Language.setLangVar('saving', " . json_encode($this->lng->txt(
'saving')) .
");");
207 $this->tpl->addOnLoadCode(
'il.ForumDraftsAutosave.init(' . json_encode(array(
209 'draft_id' => $draft_id,
210 'interval' => $interval * 1000,
211 'url' => $this->ctrl->getFormAction($this, $autosave_cmd,
'',
true,
false),
212 'selectors' => array(
213 'form' =>
'#form_' . $form->
getId()
239 strtolower($this->ctrl->getCmd()),
240 array_map(
'strtolower', array(
'createTopLevelPost',
'quoteTopLevelPost',
'saveTopLevelPost'))
256 $next_class = $this->ctrl->getNextClass($this);
257 $cmd = $this->ctrl->getCmd();
259 $exclude_cmds = array(
260 'viewThread',
'markPostUnread',
'markPostRead',
'showThreadNotification',
261 'performPostActivation',
262 'askForPostActivation',
'askForPostDeactivation',
263 'toggleThreadNotification',
'toggleThreadNotificationTab',
264 'toggleStickiness',
'cancelPost',
'savePost',
'saveTopLevelPost',
'createTopLevelPost',
'quoteTopLevelPost',
'quotePost',
'getQuotationHTMLAsynch',
265 'autosaveDraftAsync',
'autosaveThreadDraftAsync',
266 'saveAsDraft',
'editDraft',
'updateDraft',
'deliverDraftZipFile',
'deliverZipFile',
'cancelDraft',
267 'publishThreadDraft',
'deleteThreadDrafts'
270 if(!in_array(
$cmd, $exclude_cmds))
276 if(!$this->
getCreationMode() && !$ilCtrl->isAsynch() && $ilAccess->checkAccess(
'read',
'',
$_GET[
'ref_id']))
278 $ilNavigationHistory->addItem(
$_GET[
'ref_id'],
279 'ilias.php?baseClass=ilRepositoryGUI&cmd=showThreads&ref_id='.
$_GET[
'ref_id'],
'frm');
284 case 'ilrepositoryobjectsearchgui':
287 $ilTabs->setTabActive(
"forums_threads");
288 $ilCtrl->setReturn($this,
'view');
289 include_once
'./Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
291 $this->object->getRefId(),
295 $ilCtrl->forwardCommand($search_gui);
298 case 'ilpermissiongui':
299 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
301 $this->ctrl->forwardCommand($perm_gui);
304 case 'ilforumexportgui':
305 require_once
'Modules/Forum/classes/class.ilForumExportGUI.php';
307 $this->ctrl->forwardCommand($fex_gui);
311 case 'ilforummoderatorsgui':
312 require_once
'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
314 $this->ctrl->forwardCommand($fm_gui);
317 case 'ilinfoscreengui':
325 case 'ilpublicuserprofilegui':
326 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
328 $add = $this->getUserProfileAdditional((
int)
$_GET[
'ref_id'], (
int)
$_GET[
'user']);
329 $profile_gui->setAdditional($add);
330 $ret = $this->ctrl->forwardCommand($profile_gui);
331 $this->tpl->setContent(
$ret);
334 case 'ilobjectcopygui':
335 include_once
'Services/Object/classes/class.ilObjectCopyGUI.php';
338 $this->ctrl->forwardCommand($cp);
342 $ilTabs->setTabActive(
'export');
343 include_once
'Services/Export/classes/class.ilExportGUI.php';
345 $exp->addFormat(
'xml');
346 $this->ctrl->forwardCommand($exp);
350 if(!$this->objProperties->isIsThreadRatingEnabled() ||
$ilUser->isAnonymous())
352 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->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 $ilCtrl->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']))
395 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] !=
null)
397 $member_cmd = array(
'enableAdminForceNoti',
'disableAdminForceNoti',
'enableHideUserToggleNoti',
'disableHideUserToggleNoti');
398 in_array(
$_POST[
'selected_cmd'], $member_cmd) ?
$cmd =
$_POST[
'selected_cmd'] :
$cmd =
'performThreadsAction';
402 $cmd =
'showThreads';
412 if(
$cmd !=
'viewThreadObject' &&
$cmd !=
'showUserObject')
425 $this->settingsTabs();
428 $cb_sort =
new ilCheckboxInputGUI($this->lng->txt(
'sorting_manual_sticky'),
'thread_sorting');
429 $cb_sort->setValue(
'1');
430 $cb_sort->setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
438 $rg_pro->addOption($rg_sort_by_date);
443 $view_direction_group_gui->addOption($view_desc);
444 $view_direction_group_gui->addOption($view_asc);
446 $rg_sort_by_date->addSubItem($view_direction_group_gui);
449 if(
$ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
451 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
452 $cb_prop->setValue(
'1');
453 $cb_prop->setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
456 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'mark_moderator_posts'),
'mark_mod_posts');
457 $cb_prop->setValue(
'1');
458 $cb_prop->setInfo($this->lng->txt(
'mark_moderator_posts_desc'));
461 if(
$ilSetting->get(
'enable_fora_statistics',
false))
463 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
464 $cb_prop->setValue(
'1');
465 $cb_prop->setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
469 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
470 $cb_prop->setValue(
'1');
471 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
474 $frm_subject =
new ilRadioGroupInputGUI($this->lng->txt(
'frm_subject_setting'),
'subject_setting');
475 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'preset_subject'),
'preset_subject'));
476 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'add_re_to_subject'),
'add_re_to_subject'));
477 $frm_subject->addOption(
new ilRadioOption($this->lng->txt(
'empty_subject'),
'empty_subject'));
479 $a_form->
addItem($frm_subject);
481 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'enable_thread_ratings'),
'thread_rating');
482 $cb_prop->setValue(1);
483 $cb_prop->setInfo($this->lng->txt(
'enable_thread_ratings_info'));
486 if(!ilForumProperties::isFileUploadGloballyAllowed())
488 $frm_upload =
new ilCheckboxInputGUI($this->lng->txt(
'file_upload_allowed'),
'file_upload_allowed');
489 $frm_upload->setValue(1);
490 $frm_upload->setInfo($this->lng->txt(
'allow_file_upload_desc'));
497 $a_values[
"desc"] = $this->
object->getLongDescription();
498 $a_values[
'default_view'] = $this->objProperties->getDefaultView();
499 $a_values[
'anonymized'] = $this->objProperties->isAnonymized();
500 $a_values[
'statistics_enabled'] = $this->objProperties->isStatisticEnabled();
501 $a_values[
'post_activation'] = $this->objProperties->isPostActivationEnabled();
502 $a_values[
'subject_setting'] = $this->objProperties->getSubjectSetting();
503 $a_values[
'mark_mod_posts'] = $this->objProperties->getMarkModeratorPosts();
504 $a_values[
'thread_sorting'] = $this->objProperties->getThreadSorting();
505 $a_values[
'thread_rating'] = $this->objProperties->isIsThreadRatingEnabled();
511 $a_values[
'default_view'] = $default_view;
513 $default_view_sort_dir =
515 ? (
int)$this->objProperties->getDefaultView()
518 $a_values[
'default_view_sort_dir'] = $default_view_sort_dir;
519 $a_values[
'file_upload_allowed'] = (bool)$this->objProperties->getFileUploadAllowed();
529 $view = (int)
$_POST[
'default_view'];
538 $this->objProperties->setDefaultView($view);
546 if(
$ilSetting->get(
'enable_anonymous_fora') || $this->objProperties->isAnonymized())
548 $this->objProperties->setAnonymisation((
int) $a_form->
getInput(
'anonymized'));
550 if(
$ilSetting->get(
'enable_fora_statistics',
false))
552 $this->objProperties->setStatisticsStatus((
int) $a_form->
getInput(
'statistics_enabled'));
554 $this->objProperties->setPostActivation((
int) $a_form->
getInput(
'post_activation'));
555 $this->objProperties->setSubjectSetting( $a_form->
getInput(
'subject_setting'));
556 $this->objProperties->setMarkModeratorPosts((
int) $a_form->
getInput(
'mark_mod_posts'));
557 $this->objProperties->setThreadSorting((
int)$a_form->
getInput(
'thread_sorting'));
558 $this->objProperties->setIsThreadRatingEnabled((
bool)$a_form->
getInput(
'thread_rating'));
559 if(!ilForumProperties::isFileUploadGloballyAllowed())
561 $this->objProperties->setFileUploadAllowed((
bool)$a_form->
getInput(
'file_upload_allowed'));
564 $this->objProperties->update();
574 $this->ctrl->setParameter($this,
'thr_pk', $a_thread_id);
575 $form->setFormAction($this->ctrl->getFormAction($this,
'updateThread'));
578 $ti_prop->setRequired(
true);
579 $ti_prop->setMaxLength(255);
580 $ti_prop->setSize(50);
581 $form->addItem($ti_prop);
583 $form->addCommandButton(
'updateThread', $this->lng->txt(
'save'));
584 $form->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
600 if(!$this->is_moderator)
602 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
605 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
606 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
609 $thread = new \ilForumTopic($a_thread_id);
612 $ilTabs->setTabActive(
'forums_threads');
617 $form->setValuesByArray(array(
618 'title' => $thread->getSubject()
622 $this->tpl->setContent($form->getHTML());
630 if(!$this->is_moderator)
632 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
635 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
636 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
639 if (!$this->objCurrentTopic->getId()) {
647 if(!$form->checkInput())
649 $form->setValuesByPost();
650 $this->editThreadObject($this->objCurrentTopic->getId(), $form);
654 $this->objCurrentTopic->setSubject($form->getInput(
'title'));
655 $this->objCurrentTopic->updateThreadTitle();
661 public function markAllReadObject()
668 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
669 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
672 $this->
object->markAllThreadsRead($ilUser->getId());
696 if($this->objProperties->getThreadSorting() == 1 && $this->is_moderator)
698 $ilTabs->addSubTabTarget(
'show', $this->ctrl->getLinkTarget($this,
'showThreads'),
'showThreads', get_class($this),
'', $subtab==
'showThreads'?
true :
false );
699 $ilTabs->addSubTabTarget(
'sorting_header', $this->ctrl->getLinkTarget($this,
'sortThreads'),
'sortThreads', get_class($this),
'', $subtab==
'sortThreads'?
true :
false );
702 public function getContent()
712 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
714 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
717 $cmd = $this->ctrl->getCmd();
718 $frm = $this->
object->Forum;
719 $frm->setForumId($this->object->getId());
720 $frm->setForumRefId($this->object->getRefId());
721 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
723 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
725 if((
int)strlen($this->confirmation_gui_html))
727 $this->tpl->setVariable(
'CONFIRMATION_GUI', $this->confirmation_gui_html);
731 if($ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()) && !$this->hideToolbar())
733 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
735 $btn->setUrl($this->ctrl->getLinkTarget($this,
'createThread'));
736 $btn->setCaption(
'forums_new_thread');
737 $ilToolbar->addStickyItem($btn);
741 include_once
'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
742 if(
$ilUser->getId() != ANONYMOUS_USER_ID && !(
int)strlen($this->confirmation_gui_html))
744 $ilToolbar->addButton(
745 $this->lng->txt(
'forums_mark_read'),
746 $this->ctrl->getLinkTarget($this,
'markAllRead'),
750 $this->ctrl->clearParameters($this);
755 include_once
'./Modules/Forum/classes/class.ilForumDraftsTableGUI.php';
758 if(count($draft_instances)> 0)
760 foreach($draft_instances as $draft)
762 $drafts_tbl->fillRow($draft);
764 $drafts_tbl->setData($draft_instances);
765 $this->tpl->setVariable(
'THREADS_DRAFTS_TABLE', $drafts_tbl->getHTML());
770 $topicData = $frm->getOneTopic();
774 $frm->setDbTable(
'frm_data');
775 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
776 $frm->updateVisits($topicData[
'top_pk']);
778 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
779 if(!in_array(
$cmd, array(
'showThreads',
'sortThreads') ))
781 $cmd =
'showThreads';
786 $tbl->setMapper($frm)->fetchData();
787 $this->tpl->setVariable(
'THREADS_TABLE',
$tbl->getHTML());
791 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
793 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
801 protected function renderDraftContent($render_drafts, $node, $edit_draft_id = NULL)
811 $frm = $this->
object->Forum;
814 $drafts = $draftsObjects[$node->getId()];
816 if($render_drafts && is_array($drafts))
818 foreach($drafts as $draft)
825 if(isset($edit_draft_id) && $edit_draft_id == $node->getId())
832 $filesOfDraft = $tmp_file_obj->getFilesOfPost();
833 ksort($filesOfDraft);
835 if(count($filesOfDraft))
837 if(
$_GET[
'action'] !=
'showdraft' ||
$_GET[
'action'] ==
'editdraft')
839 foreach($filesOfDraft as
$file)
841 $tpl->setCurrentBlock(
'attachment_download_row');
842 $this->ctrl->setParameter($this,
'draft_id', $tmp_file_obj->getDraftId());
843 $this->ctrl->setParameter($this,
'file',
$file[
'md5']);
844 $tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this,
'viewThread'));
845 $tpl->setVariable(
'TXT_FILENAME',
$file[
'name']);
846 $this->ctrl->setParameter($this,
'file',
'');
847 $this->ctrl->setParameter($this,
'draft_id',
'');
848 $this->ctrl->clearParameters($this);
849 $tpl->parseCurrentBlock();
852 $tpl->setCurrentBlock(
'attachments');
853 $tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD',
$lng->txt(
'forums_attachments'));
854 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
856 if(count($filesOfDraft) > 1)
859 $download_zip_button->setCaption(
$lng->txt(
'download'),
false);
860 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
861 $download_zip_button->setUrl($this->ctrl->getLinkTarget($this,
'deliverDraftZipFile'));
862 $this->ctrl->setParameter($this,
'draft_id',
'');
863 $tpl->setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
865 $tpl->parseCurrentBlock();
870 $this->renderSplitButton(
false, $node, (
int)
$_GET[
'offset'], $draft);
875 $rowCol =
'tblrowmarked';
877 $tpl->setVariable(
'ROWCOL',
' ' . $rowCol);
880 $this->ctrl->setParameter($this,
'pos_pk', $node->getId());
881 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
882 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
884 $backurl = urlencode($this->ctrl->getLinkTarget($this,
'viewThread', $node->getId()));
886 $this->ctrl->setParameter($this,
'backurl', $backurl);
887 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
888 $this->ctrl->setParameter($this,
'user', $draft->getPostDisplayUserId());
890 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
892 $draft->getPostAuthorId(),
893 $draft->getPostDisplayUserId(),
894 $draft->getPostUserAlias(),
897 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
901 $this->ctrl->clearParameters($this);
903 if($authorinfo->hasSuffix())
905 $tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
906 $tpl->setVariable(
'USR_NAME', $draft->getPostUserAlias());
910 $tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
911 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized())
913 $tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
916 $tpl->setVariable(
'DRAFT_ANCHOR',
'draft_' . $draft->getDraftId());
918 $tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
921 if($authorinfo->getAuthor()->getGender() ==
'f')
923 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
925 else if($authorinfo->getAuthor()->getGender() ==
'm')
927 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
932 if($draft->getUpdateUserId() > 0)
937 $posMod = $frm->getModeratorFromPost($node->getId());
939 if(is_array($posMod) && $posMod[
'top_mods'] > 0)
941 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
945 if(in_array($node->getUpdateUserId(), $MODS))
946 $spanClass =
'moderator_small';
950 $draft->setPostUpdate($draft->getPostUpdate());
952 if($spanClass ==
'') $spanClass =
'small';
954 $this->ctrl->setParameter($this,
'backurl', $backurl);
955 $this->ctrl->setParameter($this,
'thr_pk', $node->getThreadId());
956 $this->ctrl->setParameter($this,
'user', $node->getUpdateUserId());
957 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
958 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
960 $draft->getPostAuthorId(),
961 $draft->getUpdateUserId(),
962 $draft->getPostUserAlias(),
965 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
969 $this->ctrl->clearParameters($this);
971 $tpl->setVariable(
'POST_UPDATE_TXT',
$lng->txt(
'edited_on') .
': ' . $frm->convertDate($draft->getPostUpdate()) .
' - ' . strtolower(
$lng->txt(
'by')));
972 $tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
973 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix())
975 $tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
981 $draft->setPostMessage($frm->prepareText($draft->getPostMessage()));
983 $tpl->setVariable(
'SUBJECT', $draft->getPostSubject());
984 $tpl->setVariable(
'POST_DATE', $frm->convertDate($draft->getPostDate()));
986 if(!$node->isCensored() ||
987 ($this->objCurrentPost->getId() == $node->getId() &&
$_GET[
'action'] ==
'censor')
991 $modAuthor = $frm->getModeratorFromPost($node->getId());
995 if(is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
999 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
1003 if(in_array($draft->getPostDisplayUserId(), $MODS))
1004 $spanClass =
'moderator';
1008 if($draft->getPostMessage() == strip_tags($draft->getPostMessage()))
1011 $draft->setPostMessage(nl2br($draft->getPostMessage()));
1014 if($spanClass !=
"")
1023 if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'deletedraft')
1025 if(
$ilUser->getId() != ANONYMOUS_USER_ID && $draft->getDraftId() == (
int)
$_GET[
'draft_id'])
1028 $tpl->setVariable(
'FORM', $this->getDeleteDraftFormHTML());
1031 else if(
$_GET[
'action'] ==
'editdraft' && $draft->getDraftId() == (
int)
$_GET[
'draft_id'])
1034 $tpl->setVariable(
'EDIT_DRAFT_ANCHOR',
'draft_edit_' . $draft->getDraftId());
1035 $tpl->setVariable(
'DRAFT_FORM', $oEditReplyForm->getHTML(). $this->modal_history);
1038 $tpl->parseCurrentBlock();
1050 protected function renderPostContent(
ilForumPost $node, $Start, $z)
1061 $frm = $this->
object->Forum;
1066 $filesOfPost = $tmp_file_obj->getFilesOfPost();
1067 ksort($filesOfPost);
1068 if(count($filesOfPost))
1070 if($node->
getId() != $this->objCurrentPost->getId() ||
$_GET[
'action'] !=
'showedit')
1072 foreach($filesOfPost as
$file)
1074 $tpl->setCurrentBlock(
'attachment_download_row');
1075 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
1076 $this->ctrl->setParameter($this,
'file',
$file[
'md5']);
1077 $tpl->setVariable(
'HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this,
'viewThread'));
1078 $tpl->setVariable(
'TXT_FILENAME',
$file[
'name']);
1079 $this->ctrl->clearParameters($this);
1080 $tpl->parseCurrentBlock();
1082 $tpl->setCurrentBlock(
'attachments');
1083 $tpl->setVariable(
'TXT_ATTACHMENTS_DOWNLOAD',
$lng->txt(
'forums_attachments'));
1084 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
1086 if(count($filesOfPost) > 1)
1089 $download_zip_button->setCaption(
$lng->txt(
'download'),
false);
1090 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
1091 $download_zip_button->setUrl($this->ctrl->getLinkTarget($this,
'deliverZipFile'));
1093 $tpl->setVariable(
'DOWNLOAD_ZIP', $download_zip_button->render());
1096 $tpl->parseCurrentBlock();
1100 $this->renderSplitButton(
true, $node, $Start);
1103 $tpl->setVariable(
'POST_ANKER', $node->
getId());
1106 $tpl->setVariable(
'TXT_PERMA_LINK',
$lng->txt(
'perma_link'));
1107 $tpl->setVariable(
'PERMA_TARGET',
'_top');
1109 if(!$node->
isActivated() && !$this->objCurrentTopic->isClosed() && $this->is_moderator)
1111 $rowCol =
'ilPostingNeedsActivation';
1113 else if($this->objProperties->getMarkModeratorPosts() == 1)
1117 $rowCol =
'ilModeratorPosting';
1121 $rowCol =
'ilModeratorPosting';
1126 if((
$_GET[
'action'] !=
'delete' &&
$_GET[
'action'] !=
'censor' &&
1129 || $this->objCurrentPost->getId() != $node->
getId()
1132 $tpl->setVariable(
'ROWCOL',
' ' . $rowCol);
1137 $rowCol =
'tblrowmarked';
1144 if(
$_GET[
'action'] !=
'censor')
1146 $tpl->setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
1150 $rowCol =
'tblrowmarked';
1154 $tpl->setVariable(
'ROWCOL',
' ' . $rowCol);
1158 $tpl->setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
1162 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
1163 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1164 $backurl = urlencode($this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId()));
1165 $this->ctrl->clearParameters($this);
1167 $this->ctrl->setParameter($this,
'backurl', $backurl);
1168 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1171 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
1178 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
1182 $this->ctrl->clearParameters($this);
1184 if($authorinfo->hasSuffix())
1186 $tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
1191 $tpl->setVariable(
'AUTHOR', $authorinfo->getLinkedAuthorShortName());
1192 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized())
1194 $tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
1198 $tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
1201 if($authorinfo->getAuthor()->getGender() ==
'f')
1203 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
1205 else if($authorinfo->getAuthor()->getGender() ==
'm')
1207 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
1217 $posMod = $frm->getModeratorFromPost($node->
getId());
1219 if(is_array($posMod) && $posMod[
'top_mods'] > 0)
1221 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
1226 $spanClass =
'moderator_small';
1232 if($spanClass ==
'') $spanClass =
'small';
1234 $this->ctrl->setParameter($this,
'backurl', $backurl);
1235 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1244 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
1251 'href' => $this->ctrl->getLinkTarget($this,
'showUser')
1255 $this->ctrl->clearParameters($this);
1257 $tpl->setVariable(
'POST_UPDATE_TXT',
$lng->txt(
'edited_on') .
': ' . $frm->convertDate($node->
getChangeDate()) .
' - ' . strtolower(
$lng->txt(
'by')));
1258 $tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
1259 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix())
1261 $tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
1270 if(
$ilUser->getId() == ANONYMOUS_USER_ID ||
1278 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
1279 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
1280 $this->ctrl->setParameter($this,
'offset', $Start);
1281 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1282 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
1283 $mark_post_target = $this->ctrl->getLinkTarget($this,
'markPostRead', $node->
getId());
1285 $tpl->setVariable(
'SUBJECT',
"<a href=\"" . $mark_post_target .
"\"><b>" . $node->
getSubject() .
"</b></a>");
1291 ($this->objCurrentPost->getId() == $node->
getId() &&
$_GET[
'action'] ==
'censor')
1295 $modAuthor = $frm->getModeratorFromPost($node->
getId());
1299 if(is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
1303 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
1308 $spanClass =
'moderator';
1319 if($spanClass !=
"")
1333 $tpl->parseCurrentBlock();
1343 $this->create_form_gui->setTableWidth(
'600px');
1345 $this->create_form_gui->setTitle($this->lng->txt(
'frm_new'));
1349 $this->ctrl->setParameter($this,
'new_type', $object_type);
1350 $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this,
'save'));
1353 $title_gui =
new ilTextInputGUI($this->lng->txt(
'title'),
'title');
1356 $this->create_form_gui->addItem($title_gui);
1360 $description_gui->setCols(40);
1361 $description_gui->setRows(2);
1362 $this->create_form_gui->addItem($description_gui);
1365 $sort_man =
new ilCheckboxInputGUI($this->lng->txt(
'sorting_manual_sticky'),
'thread_sorting');
1366 $sort_man->setInfo($this->lng->txt(
'sticky_threads_always_on_top'));
1367 $sort_man->setValue(1);
1368 $this->create_form_gui->addItem($sort_man);
1373 $view_group_gui->addOption($view_hir);
1375 $view_group_gui->addOption($view_dat);
1376 $this->create_form_gui->addItem($view_group_gui);
1379 $view_direction_group_gui->addOption($view_desc);
1381 $view_direction_group_gui->addOption($view_asc);
1382 $view_dat->addSubItem($view_direction_group_gui);
1385 $anonymize_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_anonymous_posting'),
'anonymized');
1386 $anonymize_gui->setInfo($this->lng->txt(
'frm_anonymous_posting_desc'));
1387 $anonymize_gui->setValue(1);
1389 if($this->
ilias->getSetting(
'enable_anonymous_fora',
false))
1390 $anonymize_gui->setDisabled(
true);
1391 $this->create_form_gui->addItem($anonymize_gui);
1394 $statistics_gui =
new ilCheckboxInputGUI($this->lng->txt(
'frm_statistics_enabled'),
'statistics_enabled');
1395 $statistics_gui->setInfo($this->lng->txt(
'frm_statistics_enabled_desc'));
1396 $statistics_gui->setValue(1);
1397 if(!$this->
ilias->getSetting(
'enable_fora_statistics',
false))
1398 $statistics_gui->setDisabled(
true);
1399 $this->create_form_gui->addItem($statistics_gui);
1401 $cb_prop =
new ilCheckboxInputGUI($this->lng->txt(
'activate_new_posts'),
'post_activation');
1402 $cb_prop->setValue(
'1');
1403 $cb_prop->setInfo($this->lng->txt(
'post_activation_desc'));
1404 $this->create_form_gui->addItem($cb_prop);
1406 $this->create_form_gui->addCommandButton(
'save', $this->lng->txt(
'save'));
1407 $this->create_form_gui->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
1422 $this->ctrl->setParameter($this,
'ref_id', $forumObj->
getRefId());
1423 ilUtil::redirect($this->ctrl->getLinkTarget($this,
'createThread',
'',
false,
false));
1433 global $ilAccess, $ilHelp,
$ilCtrl;
1435 $ilHelp->setScreenIdComponent(
"frm");
1437 $this->ctrl->setParameter($this,
'ref_id', $this->ref_id);
1440 '',
'showThreads',
'view',
'markAllRead',
1441 'enableForumNotification',
'disableForumNotification',
'moveThreads',
'performMoveThreads',
1442 'cancelMoveThreads',
'performThreadsAction',
'createThread',
'addThread',
1443 'showUser',
'confirmDeleteThreads',
1444 'merge',
'mergeThreads',
'cancelMergeThreads',
'performMergeThreads'
1447 (in_array(
$ilCtrl->getCmd(), $active)) ? $force_active =
true : $force_active =
false;
1448 $this->tabs_gui->addTarget(
'forums_threads', $this->ctrl->getLinkTarget($this,
'showThreads'),
$ilCtrl->getCmd(), get_class($this),
'', $force_active);
1451 if($ilAccess->checkAccess(
'visible',
'', $this->ref_id))
1453 $force_active = ($this->ctrl->getNextClass() ==
'ilinfoscreengui' || strtolower(
$_GET[
'cmdClass']) ==
'ilnotegui') ?
true :
false;
1454 $this->tabs_gui->addTarget(
'info_short',
1455 $this->ctrl->getLinkTargetByClass(
1456 array(
'ilobjforumgui',
'ilinfoscreengui'),
'showSummary'),
1457 array(
'showSummary',
'infoScreen'),
1458 '',
'', $force_active);
1461 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
1463 $force_active = (
$ilCtrl->getCmd() ==
'edit') ?
true :
false;
1464 $this->tabs_gui->addTarget(
'settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'', $force_active);
1467 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
1469 $this->tabs_gui->addTarget(
'frm_moderators', $this->ctrl->getLinkTargetByClass(
'ilForumModeratorsGUI',
'showModerators'),
'showModerators', get_class($this));
1472 if($this->
ilias->getSetting(
'enable_fora_statistics',
false) &&
1473 ($this->objProperties->isStatisticEnabled() || $ilAccess->checkAccess(
'write',
'', $this->ref_id)))
1475 $force_active = (
$ilCtrl->getCmd() ==
'showStatistics') ?
true :
false;
1476 $this->tabs_gui->addTarget(
'frm_statistics', $this->ctrl->getLinkTarget($this,
'showStatistics'),
'showStatistics', get_class($this),
'', $force_active);
1479 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
1481 $this->tabs_gui->addTarget(
'export', $this->ctrl->getLinkTargetByClass(
'ilexportgui',
''),
'',
'ilexportgui');
1484 if($ilAccess->checkAccess(
'edit_permission',
'', $this->ref_id))
1486 $this->tabs_gui->addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'), array(
'perm',
'info',
'owner'),
'ilpermissiongui');
1490 public function settingsTabs()
1497 global $ilTabs, $ilAccess,
$tree;
1499 $ilTabs->setTabActive(
'settings');
1500 $ilTabs->addSubTabTarget(
'basic_settings', $this->ctrl->getLinkTarget($this,
'edit'),
'edit', get_class($this),
'',
$_GET[
'cmd']==
'edit'?
true :
false );
1503 if($this->
ilias->getSetting(
'forum_notification') > 0)
1506 $grp_ref_id =
$tree->checkForParentType($this->object->getRefId(),
'grp');
1507 $crs_ref_id =
$tree->checkForParentType($this->object->getRefId(),
'crs');
1509 if((
int)$grp_ref_id > 0 || (
int)$crs_ref_id > 0 )
1511 #show member-tab for notification if forum-notification is enabled in administration
1512 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
1514 $mem_active = array(
'showMembers',
'forums_notification_settings');
1515 (in_array(
$_GET[
'cmd'],$mem_active)) ? $force_mem_active =
true : $force_mem_active =
false;
1517 $ilTabs->addSubTabTarget(
'notifications', $this->ctrl->getLinkTarget($this,
'showMembers'),
$_GET[
'cmd'], get_class($this),
'', $force_mem_active);
1527 if (!$this->
settings->get(
'enable_fora_statistics',
false)) {
1528 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1532 if (!$this->access->checkAccess(
'read',
'', (
int)
$_GET[
'ref_id'])) {
1533 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1537 if (!$this->objProperties->isStatisticEnabled()) {
1539 if ($this->access->checkAccess(
'write',
'', (
int)
$_GET[
'ref_id'])) {
1540 ilUtil::sendInfo($this->lng->txt(
'frm_statistics_disabled_for_participants'));
1542 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1546 $this->
object->Forum->setForumId($this->object->getId());
1548 require_once
'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
1551 $tbl->setId(
'il_frm_statistic_table_'. (
int)
$_GET[
'ref_id']);
1552 $tbl->setTitle($this->lng->txt(
'statistic'),
'icon_usr.svg', $this->lng->txt(
'obj_'.$this->object->getType()));
1554 $data = $this->
object->Forum->getUserStatistic($this->is_moderator);
1568 $this->tpl->setContent(
$tbl->getHTML());
1571 public static function _goto($a_target, $a_thread = 0, $a_posting = 0)
1580 if($ilAccess->checkAccess(
'read',
'', $a_target))
1585 if ($objTopic->getFrmObjId() &&
1591 if($ilAccess->checkAccess(
'read',
'',
$ref_id))
1598 if (isset($new_ref_id) && $new_ref_id != $a_target)
1600 ilUtil::redirect(ILIAS_HTTP_PATH.
"/goto.php?target=frm_".$new_ref_id.
"_".$a_thread.
"_".$a_posting);
1604 $_GET[
'ref_id'] = $a_target;
1605 $_GET[
'pos_pk'] = $a_posting;
1606 $_GET[
'thr_pk'] = $a_thread;
1607 $_GET[
'anchor'] = $a_posting;
1608 $_GET[
'cmdClass'] =
'ilObjForumGUI';
1609 $_GET[
'cmd'] =
'viewThread';
1610 $_GET[
'baseClass'] =
'ilRepositoryGUI';
1612 include_once(
'ilias.php');
1618 $_GET[
'ref_id'] = $a_target;
1619 $_GET[
'baseClass'] =
'ilRepositoryGUI';
1620 include_once(
'ilias.php');
1624 else if($ilAccess->checkAccess(
'read',
'', ROOT_FOLDER_ID))
1626 $_GET[
'target'] =
'';
1627 $_GET[
'ref_id'] = ROOT_FOLDER_ID;
1630 $_GET[
'baseClass'] =
'ilRepositoryGUI';
1631 include(
'ilias.php');
1640 if (!$this->is_moderator) {
1641 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1644 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1645 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1648 if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
1653 require_once
'Modules/Forum/classes/class.ilForum.php';
1654 require_once
'Modules/Forum/classes/class.ilObjForum.php';
1655 $forumObj =
new ilObjForum($this->object->getRefId());
1656 $this->objProperties->setObjId($forumObj->getId());
1660 $success_message =
"forums_thread_deleted";
1661 if (count(
$_POST[
'thread_ids']) > 1) {
1662 $success_message =
"forums_threads_deleted";
1666 if (isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids'] )) {
1667 $threadIds =
$_POST[
'thread_ids'];
1671 array_walk($threadIds,
function($threadId) use (&$threads) {
1672 $thread = new \ilForumTopic($threadId);
1675 $threads[] = $thread;
1678 foreach ($threads as $thread) {
1679 $frm->setForumId($forumObj->getId());
1680 $frm->setForumRefId($forumObj->getRefId());
1682 $first_node = $frm->getFirstPostNode($thread->getId());
1683 if ((
int)$first_node[
'pos_pk']) {
1684 $frm->deletePost($first_node[
'pos_pk']);
1688 $this->ctrl->redirect($this,
'showThreads');
1693 if (!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids'])) {
1698 if (!$this->is_moderator) {
1699 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1702 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1703 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1707 array_walk(
$_POST[
'thread_ids'],
function($threadId) use (&$threads) {
1708 $thread = new \ilForumTopic($threadId);
1711 $threads[] = $thread;
1714 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
1717 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteThreads'));
1718 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_delete_threads'));
1719 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
1720 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteThreads');
1722 foreach ($threads as $thread) {
1723 $c_gui->addItem(
'thread_ids[]', $thread->getId(), $thread->getSubject());
1726 $this->confirmation_gui_html = $c_gui->getHTML();
1730 return $this->tpl->setContent($c_gui->getHTML());
1737 if(!isset(
$_POST[
'draft_ids']) || !is_array(
$_POST[
'draft_ids']))
1743 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
1746 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'deleteThreadDrafts'));
1747 $c_gui->setHeaderText($this->lng->txt(
'sure_delete_drafts'));
1748 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
1749 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'deleteThreadDrafts');
1751 foreach(
$_POST[
'draft_ids'] as $draft_id)
1753 if(array_key_exists($draft_id, $instances))
1755 $c_gui->addItem(
'draft_ids[]', $draft_id, $instances[$draft_id]->getPostSubject());
1759 $this->confirmation_gui_html = $c_gui->getHTML();
1763 return $this->tpl->setContent($c_gui->getHTML());
1766 public function prepareThreadScreen(
ilObjForum $a_forum_obj)
1774 global
$tpl,
$lng, $ilTabs, $ilHelp;
1776 $ilHelp->setScreenIdComponent(
"frm");
1778 $tpl->getStandardTemplate();
1784 $ilTabs->setBackTarget(
$lng->txt(
'all_topics'),
'ilias.php?baseClass=ilRepositoryGUI&ref_id='.$_GET[
'ref_id']);
1787 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1788 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1790 $ilTabs->addTarget(
'sort_by_posts', $this->ctrl->getLinkTarget($this,
'viewThread'));
1793 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
1794 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1796 $ilTabs->addTarget(
'order_by_date', $this->ctrl->getLinkTarget($this,
'viewThread'));
1798 $this->ctrl->clearParameters($this);
1802 $ilTabs->setTabActive(
'sort_by_posts');
1806 $ilTabs->setTabActive(
'order_by_date');
1812 $frm = $a_forum_obj->Forum;
1813 $frm->setForumId($a_forum_obj->
getId());
1818 if (!$this->is_moderator) {
1819 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1822 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1823 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1828 $this->objCurrentPost->activatePost();
1829 $GLOBALS[
'ilAppEventHandler']->raise(
1833 'ref_id' => $this->object->getRefId(),
1834 'post' => $this->objCurrentPost
1839 $this->viewThreadObject();
1844 if (!$this->is_moderator) {
1845 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1848 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1849 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1854 $this->viewThreadObject();
1859 $this->display_confirm_post_activation = $status;
1867 public function toggleThreadNotificationObject()
1874 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1875 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1880 if ($this->objCurrentTopic->isNotificationEnabled(
$ilUser->getId())) {
1881 $this->objCurrentTopic->disableNotification(
$ilUser->getId());
1884 $this->objCurrentTopic->enableNotification(
$ilUser->getId());
1888 $this->viewThreadObject();
1893 if (!$this->is_moderator) {
1894 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1897 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
1898 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
1903 if ($this->objCurrentTopic->isSticky()) {
1904 $this->objCurrentTopic->unmakeSticky();
1906 $this->objCurrentTopic->makeSticky();
1909 $this->viewThreadObject();
1914 $_GET[
'action'] =
'';
1915 if(isset(
$_POST[
'draft_id']) && (
int)
$_POST[
'draft_id'] > 0)
1917 $draft = ilForumPostDraft::newInstanceByDraftId((
int)
$_POST[
'draft_id']);
1918 $draft->deleteDraftsByDraftIds(array( (
int)
$_POST[
'draft_id']));
1921 $this->viewThreadObject();
1926 $_GET[
'action'] =
'';
1927 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0)
1932 $history_obj->getFirstAutosaveByDraftId((
int)
$_GET[
'draft_id']);
1933 $draft = ilForumPostDraft::newInstanceByDraftId((
int)
$_GET[
'draft_id']);
1934 $draft->setPostSubject($history_obj->getPostSubject());
1935 $draft->setPostMessage($history_obj->getPostMessage());
1941 $draft->updateDraft();
1943 $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
1946 $this->ctrl->clearParameters($this);
1947 $this->viewThreadObject();
1950 public function getDeleteFormHTML()
1958 $form_tpl =
new ilTemplate(
'tpl.frm_delete_post_form.html',
true,
true,
'Modules/Forum');
1960 $form_tpl->setVariable(
'ANKER', $this->objCurrentPost->getId());
1961 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1962 $form_tpl->setVariable(
'TXT_DELETE',
$lng->txt(
'forums_info_delete_post'));
1963 $this->ctrl->setParameter($this,
'action',
'ready_delete');
1964 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1965 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1966 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1967 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1968 $this->ctrl->clearParameters($this);
1969 $form_tpl->setVariable(
'CANCEL_BUTTON',
$lng->txt(
'cancel'));
1970 $form_tpl->setVariable(
'CONFIRM_BUTTON',
$lng->txt(
'confirm'));
1972 return $form_tpl->get();
1974 public function getDeleteDraftFormHTML()
1982 $form_tpl =
new ilTemplate(
'tpl.frm_delete_post_form.html',
true,
true,
'Modules/Forum');
1984 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
1985 $form_tpl->setVariable(
'TXT_DELETE',
$lng->txt(
'forums_info_delete_draft'));
1986 $this->ctrl->setParameter($this,
'action',
'ready_delete_draft');
1987 $this->ctrl->setParameter($this,
'draft_id', (
int)
$_GET[
'draft_id']);
1988 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
1989 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
1990 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
1991 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
1992 $this->ctrl->clearParameters($this);
1993 $form_tpl->setVariable(
'CANCEL_BUTTON',
$lng->txt(
'cancel'));
1994 $form_tpl->setVariable(
'CONFIRM_BUTTON',
$lng->txt(
'confirm'));
1996 return $form_tpl->get();
1999 public function getActivationFormHTML()
2006 $form_tpl =
new ilTemplate(
'tpl.frm_activation_post_form.html',
true,
true,
'Modules/Forum');
2008 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2009 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2010 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
2011 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getFormAction($this,
'performPostActivation'));
2012 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
2013 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
2014 $form_tpl->setVariable(
'TXT_ACT',
$lng->txt(
'activate_post_txt'));
2015 $form_tpl->setVariable(
'CONFIRM_BUTTON',
$lng->txt(
'activate_only_current'));
2016 $form_tpl->setVariable(
'CMD_CONFIRM',
'performPostActivation');
2017 $form_tpl->setVariable(
'CANCEL_BUTTON',
$lng->txt(
'cancel'));
2018 $form_tpl->setVariable(
'CMD_CANCEL',
'viewThread');
2019 $this->ctrl->clearParameters($this);
2021 return $form_tpl->get();
2024 public function getCensorshipFormHTML()
2032 $form_tpl =
new ilTemplate(
'tpl.frm_censorship_post_form.html',
true,
true,
'Modules/Forum');
2034 $form_tpl->setVariable(
'ANCHOR', $this->objCurrentPost->getId());
2035 $form_tpl->setVariable(
'SPACER',
'<hr noshade="noshade" width="100%" size="1" align="center" />');
2036 $this->ctrl->setParameter($this,
'action',
'ready_censor');
2037 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2038 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2039 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
2040 $form_tpl->setVariable(
'FORM_ACTION', $this->ctrl->getLinkTarget($this,
'viewThread'));
2041 $this->ctrl->clearParameters($this);
2042 $form_tpl->setVariable(
'TXT_CENS_MESSAGE',
$lng->txt(
'forums_the_post'));
2043 $form_tpl->setVariable(
'TXT_CENS_COMMENT',
$lng->txt(
'forums_censor_comment').
':');
2044 $form_tpl->setVariable(
'CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
2046 if($this->objCurrentPost->isCensored())
2048 $form_tpl->setVariable(
'TXT_CENS',
$lng->txt(
'forums_info_censor2_post'));
2049 $form_tpl->setVariable(
'YES_BUTTON',
$lng->txt(
'confirm'));
2050 $form_tpl->setVariable(
'NO_BUTTON',
$lng->txt(
'cancel'));
2054 $form_tpl->setVariable(
'TXT_CENS',
$lng->txt(
'forums_info_censor_post'));
2055 $form_tpl->setVariable(
'CANCEL_BUTTON',
$lng->txt(
'cancel'));
2056 $form_tpl->setVariable(
'CONFIRM_BUTTON',
$lng->txt(
'confirm'));
2059 return $form_tpl->get();
2065 private function initReplyEditForm()
2077 $frm = $oForumObjects[
'frm'];
2078 $oFDForum = $oForumObjects[
'file_obj'];
2080 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
2082 $this->replyEditForm->setId(
'id_showreply');
2083 $this->replyEditForm->setTableWidth(
'100%');
2084 $cancel_cmd =
'cancelPost';
2085 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply')
2087 $this->ctrl->setParameter($this,
'action',
'ready_showreply');
2089 else if(
$_GET[
'action'] ==
'showdraft' ||
$_GET[
'action'] ==
'editdraft')
2091 $this->ctrl->setParameter($this,
'action',
$_GET[
'action']);
2092 $this->ctrl->setParameter($this,
'draft_id', (
int)
$_GET[
'draft_id']);
2096 $this->ctrl->setParameter($this,
'action',
'ready_showedit');
2099 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
2100 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
2101 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2102 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2105 $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this,
'saveTopLevelPost'),
'frm_page_bottom');
2107 else if(
$_GET[
'action'] ==
'publishDraft' ||
$_GET[
'action'] ==
'editdraft')
2109 $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this,
'publishDraft'), $this->objCurrentPost->getId());
2113 $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this,
'savePost'), $this->objCurrentPost->getId());
2115 $this->ctrl->clearParameters($this);
2117 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply')
2119 $this->replyEditForm->setTitle($this->lng->txt(
'forums_your_reply'));
2121 elseif(
$_GET[
'action'] ==
'showdraft' ||
$_GET[
'action'] ==
'editdraft')
2123 $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_draft'));
2127 $this->replyEditForm->setTitle($this->lng->txt(
'forums_edit_post'));
2132 && in_array(
$_GET[
'action'], array(
'showreply',
'ready_showreply')))
2134 $oAnonymousNameGUI =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
2135 $oAnonymousNameGUI->setMaxLength(64);
2136 $oAnonymousNameGUI->setInfo($this->lng->txt(
'forums_use_alias'));
2138 $this->replyEditForm->addItem($oAnonymousNameGUI);
2142 $oSubjectGUI =
new ilTextInputGUI($this->lng->txt(
'forums_subject'),
'subject');
2143 $oSubjectGUI->setMaxLength(64);
2144 $oSubjectGUI->setRequired(
true);
2146 if($this->objProperties->getSubjectSetting() ==
'empty_subject')
2147 $oSubjectGUI->setInfo($this->lng->txt(
'enter_new_subject'));
2149 $this->replyEditForm->addItem($oSubjectGUI);
2153 $_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply' ? $this->lng->txt(
'forums_your_reply') : $this->lng->txt(
'forums_edit_post'),
2156 $oPostGUI->setRequired(
true);
2157 $oPostGUI->setCols(50);
2158 $oPostGUI->setRows(15);
2159 $oPostGUI->setUseRte(
true);
2160 $oPostGUI->addPlugin(
'latex');
2161 $oPostGUI->addButton(
'latex');
2162 $oPostGUI->addButton(
'pastelatex');
2163 $oPostGUI->addPlugin(
'ilfrmquote');
2166 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'showdraft')
2168 $oPostGUI->addButton(
'ilFrmQuoteAjaxCall');
2170 $oPostGUI->removePlugin(
'advlink');
2171 $oPostGUI->setRTERootBlockElement(
'');
2172 $oPostGUI->usePurifier(
true);
2173 $oPostGUI->disableButtons(array(
2190 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply' ||
$_GET[
'action'] ==
'showdraft' ||
$_GET[
'action'] ==
'editdraft')
2192 $oPostGUI->setRTESupport(
$ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.5.11');
2196 $oPostGUI->setRTESupport($this->objCurrentPost->getId(),
'frm',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.5.11');
2199 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
2202 $this->replyEditForm->addItem($oPostGUI);
2205 include_once
'Services/Mail/classes/class.ilMail.php';
2207 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
2208 !$frm->isThreadNotificationEnabled(
$ilUser->getId(), $this->objCurrentPost->getThreadId()) &&
2209 !$this->objProperties->isAnonymized())
2211 $oNotificationGUI =
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'),
'notify');
2212 $oNotificationGUI->setInfo($this->lng->txt(
'forum_notify_me'));
2214 $this->replyEditForm->addItem($oNotificationGUI);
2217 if($this->objProperties->isFileUploadAllowed())
2219 $oFileUploadGUI =
new ilFileWizardInputGUI($this->lng->txt(
'forums_attachments_add'),
'userfile');
2220 $oFileUploadGUI->setFilenames(array(0 =>
''));
2221 $this->replyEditForm->addItem($oFileUploadGUI);
2224 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
2227 !
$ilUser->isCaptchaVerified() &&
2228 ilCaptchaUtil::isActiveForForum()
2231 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
2232 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
2233 $captcha->setRequired(
true);
2234 $this->replyEditForm->addItem($captcha);
2237 $attachments_of_node = $oFDForum->getFilesOfPost();
2238 if(count($attachments_of_node) && (
$_GET[
'action'] ==
'showedit' ||
$_GET[
'action'] ==
'ready_showedit'))
2241 foreach($oFDForum->getFilesOfPost() as
$file)
2244 $oAttachmentGUI->setValue(
$file[
'md5']);
2245 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
2247 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
2252 if(
$_GET[
'action'] ==
'showdraft' ||
$_GET[
'action'] ==
'editdraft')
2256 $this->replyEditForm->addItem($draftInfoGUI);
2258 else if(
$_GET[
'action'] !=
'showedit' &&
$_GET[
'action'] !=
'ready_showedit')
2262 $this->replyEditForm->addItem($draftInfoGUI);
2265 $selected_draft_id = (int)
$_GET[
'draft_id'];
2267 if($draftObj->getDraftId() > 0)
2270 if(count($oFDForumDrafts->getFilesOfPost()))
2273 foreach($oFDForumDrafts->getFilesOfPost() as
$file)
2276 $oAttachmentGUI->setValue(
$file[
'md5']);
2277 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
2279 $this->replyEditForm->addItem($oExistingAttachmentsGUI);
2286 $this->replyEditForm->addCommandButton(
'saveTopLevelPost', $this->lng->txt(
'create'));
2290 $this->replyEditForm->addCommandButton(
'publishDraft', $this->lng->txt(
'publish'));
2294 $this->replyEditForm->addCommandButton(
'savePost', $this->lng->txt(
'save'));
2297 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id']> 0)
2299 $auto_save_draft_id = (int)
$_GET[
'draft_id'];
2301 $hidden_draft_id->setValue($auto_save_draft_id);
2302 $this->replyEditForm->addItem($hidden_draft_id);
2304 if(
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply' ||
$_GET[
'action'] ==
'editdraft')
2306 include_once
'Services/RTE/classes/class.ilRTE.php';
2309 if(array_key_exists(
'show_rte',
$_POST))
2318 $this->replyEditForm->addCommandButton(
'quoteTopLevelPost', $this->lng->txt(
'forum_add_quote'));
2322 $this->replyEditForm->addCommandButton(
'quotePost', $this->lng->txt(
'forum_add_quote'));
2327 && (
$_GET[
'action'] ==
'editdraft' ||
$_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'ready_showreply')
2336 if(
$_GET[
'action'] ==
'editdraft')
2338 $this->replyEditForm->addCommandButton(
'updateDraft', $this->lng->txt(
'save_message'));
2342 $this->replyEditForm->addCommandButton(
'saveAsDraft', $this->lng->txt(
'save_message'));
2345 $cancel_cmd =
'cancelDraft';
2348 $this->replyEditForm->addCommandButton($cancel_cmd, $this->lng->txt(
'cancel'));
2357 if(
null === $this->replyEditForm)
2359 $this->initReplyEditForm();
2372 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0 && !
$ilUser->isAnonymous()
2380 $this->ctrl->setParameter($this,
'action',
'editdraft');
2381 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2382 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
2383 $this->ctrl->setParameter($this,
'draft_id', $draft_obj->getDraftId());
2384 $this->ctrl->setParameter($this,
'offset', 0);
2385 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
2386 $this->ctrl->redirect($this,
'editDraft');
2390 $this->viewThreadObject();
2400 $this->savePostObject();
2415 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0)
2425 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2426 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2429 if (!$this->access->checkAccess(
'add_reply',
'', $this->object->getRefId())) {
2430 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2433 if($this->objCurrentTopic->isClosed())
2435 $_GET[
'action'] =
'';
2436 return $this->viewThreadObject();
2439 $post_id = $this->objCurrentPost->getId();
2446 if(!$oReplyEditForm->checkInput() && !$draft_obj instanceof
ilForumPostDraft)
2448 $oReplyEditForm->setValuesByPost();
2449 return $this->viewThreadObject();
2451 $post_subject = $oReplyEditForm->getInput(
'subject');
2452 $post_message = $oReplyEditForm->getInput(
'message');
2457 $post_subject = $draft_obj->getPostSubject();
2458 $post_message = $draft_obj->getPostMessage();
2462 if($draft_obj->getDraftId() > 0)
2466 $frm = $oForumObjects[
'frm'];
2467 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2471 $send_activation_mail = 0;
2473 if($this->objProperties->isPostActivationEnabled())
2475 if(!$this->is_moderator)
2478 $send_activation_mail = 1;
2480 else if($this->objCurrentPost->isAnyParentDeactivated())
2486 $newPost = $frm->generatePost(
2487 $draft_obj->getForumId(),
2488 $draft_obj->getThreadId(),
2490 $draft_obj->getPostDisplayUserId(),
2492 $draft_obj->getPostId(),
2493 (
int)$draft_obj->getNotify(),
2494 $this->handleFormInput($post_subject ,
false),
2495 $draft_obj->getPostUserAlias(),
2498 $send_activation_mail
2501 $this->
object->markPostRead($ilUser->getId(), (
int) $this->objCurrentTopic->getId(), (
int) $this->objCurrentPost->getId());
2505 foreach($uploadedObjects as $mob)
2512 if($this->objProperties->isFileUploadAllowed())
2514 $file = $_FILES[
'userfile'];
2517 $tmp_file_obj =
new ilFileDataForum($this->object->getId(), $newPost);
2518 $tmp_file_obj->storeUploadedFile(
$file);
2525 $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
2526 $oFDForumDrafts->delete();
2531 $GLOBALS[
'ilAppEventHandler']->raise(
2534 array(
'draftObj' => $draft_obj,
2535 'obj_id' => $this->object->getId(),
2536 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
2539 $draft_obj->deleteDraft();
2541 $GLOBALS[
'ilAppEventHandler']->raise(
2545 'ref_id' => $this->object->getRefId(),
2547 'notify_moderators' => (
bool)$send_activation_mail
2552 if(!$this->is_moderator && !$status)
2554 $message .=
$lng->txt(
'forums_post_needs_to_be_activated');
2558 $message .=
$lng->txt(
'forums_post_new_entry');
2561 $_SESSION[
'frm'][(int)
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$this->objCurrentPost->getId();
2563 $this->ctrl->clearParameters($this);
2565 $this->ctrl->setParameter($this,
'pos_pk', $newPost);
2566 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2568 $this->ctrl->redirect($this,
'viewThread');
2575 public function savePostObject()
2583 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2584 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2587 if (!$this->objCurrentTopic->getId()) {
2589 $this->ctrl->redirect($this);
2592 if ($this->objCurrentTopic->isClosed()) {
2594 $this->ctrl->redirect($this);
2599 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
2601 if($this->objCurrentTopic->isClosed())
2603 $_GET[
'action'] =
'';
2604 return $this->viewThreadObject();
2608 if($oReplyEditForm->checkInput())
2610 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
2613 !
$ilUser->isCaptchaVerified() &&
2614 ilCaptchaUtil::isActiveForForum()
2617 $ilUser->setCaptchaVerified(
true);
2625 $forumObj = $oForumObjects[
'forumObj'];
2629 $frm = $oForumObjects[
'frm'];
2630 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
2631 $topicData = $frm->getOneTopic();
2634 if(
$_GET[
'action'] ==
'ready_showreply')
2636 if (!$this->access->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])) {
2637 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2642 $send_activation_mail = 0;
2644 if($this->objProperties->isPostActivationEnabled())
2646 if(!$this->is_moderator)
2649 $send_activation_mail = 1;
2651 else if($this->objCurrentPost->isAnyParentDeactivated())
2659 if(!strlen($oReplyEditForm->getInput(
'alias')))
2661 $user_alias = $this->lng->txt(
'forums_anonymous');
2665 $user_alias = $oReplyEditForm->getInput(
'alias');
2667 $display_user_id = 0;
2671 $user_alias =
$ilUser->getLogin();
2672 $display_user_id =
$ilUser->getId();
2676 $newPost = $frm->generatePost(
2677 $topicData[
'top_pk'],
2678 $this->objCurrentTopic->getId(),
2682 $this->objCurrentPost->getId(),
2683 (
int)$oReplyEditForm->getInput(
'notify'),
2684 $this->handleFormInput($oReplyEditForm->getInput(
'subject'),
false),
2688 $send_activation_mail
2696 $draft_id =
$_POST[
'draft_id'];
2701 $draft_obj->deleteDraft();
2706 $this->
object->markPostRead($ilUser->getId(), (
int) $this->objCurrentTopic->getId(), (
int) $this->objCurrentPost->getId());
2711 if($this->objProperties->isFileUploadAllowed())
2714 $file = $_FILES[
'userfile'];
2717 $oFDForum->storeUploadedFile(
$file);
2721 $GLOBALS[
'ilAppEventHandler']->raise(
2725 'ref_id' => $this->object->getRefId(),
2727 'notify_moderators' => (
bool)$send_activation_mail
2732 if(!$this->is_moderator && !$status)
2734 $message .=
$lng->txt(
'forums_post_needs_to_be_activated');
2738 $message .=
$lng->txt(
'forums_post_new_entry');
2742 $this->ctrl->clearParameters($this);
2743 $this->ctrl->setParameter($this,
'post_created_below', $this->objCurrentPost->getId());
2744 $this->ctrl->setParameter($this,
'pos_pk', $newPost);
2745 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2746 $this->ctrl->redirect($this,
'viewThread');
2750 if((!$this->is_moderator &&
2751 !$this->objCurrentPost->isOwner(
$ilUser->getId())) || $this->objCurrentPost->isCensored() ||
2752 $ilUser->getId() == ANONYMOUS_USER_ID)
2754 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2760 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
2763 foreach($oldMediaObjects as $oldMob)
2766 foreach($curMediaObjects as $curMob)
2768 if($oldMob == $curMob)
2786 $old_status_was_active = $this->objCurrentPost->isActivated();
2790 $send_activation_mail = 0;
2792 if($this->objProperties->isPostActivationEnabled())
2794 if(!$this->is_moderator)
2797 $send_activation_mail = 1;
2799 else if($this->objCurrentPost->isAnyParentDeactivated())
2804 $this->objCurrentPost->setStatus($status);
2806 $this->objCurrentPost->setSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
2808 $this->objCurrentPost->setNotification((
int)$oReplyEditForm->getInput(
'notify'));
2809 $this->objCurrentPost->setChangeDate(
date(
'Y-m-d H:i:s'));
2810 $this->objCurrentPost->setUpdateUserId(
$ilUser->getId());
2813 if($this->objCurrentPost->update())
2815 $this->objCurrentPost->reload();
2818 include_once
'Services/News/classes/class.ilNewsItem.php';
2821 'frm', $this->objCurrentPost->getId(),
'pos');
2825 $news_item->setTitle($this->objCurrentPost->getSubject());
2827 $this->objCurrentPost->getMessage(), 0), 1)
2830 if($this->objCurrentPost->getMessage() != strip_tags($this->objCurrentPost->getMessage()))
2832 $news_item->setContentHtml(
true);
2836 $news_item->setContentHtml(
false);
2838 $news_item->update();
2841 $oFDForum = $oForumObjects[
'file_obj'];
2843 if($this->objProperties->isFileUploadAllowed())
2845 $file = $_FILES[
'userfile'];
2848 $oFDForum->storeUploadedFile(
$file);
2852 $file2delete = $oReplyEditForm->getInput(
'del_file');
2853 if(is_array($file2delete) && count($file2delete))
2855 $oFDForum->unlinkFilesByMD5Filenames($file2delete);
2858 $GLOBALS[
'ilAppEventHandler']->raise(
2862 'ref_id' => $this->object->getRefId(),
2863 'post' => $this->objCurrentPost,
2864 'notify_moderators' => (
bool)$send_activation_mail,
2865 'old_status_was_active' => (
bool)$old_status_was_active
2872 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
2873 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
2874 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
2875 $this->ctrl->redirect($this,
'viewThread');
2880 $_GET[
'action'] = substr(
$_GET[
'action'], 6);
2882 return $this->viewThreadObject();
2887 if(
null === $a_flag)
2898 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2899 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2902 if(!is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
2904 if($this->objCurrentTopic->isClosed())
2906 $_GET[
'action'] =
'';
2907 return $this->viewThreadObject();
2913 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
false);
2914 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
false);
2916 $oReplyEditForm->checkInput();
2919 $oReplyEditForm->getItemByPostVar(
'subject')->setRequired(
true);
2920 $oReplyEditForm->getItemByPostVar(
'message')->setRequired(
true);
2922 $_GET[
'action'] =
'showreply';
2924 $this->viewThreadObject();
2927 public function getQuotationHTMLAsynchObject()
2929 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
2930 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
2939 $frm = $oForumObjects[
'frm'];
2941 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
2943 $this->objCurrentPost->getPosAuthorId(),
2944 $this->objCurrentPost->getDisplayUserId(),
2945 $this->objCurrentPost->getUserAlias(),
2946 $this->objCurrentPost->getImportName()
2956 if(
null === $this->forumObjects)
2959 $file_obj =
new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
2960 $frm = $forumObj->Forum;
2961 $frm->setForumId($forumObj->getId());
2962 $frm->setForumRefId($forumObj->getRefId());
2964 $this->forumObjects[
'forumObj'] = $forumObj;
2965 $this->forumObjects[
'frm'] = $frm;
2966 $this->forumObjects[
'file_obj'] = $file_obj;
2972 public function viewThreadObject()
2984 global
$tpl,
$lng,
$ilUser, $ilAccess, $rbacreview, $ilNavigationHistory,
$ilCtrl, $frm, $ilToolbar, $ilLocator;
2986 $bottom_toolbar = clone $ilToolbar;
2987 $bottom_toolbar_split_button_items = array();
2989 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
2990 $tpl->addCss(
'./Modules/Forum/css/forum_tree.css');
2993 $_SESSION[
'viewmode'] = $this->objProperties->getDefaultView();
2997 if(!isset(
$_SESSION[
'thread_control'][
'old']))
3023 if(!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3024 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3032 $forumObj = $oForumObjects[
'forumObj'];
3036 $frm = $oForumObjects[
'frm'];
3040 $file_obj = $oForumObjects[
'file_obj'];
3043 if(isset(
$_GET[
'file']))
3045 $file_obj_for_delivery = $file_obj;
3050 $file_obj_for_delivery->deliverFile(
$_GET[
'file']);
3051 unset($file_obj_for_delivery);
3054 if(!$this->objCurrentTopic->getId())
3056 $ilCtrl->redirect($this,
'showThreads');
3062 $append =
'_'.$this->objCurrentTopic->getId().
3063 ($this->objCurrentPost->getId() ?
'_'.$this->objCurrentPost->getId() :
'');
3064 $tpl->setLoginTargetPar(
'frm_'.
$_GET[
'ref_id'].$append);
3067 if(
$_GET[
'action'] !=
'showreply' &&
$_GET[
'action'] !=
'showedit')
3071 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
3073 foreach(
$mobs as $mob)
3090 require_once
'Modules/Forum/classes/class.ilForumExplorerGUI.php';
3091 $exp =
new ilForumExplorerGUI(
'frm_exp_' . $this->objCurrentTopic->getId(), $this,
'viewThread');
3092 $exp->setThread($this->objCurrentTopic);
3093 if(!$exp->handleCommand())
3095 $this->tpl->setLeftNavContent($exp->getHTML());
3099 require_once
'./Modules/Forum/classes/class.ilObjForum.php';
3100 require_once
'./Modules/Forum/classes/class.ilFileDataForum.php';
3102 $lng->loadLanguageModule(
'forum');
3106 $ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
3108 $ilCtrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3109 $ilNavigationHistory->addItem($this->object->getRefId(),
$ilCtrl->getLinkTarget($this,
'showThreads'),
'frm');
3113 $forumObj->updateLastAccess(
$ilUser->getId(), (
int) $this->objCurrentTopic->getId());
3115 $this->prepareThreadScreen($forumObj);
3117 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_view.html',
'Modules/Forum');
3119 if(isset(
$_GET[
'anchor']))
3121 $tpl->setVariable(
'JUMP2ANCHOR_ID', (
int)
$_GET[
'anchor']);
3126 $orderField =
'frm_posts_tree.rgt';
3127 $this->objCurrentTopic->setOrderDirection(
'DESC');
3131 $orderField =
'frm_posts.pos_date';
3132 $this->objCurrentTopic->setOrderDirection(
3139 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
3141 if(is_array($topicData = $frm->getOneTopic()))
3144 $this->objCurrentTopic->updateVisits();
3146 $tpl->setTitle(
$lng->txt(
'forums_thread').
" \"".$this->objCurrentTopic->getSubject().
"\"");
3150 $ilLocator->addRepositoryItems();
3151 $ilLocator->addItem($this->object->getTitle(),
$ilCtrl->getLinkTarget($this,
""),
"_top");
3157 $menutpl =
new ilTemplate(
'tpl.forums_threads_menu.html',
true,
true,
'Modules/Forum');
3159 include_once(
"./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
3163 $ilUser->getId() != ANONYMOUS_USER_ID &&
3164 $forumObj->getCountUnread(
$ilUser->getId(), (
int) $this->objCurrentTopic->getId())
3167 $this->ctrl->setParameter($this,
'mark_read',
'1');
3168 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3171 $mark_thr_read_button->setCaption(
'forums_mark_read');
3172 $mark_thr_read_button->setUrl($this->ctrl->getLinkTarget($this,
'viewThread'));
3175 $bottom_toolbar_split_button_items[] = $mark_thr_read_button;
3177 $this->ctrl->clearParameters($this);
3181 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_thread', $this->objCurrentTopic->getId());
3182 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_top_fk', $this->objCurrentTopic->getForumId());
3186 $print_thr_button->setCaption(
'forums_print_thread');
3187 $print_thr_button->setUrl($this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printThread'));
3189 $bottom_toolbar_split_button_items[] = $print_thr_button;
3191 $this->ctrl->clearParametersByClass(
'ilforumexportgui');
3195 if($_GET[
'mark_read'])
3197 $forumObj->markThreadRead(
$ilUser->getId(), (
int)$this->objCurrentTopic->getId());
3202 require_once
'./Modules/Forum/classes/class.ilForum.php';
3204 if (
$_GET[
'action'] ==
'ready_delete' &&
$_POST[
'confirm'] !=
'')
3206 if(!$this->objCurrentTopic->isClosed() &&
3207 ($this->is_moderator ||
3208 ($this->objCurrentPost->isOwner(
$ilUser->getId()) && !$this->objCurrentPost->hasReplies())) &&
3209 $ilUser->getId() != ANONYMOUS_USER_ID)
3215 $frm->setForumId($forumObj->getId());
3216 $frm->setForumRefId($forumObj->getRefId());
3218 $dead_thr = $frm->deletePost($this->objCurrentPost->getId());
3221 if ($dead_thr == $this->objCurrentTopic->getId())
3224 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($forumObj->getId()));
3226 $topicData = $frm->getOneTopic();
3230 if ($topicData[
'top_num_threads'] > 0)
3232 $this->ctrl->redirect($this,
'showThreads');
3236 $this->ctrl->redirect($this,
'createThread');
3244 if (
$_GET[
'action'] ==
'ready_delete_draft' &&
$_POST[
'confirm'] !=
'')
3251 if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'ready_censor')
3255 if((
$_POST[
'confirm'] !=
'' ||
$_POST[
'no_cs_change'] !=
'') && $_GET[
'action'] ==
'ready_censor') {
3257 $frm->postCensorship($cens_message, $this->objCurrentPost->getId(), 1);
3259 } elseif ((
$_POST[
'cancel'] !=
'' ||
$_POST[
'yes_cs_change'] !=
'') &&
$_GET[
'action'] ==
'ready_censor') {
3261 $frm->postCensorship($cens_message, $this->objCurrentPost->getId());
3267 $first_node = $this->objCurrentTopic->getFirstPostNode();
3268 $this->objCurrentTopic->setOrderField($orderField);
3269 $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
3274 !$this->objCurrentTopic->isClosed() &&
3275 $ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id'])
3279 $reply_button->setPrimary(
true);
3280 $reply_button->setCaption(
'add_new_answer');
3281 $this->ctrl->setParameter($this,
'action',
'showreply');
3282 $this->ctrl->setParameter($this,
'pos_pk', $first_node->getId());
3283 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3284 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
3285 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
3287 $reply_button->setUrl($this->ctrl->getLinkTarget($this,
'createTopLevelPost',
'frm_page_bottom'));
3289 $this->ctrl->clearParameters($this);
3290 array_unshift($bottom_toolbar_split_button_items, $reply_button);
3294 if (!$posNum = count($subtree_nodes))
3299 $pageHits = $frm->getPageHits();
3304 if ($posNum > $pageHits)
3307 'ref_id' =>
$_GET[
'ref_id'],
3308 'thr_pk' => $this->objCurrentTopic->getId(),
3309 'orderby' =>
$_GET[
'orderby']
3312 if (!
$_GET[
'offset'])
3318 $Start =
$_GET[
'offset'];
3325 $menutpl->setCurrentBlock(
'linkbar');
3326 $menutpl->setVariable(
'LINKBAR', $linkbar);
3327 $menutpl->parseCurrentBlock();
3331 $tpl->setVariable(
'THREAD_MENU', $menutpl->get());
3335 $render_drafts =
false;
3336 $draftsObjects = NULL;
3341 if(count($draftsObjects) > 0)
3343 $render_drafts =
true;
3348 foreach($subtree_nodes as $node)
3354 $this->ctrl->clearParameters($this);
3356 if($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId())
3361 if ($posNum > $pageHits && $z >= ($Start + $pageHits))
3364 if ($this->objCurrentPost->getId() && $jump < 1)
3366 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
3367 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
3368 $this->ctrl->setParameter($this,
'offset', ($Start + $pageHits));
3369 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
3370 $this->ctrl->redirect($this,
'viewThread', $this->objCurrentPost->getId());
3378 if(($posNum > $pageHits && $z >= $Start) || $posNum <= $pageHits)
3383 # actions for "active" post
3384 if($this->is_moderator || $node->isActivated() || $node->isOwner(
$ilUser->getId()))
3388 !$this->objCurrentTopic->isClosed() && (
3389 $_GET[
'action'] ==
'showreply' ||
$_GET[
'action'] ==
'showedit' ||
3390 $_GET[
'action'] ==
'showdraft'||
$_GET[
'action'] ==
'editdraft'
3393 if(
$_GET[
'action'] ==
'showedit' &&
3394 ((!$this->is_moderator &&
3395 !$node->isOwner(
$ilUser->getId()) ||
$ilUser->getId() == ANONYMOUS_USER_ID) || $node->isCensored()))
3397 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
3399 else if(
$_GET[
'action'] ==
'showreply' && !$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
3401 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
3404 $tpl->setVariable(
'REPLY_ANKER', $this->objCurrentPost->getId());
3406 if($_GET[
'action'] !=
'editdraft')
3408 switch($this->objProperties->getSubjectSetting())
3410 case 'add_re_to_subject':
3414 case 'preset_subject':
3415 $subject = $this->objCurrentPost->getSubject();
3418 case 'empty_subject':
3424 switch(
$_GET[
'action'])
3427 if($this->ctrl->getCmd() ==
'savePost' || $this->ctrl->getCmd() ==
'saveAsDraft')
3429 $oEditReplyForm->setValuesByPost();
3431 else if($this->ctrl->getCmd() ==
'quotePost')
3433 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
3435 $node->getPosAuthorId(),
3436 $node->getDisplayUserId(),
3437 $node->getUserAlias(),
3438 $node->getImportName()
3441 $oEditReplyForm->setValuesByPost();
3442 $oEditReplyForm->getItemByPostVar(
'message')->setValue(
3444 $frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()).
"\n".$oEditReplyForm->getInput(
'message'), 1
3450 $oEditReplyForm->setValuesByArray(array(
3452 'subject' => $subject,
3456 'del_file' => array()
3460 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
3461 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
3463 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
3464 $jsTpl->setVariable(
'IL_FRM_QUOTE_CALLBACK_SRC',
3465 $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true));
3466 $this->ctrl->clearParameters($this);
3467 $this->tpl->setVariable(
'FORM_ADDITIONAL_JS', $jsTpl->get());
3471 if($this->ctrl->getCmd() ==
'savePost')
3473 $oEditReplyForm->setValuesByPost();
3477 $oEditReplyForm->setValuesByArray(array(
3479 'subject' => $this->objCurrentPost->getSubject(),
3481 'notify' => $this->objCurrentPost->isNotificationEnabled() ?
true :
false,
3483 'del_file' => array()
3489 if(in_array($this->ctrl->getCmd(), array(
'saveDraft',
'updateDraft',
'publishDraft' )))
3491 $oEditReplyForm->setValuesByPost();
3496 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0)
3502 $oEditReplyForm->setValuesByArray(array(
3503 'alias' => $draftObject->getPostUserAlias(),
3504 'subject' => $draftObject->getPostSubject(),
3506 'notify' => $draftObject->getNotify() ?
true :
false,
3508 'del_file' => array()
3511 $edit_draft_id = $draftObject->getDraftId();
3516 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
3517 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
3518 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
3519 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
3520 $this->ctrl->setParameter($this,
'action',
$_GET[
'action']);
3521 if(
$_GET[
'action'] !=
'editdraft')
3523 $tpl->setVariable(
'FORM', $oEditReplyForm->getHTML());
3525 $this->ctrl->clearParameters($this);
3528 else if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'delete')
3530 if($this->is_moderator ||
3531 ($node->isOwner(
$ilUser->getId()) && !$node->hasReplies()) &&
3532 $ilUser->getId() != ANONYMOUS_USER_ID)
3535 $tpl->setVariable(
'FORM', $this->getDeleteFormHTML());
3539 else if(!$this->objCurrentTopic->isClosed() &&
$_GET[
'action'] ==
'censor')
3541 if($this->is_moderator)
3544 $tpl->setVariable(
'FORM', $this->getCensorshipFormHTML());
3547 else if (!$this->objCurrentTopic->isClosed() && $this->displayConfirmPostActivation())
3549 if ($this->is_moderator)
3552 $tpl->setVariable(
'FORM', $this->getActivationFormHTML());
3558 $this->renderPostContent($node, $Start, $z);
3559 $this->renderDraftContent($render_drafts, $node, $edit_draft_id);
3564 $first_node = $this->objCurrentTopic->getFirstPostNode();
3567 in_array($this->ctrl->getCmd(), array(
'createTopLevelPost',
'saveTopLevelPost',
'quoteTopLevelPost')) &&
3568 !$this->objCurrentTopic->isClosed() &&
3569 $ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
3572 $this->objCurrentPost->setId($first_node->getId());
3575 if($this->ctrl->getCmd() ==
'saveTopLevelPost')
3577 $form->setValuesByPost();
3579 else if($this->ctrl->getCmd() ==
'quoteTopLevelPost')
3581 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
3583 $first_node->getPosAuthorId(),
3584 $first_node->getDisplayUserId(),
3585 $first_node->getUserAlias(),
3586 $first_node->getImportName()
3589 $form->setValuesByPost();
3590 $form->getItemByPostVar(
'message')->setValue(
3592 $frm->prepareText($first_node->getMessage(), 1, $authorinfo->getAuthorName()).
"\n".$form->getInput(
'message'), 1
3596 $this->ctrl->setParameter($this,
'pos_pk', $first_node->getId());
3597 $this->ctrl->setParameter($this,
'thr_pk', $first_node->getThreadId());
3598 $jsTpl =
new ilTemplate(
'tpl.forum_post_quoation_ajax_handler.html',
true,
true,
'Modules/Forum');
3599 $jsTpl->setVariable(
'IL_FRM_QUOTE_CALLBACK_SRC', $this->ctrl->getLinkTarget($this,
'getQuotationHTMLAsynch',
'',
true));
3600 $this->ctrl->clearParameters($this);
3601 $tpl->setVariable(
'BOTTOM_FORM_ADDITIONAL_JS', $jsTpl->get());;
3602 $tpl->setVariable(
'BOTTOM_FORM', $form->getHTML());
3607 $tpl->setCurrentBlock(
'posts_no');
3608 $tpl->setVariable(
'TXT_MSG_NO_POSTS_AVAILABLE',
$lng->txt(
'forums_posts_not_available'));
3609 $tpl->parseCurrentBlock();
3612 if($bottom_toolbar_split_button_items)
3616 foreach($bottom_toolbar_split_button_items as $item)
3620 $bottom_split_button->setDefaultButton($item);
3629 $bottom_toolbar->addStickyItem($bottom_split_button);
3632 $ilToolbar = clone $bottom_toolbar;
3634 if($bottom_toolbar_split_button_items)
3636 $bottom_toolbar->addSeparator();
3640 $to_top_button->setCaption(
'top_of_page');
3641 $to_top_button->setUrl(
'#frm_page_top');
3642 $bottom_toolbar->addButtonInstance($to_top_button);
3643 $tpl->setVariable(
'TOOLBAR_BOTTOM', $bottom_toolbar->getHTML());
3645 include_once
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
3646 $permalink =
new ilPermanentLinkGUI(
'frm', $this->object->getRefId(),
'_'.$this->objCurrentTopic->getId());
3647 $this->tpl->setVariable(
'PRMLINK', $permalink->getHTML());
3654 $subject = $this->objCurrentPost->getSubject();
3655 $re_txt = $this->lng->txt(
'post_reply');
3657 $re_txt_with_num = str_replace(
':',
'(',$re_txt);
3658 $search_length = strlen($re_txt_with_num);
3659 $comp = substr_compare($re_txt_with_num, substr($subject, 0 , $search_length), 0, $search_length);
3663 $modified_subject = $subject;
3664 if($on_reply ==
true)
3667 $str_pos_start = strpos($subject,
'(');
3668 $str_pos_end = strpos($subject,
')');
3670 $length = ((int)$str_pos_end - (
int)$str_pos_start);
3672 $txt_number = substr($subject, $str_pos_start, $length - 1);
3674 if(is_numeric($txt_number))
3676 $re_count = (int)$txt_number + 1;
3677 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
3683 $re_count = substr_count($subject, $re_txt);
3684 if($re_count >= 1 && $on_reply ==
true)
3686 $subject = str_replace($re_txt,
'', $subject);
3690 $modified_subject =
sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
3692 else if($re_count >= 1 && $on_reply ==
false)
3696 $modified_subject =
sprintf($this->lng->txt(
'post_reply_count'), $re_count).
' '.trim($subject);
3698 else if($re_count == 0)
3701 $modified_subject = $this->lng->txt(
'post_reply').
' '. $this->objCurrentPost->getSubject();
3704 return $modified_subject;
3713 include_once
'Services/User/classes/class.ilPublicUserProfileGUI.php';
3715 $add = $this->getUserProfileAdditional((
int)
$_GET[
'ref_id'], (
int)
$_GET[
'user']);
3716 $profile_gui->setAdditional($add);
3718 $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
3721 protected function getUserProfileAdditional($a_forum_ref_id, $a_user_id)
3727 global
$lng, $ilAccess;
3729 if(!$ilAccess->checkAccess(
'read',
'', $a_forum_ref_id))
3731 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
3734 require_once
'Modules/Forum/classes/class.ilForum.php';
3736 $lng->loadLanguageModule(
'forum');
3742 if($ref_obj->getType() ==
'frm')
3745 $frm = $forumObj->Forum;
3746 $frm->setForumId($forumObj->getId());
3747 $frm->setForumRefId($forumObj->getRefId());
3755 if($ilAccess->checkAccess(
'moderate_frm',
'', $a_forum_ref_id))
3757 $numPosts = $frm->countUserArticles(addslashes($a_user_id));
3761 $numPosts = $frm->countActiveUserArticles(addslashes($a_user_id));
3764 return array(
$lng->txt(
'forums_posts') => $numPosts);
3767 public function performThreadsActionObject()
3774 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3775 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3780 if(isset(
$_POST[
'thread_ids']) && is_array(
$_POST[
'thread_ids']))
3782 if(isset(
$_POST[
'selected_cmd']) &&
$_POST[
'selected_cmd'] ==
'move')
3784 if($this->is_moderator)
3787 $this->moveThreadsObject();
3790 else if(
$_POST[
'selected_cmd'] ==
'enable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
3792 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3796 $tmp_obj->enableNotification(
$ilUser->getId());
3799 $this->ctrl->redirect($this,
'showThreads');
3801 else if(
$_POST[
'selected_cmd'] ==
'disable_notifications' && $this->
ilias->getSetting(
'forum_notification') != 0)
3803 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3807 $tmp_obj->disableNotification(
$ilUser->getId());
3810 $this->ctrl->redirect($this,
'showThreads');
3813 else if(
$_POST[
'selected_cmd'] ==
'close')
3815 if($this->is_moderator)
3817 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3825 $this->ctrl->redirect($this,
'showThreads');
3827 else if(
$_POST[
'selected_cmd'] ==
'reopen')
3829 if($this->is_moderator)
3831 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3840 $this->ctrl->redirect($this,
'showThreads');
3842 else if(
$_POST[
'selected_cmd'] ==
'makesticky')
3844 if($this->is_moderator)
3846 $message = $this->lng->txt(
'sel_threads_make_sticky');
3848 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3852 $makeSticky = $tmp_obj->makeSticky();
3856 $message = $this->lng->txt(
'sel_threads_already_sticky');
3860 if($message !=
null)
3864 $this->ctrl->redirect($this,
'showThreads');
3866 else if(
$_POST[
'selected_cmd'] ==
'unmakesticky')
3868 if($this->is_moderator)
3870 $message = $this->lng->txt(
'sel_threads_make_unsticky');
3871 for($i = 0; $i < count(
$_POST[
'thread_ids']); $i++)
3875 $unmakeSticky = $tmp_obj->unmakeSticky();
3878 $message = $this->lng->txt(
'sel_threads_already_unsticky');
3883 if($message !=
null)
3887 $this->ctrl->redirect($this,
'showThreads');
3889 else if(
$_POST[
'selected_cmd'] ==
'editThread')
3891 if($this->is_moderator)
3893 $count = count(
$_POST[
'thread_ids']);
3897 $this->ctrl->redirect($this,
'showThreads');
3901 foreach(
$_POST[
'thread_ids'] as $thread_id)
3903 return $this->editThreadObject($thread_id,
null);
3908 $this->ctrl->redirect($this,
'showThreads');
3910 else if(
$_POST[
'selected_cmd'] ==
'html')
3912 $this->ctrl->setCmd(
'exportHTML');
3913 $this->ctrl->setCmdClass(
'ilForumExportGUI');
3916 else if(
$_POST[
'selected_cmd'] ==
'confirmDeleteThreads')
3920 else if(
$_POST[
'selected_cmd'] ==
'merge')
3926 ilUtil::sendInfo($this->lng->txt(
'topics_please_select_one_action'),
true);
3927 $this->ctrl->redirect($this,
'showThreads');
3933 $this->ctrl->redirect($this,
'showThreads');
3939 if (!$this->is_moderator) {
3940 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3943 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
3944 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3947 $threads2move =
$_SESSION[
'threads2move'];
3948 if (!is_array($threads2move) || !count($threads2move)) {
3950 $this->ctrl->redirect($this,
'showThreads');
3953 if (!$this->access->checkAccess(
'read',
'', (
int)
$_POST[
'frm_ref_id'])) {
3954 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
3958 array_walk($threads2move,
function($threadId) use (&$threads) {
3959 $thread = new \ilForumTopic($threadId);
3962 $threads[] = $threadId;
3965 if (isset(
$_POST[
'frm_ref_id']) && (int)
$_POST[
'frm_ref_id']) {
3966 $this->
object->Forum->moveThreads(
3967 $threads, $this->object->getRefId(),
3968 $this->ilObjDataCache->lookupObjId((
int)
$_POST[
'frm_ref_id'])
3973 $this->ctrl->redirect($this,
'showThreads');
3976 $this->moveThreadsObject();
3984 $this->ctrl->redirect($this,
'showThreads');
3987 public function moveThreadsObject()
3996 if (!$this->is_moderator) {
3997 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4000 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4001 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4004 $threads2move =
$_SESSION[
'threads2move'];
4005 if(!is_array($threads2move) || !count($threads2move))
4008 $this->ctrl->redirect($this,
'showThreads');
4011 require_once
'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php';
4015 array_walk($threads2move,
function($threadId) use (&$threads, $isModerator) {
4016 $thread = new \ilForumTopic($threadId, $isModerator);
4019 $threads[] = $thread;
4023 $exp->setPathOpen($this->object->getRefId());
4024 $exp->setNodeSelected(isset(
$_POST[
'frm_ref_id']) && (
int)
$_POST[
'frm_ref_id'] ? (
int)
$_POST[
'frm_ref_id'] : 0);
4025 $exp->setCurrentFrmRefId($this->object->getRefId());
4026 $exp->setHighlightedNode($this->object->getRefId());
4027 if(!$exp->handleCommand())
4029 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_move.html',
'Modules/Forum');
4032 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this));
4035 $tblThr->setId(
'il_frm_thread_move_table_'.$this->object->getRefId());
4036 $tblThr->setTitle($this->lng->txt(
'move_chosen_topics'));
4037 $tblThr->addColumn($this->lng->txt(
'subject'),
'top_name',
'100%');
4038 $tblThr->disable(
'header');
4039 $tblThr->disable(
'footer');
4040 $tblThr->disable(
'linkbar');
4041 $tblThr->disable(
'sort');
4042 $tblThr->disable(
'linkbar');
4043 $tblThr->setLimit(PHP_INT_MAX);
4044 $tblThr->setRowTemplate(
'tpl.forums_threads_move_thr_row.html',
'Modules/Forum');
4045 $tblThr->setDefaultOrderField(
'is_sticky');
4048 foreach ($threads as $thread) {
4054 $this->tpl->setVariable(
'THREADS_TABLE', $tblThr->getHTML());
4056 $this->tpl->setVariable(
'FRM_SELECTION_TREE', $exp->getHTML());
4057 $this->tpl->setVariable(
'CMD_SUBMIT',
'performMoveThreads');
4058 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'move'));
4059 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this,
'performMoveThreads'));
4067 if($this->objProperties->isAnonymized()
4068 && (!$this->is_moderator || ($this->is_moderator && !$this->objProperties->getMarkModeratorPosts())))
4075 private function initTopicCreateForm($edit_draft =
false)
4086 if($edit_draft ==
true)
4088 $this->create_topic_form_gui->setTitle($this->lng->txt(
'edit_thread_draft'));
4092 $this->create_topic_form_gui->setTitle($this->lng->txt(
'forums_new_thread'));
4095 $this->create_topic_form_gui->setTableWidth(
'100%');
4098 $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this,
'addThread'));
4102 $alias_gui =
new ilTextInputGUI($this->lng->txt(
'forums_your_name'),
'alias');
4103 $alias_gui->setInfo($this->lng->txt(
'forums_use_alias'));
4104 $alias_gui->setMaxLength(255);
4105 $alias_gui->setSize(50);
4106 $this->create_topic_form_gui->addItem($alias_gui);
4111 $alias_gui->setValue(
$ilUser->getLogin());
4112 $this->create_topic_form_gui->addItem($alias_gui);
4116 $subject_gui =
new ilTextInputGUI($this->lng->txt(
'forums_thread'),
'subject');
4117 $subject_gui->setMaxLength(255);
4118 $subject_gui->setSize(50);
4119 $subject_gui->setRequired(
true);
4120 $this->create_topic_form_gui->addItem($subject_gui);
4124 $post_gui->setCols(50);
4125 $post_gui->setRows(15);
4126 $post_gui->setRequired(
true);
4127 $post_gui->setUseRte(
true);
4128 $post_gui->addPlugin(
'latex');
4129 $post_gui->addButton(
'latex');
4130 $post_gui->addButton(
'pastelatex');
4131 $post_gui->addPlugin(
'ilfrmquote');
4136 $post_gui->removePlugin(
'advlink');
4137 $post_gui->usePurifier(
true);
4138 $post_gui->setRTERootBlockElement(
'');
4139 $post_gui->setRTESupport(
$ilUser->getId(),
'frm~',
'frm_post',
'tpl.tinymce_frm_post.html',
false,
'3.5.11');
4140 $post_gui->disableButtons(array(
4158 require_once
'Services/Html/classes/class.ilHtmlPurifierFactory.php';
4160 $this->create_topic_form_gui->addItem($post_gui);
4162 if($this->objProperties->isFileUploadAllowed())
4165 $fi->setFilenames(array(0 =>
''));
4166 $this->create_topic_form_gui->addItem($fi);
4167 if($edit_draft ==
true)
4169 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0)
4171 $thread_draft = ilForumPostDraft::newInstanceByDraftId((
int)
$_GET[
'draft_id']);
4173 if($thread_draft->getDraftId() > 0)
4176 if(count($oFDForumDrafts->getFilesOfPost()))
4179 foreach($oFDForumDrafts->getFilesOfPost() as
$file)
4182 $oAttachmentGUI->setValue(
$file[
'md5']);
4183 $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
4185 $this->create_topic_form_gui->addItem($oExistingAttachmentsGUI);
4192 include_once
'Services/Mail/classes/class.ilMail.php';
4195 if($rbacsystem->checkAccess(
'internal_mail', $umail->getMailObjectReferenceId()) &&
4196 !$this->objProperties->isAnonymized()
4200 $dir_notification_gui =
new ilCheckboxInputGUI($this->lng->txt(
'forum_direct_notification'),
'notify');
4201 $dir_notification_gui->setInfo($this->lng->txt(
'forum_notify_me'));
4202 $dir_notification_gui->setValue(1);
4203 $this->create_topic_form_gui->addItem($dir_notification_gui);
4206 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
4209 !
$ilUser->isCaptchaVerified() &&
4210 ilCaptchaUtil::isActiveForForum()
4213 require_once
'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
4214 $captcha =
new ilCaptchaInputGUI($this->lng->txt(
'cont_captcha_code'),
'captcha_code');
4215 $captcha->setRequired(
true);
4216 $this->create_topic_form_gui->addItem($captcha);
4222 if($this->ctrl->getCmd() ==
'editThreadDraft')
4224 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
4226 $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this,
'updateThreadDraft'));
4227 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
4228 $this->create_topic_form_gui->addCommandButton(
'publishThreadDraft', $this->lng->txt(
'publish'));
4229 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
4230 $this->create_topic_form_gui->addCommandButton(
'updateThreadDraft', $this->lng->txt(
'save_message'));
4234 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
4235 $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this,
'saveThreadAsDraft'));
4236 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
4237 $this->create_topic_form_gui->addCommandButton(
'addThread', $this->lng->txt(
'create'));
4238 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
4239 $this->create_topic_form_gui->addCommandButton(
'saveThreadAsDraft', $this->lng->txt(
'save_message'));
4241 $this->create_topic_form_gui->addCommandButton(
'cancelDraft', $this->lng->txt(
'cancel'));
4245 $this->create_topic_form_gui->addCommandButton(
'addThread', $this->lng->txt(
'create'));
4246 $this->create_topic_form_gui->addCommandButton(
'showThreads', $this->lng->txt(
'cancel'));
4254 $draft_ids = array();
4255 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0)
4257 $draft_ids = array((
int)
$_GET[
'draft_id']);
4259 elseif(isset(
$_POST[
'draft_ids']) && is_array(
$_POST[
'draft_ids']))
4261 $draft_ids =
$_POST[
'draft_ids'];
4264 $checked_draft_ids = array();
4265 foreach($draft_ids as $draft_id)
4267 if(array_key_exists($draft_id, $instances))
4269 $checked_draft_ids[] = $draft_id;
4270 $draftObj = $instances[$draft_id];
4276 $objFileDataForumDrafts->delete();
4280 $GLOBALS[
'ilAppEventHandler']->raise(
4283 array(
'draftObj' => $draftObj,
4284 'obj_id' => $this->object->getId(),
4285 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
4289 $draftObj->deleteDraft();
4293 if(count($checked_draft_ids) > 1)
4302 $this->ctrl->redirect($this,
'showThreads');
4307 $this->create_topic_form_gui->setValuesByArray(array(
4317 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
4318 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4321 if (!$this->access->checkAccess(
'add_thread',
'', $this->object->getRefId())) {
4322 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
4325 $this->initTopicCreateForm();
4328 $create_form =
new ilTemplate(
'tpl.create_thread_form.html',
true,
true,
'Modules/Forum');
4329 $create_form->setVariable(
'CREATE_FORM',$this->create_topic_form_gui->getHTML());
4330 $create_form->parseCurrentBlock();
4332 $this->tpl->setContent($create_form->get());
4335 public function publishThreadDraftObject($a_prevent_redirect =
false)
4344 $frm = $this->
object->Forum;
4345 $frm->setForumId($this->object->getId());
4346 $frm->setForumRefId($this->object->getRefId());
4348 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
4350 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
4353 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4355 $topicData = $frm->getOneTopic();
4357 $this->initTopicCreateForm();
4358 if($this->create_topic_form_gui->checkInput())
4360 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
4363 !
$ilUser->isCaptchaVerified() &&
4364 ilCaptchaUtil::isActiveForForum()
4367 $ilUser->setCaptchaVerified(
true);
4373 $this->objProperties->isPostActivationEnabled() &&
4374 !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
4380 if(isset(
$_GET[
'draft_id']))
4382 $draft_id = (int)
$_GET[
'draft_id'];
4383 $draft_obj = ilForumPostDraft::newInstanceByDraftId((
int)$draft_id);
4388 $newThread->setForumId($topicData[
'top_pk']);
4389 $newThread->setThrAuthorId($draft_obj->getPostAuthorId());
4390 $newThread->setDisplayUserId($draft_obj->getPostDisplayUserId());
4391 $newThread->setSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'),
false));
4392 $newThread->setUserAlias($draft_obj->getPostUserAlias());
4394 $newPostId = $frm->generateThread(
4397 $draft_obj->getNotify(),
4398 $draft_obj->getPostNotify(),
4402 if($this->objProperties->isFileUploadAllowed())
4404 $file = $_FILES[
'userfile'];
4407 $tmp_file_obj =
new ilFileDataForum($this->object->getId(), $newPostId);
4408 $tmp_file_obj->storeUploadedFile(
$file);
4413 $frm->setDbTable(
'frm_data');
4414 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
4415 $frm->updateVisits($topicData[
'top_pk']);
4417 $frm->setMDB2WhereCondition(
'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
4418 array(
'integer',
'text'), array($topicData[
'top_pk'], $this->create_topic_form_gui->getInput(
'subject')));
4422 foreach($uploadedObjects as $mob)
4431 $history_obj->deleteHistoryByDraftIds(array($draft_obj->getDraftId()));
4433 if($this->objProperties->isFileUploadAllowed())
4439 $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPostId);
4441 $draft_obj->deleteDraft();
4444 $GLOBALS[
'ilAppEventHandler']->raise(
4448 'ref_id' => $this->object->getRefId(),
4450 'notify_moderators' => !$status
4454 if(!$a_prevent_redirect)
4457 $this->ctrl->clearParameters($this);
4458 $this->ctrl->redirect($this);
4467 $this->create_topic_form_gui->setValuesByPost();
4469 if(!$this->objProperties->isAnonymized())
4471 $this->create_topic_form_gui->getItemByPostVar(
'alias')->setValue(
$ilUser->getLogin());
4474 return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
4478 public function addThreadObject($a_prevent_redirect =
false)
4487 $frm = $this->
object->Forum;
4488 $frm->setForumId($this->object->getId());
4489 $frm->setForumRefId($this->object->getRefId());
4491 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
4493 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
4496 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
4498 $topicData = $frm->getOneTopic();
4500 $this->initTopicCreateForm();
4501 if($this->create_topic_form_gui->checkInput())
4503 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
4506 !
$ilUser->isCaptchaVerified() &&
4507 ilCaptchaUtil::isActiveForForum()
4510 $ilUser->setCaptchaVerified(
true);
4515 if(!strlen($this->create_topic_form_gui->getInput(
'alias')))
4517 $user_alias = $this->lng->txt(
'forums_anonymous');
4521 $user_alias = $this->create_topic_form_gui->getInput(
'alias');
4523 $display_user_id = 0;
4527 $user_alias =
$ilUser->getLogin();
4528 $display_user_id =
$ilUser->getId();
4533 $this->objProperties->isPostActivationEnabled() &&
4534 !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
4541 $newThread->setForumId($topicData[
'top_pk']);
4542 $newThread->setThrAuthorId(
$ilUser->getId());
4543 $newThread->setDisplayUserId($display_user_id);
4544 $newThread->setSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'),
false));
4545 $newThread->setUserAlias($user_alias);
4547 $newPost = $frm->generateThread(
4550 $this->create_topic_form_gui->getItemByPostVar(
'notify') ? (
int)$this->create_topic_form_gui->getInput(
'notify') : 0,
4555 if($this->objProperties->isFileUploadAllowed())
4557 $file = $_FILES[
'userfile'];
4560 $tmp_file_obj =
new ilFileDataForum($this->object->getId(), $newPost);
4561 $tmp_file_obj->storeUploadedFile(
$file);
4566 $frm->setDbTable(
'frm_data');
4567 $frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topicData[
'top_pk']));
4568 $frm->updateVisits($topicData[
'top_pk']);
4570 $frm->setMDB2WhereCondition(
'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
4571 array(
'integer',
'text'), array($topicData[
'top_pk'], $this->create_topic_form_gui->getInput(
'subject')));
4574 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
4576 foreach($mediaObjects as $mob)
4587 if(isset(
$_POST[
'draft_id']) &&
$_POST[
'draft_id'] > 0)
4589 $draft_obj = ilForumPostDraft::newInstanceByDraftId(
$_POST[
'draft_id']);
4592 $history_obj->deleteHistoryByDraftIds(array($draft_obj->getDraftId()));
4594 if($this->objProperties->isFileUploadAllowed())
4600 $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
4602 $draft_obj->deleteDraft();
4605 $GLOBALS[
'ilAppEventHandler']->raise(
4609 'ref_id' => $this->object->getRefId(),
4611 'notify_moderators' => !$status
4615 if(!$a_prevent_redirect)
4618 $this->ctrl->redirect($this);
4627 $this->create_topic_form_gui->setValuesByPost();
4629 if(!$this->objProperties->isAnonymized())
4631 $this->create_topic_form_gui->getItemByPostVar(
'alias')->setValue(
$ilUser->getLogin());
4634 return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
4638 public function enableForumNotificationObject()
4645 $frm = $this->
object->Forum;
4646 $frm->setForumId($this->object->getId());
4647 $frm->enableForumNotification(
$ilUser->getId());
4649 if(!$this->objCurrentTopic->getId())
4656 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
4657 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_enabled'),
true);
4658 $this->ctrl->redirect($this,
'viewThread');
4662 public function disableForumNotificationObject()
4669 $frm = $this->
object->Forum;
4670 $frm->setForumId($this->object->getId());
4671 $frm->disableForumNotification(
$ilUser->getId());
4673 if(!$this->objCurrentTopic->getId())
4680 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
4681 ilUtil::sendInfo($this->lng->txt(
'forums_forum_notification_disabled'),
true);
4682 $this->ctrl->redirect($this,
'viewThread');
4697 global
$lng, $ilAccess;
4703 if($ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
4706 $enable_internal_rss = $news_set->get(
'enable_rss_for_internal');
4707 if($enable_internal_rss)
4710 $column_gui->
setBlockProperty(
'news',
'public_notifications_option',
true);
4720 if (!
$_POST[
'clone_source'])
4723 if (isset(
$_SESSION[
'wizard_search_title']))
4725 $this->searchCloneSourceObject();
4733 $source_id =
$_POST[
'clone_source'];
4735 $new_type = $_REQUEST[
'new_type'];
4736 $this->ctrl->setParameter($this,
'clone_source', (
int)
$_POST[
'clone_source']);
4737 $this->ctrl->setParameter($this,
'new_type', $new_type);
4739 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.frm_wizard_page.html',
'Modules/Forum');
4740 $this->tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this));
4742 $this->tpl->setVariable(
'ALT_IMG', $this->lng->txt(
'obj_'.$new_type));
4743 $this->tpl->setVariable(
'TXT_DUPLICATE', $this->lng->txt(
'frm_wizard_page'));
4744 $this->tpl->setVariable(
'INFO_THREADS', $this->lng->txt(
'fmr_copy_threads_info'));
4745 $this->tpl->setVariable(
'THREADS', $this->lng->txt(
'forums_threads'));
4748 include_once(
'Modules/Forum/classes/class.ilForum.php');
4750 foreach ($threads as $thread_id =>
$title)
4752 $this->tpl->setCurrentBlock(
'thread_row');
4753 $this->tpl->setVariable(
'CHECK_THREAD',
ilUtil::formCheckbox(0,
'cp_options['.$source_id.
'][threads][]', $thread_id));
4754 $this->tpl->setVariable(
'NAME_THREAD',
$title);
4755 $this->tpl->parseCurrentBlock();
4757 $this->tpl->setVariable(
'SELECT_ALL', $this->lng->txt(
'select_all'));
4758 $this->tpl->setVariable(
'JS_FIELD',
'cp_options['.$source_id.
'][threads]');
4759 $this->tpl->setVariable(
'BTN_COPY', $this->lng->txt(
'obj_'.$new_type.
'_duplicate'));
4760 if (isset(
$_SESSION[
'wizard_search_title']))
4762 $this->tpl->setVariable(
'BACK_CMD',
'searchCloneSource');
4766 $this->tpl->setVariable(
'BACK_CMD',
'create');
4768 $this->tpl->setVariable(
'BTN_BACK', $this->lng->txt(
'btn_back'));
4777 if($this->
object instanceof
ilObject)
4779 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
''),
'', $this->object->getRefId());
4785 $a_text = str_replace(
"<",
"<", $a_text);
4786 $a_text = str_replace(
">",
">", $a_text);
4795 $a_text = str_replace(
"<",
"<", $a_text);
4796 $a_text = str_replace(
">",
">", $a_text);
4808 $this->ctrl->setCmd(
'showSummary');
4809 $this->ctrl->setCmdClass(
'ilinfoscreengui');
4810 $this->infoScreen();
4813 public function infoScreen()
4820 if(!$ilAccess->checkAccess(
'visible',
'', $this->object->getRefId()))
4822 $this->
ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->ilias->error_obj->MESSAGE);
4825 include_once
'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
4828 $info->enablePrivateNotes();
4831 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
4834 $this->ctrl->forwardCommand(
$info);
4837 public function updateNotificationSettingsObject()
4843 global $ilAccess,
$ilErr;
4844 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4846 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->MESSAGE);
4853 if($this->notificationSettingsForm->checkInput())
4855 if(isset(
$_POST[
'notification_type']) &&
$_POST[
'notification_type']==
'all_users')
4858 $this->objProperties->setAdminForceNoti(1);
4859 $this->objProperties->setUserToggleNoti((
int) $this->notificationSettingsForm->getInput(
'usr_toggle'));
4860 $this->objProperties->setNotificationType(
'all_users');
4863 else if($_POST[
'notification_type']==
'per_user')
4865 $this->objProperties->setNotificationType(
'per_user');
4866 $this->objProperties->setAdminForceNoti(1);
4867 $this->objProperties->setUserToggleNoti(0);
4872 $this->objProperties->setNotificationType(
'default');
4873 $this->objProperties->setAdminForceNoti(0);
4874 $this->objProperties->setUserToggleNoti(0);
4875 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4877 $frm_noti->deleteNotificationAllUsers();
4880 $this->objProperties->update();
4885 $this->notificationSettingsForm->setValuesByPost();
4887 return $this->showMembersObject();
4892 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
4894 $oParticipants = $this->getParticipantsObject();
4899 $admin_ids = $oParticipants->getAdmins();
4900 $member_ids = $oParticipants->getMembers();
4901 $tutor_ids = $oParticipants->getTutors();
4903 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
4904 $all_forum_users= array_unique($all_forum_users);
4906 $all_notis = $frm_noti->read();
4908 foreach($all_forum_users as $user_id)
4910 $frm_noti->setUserId($user_id);
4912 $frm_noti->setAdminForce(1);
4913 $frm_noti->setUserToggle($this->objProperties->isUserToggleNoti());
4915 if(array_key_exists($user_id, $all_notis) && $update_all_users)
4917 $frm_noti->update();
4919 else if($frm_noti->existsNotification() ==
false)
4921 $frm_noti->insertAdminForce();
4928 if(
null === $this->notificationSettingsForm)
4931 $form->setFormAction($this->ctrl->getFormAction($this,
'updateNotificationSettings'));
4932 $form->setTitle($this->lng->txt(
'forums_notification_settings'));
4935 $radio_grp->setValue(
'default');
4937 $opt_default =
new ilRadioOption($this->lng->txt(
"user_decides_notification"),
'default');
4938 $opt_0 =
new ilRadioOption($this->lng->txt(
"settings_for_all_members"),
'all_users');
4939 $opt_1 =
new ilRadioOption($this->lng->txt(
"settings_per_users"),
'per_user');
4941 $radio_grp->addOption($opt_default,
'default');
4942 $radio_grp->addOption($opt_0,
'all_users');
4943 $radio_grp->addOption($opt_1,
'per_user');
4946 $chb_2->setValue(1);
4948 $opt_0->addSubItem($chb_2);
4949 $form->addItem($radio_grp);
4951 $form->addCommandButton(
'updateNotificationSettings', $this->lng->txt(
'save'));
4953 $this->notificationSettingsForm = $form;
4963 $icon = $user_toggle_noti
4964 ?
"<img src=\"".ilUtil::getImagePath(
"icon_ok.svg").
"\" alt=\"".$this->lng->txt(
"enabled").
"\" title=\"".$this->lng->txt(
"enabled").
"\" border=\"0\" vspace=\"0\"/>"
4965 :
"<img src=\"".ilUtil::getImagePath(
"icon_not_ok.svg").
"\" alt=\"".$this->lng->txt(
"disabled").
"\" title=\"".$this->lng->txt(
"disabled").
"\" border=\"0\" vspace=\"0\"/>";
4969 public function showMembersObject()
4980 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
4982 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->MESSAGE);
4985 $tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_members_list.html',
'Modules/Forum');
4987 $ilTabs->setTabActive(
'settings');
4988 $this->settingsTabs();
4994 $this->notificationSettingsForm->setValuesByArray(array(
4995 'notification_type' => $this->objProperties->getNotificationType(),
4996 'adm_force' => (
bool) $this->objProperties->isAdminForceNoti(),
4997 'usr_toggle' => (
bool) $this->objProperties->isUserToggleNoti()
5002 $tpl->setVariable(
'NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
5004 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
5005 include_once
'Modules/Forum/classes/class.ilObjForum.php';
5008 $oParticipants = $this->getParticipantsObject();
5012 $admin_ids = $oParticipants->getAdmins();
5013 $member_ids = $oParticipants->getMembers();
5014 $tutor_ids = $oParticipants->getTutors();
5016 if($this->objProperties->getNotificationType() ==
'default')
5019 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
5021 $forum_noti->setAdminForce($this->objProperties->isAdminForceNoti());
5022 $forum_noti->setUserToggle($this->objProperties->isUserToggleNoti());
5023 $forum_noti->setForumId($this->objProperties->getObjId());
5025 else if($this->objProperties->getNotificationType() ==
'per_user')
5032 $this->__showMembersTable($moderators, $admins, $members, $tutors);
5040 foreach($user_ids as $user_id)
5044 $icon_ok = $this->
getIcon(!$user_toggle_noti);
5049 $users[
$counter][
'firstname'] = $name[
'firstname'];
5050 $users[
$counter][
'lastname'] = $name[
'lastname'];
5051 $users[
$counter][
'user_toggle_noti'] = $icon_ok;
5057 private function __showMembersTable($moderators, $admins, $members, $tutors)
5069 $tbl_mod->setId(
'tbl_id_mod');
5070 $tbl_mod->setFormAction(
$ilCtrl->getFormAction($this,
'showMembers'));
5071 $tbl_mod->setTitle(
$lng->txt(
'moderators'));
5073 $tbl_mod->addColumn(
'',
'',
'1%',
true);
5074 $tbl_mod->addColumn(
$lng->txt(
'login'),
'',
'10%');
5075 $tbl_mod->addColumn(
$lng->txt(
'firstname'),
'',
'10%');
5076 $tbl_mod->addColumn(
$lng->txt(
'lastname'),
'',
'10%');
5077 $tbl_mod->addColumn(
$lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
5078 $tbl_mod->setSelectAllCheckbox(
'user_id');
5080 $tbl_mod->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
5081 $tbl_mod->setData($moderators);
5083 $tbl_mod->addMultiCommand(
'enableHideUserToggleNoti',
$lng->txt(
'enable_hide_user_toggle'));
5084 $tbl_mod->addMultiCommand(
'disableHideUserToggleNoti',
$lng->txt(
'disable_hide_user_toggle'));
5086 $tpl->setCurrentBlock(
'moderators_table');
5087 $tpl->setVariable(
'MODERATORS',$tbl_mod->getHTML());
5093 $tbl_adm->setId(
'tbl_id_adm');
5094 $tbl_adm->setFormAction(
$ilCtrl->getFormAction($this,
'showMembers'));
5095 $tbl_adm->setTitle(
$lng->txt(
'administrator'));
5097 $tbl_adm->addColumn(
'',
'',
'1%',
true);
5098 $tbl_adm->addColumn(
$lng->txt(
'login'),
'',
'10%');
5099 $tbl_adm->addColumn(
$lng->txt(
'firstname'),
'',
'10%');
5100 $tbl_adm->addColumn(
$lng->txt(
'lastname'),
'',
'10%');
5101 $tbl_adm->addColumn(
$lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
5102 $tbl_adm->setSelectAllCheckbox(
'user_id');
5103 $tbl_adm->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
5105 $tbl_adm->setData($admins);
5106 $tbl_adm->addMultiCommand(
'enableHideUserToggleNoti',
$lng->txt(
'enable_hide_user_toggle'));
5107 $tbl_adm->addMultiCommand(
'disableHideUserToggleNoti',
$lng->txt(
'disable_hide_user_toggle'));
5109 $tpl->setCurrentBlock(
'admins_table');
5110 $tpl->setVariable(
'ADMINS',$tbl_adm->getHTML());
5116 $tbl_mem->setId(
'tbl_id_mem');
5117 $tbl_mem->setFormAction(
$ilCtrl->getFormAction($this,
'showMembers'));
5118 $tbl_mem->setTitle(
$lng->txt(
'members'));
5120 $tbl_mem->addColumn(
'',
'',
'1%',
true);
5121 $tbl_mem->addColumn(
$lng->txt(
'login'),
'',
'10%');
5122 $tbl_mem->addColumn(
$lng->txt(
'firstname'),
'',
'10%');
5123 $tbl_mem->addColumn(
$lng->txt(
'lastname'),
'',
'10%');
5124 $tbl_mem->addColumn(
$lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
5125 $tbl_mem->setSelectAllCheckbox(
'user_id');
5126 $tbl_mem->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
5127 $tbl_mem->setData($members);
5129 $tbl_mem->addMultiCommand(
'enableHideUserToggleNoti',
$lng->txt(
'enable_hide_user_toggle'));
5130 $tbl_mem->addMultiCommand(
'disableHideUserToggleNoti',
$lng->txt(
'disable_hide_user_toggle'));
5132 $tpl->setCurrentBlock(
'members_table');
5133 $tpl->setVariable(
'MEMBERS',$tbl_mem->getHTML());
5139 $tbl_tut->setId(
'tbl_id_tut');
5140 $tbl_tut->setFormAction(
$ilCtrl->getFormAction($this,
'showMembers'));
5141 $tbl_tut->setTitle(
$lng->txt(
'tutors'));
5143 $tbl_tut->addColumn(
'',
'',
'1%',
true);
5144 $tbl_tut->addColumn(
$lng->txt(
'login'),
'',
'10%');
5145 $tbl_tut->addColumn(
$lng->txt(
'firstname'),
'',
'10%');
5146 $tbl_tut->addColumn(
$lng->txt(
'lastname'),
'',
'10%');
5147 $tbl_tut->addColumn(
$lng->txt(
'allow_user_toggle_noti'),
'',
'10%');
5148 $tbl_tut->setSelectAllCheckbox(
'user_id');
5149 $tbl_tut->setRowTemplate(
'tpl.forums_members_row.html',
'Modules/Forum');
5150 $tbl_tut->setData($tutors);
5152 $tbl_tut->addMultiCommand(
'enableHideUserToggleNoti',
$lng->txt(
'enable_hide_user_toggle'));
5153 $tbl_tut->addMultiCommand(
'disableHideUserToggleNoti',
$lng->txt(
'disable_hide_user_toggle'));
5155 $tpl->setCurrentBlock(
'tutors_table');
5156 $tpl->setVariable(
'TUTORS',$tbl_tut->getHTML());
5160 public function enableAdminForceNotiObject()
5166 global $ilAccess,
$ilErr;
5167 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
5169 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->MESSAGE);
5172 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
5178 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
5181 foreach(
$_POST[
'user_id'] as $user_id)
5183 $frm_noti->setUserId((
int) $user_id);
5184 $is_enabled = $frm_noti->isAdminForceNotification();
5186 $frm_noti->setUserToggle(0);
5189 $frm_noti->setAdminForce(1);
5190 $frm_noti->insertAdminForce();
5197 $this->showMembersObject();
5200 public function disableAdminForceNotiObject()
5206 global $ilAccess,
$ilErr;
5207 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
5209 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->MESSAGE);
5212 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
5218 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
5221 foreach(
$_POST[
'user_id'] as $user_id)
5223 $frm_noti->setUserId((
int) $user_id);
5224 $is_enabled = $frm_noti->isAdminForceNotification();
5228 $frm_noti->deleteAdminForce();
5235 $this->showMembersObject();
5238 public function enableHideUserToggleNotiObject()
5244 global $ilAccess,
$ilErr;
5245 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
5247 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->MESSAGE);
5249 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
5255 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
5258 foreach(
$_POST[
'user_id'] as $user_id)
5260 $frm_noti->setUserId((
int) $user_id);
5261 $is_enabled = $frm_noti->isAdminForceNotification();
5262 $frm_noti->setUserToggle(1);
5266 $frm_noti->setAdminForce(1);
5267 $frm_noti->insertAdminForce();
5271 $frm_noti->updateUserToggle();
5278 $this->showMembersObject();
5281 public function disableHideUserToggleNotiObject()
5287 global $ilAccess,
$ilErr;
5288 if(!$ilAccess->checkAccess(
'write',
'', $this->ref_id))
5290 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->MESSAGE);
5293 if(!isset(
$_POST[
'user_id']) || !is_array(
$_POST[
'user_id']))
5299 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
5302 foreach(
$_POST[
'user_id'] as $user_id)
5304 $frm_noti->setUserId((
int) $user_id);
5305 $is_enabled = $frm_noti->isAdminForceNotification();
5306 $frm_noti->setUserToggle(0);
5309 $frm_noti->updateUserToggle();
5313 $frm_noti->setAdminForce(1);
5314 $frm_noti->insertAdminForce();
5321 $this->showMembersObject();
5326 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
5327 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5330 if ((
int)$this->objCurrentPost->getId() > 0) {
5333 $this->
object->markPostUnread($this->
user->getId(), (
int)$this->objCurrentPost->getId());
5335 $this->viewThreadObject();
5340 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
5341 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5344 if ((
int)$this->objCurrentTopic->getId() > 0 && (
int)$this->objCurrentPost->getId() > 0) {
5347 $this->
object->markPostRead(
5348 $this->
user->getId(), (
int)$this->objCurrentTopic->getId(), (
int)$this->objCurrentPost->getId()
5351 $this->viewThreadObject();
5361 $lg = parent::initHeaderAction();
5364 if($this->objCurrentTopic->getId())
5366 $container_obj =
null;
5367 $lg->setContainerObject($container_obj);
5372 if(
$ilUser->getId() != ANONYMOUS_USER_ID && $this->ilias->getSetting(
'forum_notification') != 0 )
5376 $frm = $this->
object->Forum;
5377 $frm->setForumId($this->object->getId());
5378 $frm->setForumRefId($this->object->getRefId());
5379 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
5380 $frm_notificiation_enabled = $frm->isForumNotificationEnabled(
$ilUser->getId());
5382 if($this->objCurrentTopic->getId())
5384 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
5391 $frm_notificiation_enabled &&
5392 $is_user_allowed_to_deactivate_notification
5395 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
5399 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
5404 if($frm_notificiation_enabled)
5406 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'disableForumNotification'),
"forums_disable_forum_notification");
5410 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'enableForumNotification'),
"forums_enable_forum_notification");
5414 $topic_notification_enabled =
false;
5415 if($this->objCurrentTopic->getId())
5417 $topic_notification_enabled = $this->objCurrentTopic->isNotificationEnabled(
$ilUser->getId());
5418 if($topic_notification_enabled)
5420 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_disable_notification");
5424 $lg->addCustomCommand($this->ctrl->getLinkTarget($this,
'toggleThreadNotification'),
"forums_enable_notification");
5427 $this->ctrl->setParameter($this,
'thr_pk',
'');
5429 if($frm_notificiation_enabled || $topic_notification_enabled)
5434 $this->lng->txt(
"frm_notification_activated")
5442 $this->lng->txt(
"frm_notification_deactivated")
5453 if($this->objProperties->getNotificationType() ==
'default')
5458 if($this->objProperties->isUserToggleNoti() == 0)
5467 include_once
'Modules/Forum/classes/class.ilForumNotification.php';
5470 $frm_noti->setUserId(
$ilUser->getId());
5472 $user_toggle = (int)$frm_noti->isUserToggleNotification();
5473 if($user_toggle == 0)
5487 $grp_ref_id =
$tree->checkForParentType($this->object->getRefId(),
'grp');
5488 $crs_ref_id =
$tree->checkForParentType($this->object->getRefId(),
'crs');
5490 if($grp_ref_id == 0 && $crs_ref_id == 0)
5500 public function getParticipantsObject()
5504 $grp_ref_id =
$tree->checkForParentType($this->object->getRefId(),
'grp');
5505 $crs_ref_id =
$tree->checkForParentType($this->object->getRefId(),
'crs');
5509 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_read'),
$ilErr->MESSAGE);
5515 $oParticipants =
null;
5520 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
5522 return $oParticipants;
5524 else if($crs_ref_id > 0)
5528 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
5530 return $oParticipants;
5533 return $oParticipants;
5547 if((
int)
$ilSetting->get(
'disable_my_offers'))
5553 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
5566 if((
int)
$ilSetting->get(
'disable_my_offers'))
5572 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
5580 $_POST[
'thread_sorting'] ? $thread_sorting =
$_POST[
'thread_sorting'] :$thread_sorting = array();
5582 if (!$this->is_moderator) {
5583 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5586 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
5587 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5590 array_walk($thread_sorting,
function($sortValue, $threadId) {
5594 foreach($thread_sorting as $thr_pk=>$sorting_value)
5596 $sorting_value = str_replace(
',',
'.',$sorting_value);
5597 $sorting_value = (float)$sorting_value * 100;
5598 $this->
object->setThreadSorting($thr_pk,$sorting_value);
5610 if(!$this->is_moderator)
5612 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
5615 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
5616 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5619 $selected_thread_id = 0;
5620 if(isset(
$_GET[
'merge_thread_id']) && (
int)
$_GET[
'merge_thread_id'])
5622 $selected_thread_id = (int)
$_GET[
'merge_thread_id'];
5624 else if(isset(
$_POST[
'thread_ids']) && count((array)
$_POST[
'thread_ids']) == 1)
5626 $selected_thread_id = (int)current(
$_POST[
'thread_ids']);
5635 if($selected_thread_id)
5637 $frm = $this->
object->Forum;
5638 $frm->setForumId($this->object->getId());
5639 $frm->setForumRefId($this->object->getRefId());
5641 $selected_thread_obj =
new ilForumTopic($selected_thread_id);
5650 $frm->setMDB2Wherecondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
5652 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forums_threads_liste.html',
'Modules/Forum');
5654 $topicData = $frm->getOneTopic();
5657 include_once
'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
5658 $this->ctrl->setParameter($this,
'merge_thread_id', $selected_thread_id);
5659 $tbl =
new ilForumTopicTableGUI($this,
'mergeThreads',
'', (
int)
$_GET[
'ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
5660 $tbl->setSelectedThread($selected_thread_obj);
5661 $tbl->setMapper($frm)->fetchData();
5663 $this->tpl->setVariable(
'THREADS_TABLE',
$tbl->getHTML());
5679 if(!$this->is_moderator)
5681 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
5684 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
5685 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5688 if(!isset(
$_GET[
'merge_thread_id']) || !(
int)
$_GET[
'merge_thread_id'] || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 1)
5695 $source_thread_id = (int)
$_GET[
'merge_thread_id'];
5696 $target_thread_id = (int)current(
$_POST[
'thread_ids']);
5698 if($source_thread_id == $target_thread_id)
5708 $this->ctrl->clearParameters($this);
5721 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
5724 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performMergeThreads'));
5725 $c_gui->setHeaderText($this->lng->txt(
'frm_sure_merge_threads'));
5726 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showThreads');
5727 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performMergeThreads');
5732 $this->tpl->setContent($c_gui->getHTML());
5739 public function performMergeThreadsObject()
5746 if(!$this->is_moderator)
5748 $this->
ilias->raiseError($this->lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
5751 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
5752 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5755 if(!isset(
$_POST[
'thread_ids']) || !is_array(
$_POST[
'thread_ids']) || count(
$_POST[
'thread_ids']) != 2)
5762 if((
int)$_POST[
'thread_ids'][0] == (
int)
$_POST[
'thread_ids'][1])
5797 if(!
$GLOBALS[
'ilCtrl']->isAsynch())
5799 require_once
'Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
5808 public function deliverDraftZipFileObject()
5813 $draftObj = ilForumPostDraft::newInstanceByDraftId((
int)
$_GET[
'draft_id']);
5814 if($draftObj->getPostAuthorId() ==
$ilUser->getId())
5817 if(!$tmp_file_obj->deliverZipFile())
5819 $this->ctrl->redirect($this);
5829 if (!$this->access->checkAccess(
'read',
'', $this->object->getRefId())) {
5830 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
5835 $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
5836 if (!$fileData->deliverZipFile()) {
5837 $this->ctrl->redirect($this);
5841 public function editThreadDraftObject($form = NULL)
5850 $frm = $this->
object->Forum;
5851 $frm->setForumId($this->object->getId());
5852 $frm->setForumRefId($this->object->getRefId());
5854 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
5856 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
5860 if(array_key_exists(
'draft_id',
$_GET))
5862 $draft_id = (int)
$_GET[
'draft_id'];
5863 $thread_draft = $thread_draft->newInstanceByDraftId($draft_id);
5866 if(!isset(
$_GET[
'hist_check']) || (int)
$_GET[
'hist_check'] != 0)
5873 $this->initTopicCreateForm(
true);
5875 $this->create_topic_form_gui->setValuesByArray(array(
5876 'alias' => $thread_draft->getPostUserAlias(),
5877 'subject' => $thread_draft->getPostSubject(),
5879 'notify' =>$thread_draft->getNotify() ?
true :
false,
5881 'del_file' => array())
5883 $tpl->setContent($this->create_topic_form_gui->getHTML() . $this->modal_history);
5887 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
5888 return $tpl->setContent($form->getHTML());
5894 $history_id = ((int)
$_GET[
'history_id']);
5897 $draft = $history->rollbackAutosave();
5899 if($draft->getThreadId() == 0 && $draft->getPostId() == 0)
5901 $this->ctrl->setParameter($this,
'draft_id', $history->getDraftId());
5902 $this->ctrl->redirect($this,
'editThreadDraft');
5905 $this->ctrl->clearParameters($this);
5906 $this->ctrl->setParameter($this,
'pos_pk', $draft->getPostId());
5907 $this->ctrl->setParameter($this,
'thr_pk', $draft->getThreadId());
5908 $this->ctrl->setParameter($this,
'draft_id',$draft->getDraftId());
5909 $this->ctrl->setParameter($this,
'action',
'editdraft');
5914 $this->ctrl->redirect($this,
'viewThread');
5917 public function saveThreadAsDraftObject()
5926 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
5927 $autosave_draft_id = 0;
5930 $autosave_draft_id = (int)
$_POST[
'draft_id'];
5932 else if(isset(
$_GET[
'draft_id']) && (int)
$_GET[
'draft_id'] > 0)
5934 $autosave_draft_id = (int)
$_GET[
'draft_id'];
5937 $frm = $this->
object->Forum;
5938 $frm->setForumId($this->object->getId());
5939 $frm->setForumRefId($this->object->getRefId());
5941 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId()))
5943 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->
ilias->error_obj->MESSAGE);
5946 $frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
5948 $topicData = $frm->getOneTopic();
5950 $this->initTopicCreateForm();
5951 if($this->create_topic_form_gui->checkInput())
5953 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
5956 !
$ilUser->isCaptchaVerified() &&
5957 ilCaptchaUtil::isActiveForForum()
5960 $ilUser->setCaptchaVerified(
true);
5965 if($autosave_draft_id == 0)
5971 $draftObj = ilForumPostDraft::newInstanceByDraftId($autosave_draft_id);
5973 $draftObj->setForumId($topicData[
'top_pk']);
5974 $draftObj->setThreadId(0);
5975 $draftObj->setPostId(0);
5977 $draftObj->setPostSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'),
false));
5979 $draftObj->setPostUserAlias($user_alias);
5980 $draftObj->setNotify((
int)$this->create_topic_form_gui->getInput(
'notify'));
5981 $draftObj->setPostAuthorId(
$ilUser->getId());
5982 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
5984 if($autosave_draft_id == 0)
5986 $draft_id = $draftObj->saveDraft();
5990 $draftObj->updateDraft();
5991 $draft_id = $draftObj->getDraftId();
5996 $GLOBALS[
'ilAppEventHandler']->raise(
5999 array(
'draftObj' => $draftObj,
6000 'obj_id' => $this->object->getId(),
6001 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
6007 if($this->objProperties->isFileUploadAllowed())
6010 $file = $_FILES[
'userfile'];
6013 $oFDForumDrafts->storeUploadedFile(
$file);
6016 $file2delete = $this->create_topic_form_gui->getInput(
'del_file');
6017 if(is_array($file2delete) && count($file2delete))
6019 $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
6022 $this->ctrl->clearParameters($this);
6024 $this->ctrl->redirect($this,
'showThreads');
6028 $_GET[
'action'] = substr(
$_GET[
'action'], 6);
6029 $this->create_topic_form_gui->setValuesByPost();
6030 $this->ctrl->setParameter($this,
'draft_id', $autosave_draft_id );
6031 return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
6033 $this->ctrl->clearParameters($this);
6034 $this->ctrl->redirect($this,
'showThreads');
6037 public function updateThreadDraftObject()
6046 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
6048 $frm = $this->
object->Forum;
6049 $frm->setForumId($this->object->getId());
6050 $frm->setForumRefId($this->object->getRefId());
6052 if(!$ilAccess->checkAccess(
'add_thread',
'', $this->object->getRefId())
6053 || !isset(
$_GET[
'draft_id']) || (
int)
$_GET[
'draft_id'] <= 0)
6055 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
6057 $this->initTopicCreateForm();
6059 if($this->create_topic_form_gui->checkInput())
6061 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
6064 !
$ilUser->isCaptchaVerified() &&
6065 ilCaptchaUtil::isActiveForForum()
6068 $ilUser->setCaptchaVerified(
true);
6072 $draftObj= ilForumPostDraft::newInstanceByDraftId((
int)
$_GET[
'draft_id']);
6074 $draftObj->setPostSubject($this->
handleFormInput($this->create_topic_form_gui->getInput(
'subject'),
false));
6076 $draftObj->setPostUserAlias($user_alias);
6077 $draftObj->setNotify((
int)$this->create_topic_form_gui->getInput(
'notify'));
6078 $draftObj->setPostAuthorId(
$ilUser->getId());
6079 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
6081 $draftObj->updateDraft();
6084 $GLOBALS[
'ilAppEventHandler']->raise(
6087 array(
'draftObj' => $draftObj,
6088 'obj_id' => $this->object->getId(),
6089 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
6094 ilForumUtil::moveMediaObjects($this->create_topic_form_gui->getInput(
'message'),
'frm~d:html', $draftObj->getDraftId(),
'frm~d:html', $draftObj->getDraftId());
6096 if($this->objProperties->isFileUploadAllowed())
6099 $file = $_FILES[
'userfile'];
6102 $oFDForumDrafts->storeUploadedFile(
$file);
6105 $file2delete = $this->create_topic_form_gui->getInput(
'del_file');
6106 if(is_array($file2delete) && count($file2delete))
6108 $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
6113 $this->ctrl->clearParameters($this);
6114 $this->ctrl->redirect($this,
'showThreads');
6118 $this->create_topic_form_gui->setValuesByPost();
6119 $this->ctrl->setParameter($this,
'hist_check', 0);
6120 $this->ctrl->setParameter($this,
'draft_id',
$_GET[
'draft_id']);
6121 return $this->editThreadDraftObject($this->create_topic_form_gui);
6124 $this->ctrl->clearParameters($this);
6125 $this->ctrl->redirect($this,
'showThreads');
6128 public function saveAsDraftObject()
6137 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
6138 $autosave_draft_id = 0;
6141 $autosave_draft_id = (int)
$_POST[
'draft_id'];
6144 if($oReplyEditForm->checkInput())
6146 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
6149 !
$ilUser->isCaptchaVerified() &&
6150 ilCaptchaUtil::isActiveForForum()
6153 $ilUser->setCaptchaVerified(
true);
6161 $forumObj = $oForumObjects[
'forumObj'];
6165 $frm = $oForumObjects[
'frm'];
6166 $frm->setMDB2WhereCondition(
' top_frm_fk = %s ', array(
'integer'), array($frm->getForumId()));
6167 $topicData = $frm->getOneTopic();
6170 if(
$_GET[
'action'] ==
'ready_showreply')
6172 if(!$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
6174 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
6179 if($autosave_draft_id == 0)
6185 $draftObj = ilForumPostDraft::newInstanceByDraftId($autosave_draft_id);
6187 $draftObj->setForumId($topicData[
'top_pk']);
6188 $draftObj->setThreadId($this->objCurrentTopic->getId());
6189 $draftObj->setPostId($this->objCurrentPost->getId());
6191 $draftObj->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
6193 $draftObj->setPostUserAlias($user_alias);
6194 $draftObj->setNotify((
int)$oReplyEditForm->getInput(
'notify'));
6195 $draftObj->setPostNotify((
int)$oReplyEditForm->getInput(
'notify_post'));
6197 $draftObj->setPostAuthorId(
$ilUser->getId());
6198 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
6200 if($autosave_draft_id == 0)
6202 $draft_id = $draftObj->saveDraft();
6206 $draftObj->updateDraft();
6207 $draft_id = $draftObj->getDraftId();
6213 $GLOBALS[
'ilAppEventHandler']->raise(
6216 array(
'draftObj' => $draftObj,
6217 'obj_id' => $this->object->getId(),
6218 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
6222 if($this->objProperties->isFileUploadAllowed())
6224 $file = $_FILES[
'userfile'];
6228 $oFDForumDrafts->storeUploadedFile(
$file);
6235 $_SESSION[
'frm'][(int)
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$this->objCurrentPost->getId();
6238 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
6239 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
6240 $this->ctrl->redirect($this,
'viewThread');
6245 $oReplyEditForm->setValuesByPost();
6246 $_GET[
'action'] = substr(
$_GET[
'action'], 6);
6248 return $this->viewThreadObject();
6255 $draft_id = (int)
$_GET[
'draft_id'];
6262 $this->viewThreadObject();
6269 public function updateDraftObject()
6278 if(!isset(
$_POST[
'del_file']) || !is_array(
$_POST[
'del_file']))
$_POST[
'del_file'] = array();
6281 if($oReplyEditForm->checkInput())
6283 require_once
'Services/Captcha/classes/class.ilCaptchaUtil.php';
6286 !
$ilUser->isCaptchaVerified() &&
6287 ilCaptchaUtil::isActiveForForum()
6290 $ilUser->setCaptchaVerified(
true);
6298 $forumObj = $oForumObjects[
'forumObj'];
6300 if( !
$ilUser->isAnonymous() &&
6301 (
$_GET[
'action'] ==
'showdraft' ||
$_GET[
'action'] ==
'editdraft'))
6303 if(!$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']))
6305 $this->
ilias->raiseError($lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
6313 $update_draft->setPostSubject($this->
handleFormInput($oReplyEditForm->getInput(
'subject'),
false));
6315 $update_draft->setPostUserAlias($user_alias);
6316 $update_draft->setNotify((
int)$oReplyEditForm->getInput(
'notify'));
6317 $update_draft->setUpdateUserId(
$ilUser->getId());
6318 $update_draft->setPostAuthorId(
$ilUser->getId());
6319 $update_draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
6321 $update_draft->updateDraft();
6325 $GLOBALS[
'ilAppEventHandler']->raise(
6328 array(
'draftObj' => $update_draft,
6329 'obj_id' => $this->object->getId(),
6330 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
6336 foreach($uploadedObjects as $mob)
6343 if($this->objProperties->isFileUploadAllowed())
6346 $file = $_FILES[
'userfile'];
6349 $oFDForumDrafts->storeUploadedFile(
$file);
6353 $file2delete = $oReplyEditForm->getInput(
'del_file');
6354 if(is_array($file2delete) && count($file2delete))
6356 $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
6359 $_SESSION[
'frm'][(int)
$_GET[
'thr_pk']][
'openTreeNodes'][] = (
int)$this->objCurrentPost->getId();
6362 $this->ctrl->clearParameters($this);
6363 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
6364 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
6365 $this->ctrl->setParameter($this,
'draft_id', $update_draft->getDraftId());
6369 $this->ctrl->clearParameters($this);
6370 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
6371 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
6372 $this->ctrl->setParameter($this,
'draft_id',(
int)
$_GET[
'draft_id']);
6373 $this->ctrl->setParameter($this,
'action',
'editdraft');
6374 $oReplyEditForm->setValuesByPost();
6375 return $this->viewThreadObject();
6377 $this->ctrl->clearParameters($this);
6378 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
6379 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
6380 $this->ctrl->redirect($this,
'viewThread');
6391 include_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
6394 foreach($oldMediaObjects as $oldMob)
6397 foreach($curMediaObjects as $curMob)
6399 if($oldMob == $curMob)
6425 !$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']) ||
6432 $post_id = $this->objCurrentPost->getId();
6435 $draft_id_to_delete = (int)
$_GET[
'draft_id'];
6438 if(!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete))
6440 $this->ctrl->clearParameters($this);
6441 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
6442 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
6443 $this->ctrl->redirect($this,
'viewThread');
6447 $this->
deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
6451 $objFileDataForumDrafts->delete();
6455 $GLOBALS[
'ilAppEventHandler']->raise(
6458 array(
'draftObj' => $draft_obj,
6459 'obj_id' => $this->object->getId(),
6460 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
6464 $draft_obj->deleteDraft();
6467 $this->ctrl->clearParameters($this);
6468 $this->ctrl->setParameter($this,
'pos_pk', $this->objCurrentPost->getId());
6469 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentPost->getThreadId());
6470 $this->ctrl->redirect($this,
'viewThread');
6477 if(
$ilUser->isAnonymous() ||
$_GET[
'action'] ==
'ready_showreply')
6482 $reponse =
new stdClass();
6483 $reponse->draft_id = 0;
6488 $current_post_id =$this->objCurrentPost->getId();
6490 $replyform->checkInput();
6492 $form_autosave_values[
'subject'] = $replyform->getInput(
'subject');
6493 $form_autosave_values[
'message'] = $replyform->getInput(
'message');
6494 $form_autosave_values[
'notify'] = $replyform->getInput(
'notify');
6495 $form_autosave_values[
'alias'] = $replyform->getInput(
'alias');
6497 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0)
6499 $draft_id = (int)
$_GET[
'draft_id'];
6503 $draft_id = $replyform->getInput(
'draft_id');
6507 if((
int)$draft_id > 0)
6509 if(
$_GET[
'action'] ==
'showreply')
6511 $draftObj = ilForumPostDraft::newInstanceByDraftId((
int)$draft_id);
6512 $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'],
false));
6515 $draftObj->setPostUserAlias($user_alias);
6516 $draftObj->setNotify((
int)$form_autosave_values[
'notify']);
6517 $draftObj->setUpdateUserId(
$ilUser->getId());
6518 $draftObj->setPostAuthorId(
$ilUser->getId());
6519 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
6521 $draftObj->updateDraft();
6527 foreach($uploadedObjects as $mob)
6533 foreach($oldMediaObjects as $mob)
6538 foreach($curMediaObjects as $mob)
6546 $draftObj->setDraftId((
int)$draft_id);
6547 $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'],
false));
6549 $draftObj->addDraftToHistory();
6555 foreach($uploadedObjects as $mob)
6561 foreach($oldMediaObjects as $mob)
6566 foreach($curMediaObjects as $mob)
6576 $draftObj->setThreadId($this->objCurrentTopic->getId());
6577 $draftObj->setPostId($current_post_id);
6579 $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'],
false));
6582 $draftObj->setPostUserAlias($user_alias);
6583 $draftObj->setNotify((
int)$form_autosave_values[
'notify']);
6584 $draftObj->setPostAuthorId(
$ilUser->getId());
6585 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
6586 $draftObj->saveDraft();
6592 foreach($uploadedObjects as $mob)
6598 foreach($oldMediaObjects as $mob)
6603 foreach($curMediaObjects as $mob)
6610 $reponse->draft_id = $draftObj->getDraftId();
6611 echo json_encode($reponse);
6619 if(
$ilUser->isAnonymous() ||
$_GET[
'action'] ==
'ready_showreply')
6624 $reponse =
new stdClass();
6625 $reponse->draft_id = 0;
6629 $this->initTopicCreateForm();
6631 $current_post_id = 0;
6634 $replyform->checkInput();
6636 $form_autosave_values[
'subject'] = $replyform->getInput(
'subject');
6637 $form_autosave_values[
'message'] = $replyform->getInput(
'message');
6638 $form_autosave_values[
'notify'] = $replyform->getInput(
'notify');
6639 $form_autosave_values[
'alias'] = $replyform->getInput(
'alias');
6641 if(isset(
$_GET[
'draft_id']) && (
int)
$_GET[
'draft_id'] > 0)
6643 $draft_id = (int)
$_GET[
'draft_id'];
6647 $draft_id = $replyform->getInput(
'draft_id');
6650 if((
int)$draft_id > 0)
6652 if(
$_GET[
'action'] ==
'showreply')
6654 $draftObj = ilForumPostDraft::newInstanceByDraftId((
int)$draft_id);
6655 $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'],
false));
6657 $draftObj->setPostUserAlias($user_alias);
6658 $draftObj->setNotify((
int)$form_autosave_values[
'notify']);
6659 $draftObj->setUpdateUserId(
$ilUser->getId());
6660 $draftObj->setPostAuthorId(
$ilUser->getId());
6661 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
6663 $draftObj->updateDraft();
6669 foreach($uploadedObjects as $mob)
6675 foreach($oldMediaObjects as $mob)
6680 foreach($curMediaObjects as $mob)
6689 $draftObj->setDraftId((
int)$draft_id);
6690 $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'],
false));
6692 $draftObj->addDraftToHistory();
6698 foreach($uploadedObjects as $mob)
6704 foreach($oldMediaObjects as $mob)
6709 foreach($curMediaObjects as $mob)
6720 $draftObj->setThreadId($this->objCurrentTopic->getId());
6721 $draftObj->setPostId($current_post_id);
6723 $draftObj->setPostSubject($this->
handleFormInput($form_autosave_values[
'subject'],
false));
6726 $draftObj->setPostUserAlias($user_alias);
6727 $draftObj->setNotify((
int)$form_autosave_values[
'notify']);
6728 $draftObj->setPostAuthorId(
$ilUser->getId());
6729 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 :
$ilUser->getId()));
6730 $draftObj->saveDraft();
6736 foreach($uploadedObjects as $mob)
6742 foreach($oldMediaObjects as $mob)
6747 foreach($curMediaObjects as $mob)
6755 $reponse->draft_id = $draftObj->getDraftId();
6756 echo json_encode($reponse);
6779 if($this->objCurrentPost->getId() != $node->
getId()
6780 || (
$_GET[
'action'] !=
'showreply' &&
6781 $_GET[
'action'] !=
'showedit' &&
6782 $_GET[
'action'] !=
'censor' &&
6783 $_GET[
'action'] !=
'delete' &&
6784 !$this->displayConfirmPostActivation())
6790 if(!$this->objCurrentTopic->isClosed() && $node->
isActivated() &&
6791 $ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']) &&
6795 $this->ctrl->setParameter($this,
'action',
'showreply');
6796 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6797 $this->ctrl->setParameter($this,
'offset', $Start);
6798 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6799 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
6801 if(!isset($draftsObjects[$node->
getId()]))
6803 $actions[
'reply_to_postings'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId());
6806 $this->ctrl->clearParameters($this);
6810 if(!$this->objCurrentTopic->isClosed() &&
6813 $ilUser->getId() != ANONYMOUS_USER_ID
6816 $this->ctrl->setParameter($this,
'action',
'showedit');
6817 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6818 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
6819 $this->ctrl->setParameter($this,
'offset', $Start);
6820 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6822 $actions[
'edit'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId());
6824 $this->ctrl->clearParameters($this);
6830 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6831 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
6832 $this->ctrl->setParameter($this,
'offset', $Start);
6833 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6834 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
6836 $actions[
'frm_mark_as_read'] = $this->ctrl->getLinkTarget($this,
'markPostRead', $node->
getId());
6838 $this->ctrl->clearParameters($this);
6842 if(
$ilUser->getId() != ANONYMOUS_USER_ID &&
6846 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6847 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
6848 $this->ctrl->setParameter($this,
'offset', $Start);
6849 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6850 $this->ctrl->setParameter($this,
'viewmode',
$_SESSION[
'viewmode']);
6852 $actions[
'frm_mark_as_unread'] = $this->ctrl->getLinkTarget($this,
'markPostUnread', $node->
getId());
6854 $this->ctrl->clearParameters($this);
6860 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'print_post', $node->
getId());
6861 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'top_pk', $node->
getForumId());
6862 $this->ctrl->setParameterByClass(
'ilforumexportgui',
'thr_pk', $node->
getThreadId());
6864 $actions[
'print'] = $this->ctrl->getLinkTargetByClass(
'ilforumexportgui',
'printPost');
6866 $this->ctrl->clearParameters($this);
6869 # buttons for every post except the "active"
6870 if(!$this->objCurrentTopic->isClosed() &&
6871 ($this->is_moderator ||
6873 $ilUser->getId() != ANONYMOUS_USER_ID
6877 $this->ctrl->setParameter($this,
'action',
'delete');
6878 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6879 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
6880 $this->ctrl->setParameter($this,
'offset', $Start);
6881 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6883 $actions[
'delete'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId());
6885 $this->ctrl->clearParameters($this);
6888 if(!$this->objCurrentTopic->isClosed() && $this->is_moderator)
6891 $this->ctrl->setParameter($this,
'action',
'censor');
6892 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6893 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
6894 $this->ctrl->setParameter($this,
'offset', $Start);
6895 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6898 $actions[
'frm_revoke_censorship'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId());
6902 $actions[
'frm_censorship'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId());
6905 $this->ctrl->clearParameters($this);
6908 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6909 $this->ctrl->setParameter($this,
'thr_pk', $node->
getThreadId());
6910 $this->ctrl->setParameter($this,
'offset', $Start);
6911 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6915 $actions[
'activate_post'] = $this->ctrl->getLinkTarget($this,
'askForPostActivation', $node->
getId());
6918 $this->ctrl->clearParameters($this);
6928 $draft = $draftsObjects[$node->
getId()];
6931 $this->ctrl->setParameter($this,
'action',
'publishdraft');
6932 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6933 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
6934 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
6935 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
6936 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6937 $actions[
'publish'] = $this->ctrl->getLinkTarget($this,
'publishSelectedDraft', $node->
getId());
6938 $this->ctrl->clearParameters($this);
6940 $this->ctrl->setParameter($this,
'action',
'editdraft');
6941 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6942 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
6943 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
6944 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
6945 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6946 $actions[
'edit'] = $this->ctrl->getLinkTarget($this,
'editDraft',
'draft_edit_' . $draft->getDraftId());
6947 $this->ctrl->clearParameters($this);
6949 $this->ctrl->setParameter($this,
'action',
'deletedraft');
6950 $this->ctrl->setParameter($this,
'pos_pk', $node->
getId());
6951 $this->ctrl->setParameter($this,
'thr_pk', $this->objCurrentTopic->getId());
6952 $this->ctrl->setParameter($this,
'draft_id', $draft->getDraftId());
6953 $this->ctrl->setParameter($this,
'offset', (
int)
$_GET[
'offset']);
6954 $this->ctrl->setParameter($this,
'orderby',
$_GET[
'orderby']);
6955 $actions[
'delete'] = $this->ctrl->getLinkTarget($this,
'viewThread', $node->
getId());
6956 $this->ctrl->clearParameters($this);
6958 if(isset(
$_GET[
'draft_id']) &&
$_GET[
'action'] ==
'editdraft')
6964 $tpl->setCurrentBlock(
'posts_row');
6967 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
6976 $sb_item->setCaption($lng_id);
6977 $sb_item->setUrl(
$url);
6979 $action_button->setDefaultButton($sb_item);
6985 $sb_item->setCaption($lng_id);
6986 $sb_item->setUrl(
$url);
6994 $tpl->setVariable(
'COMMANDS', $action_button->render());
6998 if(
$_GET[
'action'] !=
'deletedraft' &&
$_GET[
'action'] !=
'editdraft' && !$this->objCurrentTopic->isClosed())
7000 $tpl->setVariable(
'COMMANDS', $action_button->render());
7014 $draft_obj = ilForumPostDraft::newInstanceByDraftId($draft_id);
7016 if(!$ilAccess->checkAccess(
'add_reply',
'', (
int)
$_GET[
'ref_id']) ||
7031 require_once
'./Services/jQuery/classes/class.iljQueryUtil.php';
7038 if(is_array($history_instances) &&
sizeof($history_instances) > 0)
7040 require_once
'Services/UIComponent/Modal/classes/class.ilModalGUI.php';
7042 $modal->setHeading($this->lng->txt(
'restore_draft_from_autosave'));
7043 $modal->setId(
'frm_autosave_restore');
7044 $form_tpl =
new ilTemplate(
'tpl.restore_thread_draft.html',
true,
true,
'Modules/Forum');
7045 include_once
'./Services/Accordion/classes/class.ilAccordionGUI.php';
7047 foreach($history_instances as $key => $history_instance)
7050 $acc_autosave->setId(
'acc_'.$history_instance->getHistoryId());
7052 $form_tpl->setCurrentBlock(
'list_item');
7057 $restore_btn->addCSSClass(
'restore_btn');
7058 $this->ctrl->setParameter($this,
'history_id', $history_instance->getHistoryId());
7059 $restore_btn->setUrl($this->ctrl->getLinkTarget($this,
'restoreFromHistory'));
7060 $restore_btn->setCaption($this->lng->txt(
'restore'),
false);
7062 $acc_autosave->addItem($history_date.
' - '. $history_instance->getPostSubject(), $post_message . $restore_btn->render());
7064 $form_tpl->setVariable(
'ACC_AUTO_SAVE', $acc_autosave->getHtml());
7065 $form_tpl->parseCurrentBlock();
7068 $form_tpl->setVariable(
'RESTORE_DATA_EXISTS',
'found_threat_history_to_restore');
7069 $modal->setBody($form_tpl->get());
7071 $this->modal_history = $modal->getHTML();
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 _getInstanceByObjId($a_obj_id)
Get singleton instance.
static formatDate(ilDateTime $date)
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.
isUserToggleNotification()
static lookupAutosaveInterval()
static isAutoSavePostDraftAllowed()
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 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 _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
static get($a_glyph, $a_text="")
Get glyph html.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
This class handles base functions for mail handling.
static getInstance()
Get instance.
static getFirstNewsIdForContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
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.
getEditFormCustomValues(Array &$a_values)
afterSave(ilObject $forumObj)
getThreadEditingForm($a_thread_id)
addAutosave(ilPropertyFormGUI $form)
publishDraftObject($use_replyform=true)
cancelMoveThreadsObject()
quoteTopLevelPostObject()
getModifiedReOnSubject($on_reply=false)
displayConfirmPostActivation()
$display_confirm_post_activation
getSubTabs($subtab='showThreads')
isUserAllowedToDeactivateNotification()
cancelObject()
cancel action and go back to previous page @access public
autosaveDraftAsyncObject()
initNotificationSettingsForm()
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
publishSelectedDraftObject()
autosaveThreadDraftAsyncObject()
hideToolbar($a_flag=null)
initForumCreateForm($object_type)
doHistoryCheck($draft_id)
updateUserNotifications($update_all_users=false)
restoreFromHistoryObject()
confirmMergeThreadsObject()
isWritingWithPseudonymAllowed()
checkDraftAccess($draft_id)
handleFormInput($a_text, $a_stripslashes=true)
getIcon($user_toggle_noti)
createTopLevelPostObject()
performDeleteThreadsObject()
confirmDeleteThreadDraftsObject()
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
askForPostActivationObject()
performPostActivationObject()
setDisplayConfirmPostActivation($status=0)
deleteSelectedDraft(ilForumPostDraft $draft_obj=null)
performMoveThreadsObject()
setTopicCreateDefaultValues()
$notificationSettingsForm
deleteThreadDraftsObject()
saveThreadSortingObject()
prepareFormOutput($a_text)
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
getUserNotificationTableData($user_ids, ilForumNotification $frm_noti)
static lookupForumIdByRefId($ref_id)
static lookupForumIdByObjId($obj_id)
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
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.
getTabs()
get tabs abstract method.
prepareOutput($a_show_subobjects=true)
prepare output
setColumnSettings(ilColumnGUI $column_gui)
May be overwritten in subclasses.
getRightColumnHTML()
Display right column.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
getCenterColumnHTML()
Get center column.
getCreationMode()
get creation mode
addHeaderAction()
Add header action menu.
createObject()
create new object form
executeCommand()
execute command
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.
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
getRefId()
get reference id @access public
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
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)
http redirect to other 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)
Init jQuery.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
addToDeskObject()
Add desktop item @access public.
redirection script todo: (a better solution should control the processing via a xml file)
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file