ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjForumGUI Class Reference

Class ilObjForumGUI. More...

+ Inheritance diagram for ilObjForumGUI:
+ Collaboration diagram for ilObjForumGUI:

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
 
 ensureThreadBelongsToForum (int $objId, \ilForumTopic $thread)
 
 executeCommand ()
 execute command More...
 
 infoScreenObject ()
 
 editThreadObject ($threadId, ilPropertyFormGUI $form=null)
 
 updateThreadObject ()
 
 markAllReadObject ()
 
 showThreadsObject ()
 
 sortThreadsObject ()
 
 getSubTabs ($subtab='showThreads')
 
 getContent ()
 
 showStatisticsObject ()
 
 performDeleteThreadsObject ()
 
 confirmDeleteThreads ()
 
 performPostActivationObject ()
 
 askForPostActivationObject ()
 
 setDisplayConfirmPostActivation ($status=0)
 
 displayConfirmPostActivation ()
 
 cancelPostObject ()
 
 cancelDraftObject ()
 
 getActivationFormHTML ()
 
 getCensorshipFormHTML ()
 
 createTopLevelPostObject ()
 
 saveTopLevelPostObject ()
 
 publishSelectedDraftObject ()
 
 publishDraftObject ($use_replyform=true)
 
 quotePostObject ()
 
 checkUsersViewMode ()
 
 showUserObject ()
 
 performThreadsActionObject ()
 
 performMoveThreadsObject ()
 
 cancelMoveThreadsObject ()
 
 moveThreadsObject ()
 
 handleFormInput ($a_text, $a_stripslashes=true)
 
 prepareFormOutput ($a_text)
 
 isUserAllowedToDeactivateNotification ()
 
 isParentObjectCrsOrGrp ()
 
 mergeThreadsObject ()
 
 confirmMergeThreadsObject ()
 
 performMergeThreadsObject ()
 
 saveTopLevelDraftObject ()
 
 checkDraftAccess (int $draftId)
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 @inheritDoc More...
 
 removeFromDeskObject ()
 @inheritDoc More...
 
- Public Member Functions inherited from ilDesktopItemHandling
 addToDeskObject ()
 Add desktop item @access public. More...
 
 removeFromDeskObject ()
 Remove from desktop @access public. More...
 

Static Public Member Functions

static _goto ($a_target, $a_thread=0, $a_posting=0)
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Data Fields

 $modal_history = ''
 
 $objProperties
 
 $object
 
 $ilNavigationHistory
 
 $access
 
 $ilObjDataCache
 
 $tabs
 
 $error
 
 $user
 
 $settings
 
 $toolbar
 
 $repositoryTree
 
 $rbac
 
 $locator
 
 $ilHelp
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 initSessionStorage ()
 
 toggleExplorerNodeStateObject ()
 Toggle explorer node. More...
 
 ensureValidPageForCurrentPosting (array $subtree_nodes, array $pagedPostings, int $pageSize, ilForumPost $firstForumPost)
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 
 getEditFormCustomValues (array &$a_values)
 
 updateCustom (ilPropertyFormGUI $a_form)
 
 renderDraftContent (ilTemplate $tpl, string $action, ilForumPost $referencePosting, array $drafts)
 
 renderPostContent (ilTemplate $tpl, ilForumPost $node, string $action, int $pageIndex, int $postIndex)
 
 afterSave (ilObject $a_new_object)
 
 getTabs ()
 get tabs abstract method. More...
 
 confirmDeleteThreadDraftsObject ()
 
 toggleThreadNotificationObject ()
 
 toggleStickinessObject ()
 
 deleteThreadDraftsObject ()
 
 createThreadObject ()
 
 publishThreadDraftObject ()
 
 addThreadObject ()
 
 enableForumNotificationObject ()
 
 disableForumNotificationObject ()
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 infoScreen ()
 
 markPostUnreadObject ()
 
 markPostReadObject ()
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu.
Parameters
string$a_sub_type
int$a_sub_id
Returns
ilObjectListGUI
More...
 
 saveThreadSortingObject ()
 
 setSideBlocks ()
 
 deliverDraftZipFileObject ()
 
 deliverZipFileObject ()
 
 editThreadDraftObject (\ilPropertyFormGUI $form=null)
 
 restoreFromHistoryObject ()
 
 saveThreadAsDraftObject ()
 
 updateThreadDraftObject ()
 
 editDraftObject ()
 
 deleteMobsOfDraft ($draft_id, $message)
 todo: move to ilForumUtil More...
 
 deleteSelectedDraft (ilForumPostDraft $draft_obj=null)
 
 autosaveDraftAsyncObject ()
 
 autosaveThreadDraftAsyncObject ()
 
 doCaptchaCheck ()
 Performs a CAPTCHA check for anonymous users if the CAPTCHA should be used for forums in the public area. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Private Member Functions

 decorateWithAutosave (\ilPropertyFormGUI $form)
 
 isHierarchicalView ()
 
 isTopLevelReplyCommand ()
 
 getThreadEditingForm ($a_thread_id)
 
 deletePostingDraftObject ()
 
 revokeCensorshipObject ()
 
 addCensorshipObject ()
 
 getReplyEditForm ()
 
 hideToolbar ($a_flag=null)
 
 getForumObjects ()
 
 renderViewModeControl (int $currentViewMode)
 
 renderSortationControl (int $currentSorting)
 
 getModifiedReOnSubject ($on_reply=false)
 
 isWritingWithPseudonymAllowed ()
 
 buildThreadForm ($isDraft=false)
 
 createThread (\ilForumPostDraft $draft, bool $createFromDraft=false)
 Refactored thread creation to method, refactoring to a separate class should be done in next refactoring steps. More...
 
 renderSplitButton (ilTemplate $tpl, string $action, bool $is_post, ilForumPost $node, int $pageIndex=0, ilForumPostDraft $draft=null)
 
 doHistoryCheck ($draftId)
 

Private Attributes

 $viewModeOptions
 
 $sortationOptions
 
 $defaultSorting
 
 $globalScreen
 
 $objCurrentTopic
 
 $objCurrentPost
 
 $display_confirm_post_activation = 0
 
 $is_moderator = false
 
 $create_form_gui
 
 $replyEditForm
 
 $hideToolbar = false
 
 $httpRequest
 
 $uiFactory
 
 $uiRenderer
 
 $forumObjects = null
 
 $confirmation_gui_html = ''
 
 $forum_settings_gui
 
 $requestAction = ''
 

Additional Inherited Members

- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjForumGUI::__construct (   $a_data,
  $a_id,
  $a_call_by_reference = true,
  $a_prepare_output = true 
)

Definition at line 102 of file class.ilObjForumGUI.php.

103 {
104 global $DIC;
105
106 $this->ctrl = $DIC->ctrl();
107 $this->ctrl->saveParameter($this, ['ref_id', 'cmdClass']);
108
109 $this->tpl = $DIC->ui()->mainTemplate();
110 $this->lng = $DIC->language();
111 $this->httpRequest = $DIC->http()->request();
112 $this->uiFactory = $DIC->ui()->factory();
113 $this->uiRenderer = $DIC->ui()->renderer();
114 $this->globalScreen = $DIC->globalScreen();
115
116 $this->access = $DIC->access();
117 $this->ilObjDataCache = $DIC['ilObjDataCache'];
118 $this->tabs = $DIC->tabs();
119 $this->error = $DIC['ilErr'];
120 $this->ilNavigationHistory = $DIC['ilNavigationHistory'];
121 $this->user = $DIC->user();
122 $this->settings = $DIC->settings();
123 $this->toolbar = $DIC->toolbar();
124 $this->repositoryTree = $DIC->repositoryTree();
125 $this->ilHelp = $DIC['ilHelp'];
126 $this->rbac = $DIC->rbac();
127 $this->locator = $DIC['ilLocator'];
128
129 $this->tpl->addJavaScript('./Services/JavaScript/js/Basic.js');
130
131 $this->type = 'frm';
132 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
133
134 $this->lng->loadLanguageModule('forum');
135
136 $this->initSessionStorage();
137
138 $this->objProperties = \ilForumProperties::getInstance($this->ilObjDataCache->lookupObjId($_GET['ref_id']));
139 $this->is_moderator = $this->access->checkAccess('moderate_frm', '', $_GET['ref_id']);
140
141 $this->objCurrentTopic = new ilForumTopic((int) $this->httpRequest->getQueryParams()['thr_pk'] ?? 0, $this->is_moderator);
142 $this->objCurrentPost = new ilForumPost((int) $this->httpRequest->getQueryParams()['pos_pk'] ?? 0, $this->is_moderator);
143
144 $this->requestAction = (string) ($this->httpRequest->getQueryParams()['action'] ?? '');
145 }
user()
Definition: user.php:4
$_GET["client_id"]
error($a_errmsg)
set error message @access public
static getInstance($a_obj_id=0)
Online help application class.
Navigation History of Repository Items.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46

References $_GET, $DIC, ILIAS\GlobalScreen\Provider\__construct(), error(), ilForumProperties\getInstance(), initSessionStorage(), settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjForumGUI::_goto (   $a_target,
  $a_thread = 0,
  $a_posting = 0 
)
static

Definition at line 1349 of file class.ilObjForumGUI.php.

1350 {
1351 global $DIC;
1352
1353 $ilAccess = $DIC->access();
1354 $lng = $DIC->language();
1355 $ilErr = $DIC['ilErr'];
1356
1357 if ($ilAccess->checkAccess('read', '', $a_target)) {
1358 if ($a_thread != 0) {
1359 $objTopic = new ilForumTopic($a_thread);
1360 if ($objTopic->getFrmObjId() &&
1361 $objTopic->getFrmObjId() != ilObject::_lookupObjectId($a_target)) {
1362 $ref_ids = ilObject::_getAllReferences($objTopic->getFrmObjId());
1363 foreach ($ref_ids as $ref_id) {
1364 if ($ilAccess->checkAccess('read', '', $ref_id)) {
1365 $new_ref_id = $ref_id;
1366 break;
1367 }
1368 }
1369
1370 if (isset($new_ref_id) && $new_ref_id != $a_target) {
1371 $DIC->ctrl()->redirectToURL(
1372 ILIAS_HTTP_PATH . '/goto.php?target=frm_' . $new_ref_id . '_' . $a_thread . '_' . $a_posting
1373 );
1374 }
1375 }
1376
1377 $DIC->ctrl()->setParameterByClass(ilObjForumGUI::class, 'ref_id', (int) $a_target);
1378 if (is_numeric($a_thread)) {
1379 $DIC->ctrl()->setParameterByClass(ilObjForumGUI::class, 'thr_pk', (int) $a_thread);
1380 }
1381 if (is_numeric($a_posting)) {
1382 $DIC->ctrl()->setParameterByClass(ilObjForumGUI::class, 'pos_pk', (int) $a_posting);
1383 }
1384 $DIC->ctrl()->redirectByClass(
1385 [ilRepositoryGUI::class, self::class],
1386 'viewThread',
1387 is_numeric($a_posting) ? (int) $a_posting : ''
1388 );
1389 } else {
1390 $_GET['ref_id'] = $a_target;
1391 $_GET['baseClass'] = 'ilRepositoryGUI';
1392 include_once('ilias.php');
1393 exit();
1394 }
1395 } elseif ($ilAccess->checkAccess('visible', '', $a_target)) {
1396 $DIC->ctrl()->setParameterByClass(ilInfoScreenGUI::class, 'ref_id', $a_target);
1397 $DIC->ctrl()->redirectByClass(
1398 [
1399 ilRepositoryGUI::class,
1400 self::class,
1401 ilInfoScreenGUI::class
1402 ],
1403 'showSummary'
1404 );
1405 } elseif ($ilAccess->checkAccess('read', '', ROOT_FOLDER_ID)) {
1406 $_GET['target'] = '';
1407 $_GET['ref_id'] = ROOT_FOLDER_ID;
1408 ilUtil::sendInfo(sprintf(
1409 $lng->txt('msg_no_perm_read_item'),
1411 ), true);
1412 $_GET['baseClass'] = 'ilRepositoryGUI';
1413 include_once('ilias.php');
1414 exit();
1415 }
1416
1417 $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
1418 }
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _getAllReferences($a_id)
get all reference ids of object
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
exit
Definition: login.php:29

References $_GET, $DIC, $ilErr, $lng, ilObject\_getAllReferences(), ilObject\_lookupObjectId(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, ILIAS_HTTP_PATH, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ addCensorshipObject()

ilObjForumGUI::addCensorshipObject ( )
private

Definition at line 1637 of file class.ilObjForumGUI.php.

1638 {
1639 $this->handleCensorship();
1640 }

◆ addLocatorItems()

ilObjForumGUI::addLocatorItems ( )
protected

should be overwritten to add object specific items (repository items are preloaded)

Reimplemented from ilObjectGUI.

Definition at line 3908 of file class.ilObjForumGUI.php.

3909 {
3910 if ($this->object instanceof \ilObjForum) {
3911 $this->locator->addItem(
3912 $this->object->getTitle(),
3913 $this->ctrl->getLinkTarget($this),
3914 '',
3915 $this->object->getRefId()
3916 );
3917 }
3918 }
Class ilObjForum.

◆ addThreadObject()

ilObjForumGUI::addThreadObject ( )
protected

Definition at line 3834 of file class.ilObjForumGUI.php.

3835 {
3836 $draft = new \ilForumPostDraft();
3838 $draftId = (int) ($this->httpRequest->getParsedBody()['draft_id'] ?? 0);
3839 if ($draftId > 0) {
3840 $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
3841 }
3842 }
3843
3844 $this->createThread($draft, false);
3845 }
static newInstanceByDraftId($draft_id)
createThread(\ilForumPostDraft $draft, bool $createFromDraft=false)
Refactored thread creation to method, refactoring to a separate class should be done in next refactor...

References ilForumPostDraft\isSavePostDraftAllowed(), and ilForumPostDraft\newInstanceByDraftId().

+ Here is the call graph for this function:

◆ afterSave()

ilObjForumGUI::afterSave ( ilObject  $a_new_object)
protected
Parameters
ilObject | ilObjForum$a_new_object

Reimplemented from ilObjectGUI.

Definition at line 1177 of file class.ilObjForumGUI.php.

1178 {
1179 \ilUtil::sendSuccess($this->lng->txt('frm_added'), true);
1180 $this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
1181 $this->ctrl->redirect($this, 'createThread');
1182 }
getRefId()
get reference id @access public

References ilObject\getRefId().

+ Here is the call graph for this function:

◆ askForPostActivationObject()

ilObjForumGUI::askForPostActivationObject ( )

Definition at line 1667 of file class.ilObjForumGUI.php.

1668 {
1669 if (!$this->is_moderator) {
1670 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1671 }
1672
1673 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1674 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1675 }
1676
1678
1679 $this->viewThreadObject();
1680 }
setDisplayConfirmPostActivation($status=0)

References error().

+ Here is the call graph for this function:

◆ autosaveDraftAsyncObject()

ilObjForumGUI::autosaveDraftAsyncObject ( )
protected

Definition at line 4953 of file class.ilObjForumGUI.php.

4954 {
4955 $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4956 if (
4957 $this->requestAction !== 'ready_showreply' &&
4958 $this->access->checkAccess('read', '', $this->object->getRefId()) &&
4959 $this->access->checkAccess('add_reply', '', $this->object->getRefId())
4960 ) {
4961 $action = new \ilForumAutoSaveAsyncDraftAction(
4962 $this->user,
4963 $this->getReplyEditForm(),
4964 $this->objProperties,
4965 $this->objCurrentTopic,
4966 $this->objCurrentPost,
4967 function (string $message) : string {
4968 return $this->handleFormInput($message);
4969 },
4970 $draftId,
4971 (int) \ilObjForum::lookupForumIdByRefId($this->ref_id),
4972 \ilUtil::stripSlashes($this->requestAction)
4973 );
4974
4975 echo json_encode($action->executeAndGetResponseObject());
4976 }
4977
4978 exit();
4979 }
handleFormInput($a_text, $a_stripslashes=true)
static lookupForumIdByRefId($ref_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$message
Definition: xapiexit.php:14

References $message, exit, ilObjForum\lookupForumIdByRefId(), ilUtil\stripSlashes(), and user().

+ Here is the call graph for this function:

◆ autosaveThreadDraftAsyncObject()

ilObjForumGUI::autosaveThreadDraftAsyncObject ( )
protected

Definition at line 4981 of file class.ilObjForumGUI.php.

4982 {
4983 $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4984 if (
4985 $this->requestAction !== 'ready_showreply' &&
4986 $this->access->checkAccess('read', '', $this->object->getRefId()) &&
4987 $this->access->checkAccess('add_thread', '', $this->object->getRefId())
4988 ) {
4989 $action = new \ilForumAutoSaveAsyncDraftAction(
4990 $this->user,
4991 $this->buildThreadForm(),
4992 $this->objProperties,
4993 $this->objCurrentTopic,
4994 $this->objCurrentPost,
4995 function (string $message) : string {
4996 return $this->handleFormInput($message, false);
4997 },
4998 $draftId,
4999 (int) \ilObjForum::lookupForumIdByRefId($this->ref_id),
5000 \ilUtil::stripSlashes($this->requestAction)
5001 );
5002
5003 echo json_encode($action->executeAndGetResponseObject());
5004 }
5005
5006 exit();
5007 }
buildThreadForm($isDraft=false)

References $message, exit, ilObjForum\lookupForumIdByRefId(), ilUtil\stripSlashes(), and user().

+ Here is the call graph for this function:

◆ buildThreadForm()

ilObjForumGUI::buildThreadForm (   $isDraft = false)
private
Parameters
bool$isDraft
Returns
\ilPropertyFormGUI

Definition at line 3647 of file class.ilObjForumGUI.php.

3648 {
3649 $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
3650 $allowNotification = !$this->objProperties->isAnonymized();
3651
3652 $mail = new \ilMail($this->user->getId());
3653 if (!$this->rbac->system()->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
3654 $allowNotification = false;
3655 }
3656
3657 $form = new \ilForumThreadFormGUI(
3658 $this,
3659 $this->objProperties,
3661 $allowNotification,
3662 $isDraft,
3663 $draftId
3664 );
3665
3666 $this->decorateWithAutosave($form);
3667
3668 return $form;
3669 }
decorateWithAutosave(\ilPropertyFormGUI $form)
This class represents a property form user interface.

References user().

+ Here is the call graph for this function:

◆ cancelDraftObject()

ilObjForumGUI::cancelDraftObject ( )

Definition at line 1743 of file class.ilObjForumGUI.php.

1744 {
1745 $this->requestAction = '';
1746 if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
1748 $history_obj = new ilForumDraftsHistory();
1749 $history_obj->getFirstAutosaveByDraftId((int) $_GET['draft_id']);
1750 $draft = ilForumPostDraft::newInstanceByDraftId((int) $_GET['draft_id']);
1751 $draft->setPostSubject($history_obj->getPostSubject());
1752 $draft->setPostMessage($history_obj->getPostMessage());
1753
1755 $history_obj->getPostMessage(),
1757 $history_obj->getHistoryId(),
1759 $draft->getDraftId()
1760 );
1761
1762 $draft->updateDraft();
1763
1764 $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
1765 }
1766 }
1767 $this->ctrl->clearParameters($this);
1768 $this->viewThreadObject();
1769 }
Class ilForumDraftHistory.
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)

References $_GET, ilForumPostDraft\isAutoSavePostDraftAllowed(), ilForumDraftsHistory\MEDIAOBJECT_TYPE, ilForumPostDraft\MEDIAOBJECT_TYPE, ilForumUtil\moveMediaObjects(), and ilForumPostDraft\newInstanceByDraftId().

+ Here is the call graph for this function:

◆ cancelMoveThreadsObject()

ilObjForumGUI::cancelMoveThreadsObject ( )

Definition at line 3509 of file class.ilObjForumGUI.php.

3510 {
3511 unset($_SESSION['threads2move']);
3512 $this->ctrl->redirect($this, 'showThreads');
3513 }
$_SESSION["AccountId"]

References $_SESSION.

◆ cancelPostObject()

ilObjForumGUI::cancelPostObject ( )

Definition at line 1732 of file class.ilObjForumGUI.php.

1733 {
1734 $this->requestAction = '';
1735 if (isset($_POST['draft_id']) && (int) $_POST['draft_id'] > 0) {
1736 $draft = ilForumPostDraft::newInstanceByDraftId((int) $_POST['draft_id']);
1737 $draft->deleteDraftsByDraftIds(array((int) $_POST['draft_id']));
1738 }
1739
1740 $this->viewThreadObject();
1741 }
$_POST["username"]

References $_POST, and ilForumPostDraft\newInstanceByDraftId().

+ Here is the call graph for this function:

◆ checkDraftAccess()

ilObjForumGUI::checkDraftAccess ( int  $draftId)
Parameters
int$draftId
Returns
bool

Definition at line 5270 of file class.ilObjForumGUI.php.

5270 : bool
5271 {
5272 $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
5273 if (
5274 !$this->access->checkAccess('add_reply', '', $this->object->getRefId()) || $this->user->isAnonymous() ||
5275 ($draft instanceof \ilForumPostDraft && $this->user->getId() != $draft->getPostAuthorId())
5276 ) {
5277 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5278 }
5279
5280 return true;
5281 }
Class ilForumPostDraft.

References error(), ilForumPostDraft\getPostAuthorId(), and ilForumPostDraft\newInstanceByDraftId().

+ Here is the call graph for this function:

◆ checkUsersViewMode()

ilObjForumGUI::checkUsersViewMode ( )

Definition at line 2733 of file class.ilObjForumGUI.php.

2733 : void
2734 {
2735 if (!isset($_SESSION['viewmode'])) {
2736 $_SESSION['viewmode'] = $this->objProperties->getDefaultView();
2737 }
2738
2739 if (isset($_GET['viewmode']) && (int) $_GET['viewmode'] !== (int) $_SESSION['viewmode']) {
2740 $_SESSION['viewmode'] = (int) $_GET['viewmode'];
2741 }
2742
2743 if (isset($_GET['action']) && !in_array($_SESSION['viewmode'], [
2747 ])) {
2748 $_SESSION['viewmode'] = $this->objProperties->getDefaultView();
2749 }
2750 }

References $_GET, $_SESSION, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

◆ confirmDeleteThreadDraftsObject()

ilObjForumGUI::confirmDeleteThreadDraftsObject ( )
protected

Definition at line 1512 of file class.ilObjForumGUI.php.

1513 {
1514 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1515 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1516 }
1517
1518 $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()['draft_ids'] ?? []));
1519 if (0 === count($draftIds)) {
1520 \ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1521 $this->showThreadsObject();
1522 return;
1523 }
1524
1525 $confirmation = new ilConfirmationGUI();
1526 $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteThreadDrafts'));
1527 $confirmation->setHeaderText($this->lng->txt('sure_delete_drafts'));
1528 $confirmation->setCancel($this->lng->txt('cancel'), 'showThreads');
1529 $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteThreadDrafts');
1530 $instances = \ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
1531 foreach ($draftIds as $draftId) {
1532 if (array_key_exists($draftId, $instances)) {
1533 $confirmation->addItem('draft_ids[]', $draftId, $instances[$draftId]->getPostSubject());
1534 }
1535 }
1536
1537 $this->tpl->setContent($confirmation->getHTML());
1538 }
Confirmation screen class.
static getDraftInstancesByUserId($user_id)

References error(), ilForumPostDraft\getDraftInstancesByUserId(), ilUtil\sendInfo(), and user().

+ Here is the call graph for this function:

◆ confirmDeleteThreads()

ilObjForumGUI::confirmDeleteThreads ( )

Definition at line 1471 of file class.ilObjForumGUI.php.

1472 {
1473 if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1474 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1475 return $this->showThreadsObject();
1476 }
1477
1478 if (!$this->is_moderator) {
1479 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1480 }
1481
1482 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1483 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1484 }
1485
1486 $threads = [];
1487 array_walk($_POST['thread_ids'], function ($threadId) use (&$threads) {
1488 $thread = new \ilForumTopic($threadId);
1489 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
1490
1491 $threads[] = $thread;
1492 });
1493
1494 $c_gui = new ilConfirmationGUI();
1495
1496 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteThreads'));
1497 $c_gui->setHeaderText($this->lng->txt('frm_sure_delete_threads'));
1498 $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
1499 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteThreads');
1500
1501 foreach ($threads as $thread) {
1502 $c_gui->addItem('thread_ids[]', $thread->getId(), $thread->getSubject());
1503 }
1504
1505 $this->confirmation_gui_html = $c_gui->getHTML();
1506
1507 $this->hideToolbar(true);
1508
1509 return $this->tpl->setContent($c_gui->getHTML());
1510 }
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
hideToolbar($a_flag=null)

References $_POST, error(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ confirmMergeThreadsObject()

ilObjForumGUI::confirmMergeThreadsObject ( )

Definition at line 4214 of file class.ilObjForumGUI.php.

4215 {
4216 if (!$this->is_moderator) {
4217 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4218 }
4219
4220 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4221 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4222 }
4223
4224 $sourceThreadId = (int) ($this->httpRequest->getQueryParams()['merge_thread_id'] ?? 0);
4225 $targetThreadIds = array_values(
4226 array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
4227 );
4228
4229 if (!($sourceThreadId > 0) || 1 !== count($targetThreadIds)) {
4230 \ilUtil::sendFailure($this->lng->txt('select_one'));
4231 $this->mergeThreadsObject();
4232 return;
4233 }
4234
4235 $targetThreadId = current($targetThreadIds);
4236 if ($sourceThreadId == $targetThreadId) {
4237 \ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
4238 $this->showThreadsObject();
4239 return;
4240 }
4241
4242 if (ilForumTopic::lookupForumIdByTopicId($sourceThreadId) != ilForumTopic::lookupForumIdByTopicId($targetThreadId)) {
4243 \ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
4244 $this->ctrl->clearParameters($this);
4245 $this->showThreadsObject();
4246 return;
4247 }
4248
4249 if (\ilForumTopic::_lookupDate($sourceThreadId) < ilForumTopic::_lookupDate($targetThreadId)) {
4250 \ilUtil::sendInfo($this->lng->txt('switch_threads_for_merge'));
4251 }
4252
4253 $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $sourceThreadId));
4254 $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $targetThreadId));
4255
4256 $c_gui = new ilConfirmationGUI();
4257
4258 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performMergeThreads'));
4259 $c_gui->setHeaderText($this->lng->txt('frm_sure_merge_threads'));
4260 $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
4261 $c_gui->setConfirm($this->lng->txt('confirm'), 'performMergeThreads');
4262
4263 $c_gui->addItem(
4264 'thread_ids[]',
4265 $sourceThreadId,
4266 sprintf($this->lng->txt('frm_merge_src'), ilForumTopic::_lookupTitle($sourceThreadId))
4267 );
4268 $c_gui->addItem(
4269 'thread_ids[]',
4270 $targetThreadId,
4271 sprintf($this->lng->txt('frm_merge_target'), ilForumTopic::_lookupTitle($targetThreadId))
4272 );
4273 $this->tpl->setContent($c_gui->getHTML());
4274 }
static lookupForumIdByTopicId($a_topic_id)
static _lookupDate($thread_id)
static _lookupTitle($a_topic_id)
Looks up the title/subject of a topic/thread.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References ilForumTopic\_lookupDate(), ilForumTopic\_lookupTitle(), error(), ilForumTopic\lookupForumIdByTopicId(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ createThread()

ilObjForumGUI::createThread ( \ilForumPostDraft  $draft,
bool  $createFromDraft = false 
)
private

Refactored thread creation to method, refactoring to a separate class should be done in next refactoring steps.

Parameters
ilForumPostDraft$draft
bool$createFromDraft

Definition at line 3693 of file class.ilObjForumGUI.php.

3694 {
3695 if (
3696 !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
3697 !$this->access->checkAccess('read', '', $this->object->getRefId())
3698 ) {
3699 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3700 }
3701
3702 $frm = $this->object->Forum;
3703 $frm->setForumId($this->object->getId());
3704 $frm->setForumRefId($this->object->getRefId());
3705 $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3706 $topicData = $frm->getOneTopic();
3707
3708 $form = $this->buildThreadForm($createFromDraft);
3709 if ($form->checkInput()) {
3710 $this->doCaptchaCheck();
3711
3712 $userIdForDisplayPurposes = $this->user->getId();
3713 if ($this->isWritingWithPseudonymAllowed()) {
3714 $userIdForDisplayPurposes = 0;
3715 }
3716
3717 $status = 1;
3718 if (
3719 ($this->objProperties->isPostActivationEnabled() && !$this->is_moderator) ||
3720 $this->objCurrentPost->isAnyParentDeactivated()
3721 ) {
3722 $status = 0;
3723 }
3724
3725 if ($createFromDraft) {
3726 $newThread = new \ilForumTopic(0, true, true);
3727 $newThread->setForumId($topicData['top_pk']);
3728 $newThread->setThrAuthorId($draft->getPostAuthorId());
3729 $newThread->setDisplayUserId($draft->getPostDisplayUserId());
3730 $newThread->setSubject($this->handleFormInput($form->getInput('subject'), false));
3731 $newThread->setUserAlias($draft->getPostUserAlias());
3732
3733 $newPost = $frm->generateThread(
3734 $newThread,
3735 \ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0),
3736 $draft->getNotify(),
3737 $draft->getPostNotify(),
3738 $status
3739 );
3740 } else {
3742 $form->getInput('alias'),
3743 $this->objProperties->isAnonymized()
3744 );
3745 $newThread = new \ilForumTopic(0, true, true);
3746 $newThread->setForumId($topicData['top_pk']);
3747 $newThread->setThrAuthorId($this->user->getId());
3748 $newThread->setDisplayUserId($userIdForDisplayPurposes);
3749 $newThread->setSubject($this->handleFormInput($form->getInput('subject'), false));
3750 $newThread->setUserAlias($userAlias);
3751
3752 $newPost = $frm->generateThread(
3753 $newThread,
3754 \ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0),
3755 $form->getItemByPostVar('notify') ? (int) $form->getInput('notify') : 0,
3756 0, // #19980
3757 $status
3758 );
3759 }
3760
3761 if ($this->objProperties->isFileUploadAllowed()) {
3762 $file = $_FILES['userfile'];
3763 if (is_array($file) && !empty($file)) {
3764 $fileData = new \ilFileDataForum($this->object->getId(), $newPost);
3765 $fileData->storeUploadedFile($file);
3766 }
3767 }
3768
3769 $frm->setDbTable('frm_data');
3770 $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
3771 $frm->updateVisits($topicData['top_pk']);
3772
3773 if ($createFromDraft) {
3774 $mediaObjects = \ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
3775 } else {
3776 $mediaObjects = \ilRTE::_getMediaObjects($form->getInput('message'), 0);
3777 }
3778 foreach ($mediaObjects as $mob) {
3779 if (\ilObjMediaObject::_exists($mob)) {
3780 \ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
3781 \ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
3782 }
3783 }
3784
3785 if ($draft->getDraftId() > 0) {
3786 $draftHistory = new \ilForumDraftsHistory();
3787 $draftHistory->deleteHistoryByDraftIds([$draft->getDraftId()]);
3788 if ($this->objProperties->isFileUploadAllowed()) {
3789 $forumFileData = new \ilFileDataForum($this->object->getId(), $newPost);
3790 $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
3791 $draftFileData->moveFilesOfDraft($forumFileData->getForumPath(), $newPost);
3792 }
3793 $draft->deleteDraft();
3794 }
3795
3796 $GLOBALS['ilAppEventHandler']->raise(
3797 'Modules/Forum',
3798 'createdPost',
3799 [
3800 'ref_id' => $this->object->getRefId(),
3801 'post' => new \ilForumPost($newPost),
3802 'notify_moderators' => !$status
3803 ]
3804 );
3805
3806 \ilUtil::sendSuccess($this->lng->txt('forums_thread_new_entry'), true);
3807 $this->ctrl->redirect($this);
3808 }
3809
3810 $form->setValuesByPost();
3811 if (!$this->objProperties->isAnonymized()) {
3812 $form->getItemByPostVar('alias')->setValue($this->user->getLogin());
3813 }
3814
3815 $this->tpl->setContent($form->getHTML());
3816 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getPublicUserAlias($user_alias, $is_anonymized=false)
doCaptchaCheck()
Performs a CAPTCHA check for anonymous users if the CAPTCHA should be used for forums in the public a...
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
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.

References $GLOBALS, ilObjMediaObject\_exists(), ilRTE\_getMediaObjects(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), ilForumPostDraft\deleteDraft(), error(), ilForumPostDraft\getDraftId(), ilForumPostDraft\getNotify(), ilForumPostDraft\getPostAuthorId(), ilForumPostDraft\getPostDisplayUserId(), ilForumPostDraft\getPostNotify(), ilForumPostDraft\getPostUserAlias(), ilForumUtil\getPublicUserAlias(), and user().

+ Here is the call graph for this function:

◆ createThreadObject()

ilObjForumGUI::createThreadObject ( )
protected

Definition at line 3671 of file class.ilObjForumGUI.php.

3672 {
3673 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3674 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3675 }
3676
3677 if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
3678 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3679 }
3680
3681 $templateForWidthHandling = new \ilTemplate('tpl.create_thread_form.html', true, true, 'Modules/Forum');
3682 $templateForWidthHandling->setVariable('CREATE_FORM', $this->buildThreadForm()->getHTML());
3683 $templateForWidthHandling->parseCurrentBlock();
3684
3685 $this->tpl->setContent($templateForWidthHandling->get());
3686 }

References error().

+ Here is the call graph for this function:

◆ createTopLevelPostObject()

ilObjForumGUI::createTopLevelPostObject ( )

Definition at line 2172 of file class.ilObjForumGUI.php.

2173 {
2174 if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0 && !$this->user->isAnonymous()
2176 $draft_obj = new ilForumPostDraft(
2177 $this->user->getId(),
2178 $this->objCurrentPost->getId(),
2179 (int) $_GET['draft_id']
2180 );
2181 }
2182
2183 if ($draft_obj instanceof ilForumPostDraft && $draft_obj->getDraftId() > 0) {
2184 $this->ctrl->setParameter($this, 'action', 'editdraft');
2185 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
2186 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
2187 $this->ctrl->setParameter($this, 'draft_id', $draft_obj->getDraftId());
2188 $this->ctrl->setParameter($this, 'page', 1);
2189 $this->ctrl->setParameter(
2190 $this,
2191 'orderby',
2192 \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
2193 );
2194 $this->ctrl->redirect($this, 'editDraft');
2195 } else {
2196 $this->viewThreadObject();
2197 }
2198 return;
2199 }

References $_GET, ilForumPostDraft\getDraftId(), ilForumPostDraft\isSavePostDraftAllowed(), ilUtil\stripSlashes(), and user().

+ Here is the call graph for this function:

◆ decorateWithAutosave()

ilObjForumGUI::decorateWithAutosave ( \ilPropertyFormGUI  $form)
private
Parameters
\ilPropertyFormGUI$form

Definition at line 242 of file class.ilObjForumGUI.php.

243 {
246
247 $this->tpl->addJavascript('./Modules/Forum/js/autosave.js');
248 $autosave_cmd = 'autosaveDraftAsync';
249 if ($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0) {
250 $autosave_cmd = 'autosaveThreadDraftAsync';
251 }
252 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
253 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
254 $draft_id = (int) $_GET['draft_id'] > 0 ? (int) $_GET['draft_id'] : 0;
255 $this->ctrl->setParameter($this, 'draft_id', $draft_id);
256 $this->ctrl->setParameter($this, 'action', \ilUtil::stripSlashes($this->requestAction));
257 $this->tpl->addOnLoadCode(
258 "il.Language.setLangVar('saving', " . json_encode($this->lng->txt('saving')) . ");"
259 );
260
261 $this->tpl->addOnLoadCode('il.ForumDraftsAutosave.init(' . json_encode(array(
262 'loading_img_src' => \ilUtil::getImagePath('loader.svg'),
263 'draft_id' => $draft_id,
264 'interval' => $interval * 1000,
265 'url' => $this->ctrl->getFormAction($this, $autosave_cmd, '', true, false),
266 'selectors' => array(
267 'form' => '#form_' . $form->getId()
268 )
269 )) . ');');
270 }
271 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $_GET, ilFormGUI\getId(), ilUtil\getImagePath(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilForumPostDraft\lookupAutosaveInterval(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ deleteMobsOfDraft()

ilObjForumGUI::deleteMobsOfDraft (   $draft_id,
  $message 
)
protected

todo: move to ilForumUtil

Parameters
$draft_id
$message

Definition at line 4880 of file class.ilObjForumGUI.php.

4881 {
4882 // remove usage of deleted media objects
4883 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draft_id);
4884 $curMediaObjects = ilRTE::_getMediaObjects($message, 0);
4885 foreach ($oldMediaObjects as $oldMob) {
4886 $found = false;
4887 foreach ($curMediaObjects as $curMob) {
4888 if ($oldMob == $curMob) {
4889 $found = true;
4890 break;
4891 }
4892 }
4893 if (!$found) {
4894 if (ilObjMediaObject::_exists($oldMob)) {
4895 ilObjMediaObject::_removeUsage($oldMob, 'frm~d:html', $draft_id);
4896 $mob_obj = new ilObjMediaObject($oldMob);
4897 $mob_obj->delete();
4898 }
4899 }
4900 }
4901 }
Class ilObjMediaObject.

References $message, ilObjMediaObject\_exists(), ilRTE\_getMediaObjects(), ilObjMediaObject\_getMobsOfObject(), and ilObjMediaObject\_removeUsage().

+ Here is the call graph for this function:

◆ deletePostingDraftObject()

ilObjForumGUI::deletePostingDraftObject ( )
private

Definition at line 1627 of file class.ilObjForumGUI.php.

1628 {
1629 $this->deleteSelectedDraft();
1630 }
deleteSelectedDraft(ilForumPostDraft $draft_obj=null)

◆ deleteSelectedDraft()

ilObjForumGUI::deleteSelectedDraft ( ilForumPostDraft  $draft_obj = null)
protected
Parameters
ilForumPostDraft | null$draft_obj

Definition at line 4906 of file class.ilObjForumGUI.php.

4907 {
4908 if (
4909 !$this->access->checkAccess('add_reply', '', (int) $_GET['ref_id']) ||
4910 $this->user->isAnonymous() ||
4911 ($draft_obj instanceof ilForumPostDraft && $this->user->getId() != $draft_obj->getPostAuthorId())) {
4912 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4913 }
4914
4915 $post_id = $this->objCurrentPost->getId();
4916 if (!($draft_obj instanceof ilForumPostDraft)) {
4917 $draft_id_to_delete = (int) $_GET['draft_id'];
4918 $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, $draft_id_to_delete);
4919
4920 if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete)) {
4921 $this->ctrl->clearParameters($this);
4922 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4923 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4924 $this->ctrl->redirect($this, 'viewThread');
4925 }
4926 }
4927
4928 $this->deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
4929
4930 $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_obj->getDraftId());
4931 $objFileDataForumDrafts->delete();
4932
4934 $GLOBALS['ilAppEventHandler']->raise(
4935 'Modules/Forum',
4936 'deletedDraft',
4937 array(
4938 'draftObj' => $draft_obj,
4939 'obj_id' => $this->object->getId(),
4940 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
4941 )
4942 );
4943 }
4944 $draft_obj->deleteDraft();
4945
4946 ilUtil::sendSuccess($this->lng->txt('delete_draft_successfully'), true);
4947 $this->ctrl->clearParameters($this);
4948 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4949 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4950 $this->ctrl->redirect($this, 'viewThread');
4951 }
This class handles all operations on files for the drafts of a forum object.
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil

References $_GET, $GLOBALS, error(), ilForumPostDraft\getPostAuthorId(), ilForumPostDraft\isSavePostDraftAllowed(), and user().

+ Here is the call graph for this function:

◆ deleteThreadDraftsObject()

ilObjForumGUI::deleteThreadDraftsObject ( )
protected

Definition at line 3598 of file class.ilObjForumGUI.php.

3599 {
3600 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3601 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3602 }
3603
3604 $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()['draft_ids'] ?? []));
3605 if (0 === count($draftIds)) {
3606 $draftIds = array_filter([(int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0)]);
3607 }
3608
3609 $instances = \ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
3610 $checkedDraftIds = [];
3611 foreach ($draftIds as $draftId) {
3612 if (array_key_exists($draftId, $instances)) {
3613 $checkedDraftIds[] = $draftId;
3614 $draft = $instances[$draftId];
3615
3616 $this->deleteMobsOfDraft($draft->getDraftId(), $draft->getPostMessage());
3617
3618 $draftFileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
3619 $draftFileData->delete();
3620
3621 $GLOBALS['ilAppEventHandler']->raise(
3622 'Modules/Forum',
3623 'deletedDraft',
3624 [
3625 'draftObj' => $draft,
3626 'obj_id' => $this->object->getId(),
3627 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
3628 ]
3629 );
3630
3631 $draft->deleteDraft();
3632 }
3633 }
3634
3635 if (count($checkedDraftIds) > 1) {
3636 \ilUtil::sendInfo($this->lng->txt('delete_drafts_successfully'), true);
3637 } else {
3638 \ilUtil::sendInfo($this->lng->txt('delete_draft_successfully'), true);
3639 }
3640 $this->ctrl->redirect($this, 'showThreads');
3641 }

References $GLOBALS, error(), ilForumPostDraft\getDraftInstancesByUserId(), ilUtil\sendInfo(), and user().

+ Here is the call graph for this function:

◆ deliverDraftZipFileObject()

ilObjForumGUI::deliverDraftZipFileObject ( )
protected

Definition at line 4339 of file class.ilObjForumGUI.php.

4340 {
4341 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4342 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4343 }
4344
4345 $draftId = $this->httpRequest->getQueryParams()['draft_id'] ?? 0;
4346 $draft = \ilForumPostDraft::newInstanceByDraftId((int) $draftId);
4347 if ($draft->getPostAuthorId() == $this->user->getId()) {
4348 $fileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
4349 if (!$fileData->deliverZipFile()) {
4350 $this->ctrl->redirect($this);
4351 }
4352 }
4353 }

References error(), and ilForumPostDraft\newInstanceByDraftId().

+ Here is the call graph for this function:

◆ deliverZipFileObject()

ilObjForumGUI::deliverZipFileObject ( )
protected

Definition at line 4358 of file class.ilObjForumGUI.php.

4359 {
4360 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4361 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4362 }
4363
4364 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
4365
4366 $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
4367 if (!$fileData->deliverZipFile()) {
4368 $this->ctrl->redirect($this);
4369 }
4370 }

References error().

+ Here is the call graph for this function:

◆ disableForumNotificationObject()

ilObjForumGUI::disableForumNotificationObject ( )
protected

Definition at line 3867 of file class.ilObjForumGUI.php.

3868 {
3869 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3870 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3871 }
3872
3873 $frm = $this->object->Forum;
3874 $frm->setForumId($this->object->getId());
3875 $frm->disableForumNotification($this->user->getId());
3876
3877 if ((int) $this->objCurrentTopic->getId() > 0) {
3878 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3879 \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'), true);
3880 $this->ctrl->redirect($this, 'viewThread');
3881 }
3882
3883 \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'));
3884 $this->showThreadsObject();
3885 }

References error(), ilUtil\sendInfo(), and user().

+ Here is the call graph for this function:

◆ displayConfirmPostActivation()

ilObjForumGUI::displayConfirmPostActivation ( )

Definition at line 1687 of file class.ilObjForumGUI.php.

1688 {
1690 }

◆ doCaptchaCheck()

ilObjForumGUI::doCaptchaCheck ( )
protected

Performs a CAPTCHA check for anonymous users if the CAPTCHA should be used for forums in the public area.

Definition at line 5340 of file class.ilObjForumGUI.php.

5341 {
5342 if ($this->user->isAnonymous() && !$this->user->isCaptchaVerified() && \ilCaptchaUtil::isActiveForForum()) {
5343 $this->user->setCaptchaVerified(true);
5344 }
5345 }

References user().

+ Here is the call graph for this function:

◆ doHistoryCheck()

ilObjForumGUI::doHistoryCheck (   $draftId)
private
Parameters
$draftId

Definition at line 5286 of file class.ilObjForumGUI.php.

5287 {
5288 if (!$this->checkDraftAccess($draftId)) {
5289 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5290 }
5291
5293 return;
5294 }
5295
5297 $draftsFromHistory = \ilForumDraftsHistory::getInstancesByDraftId($draftId);
5298 if (is_array($draftsFromHistory) && sizeof($draftsFromHistory) > 0) {
5299 $modal = \ilModalGUI::getInstance();
5300 $modal->setHeading($this->lng->txt('restore_draft_from_autosave'));
5301 $modal->setId('frm_autosave_restore');
5302 $form_tpl = new \ilTemplate('tpl.restore_thread_draft.html', true, true, 'Modules/Forum');
5303
5304 foreach ($draftsFromHistory as $key => $history_instance) {
5305 $accordion = new ilAccordionGUI();
5306 $accordion->setId('acc_' . $history_instance->getHistoryId());
5307
5308 $form_tpl->setCurrentBlock('list_item');
5309 $message = \ilRTE::_replaceMediaObjectImageSrc($history_instance->getPostMessage(), 1);
5310
5311 $history_date = ilDatePresentation::formatDate(new ilDateTime(
5312 $history_instance->getDraftDate(),
5314 ));
5315 $this->ctrl->setParameter($this, 'history_id', $history_instance->getHistoryId());
5316 $header = $history_date . ' - ' . $history_instance->getPostSubject();
5317 $accordion->addItem($header, $message . $this->uiRenderer->render(
5318 $this->uiFactory->button()->standard(
5319 $this->lng->txt('restore'),
5320 $this->ctrl->getLinkTarget($this, 'restoreFromHistory')
5321 )
5322 ));
5323
5324 $form_tpl->setVariable('ACC_AUTO_SAVE', $accordion->getHtml());
5325 $form_tpl->parseCurrentBlock();
5326 }
5327
5328 $form_tpl->setVariable('RESTORE_DATA_EXISTS', 'found_threat_history_to_restore');
5329 $modal->setBody($form_tpl->get());
5330 $modal->initJS();
5331 $this->modal_history = $modal->getHTML();
5332 } else {
5334 }
5335 }
const IL_CAL_DATETIME
Accordion user interface class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static getInstancesByDraftId($draft_id)
static createDraftBackup($draft_id)
static getInstance()
Get instance.
checkDraftAccess(int $draftId)
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template

References $message, ilRTE\_replaceMediaObjectImageSrc(), ilForumPostDraft\createDraftBackup(), error(), ilDatePresentation\formatDate(), ilModalGUI\getInstance(), ilForumDraftsHistory\getInstancesByDraftId(), IL_CAL_DATETIME, iljQueryUtil\initjQuery(), and ilForumPostDraft\isAutoSavePostDraftAllowed().

+ Here is the call graph for this function:

◆ editDraftObject()

ilObjForumGUI::editDraftObject ( )
protected

Definition at line 4733 of file class.ilObjForumGUI.php.

4734 {
4736 $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4737 if ($this->checkDraftAccess($draftId)) {
4738 $this->doHistoryCheck($draftId);
4739 }
4740 }
4741
4742 $this->viewThreadObject();
4743 }

References ilForumPostDraft\isAutoSavePostDraftAllowed().

+ Here is the call graph for this function:

◆ editThreadDraftObject()

ilObjForumGUI::editThreadDraftObject ( \ilPropertyFormGUI  $form = null)
protected
Parameters
ilPropertyFormGUI | null$form

Definition at line 4375 of file class.ilObjForumGUI.php.

4376 {
4377 if (
4378 !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4379 !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4381 ) {
4382 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4383 }
4384
4385 $frm = $this->object->Forum;
4386 $frm->setForumId($this->object->getId());
4387 $frm->setForumRefId($this->object->getRefId());
4388
4389 $draft = new \ilForumPostDraft();
4390 $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4391 if ($draftId > 0) {
4392 $draft = $draft->newInstanceByDraftId($draftId);
4393 }
4394
4395 $historyCheck = (int) ($this->httpRequest->getQueryParams()['hist_check'] ?? 1);
4396 if (!($form instanceof \ilPropertyFormGUI) && $historyCheck > 0) {
4397 $this->doHistoryCheck($draft->getDraftId());
4398 }
4399
4400 if (!$form instanceof \ilPropertyFormGUI) {
4401 $form = $this->buildThreadForm(true);
4402 $form->setValuesByArray([
4403 'alias' => $draft->getPostUserAlias(),
4404 'subject' => $draft->getPostSubject(),
4405 'message' => \ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($draft->getPostMessage(), 2), 1),
4406 'notify' => $draft->getNotify() ? true : false,
4407 'userfile' => '',
4408 'del_file' => []
4409 ]);
4410 } else {
4411 $this->ctrl->setParameter($this, 'draft_id', $draftId);
4412 }
4413
4414 $this->tpl->setContent($form->getHTML() . $this->modal_history);
4415 }

References ilRTE\_replaceMediaObjectImageSrc(), error(), and ilForumPostDraft\isSavePostDraftAllowed().

+ Here is the call graph for this function:

◆ editThreadObject()

ilObjForumGUI::editThreadObject (   $threadId,
ilPropertyFormGUI  $form = null 
)
Parameters
int$threadId
ilPropertyFormGUI$form

Definition at line 568 of file class.ilObjForumGUI.php.

569 {
570 if (!$this->is_moderator) {
571 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
572 }
573
574 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
575 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
576 }
577
578 $thread = new \ilForumTopic($threadId);
579 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
580
581 $this->tabs->activateTab('forums_threads');
582
583 if (!($form instanceof \ilPropertyFormGUI)) {
584 $form = $this->getThreadEditingForm($threadId);
585 $form->setValuesByArray(array(
586 'title' => $thread->getSubject()
587 ));
588 }
589
590 $this->tpl->setContent($form->getHTML());
591 }
getThreadEditingForm($a_thread_id)
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.

References ensureThreadBelongsToForum(), error(), and getThreadEditingForm().

Referenced by updateThreadObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableForumNotificationObject()

ilObjForumGUI::enableForumNotificationObject ( )
protected

Definition at line 3847 of file class.ilObjForumGUI.php.

3848 {
3849 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3850 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3851 }
3852
3853 $frm = $this->object->Forum;
3854 $frm->setForumId($this->object->getId());
3855 $frm->enableForumNotification($this->user->getId());
3856
3857 if ((int) $this->objCurrentTopic->getId() > 0) {
3858 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3859 \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'), true);
3860 $this->ctrl->redirect($this, 'viewThread');
3861 }
3862
3863 \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'));
3864 $this->showThreadsObject();
3865 }

References error(), ilUtil\sendInfo(), and user().

+ Here is the call graph for this function:

◆ ensureThreadBelongsToForum()

ilObjForumGUI::ensureThreadBelongsToForum ( int  $objId,
\ilForumTopic  $thread 
)
Parameters
int$objId
ilForumTopic$thread

Definition at line 231 of file class.ilObjForumGUI.php.

232 {
234 if ((int) $thread->getForumId() !== (int) $forumId) {
235 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
236 }
237 }
static lookupForumIdByObjId($obj_id)
$objId
Definition: xapitoken.php:41

References $objId, error(), ilForumTopic\getForumId(), and ilObjForum\lookupForumIdByObjId().

Referenced by editThreadObject(), executeCommand(), and updateThreadObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureValidPageForCurrentPosting()

ilObjForumGUI::ensureValidPageForCurrentPosting ( array  $subtree_nodes,
array  $pagedPostings,
int  $pageSize,
ilForumPost  $firstForumPost 
)
protected
Parameters
array$subtree_nodes
array$pagedPostings
int$pageSize
ilForumPost$firstForumPost

Definition at line 184 of file class.ilObjForumGUI.php.

189 {
190 if ($firstForumPost->getId() == $this->objCurrentPost->getId()) {
191 return;
192 }
193
194 if (count($subtree_nodes) > 0 && $this->objCurrentPost->getId() > 0) {
195 $isCurrentPostingInPage = array_filter($pagedPostings, function (ilForumPost $posting) {
196 return $posting->getId() == $this->objCurrentPost->getId();
197 });
198
199 if (0 === count($isCurrentPostingInPage)) {
200 $pageOfCurrentPosting = 0;
201 $i = 0;
202 foreach ($subtree_nodes as $node) {
203 if ($i > 0 && 0 === $i % $pageSize) {
204 ++$pageOfCurrentPosting;
205 }
206
207 if ($node->getId() == $this->objCurrentPost->getId()) {
208 break;
209 }
210
211 ++$i;
212 }
213
214 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
215 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
216 $this->ctrl->setParameter($this, 'page', $pageOfCurrentPosting);
217 $this->ctrl->setParameter(
218 $this,
219 'orderby',
220 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
221 );
222 $this->ctrl->redirect($this, 'viewThread', $this->objCurrentPost->getId());
223 }
224 }
225 }
$i
Definition: metadata.php:24

References $i, ilForumPost\getId(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjForumGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

Definition at line 299 of file class.ilObjForumGUI.php.

300 {
301 $next_class = $this->ctrl->getNextClass($this);
302 $cmd = $this->ctrl->getCmd();
303
304 $exclude_cmds = array(
305 'viewThread',
306 'markPostUnread',
307 'markPostRead',
308 'showThreadNotification',
309 'performPostActivation',
310 'askForPostActivation',
311 'askForPostDeactivation',
312 'toggleThreadNotification',
313 'toggleThreadNotificationTab',
314 'toggleStickiness',
315 'cancelPost',
316 'savePost',
317 'saveTopLevelPost',
318 'createTopLevelPost',
319 'saveTopLevelDraft',
320 'quotePost',
321 'getQuotationHTMLAsynch',
322 'autosaveDraftAsync',
323 'autosaveThreadDraftAsync',
324 'saveAsDraft',
325 'editDraft',
326 'updateDraft',
327 'deliverDraftZipFile',
328 'deliverZipFile',
329 'cancelDraft',
330 'deleteThreadDrafts',
331 'deletePosting',
332 'deletePostingDraft',
333 'revokeCensorship',
334 'addCensorship',
335 );
336
337 if (!in_array($cmd, $exclude_cmds)) {
338 $this->prepareOutput();
339 }
340
341 if (!$this->getCreationMode() && !$this->ctrl->isAsynch() && $this->access->checkAccess(
342 'read',
343 '',
344 $_GET['ref_id']
345 )) {
347 (int) $_GET['ref_id'],
348 \ilLink::_getLink((int) $_GET['ref_id'], 'frm'),
349 'frm'
350 );
351 }
352
353 switch ($next_class) {
354 case 'ilforumsettingsgui':
356 $this->ctrl->forwardCommand($forum_settings_gui);
357 break;
358
359 case 'ilrepositoryobjectsearchgui':
360 $this->addHeaderAction();
361 $this->setSideBlocks();
362 $this->tabs->activateTab("forums_threads");
363 $this->ctrl->setReturn($this, 'view');
364 $search_gui = new ilRepositoryObjectSearchGUI(
365 $this->object->getRefId(),
366 $this,
367 'view'
368 );
369 $this->ctrl->forwardCommand($search_gui);
370 break;
371
372 case 'ilpermissiongui':
373 $perm_gui = new ilPermissionGUI($this);
374 $this->ctrl->forwardCommand($perm_gui);
375 break;
376
377 case 'ilforumexportgui':
378 $fex_gui = new ilForumExportGUI();
379 $this->ctrl->forwardCommand($fex_gui);
380 exit();
381 break;
382
383 case 'ilforummoderatorsgui':
384 $fm_gui = new ilForumModeratorsGUI();
385 $this->ctrl->forwardCommand($fm_gui);
386 break;
387
388 case 'ilinfoscreengui':
389 $this->infoScreen();
390 break;
391
392 case 'ilcolumngui':
393 $this->showThreadsObject();
394 break;
395
396 case 'ilpublicuserprofilegui':
397 $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
398 $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
399 $profile_gui->setAdditional($add);
400 $ret = $this->ctrl->forwardCommand($profile_gui);
401 $this->tpl->setContent($ret);
402 break;
403
404 case 'ilobjectcopygui':
405 $cp = new ilObjectCopyGUI($this);
406 $cp->setType('frm');
407 $this->ctrl->forwardCommand($cp);
408 break;
409
410 case 'ilexportgui':
411 $this->tabs->activateTab('export');
412 $exp = new ilExportGUI($this);
413 $exp->addFormat('xml');
414 $this->ctrl->forwardCommand($exp);
415 break;
416
417 case "ilratinggui":
418 if (!$this->objProperties->isIsThreadRatingEnabled() || $this->user->isAnonymous()) {
419 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
420 }
421
422 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
423 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
424 }
425
426 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
427
428 $rating_gui = new ilRatingGUI();
429 $rating_gui->setObject(
430 $this->object->getId(),
431 $this->object->getType(),
432 $this->objCurrentTopic->getId(),
433 'thread'
434 );
435
436 $this->ctrl->setParameter($this, 'thr_pk', (int) $this->objCurrentTopic->getId());
437 $this->ctrl->forwardCommand($rating_gui);
438
440 $this->object->getId(),
441 $this->object->getType(),
442 (int) $this->objCurrentTopic->getId(),
443 'thread'
444 );
445 $this->objCurrentTopic->setAverageRating($avg['avg']);
446 $this->objCurrentTopic->update();
447
448 $this->ctrl->redirect($this, "showThreads");
449 break;
450
451 case 'ilcommonactiondispatchergui':
453 $this->ctrl->forwardCommand($gui);
454 break;
455
456 case "ilcontainernewssettingsgui":
458 $forum_settings_gui->settingsTabs();
459
460 $this->lng->loadLanguageModule('cont');
461 $news_set_gui = new ilContainerNewsSettingsGUI($this);
462 $news_set_gui->setNewsBlockForced(true);
463 $news_set_gui->setPublicNotification(true);
464 $this->ctrl->forwardCommand($news_set_gui);
465 break;
466
467 default:
468 // alex, 11 Jan 2011:
469 // I inserted this workaround due to bug report 6971.
470 // In general the command handling is quite obscure here.
471 // The form action of the table should be filled
472 // with $ilCtrl->getFormAction(..) not with $ilCtrl->getLinkTarget(..)
473 // Commands should be determined with $ilCtrl->getCmd() not
474 // with accessing $_POST['selected_cmd'], since this is internal
475 // of ilTable2GUI/ilCtrl and may change.
476 if (isset($_POST['select_cmd2'])) {
477 $_POST['selected_cmd'] = $_POST["selected_cmd2"];
478 }
479
480 if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] != null) {
481 $member_cmd = array(
482 'enableAdminForceNoti',
483 'disableAdminForceNoti',
484 'enableHideUserToggleNoti',
485 'disableHideUserToggleNoti'
486 );
487 in_array(
488 $_POST['selected_cmd'],
489 $member_cmd
490 ) ? $cmd = $_POST['selected_cmd'] : $cmd = 'performThreadsAction';
491 } elseif (!$cmd && !$_POST['selected_cmd']) {
492 $cmd = 'showThreads';
493 }
494
495 $cmd .= 'Object';
496 $this->$cmd();
497
498 break;
499 }
500
501 // suppress for topic level
502 if ($cmd != 'viewThreadObject' && $cmd != 'showUserObject') {
503 $this->addHeaderAction();
504 }
505 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
Forum export to HTML and Print.
Class ilForumModeratorsGUI.
Class ilForumSettingsGUI.
addItem( $a_ref_id, $a_link, $a_type, $a_title="", $a_sub_obj_id="", $a_goto_link="")
Add an item to the stack.
GUI class for the workflow of copying objects.
prepareOutput($a_show_subobjects=true)
prepare output
getCreationMode()
get creation mode
addHeaderAction()
Add header action menu.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
GUI class for public user profile presentation.
Class ilRatingGUI.
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.
$ret
Definition: parser.php:6

References $_GET, $_POST, $forum_settings_gui, $ret, ilLink\_getLink(), ilObjectGUI\addHeaderAction(), ilNavigationHistory\addItem(), ensureThreadBelongsToForum(), error(), exit, ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilRating\getOverallRatingForObject(), infoScreen(), ilObjectGUI\prepareOutput(), setSideBlocks(), and showThreadsObject().

+ Here is the call graph for this function:

◆ getActivationFormHTML()

ilObjForumGUI::getActivationFormHTML ( )

Definition at line 1819 of file class.ilObjForumGUI.php.

1820 {
1821 $form_tpl = new ilTemplate('tpl.frm_activation_post_form.html', true, true, 'Modules/Forum');
1822 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1823 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1824 $this->ctrl->setParameter(
1825 $this,
1826 'orderby',
1827 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
1828 );
1829 $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPostActivation'));
1830 $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1831 $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1832 $form_tpl->setVariable('TXT_ACT', $this->lng->txt('activate_post_txt'));
1833 $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('activate_only_current'));
1834 $form_tpl->setVariable('CMD_CONFIRM', 'performPostActivation');
1835 $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1836 $form_tpl->setVariable('CMD_CANCEL', 'viewThread');
1837 $this->ctrl->clearParameters($this);
1838
1839 return $form_tpl->get();
1840 }
special template class to simplify handling of ITX/PEAR

References ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getCensorshipFormHTML()

ilObjForumGUI::getCensorshipFormHTML ( )

Definition at line 1842 of file class.ilObjForumGUI.php.

1843 {
1844 $frm = $this->object->Forum;
1845 $form_tpl = new ilTemplate('tpl.frm_censorship_post_form.html', true, true, 'Modules/Forum');
1846
1847 $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1848 $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1849 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1850 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1851 $this->ctrl->setParameter(
1852 $this,
1853 'orderby',
1854 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
1855 );
1856 $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'viewThread'));
1857 $this->ctrl->clearParameters($this);
1858 $form_tpl->setVariable('TXT_CENS_MESSAGE', $this->lng->txt('forums_the_post'));
1859 $form_tpl->setVariable('TXT_CENS_COMMENT', $this->lng->txt('forums_censor_comment') . ':');
1860 $form_tpl->setVariable('CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1861
1862 if ($this->objCurrentPost->isCensored()) {
1863 $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor2_post'));
1864 $form_tpl->setVariable('YES_BUTTON', $this->lng->txt('confirm'));
1865 $form_tpl->setVariable('NO_BUTTON', $this->lng->txt('cancel'));
1866 $form_tpl->setVariable('CMD_REVOKE_CENSORSHIP', 'revokeCensorship');
1867 $form_tpl->setVariable('CMD_CANCEL_REVOKE_CENSORSHIP', 'viewThread');
1868 } else {
1869 $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor_post'));
1870 $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1871 $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('confirm'));
1872 $form_tpl->setVariable('CMD_ADD_CENSORSHIP', 'addCensorship');
1873 $form_tpl->setVariable('CMD_CANCEL_ADD_CENSORSHIP', 'viewThread');
1874 }
1875
1876 return $form_tpl->get();
1877 }

References ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getContent()

ilObjForumGUI::getContent ( )

Definition at line 674 of file class.ilObjForumGUI.php.

675 {
676 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
677 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
678 }
679
680 $cmd = $this->ctrl->getCmd();
681 $frm = $this->object->Forum;
682 $frm->setForumId($this->object->getId());
683 $frm->setForumRefId($this->object->getRefId());
684 $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
685
686 $threadsTemplate = new \ilTemplate(
687 'tpl.forums_threads_liste.html',
688 true,
689 true,
690 'Modules/Forum'
691 );
692
693 if ((int) strlen($this->confirmation_gui_html)) {
694 $threadsTemplate->setVariable('CONFIRMATION_GUI', $this->confirmation_gui_html);
695 }
696
697 // Create topic button
698 if ($this->access->checkAccess('add_thread', '', $this->object->getRefId()) && !$this->hideToolbar()) {
700 $btn->setUrl($this->ctrl->getLinkTarget($this, 'createThread'));
701 $btn->setCaption('forums_new_thread');
702 $this->toolbar->addStickyItem($btn);
703 }
704
705 // Mark all topics as read button
706 if (!$this->user->isAnonymous() && !(int) strlen($this->confirmation_gui_html)) {
707 $this->toolbar->addButton(
708 $this->lng->txt('forums_mark_read'),
709 $this->ctrl->getLinkTarget($this, 'markAllRead'),
710 '',
712 );
713 $this->ctrl->clearParameters($this);
714 }
715
718 $this->user->getId(),
719 ilObjForum::lookupForumIdByObjId($this->object->getId())
720 );
721 if (count($drafts) > 0) {
722 $draftsTable = new ilForumDraftsTableGUI(
723 $this,
724 $cmd,
725 $this->access->checkAccess('add_thread', '', $this->object->getRefId())
726 );
727 $draftsTable->setData($drafts);
728 $threadsTemplate->setVariable('THREADS_DRAFTS_TABLE', $draftsTable->getHTML());
729 }
730 }
731
732 // Import information: Topic (variable $topicData) means frm object, not thread
733 $topicData = $frm->getOneTopic();
734 if ($topicData) {
735 // Visit-Counter
736 $frm->setDbTable('frm_data');
737 $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
738 $frm->updateVisits($topicData['top_pk']);
739
740 if (!in_array($cmd, array('showThreads', 'sortThreads'))) {
741 $cmd = 'showThreads';
742 }
743
744 $tbl = new ilForumTopicTableGUI(
745 $this,
746 $cmd,
747 '',
748 (int) $_GET['ref_id'],
749 $topicData,
750 $this->is_moderator,
751 $this->settings->get('forum_overview')
752 );
753 $tbl->init();
754 $tbl->setMapper($frm)->fetchData();
755 $threadsTemplate->setVariable('THREADS_TABLE', $tbl->getHTML());
756 }
757
758 $this->tpl->setPermanentLink($this->object->getType(), $this->object->getRefId(), '', '_top');
759
760 $this->tpl->setContent($threadsTemplate->get());
761 }
Class ilForumDraftsTableGUI.
static getThreadDraftData($post_author_id, $forum_id)
Class ilForumTopicTableGUI.
static getInstance()
Factory.

References $_GET, error(), ilLinkButton\getInstance(), ilForumPostDraft\getThreadDraftData(), ilForumPostDraft\isSavePostDraftAllowed(), ilObjForum\lookupForumIdByObjId(), ilAccessKey\MARK_ALL_READ, settings(), and user().

+ Here is the call graph for this function:

◆ getEditFormCustomValues()

ilObjForumGUI::getEditFormCustomValues ( array &  $a_values)
protected
Parameters
array$a_values

Reimplemented from ilObjectGUI.

Definition at line 529 of file class.ilObjForumGUI.php.

530 {
531 $this->forum_settings_gui->getCustomValues($a_values);
532 }

◆ getForumObjects()

ilObjForumGUI::getForumObjects ( )
private

Definition at line 2716 of file class.ilObjForumGUI.php.

2717 {
2718 if (null === $this->forumObjects) {
2719 $forumObj = $this->object;
2720 $file_obj = new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
2721 $frm = $forumObj->Forum;
2722 $frm->setForumId($forumObj->getId());
2723 $frm->setForumRefId($forumObj->getRefId());
2724
2725 $this->forumObjects['forumObj'] = $forumObj;
2726 $this->forumObjects['frm'] = $frm;
2727 $this->forumObjects['file_obj'] = $file_obj;
2728 }
2729
2730 return $this->forumObjects;
2731 }
This class handles all operations on files for the forum object.

◆ getModifiedReOnSubject()

ilObjForumGUI::getModifiedReOnSubject (   $on_reply = false)
private

Definition at line 3252 of file class.ilObjForumGUI.php.

3253 {
3254 $subject = $this->objCurrentPost->getSubject();
3255 $re_txt = $this->lng->txt('post_reply');
3256
3257 $re_txt_with_num = str_replace(':', '(', $re_txt);
3258 $search_length = strlen($re_txt_with_num);
3259 $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
3260
3261 if ($comp == 0) {
3262 $modified_subject = $subject;
3263 if ($on_reply == true) {
3264 // i.e. $subject = "Re(12):"
3265 $str_pos_start = strpos($subject, '(');
3266 $str_pos_end = strpos($subject, ')');
3267
3268 $length = ((int) $str_pos_end - (int) $str_pos_start);
3269 $str_pos_start++;
3270 $txt_number = substr($subject, $str_pos_start, $length - 1);
3271
3272 if (is_numeric($txt_number)) {
3273 $re_count = (int) $txt_number + 1;
3274 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr(
3275 $subject,
3276 $str_pos_end
3277 );
3278 }
3279 }
3280 } else {
3281 $re_count = substr_count($subject, $re_txt);
3282 if ($re_count >= 1 && $on_reply == true) {
3283 $subject = str_replace($re_txt, '', $subject);
3284
3285 // i.e. $subject = "Re: Re: Re: ... " -> "Re(4):"
3286 $re_count++;
3287 $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
3288 } elseif ($re_count >= 1 && $on_reply == false) {
3289 // possibility to modify the subject only for output
3290 // i.e. $subject = "Re: Re: Re: ... " -> "Re(3):"
3291 $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
3292 } elseif ($re_count == 0) {
3293 // the first reply to a thread
3294 $modified_subject = $this->lng->txt('post_reply') . ' ' . $this->objCurrentPost->getSubject();
3295 }
3296 }
3297 return $modified_subject;
3298 }

◆ getReplyEditForm()

ilObjForumGUI::getReplyEditForm ( )
private
Returns
ilPropertyFormGUI

Definition at line 2160 of file class.ilObjForumGUI.php.

2161 {
2162 if (null === $this->replyEditForm) {
2163 $this->initReplyEditForm();
2164 }
2165
2166 return $this->replyEditForm;
2167 }

Referenced by renderDraftContent().

+ Here is the caller graph for this function:

◆ getSubTabs()

ilObjForumGUI::getSubTabs (   $subtab = 'showThreads')

Definition at line 652 of file class.ilObjForumGUI.php.

653 {
654 if ($this->objProperties->getThreadSorting() == 1 && $this->is_moderator) {
655 $this->tabs->addSubTabTarget(
656 'show',
657 $this->ctrl->getLinkTarget($this, 'showThreads'),
658 'showThreads',
659 get_class($this),
660 '',
661 $subtab == 'showThreads' ? true : false
662 );
663 $this->tabs->addSubTabTarget(
664 'sorting_header',
665 $this->ctrl->getLinkTarget($this, 'sortThreads'),
666 'sortThreads',
667 get_class($this),
668 '',
669 $subtab == 'sortThreads' ? true : false
670 );
671 }
672 }

Referenced by showThreadsObject(), and sortThreadsObject().

+ Here is the caller graph for this function:

◆ getTabs()

ilObjForumGUI::getTabs ( )
protected

get tabs abstract method.

@abstract overwrite in derived GUI class of your object type @access public

Parameters
objectinstance of ilTabsGUI

Reimplemented from ilObjectGUI.

Definition at line 1184 of file class.ilObjForumGUI.php.

1185 {
1186 $this->ilHelp->setScreenIdComponent("frm");
1187
1188 $this->ctrl->setParameter($this, 'ref_id', $this->ref_id);
1189
1190 $active = array(
1191 '',
1192 'showThreads',
1193 'view',
1194 'markAllRead',
1195 'enableForumNotification',
1196 'disableForumNotification',
1197 'moveThreads',
1198 'performMoveThreads',
1199 'cancelMoveThreads',
1200 'performThreadsAction',
1201 'createThread',
1202 'addThread',
1203 'showUser',
1204 'confirmDeleteThreads',
1205 'merge',
1206 'mergeThreads',
1207 'performMergeThreads'
1208 );
1209
1210 (in_array($this->ctrl->getCmd(), $active)) ? $force_active = true : $force_active = false;
1211
1212 if ($this->access->checkAccess(
1213 'read',
1214 '',
1215 $this->ref_id
1216 )) {
1217 $this->tabs->addTarget(
1218 'forums_threads',
1219 $this->ctrl->getLinkTarget($this, 'showThreads'),
1220 $this->ctrl->getCmd(),
1221 get_class($this),
1222 '',
1223 $force_active
1224 );
1225 }
1226
1227 // info tab
1228 if ($this->access->checkAccess('visible', '', $this->ref_id) || $this->access->checkAccess(
1229 'read',
1230 '',
1231 $this->ref_id
1232 )) {
1233 $force_active = ($this->ctrl->getNextClass() == 'ilinfoscreengui' || strtolower($_GET['cmdClass']) == 'ilnotegui') ? true : false;
1234 $this->tabs->addTarget(
1235 'info_short',
1236 $this->ctrl->getLinkTargetByClass(array('ilobjforumgui', 'ilinfoscreengui'), 'showSummary'),
1237 array('showSummary', 'infoScreen'),
1238 '',
1239 '',
1240 $force_active
1241 );
1242 }
1243
1244 if ($this->access->checkAccess('write', '', $this->ref_id)) {
1245 $force_active = ($this->ctrl->getCmd() == 'edit') ? true : false;
1246 $this->tabs->addTarget(
1247 'settings',
1248 $this->ctrl->getLinkTarget($this, 'edit'),
1249 'edit',
1250 get_class($this),
1251 '',
1252 $force_active
1253 );
1254 }
1255
1256 if ($this->access->checkAccess('write', '', $this->ref_id)) {
1257 $this->tabs->addTarget(
1258 'frm_moderators',
1259 $this->ctrl->getLinkTargetByClass('ilForumModeratorsGUI', 'showModerators'),
1260 'showModerators',
1261 get_class($this)
1262 );
1263 }
1264
1265 if ($this->settings->get('enable_fora_statistics', false)) {
1266 $hasStatisticsAccess = $this->access->checkAccess('write', '', $this->ref_id);
1267 if (!$hasStatisticsAccess) {
1268 $hasStatisticsAccess = (
1269 $this->objProperties->isStatisticEnabled() &&
1270 $this->access->checkAccess('read', '', $this->ref_id)
1271 );
1272 }
1273
1274 if ($hasStatisticsAccess) {
1275 $force_active = ($this->ctrl->getCmd() == 'showStatistics') ? true : false;
1276 $this->tabs->addTarget(
1277 'frm_statistics',
1278 $this->ctrl->getLinkTarget($this, 'showStatistics'),
1279 'showStatistics',
1280 get_class($this),
1281 '',
1282 $force_active
1283 );
1284 }
1285 }
1286
1287 if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1288 $this->tabs->addTarget('export', $this->ctrl->getLinkTargetByClass('ilexportgui', ''), '', 'ilexportgui');
1289 }
1290
1291 if ($this->access->checkAccess('edit_permission', '', $this->ref_id)) {
1292 $this->tabs->addTarget(
1293 'perm_settings',
1294 $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), 'perm'),
1295 array('perm', 'info', 'owner'),
1296 'ilpermissiongui'
1297 );
1298 }
1299 }

References $_GET, and settings().

+ Here is the call graph for this function:

◆ getThreadEditingForm()

ilObjForumGUI::getThreadEditingForm (   $a_thread_id)
private
Parameters
int$a_thread_id
Returns
ilPropertyFormGUI

Definition at line 546 of file class.ilObjForumGUI.php.

547 {
548 $form = new ilPropertyFormGUI();
549 $this->ctrl->setParameter($this, 'thr_pk', $a_thread_id);
550 $form->setFormAction($this->ctrl->getFormAction($this, 'updateThread'));
551
552 $ti_prop = new ilTextInputGUI($this->lng->txt('title'), 'title');
553 $ti_prop->setRequired(true);
554 $ti_prop->setMaxLength(255);
555 $ti_prop->setSize(50);
556 $form->addItem($ti_prop);
557
558 $form->addCommandButton('updateThread', $this->lng->txt('save'));
559 $form->addCommandButton('showThreads', $this->lng->txt('cancel'));
560
561 return $form;
562 }
This class represents a text property in a property form.

Referenced by editThreadObject(), and updateThreadObject().

+ Here is the caller graph for this function:

◆ handleFormInput()

ilObjForumGUI::handleFormInput (   $a_text,
  $a_stripslashes = true 
)

Definition at line 3920 of file class.ilObjForumGUI.php.

3921 {
3922 $a_text = str_replace("<", "&lt;", $a_text);
3923 $a_text = str_replace(">", "&gt;", $a_text);
3924 if ($a_stripslashes) {
3925 $a_text = ilUtil::stripSlashes($a_text);
3926 }
3927
3928 return $a_text;
3929 }

References ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ hideToolbar()

ilObjForumGUI::hideToolbar (   $a_flag = null)
private

Definition at line 2644 of file class.ilObjForumGUI.php.

2645 {
2646 if (null === $a_flag) {
2647 return $this->hideToolbar;
2648 }
2649
2650 $this->hideToolbar = $a_flag;
2651 return $this;
2652 }

◆ infoScreen()

ilObjForumGUI::infoScreen ( )
protected

Definition at line 3939 of file class.ilObjForumGUI.php.

3940 {
3941 if (
3942 !$this->access->checkAccess('visible', '', $this->object->getRefId()) &&
3943 !$this->access->checkAccess('read', '', $this->object->getRefId())
3944 ) {
3945 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
3946 }
3947
3948 $info = new \ilInfoScreenGUI($this);
3949 $info->enablePrivateNotes();
3950 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
3951 $this->ctrl->forwardCommand($info);
3952 }

References error().

Referenced by executeCommand(), and infoScreenObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjForumGUI::infoScreenObject ( )

Definition at line 510 of file class.ilObjForumGUI.php.

511 {
512 $this->ctrl->setCmd('showSummary');
513 $this->ctrl->setCmdClass('ilinfoscreengui');
514 $this->infoScreen();
515 }

References infoScreen().

+ Here is the call graph for this function:

◆ initEditCustomForm()

ilObjForumGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected
Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

Definition at line 520 of file class.ilObjForumGUI.php.

521 {
522 $this->forum_settings_gui = new ilForumSettingsGUI($this);
523 $this->forum_settings_gui->getCustomForm($a_form);
524 }

◆ initHeaderAction()

ilObjForumGUI::initHeaderAction (   $a_sub_type = null,
  $a_sub_id = null 
)
protected

Add header action menu.

Parameters
string$a_sub_type
int$a_sub_id
Returns
ilObjectListGUI

Reimplemented from ilObjectGUI.

Definition at line 3995 of file class.ilObjForumGUI.php.

3996 {
3997 $lg = parent::initHeaderAction();
3998
3999 if ((int) $this->objCurrentTopic->getId() > 0) {
4000 $container_obj = null; // Workaround: Do not show "desktop actions" in thread view
4001 $lg->setContainerObject($container_obj);
4002 }
4003
4004 if (!($lg instanceof \ilObjForumListGUI) || !$this->settings->get('forum_notification')) {
4005 return $lg;
4006 }
4007
4008 if ($this->user->isAnonymous() || !$this->access->checkAccess('read', '', $this->object->getRefId())) {
4009 return $lg;
4010 }
4011
4012 $frm = $this->object->Forum;
4013 $frm->setForumId($this->object->getId());
4014 $frm->setForumRefId($this->object->getRefId());
4015 $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4016
4017 $isForumNotificationEnabled = $frm->isForumNotificationEnabled($this->user->getId());
4018 $userMayDisableNotifications = $this->isUserAllowedToDeactivateNotification();
4019
4020 if ((int) $this->objCurrentTopic->getId() > 0) {
4021 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
4022 }
4023
4024 if ($this->isParentObjectCrsOrGrp()) {
4025 // special behaviour for CRS/GRP-Forum notification!!
4026 if ($isForumNotificationEnabled && $userMayDisableNotifications) {
4027 $lg->addCustomCommand(
4028 $this->ctrl->getLinkTarget($this, 'disableForumNotification'),
4029 'forums_disable_forum_notification'
4030 );
4031 } elseif (!$isForumNotificationEnabled) {
4032 $lg->addCustomCommand(
4033 $this->ctrl->getLinkTarget($this, 'enableForumNotification'),
4034 'forums_enable_forum_notification'
4035 );
4036 }
4037 } elseif ($isForumNotificationEnabled) {
4038 $lg->addCustomCommand(
4039 $this->ctrl->getLinkTarget($this, 'disableForumNotification'),
4040 'forums_disable_forum_notification'
4041 );
4042 } else {
4043 $lg->addCustomCommand(
4044 $this->ctrl->getLinkTarget($this, 'enableForumNotification'),
4045 'forums_enable_forum_notification'
4046 );
4047 }
4048
4049 $isThreadNotificationEnabled = false;
4050 if ((int) $this->objCurrentTopic->getId() > 0) {
4051 $isThreadNotificationEnabled = $this->objCurrentTopic->isNotificationEnabled($this->user->getId());
4052 if ($isThreadNotificationEnabled) {
4053 $lg->addCustomCommand(
4054 $this->ctrl->getLinkTarget($this, 'toggleThreadNotification'),
4055 'forums_disable_notification'
4056 );
4057 } else {
4058 $lg->addCustomCommand(
4059 $this->ctrl->getLinkTarget($this, 'toggleThreadNotification'),
4060 'forums_enable_notification'
4061 );
4062 }
4063 }
4064 $this->ctrl->setParameter($this, 'thr_pk', '');
4065
4066 if ($isForumNotificationEnabled || $isThreadNotificationEnabled) {
4067 $lg->addHeaderIcon(
4068 'not_icon',
4069 ilUtil::getImagePath('notification_on.svg'),
4070 $this->lng->txt('frm_notification_activated')
4071 );
4072 } else {
4073 $lg->addHeaderIcon(
4074 'not_icon',
4075 ilUtil::getImagePath('notification_off.svg'),
4076 $this->lng->txt('frm_notification_deactivated')
4077 );
4078 }
4079
4080 return $lg;
4081 }
Class ilObjForumListGUI.

References ilUtil\getImagePath(), settings(), and user().

+ Here is the call graph for this function:

◆ initSessionStorage()

ilObjForumGUI::initSessionStorage ( )
protected

Definition at line 147 of file class.ilObjForumGUI.php.

148 {
149 $forumValues = \ilSession::get('frm');
150 if (!is_array($forumValues)) {
151 $forumValues = [];
152 \ilSession::set('frm', $forumValues);
153 }
154
155 $threadId = $this->httpRequest->getQueryParams()['thr_pk'] ?? 0;
156 if ((int) $threadId > 0 && !is_array($forumValues[(int) $threadId])) {
157 $forumValues[(int) $threadId] = [];
158 \ilSession::set('frm', $forumValues);
159 }
160 }
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.

References ilSession\get(), and ilSession\set().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHierarchicalView()

ilObjForumGUI::isHierarchicalView ( )
private
Returns
bool

Definition at line 276 of file class.ilObjForumGUI.php.

276 : bool
277 {
278 return (
279 $_SESSION['viewmode'] == 'answers' ||
281 ) || !(
282 $_SESSION['viewmode'] == 'date' ||
285 );
286 }

References $_SESSION, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

◆ isParentObjectCrsOrGrp()

ilObjForumGUI::isParentObjectCrsOrGrp ( )

Definition at line 4106 of file class.ilObjForumGUI.php.

4106 : bool
4107 {
4108 $grpRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'grp');
4109 $crsRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'crs');
4110
4111 return ($grpRefId > 0 || $crsRefId > 0);
4112 }

◆ isTopLevelReplyCommand()

ilObjForumGUI::isTopLevelReplyCommand ( )
private
Returns
bool

Definition at line 291 of file class.ilObjForumGUI.php.

291 : bool
292 {
293 return in_array(
294 strtolower($this->ctrl->getCmd()),
295 array_map('strtolower', array('createTopLevelPost', 'saveTopLevelPost', 'saveTopLevelDraft'))
296 );
297 }

◆ isUserAllowedToDeactivateNotification()

ilObjForumGUI::isUserAllowedToDeactivateNotification ( )

Definition at line 4083 of file class.ilObjForumGUI.php.

4084 {
4085 if ($this->objProperties->getNotificationType() == 'default') {
4086 return true;
4087 }
4088
4089 if ($this->objProperties->isUserToggleNoti() == 0) {
4090 return true;
4091 }
4092
4093 if ($this->isParentObjectCrsOrGrp()) {
4094 $frm_noti = new ilForumNotification((int) $_GET['ref_id']);
4095 $frm_noti->setUserId($this->user->getId());
4096
4097 $user_toggle = (int) $frm_noti->isUserToggleNotification();
4098 if ($user_toggle == 0 && $this->objProperties->isUserToggleNoti() == 0) {
4099 return true;
4100 }
4101 }
4102
4103 return false;
4104 }
Class ilForumNotification.

References $_GET, and user().

+ Here is the call graph for this function:

◆ isWritingWithPseudonymAllowed()

ilObjForumGUI::isWritingWithPseudonymAllowed ( )
private

Definition at line 3590 of file class.ilObjForumGUI.php.

3590 : bool
3591 {
3592 if ($this->objProperties->isAnonymized() && (!$this->is_moderator || !$this->objProperties->getMarkModeratorPosts())) {
3593 return true;
3594 }
3595 return false;
3596 }

◆ markAllReadObject()

ilObjForumGUI::markAllReadObject ( )

Definition at line 627 of file class.ilObjForumGUI.php.

628 {
629 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
630 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
631 }
632
633 $this->object->markAllThreadsRead($this->user->getId());
634 ilUtil::sendInfo($this->lng->txt('forums_all_threads_marked_read'));
635 $this->showThreadsObject();
636 }

References error(), ilUtil\sendInfo(), showThreadsObject(), and user().

+ Here is the call graph for this function:

◆ markPostReadObject()

ilObjForumGUI::markPostReadObject ( )
protected

Definition at line 3974 of file class.ilObjForumGUI.php.

3975 {
3976 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3977 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3978 }
3979
3980 if ((int) $this->objCurrentTopic->getId() > 0 && (int) $this->objCurrentPost->getId() > 0) {
3981 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
3982
3983 $this->object->markPostRead(
3984 $this->user->getId(),
3985 (int) $this->objCurrentTopic->getId(),
3986 (int) $this->objCurrentPost->getId()
3987 );
3988 }
3989 $this->viewThreadObject();
3990 }

References error(), and user().

+ Here is the call graph for this function:

◆ markPostUnreadObject()

ilObjForumGUI::markPostUnreadObject ( )
protected

Definition at line 3957 of file class.ilObjForumGUI.php.

3958 {
3959 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3960 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3961 }
3962
3963 if ((int) $this->objCurrentPost->getId() > 0) {
3964 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
3965
3966 $this->object->markPostUnread($this->user->getId(), (int) $this->objCurrentPost->getId());
3967 }
3968 $this->viewThreadObject();
3969 }

References error(), and user().

+ Here is the call graph for this function:

◆ mergeThreadsObject()

ilObjForumGUI::mergeThreadsObject ( )

Definition at line 4143 of file class.ilObjForumGUI.php.

4144 {
4145 if (!$this->is_moderator) {
4146 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4147 }
4148
4149 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4150 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4151 }
4152
4153 $threadIdToMerge = (int) ($this->httpRequest->getQueryParams()['merge_thread_id'] ?? 0);
4154 if (!($threadIdToMerge > 0)) {
4155 $threadIds = array_values(
4156 array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
4157 );
4158 if (1 === count($threadIds)) {
4159 $threadIdToMerge = current($threadIds);
4160 } else {
4161 \ilUtil::sendInfo($this->lng->txt('select_one'));
4162 $this->showThreadsObject();
4163 return;
4164 }
4165 }
4166
4167 $frm = $this->object->Forum;
4168 $frm->setForumId($this->object->getId());
4169 $frm->setForumRefId($this->object->getRefId());
4170
4171 $threadToMerge = new ilForumTopic($threadIdToMerge);
4172
4173 if (\ilForum::_lookupObjIdForForumId($threadToMerge->getForumId()) != $frm->getForumId()) {
4174 \ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
4175 $this->showThreadsObject();
4176 return;
4177 }
4178
4179 $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4180
4181 $threadsTemplate = new \ilTemplate(
4182 'tpl.forums_threads_liste.html',
4183 true,
4184 true,
4185 'Modules/Forum'
4186 );
4187
4188 $topicData = $frm->getOneTopic();
4189 if ($topicData) {
4190 $this->ctrl->setParameter($this, 'merge_thread_id', $threadIdToMerge);
4191 $tbl = new \ilForumTopicTableGUI(
4192 $this,
4193 'mergeThreads',
4194 '',
4195 (int) $this->httpRequest->getQueryParams()['ref_id'],
4196 $topicData,
4197 $this->is_moderator,
4198 $this->settings->get('forum_overview')
4199 );
4200 $tbl->setSelectedThread($threadToMerge);
4201 $tbl->setMapper($frm)->fetchData();
4202 $tbl->init();
4203 $threadsTemplate->setVariable('THREADS_TABLE', $tbl->getHTML());
4204 $this->tpl->setContent($threadsTemplate->get());
4205 } else {
4206 \ilUtil::sendFailure($this->lng->txt('select_one'));
4207 $this->showThreadsObject();
4208 }
4209 }
static _lookupObjIdForForumId($a_for_id)

References ilForum\_lookupObjIdForForumId(), error(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ moveThreadsObject()

ilObjForumGUI::moveThreadsObject ( )

Definition at line 3515 of file class.ilObjForumGUI.php.

3516 {
3517 if (!$this->is_moderator) {
3518 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3519 }
3520
3521 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3522 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3523 }
3524
3525 $threads2move = $_SESSION['threads2move'];
3526 if (!is_array($threads2move) || !count($threads2move)) {
3527 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3528 $this->ctrl->redirect($this, 'showThreads');
3529 }
3530
3531 $threads = [];
3532 $isModerator = $this->is_moderator;
3533 array_walk($threads2move, function ($threadId) use (&$threads, $isModerator) {
3534 $thread = new \ilForumTopic($threadId, $isModerator);
3535 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3536
3537 $threads[] = $thread;
3538 });
3539
3540 $exp = new ilForumMoveTopicsExplorer($this, 'moveThreads');
3541 $exp->setPathOpen($this->object->getRefId());
3542 $exp->setNodeSelected(isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id'] ? (int) $_POST['frm_ref_id'] : 0);
3543 $exp->setCurrentFrmRefId($this->object->getRefId());
3544 $exp->setHighlightedNode($this->object->getRefId());
3545 if (!$exp->handleCommand()) {
3546 $moveThreadTemplate = new ilTemplate(
3547 'tpl.forums_threads_move.html',
3548 true,
3549 true,
3550 'Modules/Forum'
3551 );
3552
3553 if (!$this->hideToolbar()) {
3554 $this->toolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this));
3555 }
3556
3557 $tblThr = new ilTable2GUI($this);
3558 $tblThr->setId('il_frm_thread_move_table_' . $this->object->getRefId());
3559 $tblThr->setTitle($this->lng->txt('move_chosen_topics'));
3560 $tblThr->addColumn($this->lng->txt('subject'), 'top_name', '100%');
3561 $tblThr->disable('header');
3562 $tblThr->disable('footer');
3563 $tblThr->disable('linkbar');
3564 $tblThr->disable('sort');
3565 $tblThr->disable('linkbar');
3566 $tblThr->setLimit(PHP_INT_MAX);
3567 $tblThr->setRowTemplate('tpl.forums_threads_move_thr_row.html', 'Modules/Forum');
3568 $tblThr->setDefaultOrderField('is_sticky');
3569 $counter = 0;
3570 $result = array();
3571 foreach ($threads as $thread) {
3572 $result[$counter]['num'] = $counter + 1;
3573 $result[$counter]['thr_subject'] = $thread->getSubject();
3574 ++$counter;
3575 }
3576 $tblThr->setData($result);
3577 $moveThreadTemplate->setVariable('THREADS_TABLE', $tblThr->getHTML());
3578
3579 $moveThreadTemplate->setVariable('FRM_SELECTION_TREE', $exp->getHTML());
3580 $moveThreadTemplate->setVariable('CMD_SUBMIT', 'performMoveThreads');
3581 $moveThreadTemplate->setVariable('TXT_SUBMIT', $this->lng->txt('move'));
3582 $moveThreadTemplate->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'performMoveThreads'));
3583
3584 $this->tpl->setContent($moveThreadTemplate->get());
3585 }
3586
3587 return true;
3588 }
$result
Class ilTable2GUI.

References $_POST, $_SESSION, $result, error(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ performDeleteThreadsObject()

ilObjForumGUI::performDeleteThreadsObject ( )

Definition at line 1420 of file class.ilObjForumGUI.php.

1421 {
1422 if (!$this->is_moderator) {
1423 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1424 }
1425
1426 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1427 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1428 }
1429
1430 if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1431 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1432 return $this->showThreadsObject();
1433 }
1434
1435 $forumObj = new ilObjForum($this->object->getRefId());
1436 $this->objProperties->setObjId($forumObj->getId());
1437
1438 $frm = new ilForum();
1439
1440 $success_message = "forums_thread_deleted";
1441 if (count($_POST['thread_ids']) > 1) {
1442 $success_message = "forums_threads_deleted";
1443 }
1444
1445 $threadIds = [];
1446 if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'])) {
1447 $threadIds = $_POST['thread_ids'];
1448 }
1449
1450 $threads = [];
1451 array_walk($threadIds, function ($threadId) use (&$threads) {
1452 $thread = new \ilForumTopic($threadId);
1453 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
1454
1455 $threads[] = $thread;
1456 });
1457
1458 foreach ($threads as $thread) {
1459 $frm->setForumId($forumObj->getId());
1460 $frm->setForumRefId($forumObj->getRefId());
1461
1462 $first_node = $frm->getFirstPostNode($thread->getId());
1463 if ((int) $first_node['pos_pk']) {
1464 $frm->deletePost($first_node['pos_pk']);
1465 ilUtil::sendInfo($this->lng->txt($success_message), true);
1466 }
1467 }
1468 $this->ctrl->redirect($this, 'showThreads');
1469 }
Class Forum core functions for forum.

References $_POST, error(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ performMergeThreadsObject()

ilObjForumGUI::performMergeThreadsObject ( )

Definition at line 4279 of file class.ilObjForumGUI.php.

4280 {
4281 if (!$this->is_moderator) {
4282 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4283 }
4284
4285 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4286 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4287 }
4288
4289 $threadIds = array_values(
4290 array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
4291 );
4292 if (2 !== count($threadIds)) {
4293 ilUtil::sendFailure($this->lng->txt('select_one'));
4294 $this->showThreadsObject();
4295 return;
4296 }
4297
4298 if ((int) $threadIds[0] === (int) $threadIds[1]) {
4299 ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
4300 $this->showThreadsObject();
4301 return;
4302 }
4303
4304 try {
4305 $frm = new \ilForum();
4306 $frm->setForumId($this->object->getId());
4307 $frm->setForumRefId($this->object->getRefId());
4308
4309 $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $threadIds[0]));
4310 $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $threadIds[1]));
4311
4312 $frm->mergeThreads((int) $threadIds[0], (int) $threadIds[1]);
4313 \ilUtil::sendSuccess($this->lng->txt('merged_threads_successfully'));
4314 } catch (\ilException $e) {
4315 \ilUtil::sendFailure($this->lng->txt($e->getMessage()));
4316 }
4317
4318 $this->showThreadsObject();
4319 }
Base class for ILIAS Exception handling.

References Vendor\Package\$e, error(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ performMoveThreadsObject()

ilObjForumGUI::performMoveThreadsObject ( )

Definition at line 3456 of file class.ilObjForumGUI.php.

3457 {
3458 if (!$this->is_moderator) {
3459 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3460 }
3461
3462 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3463 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3464 }
3465
3466
3467 $threads2move = $_SESSION['threads2move'];
3468 if (!is_array($threads2move) || !count($threads2move)) {
3469 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3470 $this->ctrl->redirect($this, 'showThreads');
3471 }
3472
3473 if (!$this->access->checkAccess('read', '', (int) $_POST['frm_ref_id'])) {
3474 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3475 }
3476
3477 $threads = [];
3478 array_walk($threads2move, function ($threadId) use (&$threads) {
3479 $thread = new \ilForumTopic($threadId);
3480 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3481
3482 $threads[] = $threadId;
3483 });
3484
3485 if (isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id']) {
3486 $errorMessages = $this->object->Forum->moveThreads(
3487 (array) $_SESSION['threads2move'],
3488 $this->object->getRefId(),
3489 $this->ilObjDataCache->lookupObjId($_POST['frm_ref_id'])
3490 );
3491
3492 if (array() !== $errorMessages) {
3494 implode("<br><br>", $errorMessages),
3495 true
3496 );
3497 return $this->ctrl->redirectByClass('ilObjForumGUI', 'showThreads');
3498 }
3499
3500 unset($_SESSION['threads2move']);
3501 ilUtil::sendInfo($this->lng->txt('threads_moved_successfully'), true);
3502 $this->ctrl->redirect($this, 'showThreads');
3503 } else {
3504 ilUtil::sendInfo($this->lng->txt('no_forum_selected'));
3505 $this->moveThreadsObject();
3506 }
3507 }

References $_POST, $_SESSION, error(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ performPostActivationObject()

ilObjForumGUI::performPostActivationObject ( )

Definition at line 1562 of file class.ilObjForumGUI.php.

1563 {
1564 if (!$this->is_moderator) {
1565 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1566 }
1567
1568 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1569 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1570 }
1571
1572 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
1573
1574 $this->objCurrentPost->activatePost();
1575 $GLOBALS['ilAppEventHandler']->raise(
1576 'Modules/Forum',
1577 'activatedPost',
1578 array(
1579 'ref_id' => $this->object->getRefId(),
1580 'post' => $this->objCurrentPost
1581 )
1582 );
1583 ilUtil::sendInfo($this->lng->txt('forums_post_was_activated'), true);
1584
1585 $this->viewThreadObject();
1586 }

References $GLOBALS, error(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ performThreadsActionObject()

ilObjForumGUI::performThreadsActionObject ( )

Definition at line 3338 of file class.ilObjForumGUI.php.

3339 {
3340 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3341 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3342 }
3343
3344 unset($_SESSION['threads2move']);
3345
3346 if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'])) {
3347 if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] == 'move') {
3348 if ($this->is_moderator) {
3349 $_SESSION['threads2move'] = $_POST['thread_ids'];
3350 $this->moveThreadsObject();
3351 }
3352 } elseif ($_POST['selected_cmd'] == 'enable_notifications' && $this->settings->get('forum_notification') != 0) {
3353 for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3354 $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3355 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3356 $tmp_obj->enableNotification($this->user->getId());
3357 }
3358
3359 $this->ctrl->redirect($this, 'showThreads');
3360 } elseif ($_POST['selected_cmd'] == 'disable_notifications' && $this->settings->get('forum_notification') != 0) {
3361 for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3362 $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3363 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3364 $tmp_obj->disableNotification($this->user->getId());
3365 }
3366
3367 $this->ctrl->redirect($this, 'showThreads');
3368 } elseif ($_POST['selected_cmd'] == 'close') {
3369 if ($this->is_moderator) {
3370 for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3371 $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3372 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3373 $tmp_obj->close();
3374 }
3375 }
3376 ilUtil::sendSuccess($this->lng->txt('selected_threads_closed'), true);
3377 $this->ctrl->redirect($this, 'showThreads');
3378 } elseif ($_POST['selected_cmd'] == 'reopen') {
3379 if ($this->is_moderator) {
3380 for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3381 $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3382 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3383 $tmp_obj->reopen();
3384 }
3385 }
3386
3387 ilUtil::sendSuccess($this->lng->txt('selected_threads_reopened'), true);
3388 $this->ctrl->redirect($this, 'showThreads');
3389 } elseif ($_POST['selected_cmd'] == 'makesticky') {
3390 if ($this->is_moderator) {
3391 $message = $this->lng->txt('sel_threads_make_sticky');
3392
3393 for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3394 $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3395 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3396 $makeSticky = $tmp_obj->makeSticky();
3397
3398 if (!$makeSticky) {
3399 $message = $this->lng->txt('sel_threads_already_sticky');
3400 }
3401 }
3402 }
3403 if ($message != null) {
3405 }
3406 $this->ctrl->redirect($this, 'showThreads');
3407 } elseif ($_POST['selected_cmd'] == 'unmakesticky') {
3408 if ($this->is_moderator) {
3409 $message = $this->lng->txt('sel_threads_make_unsticky');
3410 for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3411 $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3412 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3413 $unmakeSticky = $tmp_obj->unmakeSticky();
3414 if (!$unmakeSticky) {
3415 $message = $this->lng->txt('sel_threads_already_unsticky');
3416 }
3417 }
3418 }
3419
3420 if ($message != null) {
3422 }
3423 $this->ctrl->redirect($this, 'showThreads');
3424 } elseif ($_POST['selected_cmd'] == 'editThread') {
3425 if ($this->is_moderator) {
3426 $count = count($_POST['thread_ids']);
3427 if ($count != 1) {
3428 ilUtil::sendInfo($this->lng->txt('select_max_one_thread'), true);
3429 $this->ctrl->redirect($this, 'showThreads');
3430 } else {
3431 foreach ($_POST['thread_ids'] as $thread_id) {
3432 return $this->editThreadObject($thread_id, null);
3433 }
3434 }
3435 }
3436
3437 $this->ctrl->redirect($this, 'showThreads');
3438 } elseif ($_POST['selected_cmd'] == 'html') {
3439 $this->ctrl->setCmd('exportHTML');
3440 $this->ctrl->setCmdClass('ilForumExportGUI');
3441 $this->executeCommand();
3442 } elseif ($_POST['selected_cmd'] == 'confirmDeleteThreads') {
3443 $this->confirmDeleteThreads();
3444 } elseif ($_POST['selected_cmd'] == 'merge') {
3445 $this->mergeThreadsObject();
3446 } else {
3447 ilUtil::sendInfo($this->lng->txt('topics_please_select_one_action'), true);
3448 $this->ctrl->redirect($this, 'showThreads');
3449 }
3450 } else {
3451 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3452 $this->ctrl->redirect($this, 'showThreads');
3453 }
3454 }
executeCommand()
execute command
editThreadObject($threadId, ilPropertyFormGUI $form=null)

References $_POST, $_SESSION, $i, $message, error(), ilUtil\sendInfo(), settings(), and user().

+ Here is the call graph for this function:

◆ prepareFormOutput()

ilObjForumGUI::prepareFormOutput (   $a_text)

Definition at line 3931 of file class.ilObjForumGUI.php.

3932 {
3933 $a_text = str_replace("&lt;", "<", $a_text);
3934 $a_text = str_replace("&gt;", ">", $a_text);
3935 $a_text = ilUtil::prepareFormOutput($a_text);
3936 return $a_text;
3937 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ publishDraftObject()

ilObjForumGUI::publishDraftObject (   $use_replyform = true)

Definition at line 2217 of file class.ilObjForumGUI.php.

2218 {
2219 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2220 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2221 }
2222
2223 if (!$this->access->checkAccess('add_reply', '', $this->object->getRefId())) {
2224 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2225 }
2226
2227 if (!$this->objCurrentTopic->getId()) {
2228 \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_deleted'), true);
2229 $this->ctrl->redirect($this);
2230 }
2231
2232 if ($this->objCurrentTopic->isClosed()) {
2233 \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_closed'), true);
2234 $this->ctrl->redirect($this);
2235 }
2236
2237 if (!$this->objCurrentPost->getId()) {
2238 $this->requestAction = '';
2239 \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_parent_deleted'));
2240 $this->viewThreadObject();
2241 return;
2242 }
2243
2244 $post_id = $this->objCurrentPost->getId();
2245
2246 $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, (int) $_GET['draft_id']);
2247
2248 if ($use_replyform) {
2249 $oReplyEditForm = $this->getReplyEditForm();
2250 if (!$oReplyEditForm->checkInput()) {
2251 $oReplyEditForm->setValuesByPost();
2252 return $this->viewThreadObject();
2253 }
2254 $post_subject = $oReplyEditForm->getInput('subject');
2255 $post_message = $oReplyEditForm->getInput('message');
2256 $mob_direction = 0;
2257 } else {
2258 $post_subject = $draft_obj->getPostSubject();
2259 $post_message = $draft_obj->getPostMessage();
2260 $mob_direction = 1;
2261 }
2262
2263 if ($draft_obj->getDraftId() > 0) {
2264 // init objects
2265 $oForumObjects = $this->getForumObjects();
2266 $frm = $oForumObjects['frm'];
2267 $frm->setMDB2WhereCondition(' top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
2268
2269 // reply: new post
2270 $status = 1;
2271 $send_activation_mail = 0;
2272
2273 if ($this->objProperties->isPostActivationEnabled()) {
2274 if (!$this->is_moderator) {
2275 $status = 0;
2276 $send_activation_mail = 1;
2277 } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
2278 $status = 0;
2279 }
2280 }
2281
2282 $newPost = $frm->generatePost(
2283 $draft_obj->getForumId(),
2284 $draft_obj->getThreadId(),
2285 $this->user->getId(),
2286 $draft_obj->getPostDisplayUserId(),
2287 ilRTE::_replaceMediaObjectImageSrc($post_message, $mob_direction),
2288 $draft_obj->getPostId(),
2289 (int) $draft_obj->getNotify(),
2290 $this->handleFormInput($post_subject, false),
2291 $draft_obj->getPostUserAlias(),
2292 '',
2293 $status,
2294 $send_activation_mail
2295 );
2296
2297 $this->object->markPostRead(
2298 $this->user->getId(),
2299 (int) $this->objCurrentTopic->getId(),
2300 (int) $this->objCurrentPost->getId()
2301 );
2302
2303 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
2304
2305 foreach ($uploadedObjects as $mob) {
2306 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
2307 ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
2308 }
2309 ilForumUtil::saveMediaObjects($post_message, 'frm:html', $newPost, $mob_direction);
2310
2311 if ($this->objProperties->isFileUploadAllowed()) {
2312 $file = $_FILES['userfile'];
2313 if (is_array($file) && !empty($file)) {
2314 $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost);
2315 $tmp_file_obj->storeUploadedFile($file);
2316 }
2317
2318 //move files of draft to posts directory
2319 $oFDForum = new ilFileDataForum($this->object->getId(), $newPost);
2320 $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_obj->getDraftId());
2321
2322 $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
2323 $oFDForumDrafts->delete();
2324 }
2325
2327 $GLOBALS['ilAppEventHandler']->raise(
2328 'Modules/Forum',
2329 'publishedDraft',
2330 array(
2331 'draftObj' => $draft_obj,
2332 'obj_id' => $this->object->getId(),
2333 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
2334 )
2335 );
2336 }
2337 $draft_obj->deleteDraft();
2338
2339 $GLOBALS['ilAppEventHandler']->raise(
2340 'Modules/Forum',
2341 'createdPost',
2342 array(
2343 'ref_id' => $this->object->getRefId(),
2344 'post' => new ilForumPost($newPost),
2345 'notify_moderators' => (bool) $send_activation_mail
2346 )
2347 );
2348
2349 $message = '';
2350 if (!$this->is_moderator && !$status) {
2351 $message .= $this->lng->txt('forums_post_needs_to_be_activated');
2352 } else {
2353 $message .= $this->lng->txt('forums_post_new_entry');
2354 }
2355
2356 $_SESSION['frm'][(int) $_GET['thr_pk']]['openTreeNodes'][] = (int) $this->objCurrentPost->getId();
2357
2358 $this->ctrl->clearParameters($this);
2359 ilUtil::sendSuccess($message, true);
2360 $this->ctrl->setParameter($this, 'pos_pk', $newPost);
2361 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
2362
2363 $this->ctrl->redirect($this, 'viewThread');
2364 }
2365 }
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)

References $_GET, $_SESSION, $GLOBALS, $message, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), error(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumUtil\saveMediaObjects(), ilUtil\sendFailure(), and user().

+ Here is the call graph for this function:

◆ publishSelectedDraftObject()

ilObjForumGUI::publishSelectedDraftObject ( )

Definition at line 2210 of file class.ilObjForumGUI.php.

2211 {
2212 if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
2213 $this->publishDraftObject(false);
2214 }
2215 }
publishDraftObject($use_replyform=true)

References $_GET.

◆ publishThreadDraftObject()

ilObjForumGUI::publishThreadDraftObject ( )
protected

Definition at line 3818 of file class.ilObjForumGUI.php.

3819 {
3821 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3822 }
3823
3824 $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
3825 $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
3826
3827 if ((int) $draft->getDraftId() <= 0) {
3828 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3829 }
3830
3831 $this->createThread($draft, true);
3832 }

References error(), ilForumPostDraft\isSavePostDraftAllowed(), and ilForumPostDraft\newInstanceByDraftId().

+ Here is the call graph for this function:

◆ quotePostObject()

ilObjForumGUI::quotePostObject ( )

Definition at line 2654 of file class.ilObjForumGUI.php.

2655 {
2656 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2657 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2658 }
2659
2660 if (!is_array($_POST['del_file'])) {
2661 $_POST['del_file'] = array();
2662 }
2663
2664 if ($this->objCurrentTopic->isClosed()) {
2665 $this->requestAction = '';
2666 return $this->viewThreadObject();
2667 }
2668
2669 $oReplyEditForm = $this->getReplyEditForm();
2670
2671 // remove mandatory fields
2672 $oReplyEditForm->getItemByPostVar('subject')->setRequired(false);
2673 $oReplyEditForm->getItemByPostVar('message')->setRequired(false);
2674
2675 $oReplyEditForm->checkInput();
2676
2677 // add mandatory fields
2678 $oReplyEditForm->getItemByPostVar('subject')->setRequired(true);
2679 $oReplyEditForm->getItemByPostVar('message')->setRequired(true);
2680
2681 $this->requestAction = 'showreply';
2682
2683 $this->viewThreadObject();
2684 }

References $_POST, and error().

+ Here is the call graph for this function:

◆ renderDraftContent()

ilObjForumGUI::renderDraftContent ( ilTemplate  $tpl,
string  $action,
ilForumPost  $referencePosting,
array  $drafts 
)
protected
Parameters
ilTemplate$tpl
string$action
ilForumPost$referencePosting
ilForumPostDraft[]
Exceptions
ilSplitButtonException

Definition at line 770 of file class.ilObjForumGUI.php.

775 : void {
776 $frm = $this->object->Forum;
777
778 foreach ($drafts as $draft) {
779 $tmp_file_obj = new ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
780 $filesOfDraft = $tmp_file_obj->getFilesOfPost();
781 ksort($filesOfDraft);
782
783 if (count($filesOfDraft)) {
784 if ($action !== 'showdraft') {
785 foreach ($filesOfDraft as $file) {
786 $tpl->setCurrentBlock('attachment_download_row');
787 $this->ctrl->setParameter($this, 'draft_id', $tmp_file_obj->getDraftId());
788 $this->ctrl->setParameter($this, 'file', $file['md5']);
789 $tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread'));
790 $tpl->setVariable('TXT_FILENAME', $file['name']);
791 $this->ctrl->setParameter($this, 'file', '');
792 $this->ctrl->setParameter($this, 'draft_id', '');
793 $this->ctrl->clearParameters($this);
794 $tpl->parseCurrentBlock();
795 }
796
797 $tpl->setCurrentBlock('attachments');
798 $tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt('forums_attachments'));
799 $tpl->setVariable(
800 'DOWNLOAD_IMG',
801 ilGlyphGUI::get(ilGlyphGUI::ATTACHMENT, $this->lng->txt('forums_download_attachment'))
802 );
803 if (count($filesOfDraft) > 1) {
804 $download_zip_button = ilLinkButton::getInstance();
805 $download_zip_button->setCaption($this->lng->txt('download'), false);
806 $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
807 $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 'deliverDraftZipFile'));
808 $this->ctrl->setParameter($this, 'draft_id', '');
809 $tpl->setVariable('DOWNLOAD_ZIP', $download_zip_button->render());
810 }
811 $tpl->parseCurrentBlock();
812 }
813 }
814
815 $this->renderSplitButton(
816 $tpl,
817 $action,
818 false,
819 $referencePosting,
820 (int) $this->httpRequest->getQueryParams()['page'],
821 $draft
822 );
823
824 $rowCol = 'tblrowmarked';
825 $tpl->setVariable('ROWCOL', ' ' . $rowCol);
826 $tpl->setVariable('DEPTH', (int) ($referencePosting->getDepth() - 1));
827
828 $this->ctrl->setParameter($this, 'pos_pk', $referencePosting->getId());
829 $this->ctrl->setParameter($this, 'thr_pk', $referencePosting->getThreadId());
830 $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
831
832 $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $referencePosting->getId()));
833
834 $this->ctrl->setParameter($this, 'backurl', $backurl);
835 $this->ctrl->setParameter($this, 'thr_pk', $referencePosting->getThreadId());
836 $this->ctrl->setParameter($this, 'user', $draft->getPostDisplayUserId());
837
838 $authorinfo = new ilForumAuthorInformation(
839 $draft->getPostAuthorId(),
840 $draft->getPostDisplayUserId(),
841 $draft->getPostUserAlias(),
842 '',
843 array(
844 'href' => $this->ctrl->getLinkTarget($this, 'showUser')
845 )
846 );
847
848 $this->ctrl->clearParameters($this);
849
850 if ($authorinfo->hasSuffix()) {
851 $tpl->setVariable('AUTHOR', $authorinfo->getSuffix());
852 $tpl->setVariable('USR_NAME', $draft->getPostUserAlias());
853 } else {
854 $tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName());
855 if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized()) {
856 $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true));
857 }
858 }
859 $tpl->setVariable('DRAFT_ANCHOR', 'draft_' . $draft->getDraftId());
860
861 $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture());
862 $tpl->setVariable('USR_ICON_ALT', ilUtil::prepareFormOutput($authorinfo->getAuthorShortName()));
863 if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator(
864 (int) $_GET['ref_id'],
865 $draft->getPostAuthorId()
866 )) {
867 if ($authorinfo->getAuthor()->getGender() == 'f') {
868 $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_f'));
869 } elseif ($authorinfo->getAuthor()->getGender() == 'm') {
870 $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_m'));
871 } elseif ($authorinfo->getAuthor()->getGender() == 'n') {
872 $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_n'));
873 }
874 }
875
876 if ($draft->getUpdateUserId() > 0) {
877 $draft->setPostUpdate($draft->getPostUpdate());
878
879 $this->ctrl->setParameter($this, 'backurl', $backurl);
880 $this->ctrl->setParameter($this, 'thr_pk', $referencePosting->getThreadId());
881 $this->ctrl->setParameter($this, 'user', $referencePosting->getUpdateUserId());
882 $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
883
884 $authorinfo = new ilForumAuthorInformation(
885 $draft->getPostAuthorId(),
886 $draft->getUpdateUserId(),
887 $draft->getPostUserAlias(),
888 '',
889 array(
890 'href' => $this->ctrl->getLinkTarget($this, 'showUser')
891 )
892 );
893
894 $this->ctrl->clearParameters($this);
895
896 $tpl->setVariable(
897 'POST_UPDATE_TXT',
898 $this->lng->txt('edited_on') . ': ' . $frm->convertDate($draft->getPostUpdate()) . ' - ' . strtolower($this->lng->txt('by'))
899 );
900 $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
901 if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
902 $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true));
903 }
904 }
905
906 $draft->setPostMessage($frm->prepareText($draft->getPostMessage()));
907
908 $tpl->setVariable('SUBJECT', $draft->getPostSubject());
909 $tpl->setVariable('POST_DATE', $frm->convertDate($draft->getPostDate()));
910
911 if (!$referencePosting->isCensored() || ($this->objCurrentPost->getId() == $referencePosting->getId() && $action === 'censor')) {
912 $spanClass = '';
913 if (ilForum::_isModerator($this->ref_id, $draft->getPostDisplayUserId())) {
914 $spanClass = 'moderator';
915 }
916
917 if ($draft->getPostMessage() == strip_tags($draft->getPostMessage())) {
918 // We can be sure, that there are not html tags
919 $draft->setPostMessage(nl2br($draft->getPostMessage()));
920 }
921
922 if ($spanClass != "") {
923 $tpl->setVariable(
924 'POST',
925 "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc(
926 $draft->getPostMessage(),
927 1
928 ) . "</span>"
929 );
930 } else {
931 $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($draft->getPostMessage(), 1));
932 }
933 }
934
935 if (!$this->objCurrentTopic->isClosed() && $action === 'deletedraft') {
936 if (!$this->user->isAnonymous() && (int) $draft->getDraftId() === (int) $_GET['draft_id']) {
937 // confirmation: delete
938 $tpl->setVariable('FORM', $this->getDeleteDraftFormHTML());
939 }
940 } elseif ($action === 'editdraft' && (int) $draft->getDraftId() === (int) $_GET['draft_id']) {
941 $oEditReplyForm = $this->getReplyEditForm();
942
943 if (!$this->objCurrentTopic->isClosed() && in_array($this->requestAction, ['showdraft', 'editdraft'])) {
944 $this->renderPostingForm($tpl, $frm, $referencePosting, $this->requestAction);
945 }
946
947 $tpl->setVariable('EDIT_DRAFT_ANCHOR', 'draft_edit_' . $draft->getDraftId());
948 $tpl->setVariable('DRAFT_FORM', $oEditReplyForm->getHTML() . $this->modal_history);
949 }
950
951 $tpl->parseCurrentBlock();
952 }
953 }
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
static get($a_glyph, $a_text="")
Get glyph html.
renderSplitButton(ilTemplate $tpl, string $action, bool $is_post, ilForumPost $node, int $pageIndex=0, ilForumPostDraft $draft=null)

References $_GET, ilObjectGUI\$tpl, ilForum\_isModerator(), ilRTE\_replaceMediaObjectImageSrc(), ilGlyphGUI\ATTACHMENT, ilGlyphGUI\get(), ilForumPost\getDepth(), ilForumPost\getId(), ilLinkButton\getInstance(), getReplyEditForm(), ilForumPost\getThreadId(), ilForumPost\getUpdateUserId(), ilForumPost\isCensored(), ilUtil\prepareFormOutput(), renderSplitButton(), and user().

+ Here is the call graph for this function:

◆ renderPostContent()

ilObjForumGUI::renderPostContent ( ilTemplate  $tpl,
ilForumPost  $node,
string  $action,
int  $pageIndex,
int  $postIndex 
)
protected
Parameters
ilTemplate$tpl
ilForumPost$node
string$action
int$pageIndex
int$postIndex
Exceptions
ilSplitButtonException

Definition at line 963 of file class.ilObjForumGUI.php.

969 {
970 $forumObj = $this->object;
971 $frm = $this->object->Forum;
972
973 $fileDataOfForum = new ilFileDataForum($forumObj->getId(), $node->getId());
974
975 $filesOfPost = $fileDataOfForum->getFilesOfPost();
976 ksort($filesOfPost);
977 if (count($filesOfPost) > 0) {
978 if ($node->getId() != $this->objCurrentPost->getId() || $action !== 'showedit') {
979 foreach ($filesOfPost as $file) {
980 $tpl->setCurrentBlock('attachment_download_row');
981 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
982 $this->ctrl->setParameter($this, 'file', $file['md5']);
983 $tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread'));
984 $tpl->setVariable('TXT_FILENAME', $file['name']);
985 $this->ctrl->clearParameters($this);
986 $tpl->parseCurrentBlock();
987 }
988
989 $tpl->setCurrentBlock('attachments');
990 $tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt('forums_attachments'));
991 $tpl->setVariable(
992 'DOWNLOAD_IMG',
993 ilGlyphGUI::get(ilGlyphGUI::ATTACHMENT, $this->lng->txt('forums_download_attachment'))
994 );
995 if (count($filesOfPost) > 1) {
996 $download_zip_button = ilLinkButton::getInstance();
997 $download_zip_button->setCaption($this->lng->txt('download'), false);
998 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
999 $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 'deliverZipFile'));
1000
1001 $tpl->setVariable('DOWNLOAD_ZIP', $download_zip_button->render());
1002 }
1003
1004 $tpl->parseCurrentBlock();
1005 }
1006 }
1007 $this->renderSplitButton($tpl, $action, true, $node, $pageIndex);
1008
1009 $tpl->setVariable('POST_ANKER', $node->getId());
1010 $tpl->setVariable('TXT_PERMA_LINK', $this->lng->txt('perma_link'));
1011 $tpl->setVariable('PERMA_TARGET', '_top');
1012
1013 $rowCol = ilUtil::switchColor($postIndex, 'tblrow1', 'tblrow2');
1014 if (!$node->isActivated() && !$this->objCurrentTopic->isClosed() && $this->is_moderator) {
1015 $rowCol = 'ilPostingNeedsActivation';
1016 } elseif ($this->objProperties->getMarkModeratorPosts() == 1) {
1017 $isAuthorModerator = ilForum::_isModerator($this->object->getRefId(), $node->getPosAuthorId());
1018 if ($node->getIsAuthorModerator() === null && $isAuthorModerator) {
1019 $rowCol = 'ilModeratorPosting';
1020 } elseif ($node->getIsAuthorModerator()) {
1021 $rowCol = 'ilModeratorPosting';
1022 }
1023 }
1024
1025 if (
1026 (!in_array($action, ['delete', 'censor']) && !$this->displayConfirmPostActivation()) ||
1027 $this->objCurrentPost->getId() != $node->getId()
1028 ) {
1029 $tpl->setVariable('ROWCOL', ' ' . $rowCol);
1030 } else {
1031 $rowCol = 'tblrowmarked';
1032 }
1033
1034 if ($node->isCensored()) {
1035 if ($action !== 'censor') {
1036 $tpl->setVariable('TXT_CENSORSHIP_ADVICE', $this->lng->txt('post_censored_comment_by_moderator'));
1037 }
1038
1039 $rowCol = 'tblrowmarked';
1040 }
1041
1042 $tpl->setVariable('ROWCOL', ' ' . $rowCol);
1043 $tpl->setVariable('DEPTH', (int) ($node->getDepth() - 1));
1044 if (!$node->isActivated() && $node->isOwner($this->user->getId())) {
1045 $tpl->setVariable('POST_NOT_ACTIVATED_YET', $this->lng->txt('frm_post_not_activated_yet'));
1046 }
1047
1048 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
1049 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
1050 $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
1051 $this->ctrl->clearParameters($this);
1052
1053 $this->ctrl->setParameter($this, 'backurl', $backurl);
1054 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
1055 $this->ctrl->setParameter($this, 'user', $node->getDisplayUserId());
1056 $authorinfo = new ilForumAuthorInformation(
1057 $node->getPosAuthorId(),
1058 $node->getDisplayUserId(),
1059 $node->getUserAlias(),
1060 $node->getImportName(),
1061 [
1062 'href' => $this->ctrl->getLinkTarget($this, 'showUser')
1063 ]
1064 );
1065 $this->ctrl->clearParameters($this);
1066
1067 if ($authorinfo->hasSuffix()) {
1068 if (!$authorinfo->isDeleted()) {
1069 $tpl->setVariable('USR_NAME', $authorinfo->getAlias());
1070 }
1071 $tpl->setVariable('AUTHOR', $authorinfo->getSuffix());
1072 } else {
1073 if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized()) {
1074 $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true));
1075 }
1076 $tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName());
1077 }
1078
1079 $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture());
1080 $tpl->setVariable('USR_ICON_ALT', ilUtil::prepareFormOutput($authorinfo->getAuthorShortName()));
1081 $isModerator = ilForum::_isModerator((int) $authorinfo->getAuthor()->getId(), $node->getPosAuthorId());
1082 if ($authorinfo->getAuthor()->getId() && $isModerator) {
1083 $authorRole = $this->lng->txt('frm_moderator_n');
1084 if (is_string($authorinfo->getAuthor()->getGender()) && strlen($authorinfo->getAuthor()->getGender()) > 0) {
1085 $authorRole = $this->lng->txt('frm_moderator_' . $authorinfo->getAuthor()->getGender());
1086 }
1087 $tpl->setVariable('ROLE', $authorRole);
1088 }
1089
1090 if ($node->getUpdateUserId() > 0) {
1091 $node->setChangeDate($node->getChangeDate());
1092
1093 $this->ctrl->setParameter($this, 'backurl', $backurl);
1094 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
1095 $this->ctrl->setParameter($this, 'user', $node->getUpdateUserId());
1096 $update_user_id = $node->getUpdateUserId();
1097 if ($node->getPosAuthorId() == $node->getUpdateUserId() && $node->getDisplayUserId() == 0) {
1098 $update_user_id = $node->getDisplayUserId();
1099 }
1100 $authorinfo = new ilForumAuthorInformation(
1101 $node->getPosAuthorId(),
1102 $update_user_id,
1103 $node->getUserAlias(),
1104 $node->getImportName(),
1105 array(
1106 'href' => $this->ctrl->getLinkTarget($this, 'showUser')
1107 )
1108 );
1109 $this->ctrl->clearParameters($this);
1110
1111 $tpl->setVariable(
1112 'POST_UPDATE_TXT',
1113 $this->lng->txt('edited_on') . ': ' . $frm->convertDate($node->getChangeDate()) . ' - ' . strtolower($this->lng->txt('by'))
1114 );
1115 $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
1116 if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
1117 $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true));
1118 }
1119 }
1120
1121 $node->setMessage($frm->prepareText($node->getMessage()));
1122
1123 if ($this->user->isAnonymous() || $node->isPostRead()) {
1124 $tpl->setVariable('SUBJECT', $node->getSubject());
1125 } else {
1126 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
1127 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
1128 $this->ctrl->setParameter($this, 'page', $pageIndex);
1129 $this->ctrl->setParameter(
1130 $this,
1131 'orderby',
1132 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
1133 );
1134 $this->ctrl->setParameter($this, 'viewmode', ilUtil::stripSlashes($_SESSION['viewmode']));
1135 $mark_post_target = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId());
1136
1137 $tpl->setVariable(
1138 'SUBJECT',
1139 "<a href=\"" . $mark_post_target . "\"><b>" . $node->getSubject() . "</b></a>"
1140 );
1141 }
1142
1143 $tpl->setVariable('POST_DATE', $frm->convertDate($node->getCreateDate()));
1144
1145 if (!$node->isCensored() || ($this->objCurrentPost->getId() == $node->getId() && $action === 'censor')) {
1146 $spanClass = "";
1147 if (ilForum::_isModerator($this->ref_id, $node->getDisplayUserId())) {
1148 $spanClass = 'moderator';
1149 }
1150
1151 // possible bugfix for mantis #8223
1152 if ($node->getMessage() == strip_tags($node->getMessage())) {
1153 // We can be sure, that there are not html tags
1154 $node->setMessage(nl2br($node->getMessage()));
1155 }
1156
1157 if ($spanClass !== '') {
1158 $tpl->setVariable(
1159 'POST',
1160 "<span class=\"" . $spanClass . "\">" .
1162 "</span>"
1163 );
1164 } else {
1165 $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1));
1166 }
1167 } else {
1168 $tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($node->getCensorshipComment()) . "</span>");
1169 }
1170
1171 $tpl->parseCurrentBlock();
1172 }
isOwner($a_user_id=0)
setChangeDate($a_changedate)
setMessage($a_message)
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)

References $_SESSION, $tpl, ilForum\_isModerator(), ilRTE\_replaceMediaObjectImageSrc(), ilGlyphGUI\ATTACHMENT, ilGlyphGUI\get(), ilForumPost\getCensorshipComment(), ilForumPost\getChangeDate(), ilForumPost\getCreateDate(), ilForumPost\getDepth(), ilForumPost\getDisplayUserId(), ilForumPost\getId(), ilForumPost\getImportName(), ilLinkButton\getInstance(), ilForumPost\getIsAuthorModerator(), ilForumPost\getMessage(), ilForumPost\getPosAuthorId(), ilForumPost\getSubject(), ilForumPost\getThreadId(), ilForumPost\getUpdateUserId(), ilForumPost\getUserAlias(), ilForumPost\isActivated(), ilForumPost\isCensored(), ilForumPost\isOwner(), ilForumPost\isPostRead(), ilUtil\prepareFormOutput(), ilForumPost\setChangeDate(), ilForumPost\setMessage(), ilUtil\stripSlashes(), ilUtil\switchColor(), and user().

+ Here is the call graph for this function:

◆ renderSortationControl()

ilObjForumGUI::renderSortationControl ( int  $currentSorting)
private

Definition at line 3228 of file class.ilObjForumGUI.php.

3228 : void
3229 {
3230 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3231 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
3232 $target = $this->ctrl->getLinkTarget(
3233 $this,
3234 'viewThread',
3235 '',
3236 false,
3237 false
3238 );
3239
3240 $translatedSortationOptions = array_map(function ($value) {
3241 return $this->lng->txt($value);
3243
3244 $sortingDirectionViewControl = $this->uiFactory
3245 ->viewControl()
3246 ->sortation($translatedSortationOptions)
3247 ->withLabel($this->lng->txt($this->sortationOptions[$currentSorting]))
3248 ->withTargetURL($target, 'viewmode');
3249 $this->toolbar->addComponent($sortingDirectionViewControl);
3250 }

◆ renderSplitButton()

ilObjForumGUI::renderSplitButton ( ilTemplate  $tpl,
string  $action,
bool  $is_post,
ilForumPost  $node,
int  $pageIndex = 0,
ilForumPostDraft  $draft = null 
)
private
Parameters
ilTemplate$tpl
string$action
bool$is_post
ilForumPost$node
int$pageIndex
ilForumPostDraft | NULL$draft
Exceptions
ilSplitButtonException

Definition at line 5018 of file class.ilObjForumGUI.php.

5025 {
5026 $actions = array();
5027 if ($is_post) {
5028 if ($this->objCurrentPost->getId() != $node->getId() || (
5029 !in_array(
5030 $action,
5031 ['showreply', 'showedit', 'censor', 'delete']
5032 ) && !$this->displayConfirmPostActivation()
5033 )) {
5034 if ($this->is_moderator || $node->isActivated() || $node->isOwner($this->user->getId())) {
5035 if (!$this->objCurrentTopic->isClosed() && $node->isActivated() &&
5036 $this->access->checkAccess('add_reply', '', (int) $this->object->getRefId()) &&
5037 !$node->isCensored()
5038 ) {
5039 $this->ctrl->setParameter($this, 'action', 'showreply');
5040 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5041 $this->ctrl->setParameter($this, 'page', $pageIndex);
5042 $this->ctrl->setParameter(
5043 $this,
5044 'orderby',
5045 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5046 );
5047 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5048
5049 if (!isset($draftsObjects[$node->getId()])) {
5050 $actions['reply_to_postings'] = $this->ctrl->getLinkTarget(
5051 $this,
5052 'viewThread',
5053 'reply_' . $node->getId()
5054 );
5055 }
5056
5057 $this->ctrl->clearParameters($this);
5058 }
5059
5060 if (!$this->objCurrentTopic->isClosed() &&
5061 ($node->isOwner($this->user->getId()) || $this->is_moderator) &&
5062 !$node->isCensored() &&
5063 !$this->user->isAnonymous()
5064 ) {
5065 $this->ctrl->setParameter($this, 'action', 'showedit');
5066 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5067 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5068 $this->ctrl->setParameter($this, 'page', $pageIndex);
5069 $this->ctrl->setParameter(
5070 $this,
5071 'orderby',
5072 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5073 );
5074
5075 $actions['edit'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5076
5077 $this->ctrl->clearParameters($this);
5078 }
5079
5080 if (!$this->user->isAnonymous() && !$node->isPostRead()) {
5081 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5082 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5083 $this->ctrl->setParameter($this, 'page', $pageIndex);
5084 $this->ctrl->setParameter(
5085 $this,
5086 'orderby',
5087 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5088 );
5089 $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
5090
5091 $actions['frm_mark_as_read'] = $this->ctrl->getLinkTarget(
5092 $this,
5093 'markPostRead',
5094 $node->getId()
5095 );
5096
5097 $this->ctrl->clearParameters($this);
5098 }
5099
5100 if (!$this->user->isAnonymous() && $node->isPostRead()
5101 ) {
5102 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5103 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5104 $this->ctrl->setParameter($this, 'page', $pageIndex);
5105 $this->ctrl->setParameter(
5106 $this,
5107 'orderby',
5108 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5109 );
5110 $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
5111
5112 $actions['frm_mark_as_unread'] = $this->ctrl->getLinkTarget(
5113 $this,
5114 'markPostUnread',
5115 $node->getId()
5116 );
5117
5118 $this->ctrl->clearParameters($this);
5119 }
5120
5121 if (!$node->isCensored()) {
5122 $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId());
5123 $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId());
5124 $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId());
5125
5126 $actions['print'] = $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost');
5127
5128 $this->ctrl->clearParameters($this);
5129 }
5130
5131 if (!$this->objCurrentTopic->isClosed() &&
5132 ($this->is_moderator ||
5133 ($node->isOwner($this->user->getId()) && !$node->hasReplies())) &&
5134 !$this->user->isAnonymous()
5135 ) {
5136 $this->ctrl->setParameter($this, 'action', 'delete');
5137 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5138 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5139 $this->ctrl->setParameter($this, 'page', $pageIndex);
5140 $this->ctrl->setParameter(
5141 $this,
5142 'orderby',
5143 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5144 );
5145
5146 $actions['delete'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5147
5148 $this->ctrl->clearParameters($this);
5149 }
5150
5151 if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
5152 $this->ctrl->setParameter($this, 'action', 'censor');
5153 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5154 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5155 $this->ctrl->setParameter($this, 'page', $pageIndex);
5156 $this->ctrl->setParameter(
5157 $this,
5158 'orderby',
5159 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5160 );
5161 if ($node->isCensored()) {
5162 $actions['frm_revoke_censorship'] = $this->ctrl->getLinkTarget(
5163 $this,
5164 'viewThread',
5165 $node->getId()
5166 );
5167 } else {
5168 $actions['frm_censorship'] = $this->ctrl->getLinkTarget(
5169 $this,
5170 'viewThread',
5171 $node->getId()
5172 );
5173 }
5174
5175 $this->ctrl->clearParameters($this);
5176
5177 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5178 $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5179 $this->ctrl->setParameter($this, 'page', $pageIndex);
5180 $this->ctrl->setParameter(
5181 $this,
5182 'orderby',
5183 ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5184 );
5185
5186 if (!$node->isActivated()) {
5187 $actions['activate_post'] = $this->ctrl->getLinkTarget(
5188 $this,
5189 'askForPostActivation',
5190 $node->getId()
5191 );
5192 }
5193
5194 $this->ctrl->clearParameters($this);
5195 }
5196 }
5197 }
5198 } elseif ($_GET['draft_id'] != $draft->getDraftId() || !in_array($action, ['deletedraft', 'editdraft'])) {
5199 // get actions for drafts
5200 $this->ctrl->setParameter($this, 'action', 'publishdraft');
5201 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5202 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5203 $this->ctrl->setParameter($this, 'page', (int) $this->httpRequest->getQueryParams()['page']);
5204 $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5205 $this->ctrl->setParameter(
5206 $this,
5207 'orderby',
5208 \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5209 );
5210 $actions['publish'] = $this->ctrl->getLinkTarget($this, 'publishSelectedDraft', $node->getId());
5211 $this->ctrl->clearParameters($this);
5212
5213 $this->ctrl->setParameter($this, 'action', 'editdraft');
5214 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5215 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5216 $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5217 $this->ctrl->setParameter($this, 'page', (int) $this->httpRequest->getQueryParams()['page']);
5218 $this->ctrl->setParameter(
5219 $this,
5220 'orderby',
5221 \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5222 );
5223 $actions['edit'] = $this->ctrl->getLinkTarget($this, 'editDraft', 'draft_edit_' . $draft->getDraftId());
5224 $this->ctrl->clearParameters($this);
5225
5226 $this->ctrl->setParameter($this, 'action', 'deletedraft');
5227 $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5228 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5229 $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5230 $this->ctrl->setParameter($this, 'page', (int) $this->httpRequest->getQueryParams()['page']);
5231 $this->ctrl->setParameter(
5232 $this,
5233 'orderby',
5234 \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5235 );
5236 $actions['delete'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5237 $this->ctrl->clearParameters($this);
5238 }
5239
5240 $tpl->setCurrentBlock('posts_row');
5241 if (count($actions) > 0 && !$this->objCurrentTopic->isClosed()) {
5242 $action_button = ilSplitButtonGUI::getInstance();
5243
5244 $i = 0;
5245 foreach ($actions as $lng_id => $url) {
5246 if ($i == 0) {
5247 $sb_item = ilLinkButton::getInstance();
5248 $sb_item->setCaption($lng_id);
5249 $sb_item->setUrl($url);
5250
5251 $action_button->setDefaultButton($sb_item);
5252 ++$i;
5253 } else {
5254 $sb_item = ilLinkButton::getInstance();
5255 $sb_item->setCaption($lng_id);
5256 $sb_item->setUrl($url);
5257
5258 $action_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($sb_item));
5259 }
5260 }
5261
5262 $tpl->setVariable('COMMANDS', $action_button->render());
5263 }
5264 }
$url

References $_GET, $_SESSION, $i, $tpl, $url, ilForumPost\getForumId(), ilForumPost\getId(), ilLinkButton\getInstance(), ilSplitButtonGUI\getInstance(), ilForumPost\getThreadId(), ilForumPost\hasReplies(), ilForumPost\isActivated(), ilForumPost\isCensored(), ilForumPost\isOwner(), ilForumPost\isPostRead(), ilUtil\stripSlashes(), and user().

Referenced by renderDraftContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderViewModeControl()

ilObjForumGUI::renderViewModeControl ( int  $currentViewMode)
private

Definition at line 3202 of file class.ilObjForumGUI.php.

3202 : void
3203 {
3204 $translationKeys = [];
3205 foreach ($this->viewModeOptions as $sortingConstantKey => $languageKey) {
3206 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3207 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
3208 $this->ctrl->setParameter($this, 'viewmode', $sortingConstantKey);
3209
3210 $translationKeys[$this->lng->txt($languageKey)] = $this->ctrl->getLinkTarget(
3211 $this,
3212 'viewThread',
3213 '',
3214 false,
3215 false
3216 );
3217
3218 $this->ctrl->clearParameters($this);
3219 }
3220
3221 $sortViewControl = $this->uiFactory
3222 ->viewControl()
3223 ->mode($translationKeys, $this->lng->txt($this->viewModeOptions[$currentViewMode]))
3224 ->withActive($this->lng->txt($this->viewModeOptions[$currentViewMode]));
3225 $this->toolbar->addComponent($sortViewControl);
3226 }

◆ restoreFromHistoryObject()

ilObjForumGUI::restoreFromHistoryObject ( )
protected

Definition at line 4417 of file class.ilObjForumGUI.php.

4418 {
4419 $historyId = (int) ($this->httpRequest->getQueryParams()['history_id'] ?? 0);
4420 $history = new \ilForumDraftsHistory($historyId);
4421
4422 $draft = $history->rollbackAutosave();
4423 if ($draft->getThreadId() == 0 && $draft->getPostId() == 0) {
4424 $this->ctrl->setParameter($this, 'draft_id', $history->getDraftId());
4425 $this->ctrl->redirect($this, 'editThreadDraft');
4426 }
4427
4428 $this->ctrl->clearParameters($this);
4429 $this->ctrl->setParameter($this, 'pos_pk', $draft->getPostId());
4430 $this->ctrl->setParameter($this, 'thr_pk', $draft->getThreadId());
4431 $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
4432 $this->ctrl->setParameter($this, 'action', 'editdraft');
4433
4434 // create draft backup before redirect!
4435 \ilForumPostDraft::createDraftBackup((int) $draft->getDraftId());
4436
4437 $this->ctrl->redirect($this, 'viewThread');
4438 }

References ilForumPostDraft\createDraftBackup().

+ Here is the call graph for this function:

◆ revokeCensorshipObject()

ilObjForumGUI::revokeCensorshipObject ( )
private

Definition at line 1632 of file class.ilObjForumGUI.php.

1633 {
1634 $this->handleCensorship(true);
1635 }

◆ saveThreadAsDraftObject()

ilObjForumGUI::saveThreadAsDraftObject ( )
protected

Definition at line 4440 of file class.ilObjForumGUI.php.

4441 {
4442 if (
4443 !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4444 !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4446 ) {
4447 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4448 }
4449
4450 $autoSavedDraftId = (int) ($this->httpRequest->getParsedBody()['draft_id'] ?? 0);
4451 if ($autoSavedDraftId <= 0) {
4452 $autoSavedDraftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4453 }
4454
4455 $frm = $this->object->Forum;
4456 $frm->setForumId($this->object->getId());
4457 $frm->setForumRefId($this->object->getRefId());
4458 $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4459 $topicData = $frm->getOneTopic();
4460
4461 $form = $this->buildThreadForm();
4462 if ($form->checkInput()) {
4463 $this->doCaptchaCheck();
4464
4465 if (0 === $autoSavedDraftId) {
4466 $draft = new \ilForumPostDraft();
4467 } else {
4468 $draft = \ilForumPostDraft::newInstanceByDraftId($autoSavedDraftId);
4469 }
4470
4471 $draft->setForumId($topicData['top_pk']);
4472 $draft->setThreadId(0);
4473 $draft->setPostId(0);
4474 $draft->setPostSubject($this->handleFormInput($form->getInput('subject'), false));
4475 $draft->setPostMessage(\ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0));
4477 $form->getInput('alias'),
4478 $this->objProperties->isAnonymized()
4479 );
4480 $draft->setPostUserAlias($userAlias);
4481 $draft->setNotify((int) $form->getInput('notify'));
4482 $draft->setPostAuthorId($this->user->getId());
4483 $draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
4484
4485 if (0 === $autoSavedDraftId) {
4486 $draftId = $draft->saveDraft();
4487 } else {
4488 $draft->updateDraft();
4489 $draftId = $draft->getDraftId();
4490 }
4491
4492 $GLOBALS['ilAppEventHandler']->raise(
4493 'Modules/Forum',
4494 'savedAsDraft',
4495 [
4496 'draftObj' => $draft,
4497 'obj_id' => $this->object->getId(),
4498 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4499 ]
4500 );
4501
4502 \ilForumUtil::moveMediaObjects($form->getInput('message'), 'frm~d:html', $draftId, 'frm~d:html', $draftId);
4503
4504 $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draftId);
4505
4506 $files2delete = $form->getInput('del_file');
4507 if (is_array($files2delete) && count($files2delete) > 0) {
4508 $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4509 }
4510
4511 if ($this->objProperties->isFileUploadAllowed()) {
4512 $file = $_FILES['userfile'];
4513 if (is_array($file) && !empty($file)) {
4514 $draftFileData->storeUploadedFile($file);
4515 }
4516 }
4517
4518 \ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4519 $this->ctrl->clearParameters($this);
4520 $this->ctrl->redirect($this, 'showThreads');
4521 }
4522
4523 $this->requestAction = substr($this->requestAction, 6); // @nmatuschek: Why this, I don't get it???
4524 $form->setValuesByPost();
4525 $this->ctrl->setParameter($this, 'draft_id', $autoSavedDraftId);
4526 $this->tpl->setContent($form->getHTML());
4527 }

References $GLOBALS, ilRTE\_replaceMediaObjectImageSrc(), error(), ilForumUtil\getPublicUserAlias(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumUtil\moveMediaObjects(), ilForumPostDraft\newInstanceByDraftId(), and user().

+ Here is the call graph for this function:

◆ saveThreadSortingObject()

ilObjForumGUI::saveThreadSortingObject ( )
protected

Definition at line 4114 of file class.ilObjForumGUI.php.

4115 {
4116 if (!$this->is_moderator) {
4117 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4118 }
4119
4120 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4121 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4122 }
4123
4124 $threadIdToSortValueMap = (array) ($this->httpRequest->getParsedBody()['thread_sorting'] ?? []);
4125
4126 array_walk($threadIdToSortValueMap, function ($sortValue, $threadId) {
4127 $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic($threadId));
4128 });
4129
4130 foreach ($threadIdToSortValueMap as $threadId => $sortValue) {
4131 $sortValue = str_replace(',', '.', $sortValue);
4132 $sortValue = (float) $sortValue * 100;
4133 $this->object->setThreadSorting((int) $threadId, $sortValue);
4134 }
4135
4136 \ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
4137 $this->ctrl->redirect($this, 'showThreads');
4138 }

References error().

+ Here is the call graph for this function:

◆ saveTopLevelDraftObject()

ilObjForumGUI::saveTopLevelDraftObject ( )

Definition at line 4605 of file class.ilObjForumGUI.php.

4605 : void
4606 {
4607 $this->saveAsDraftObject();
4608 }

◆ saveTopLevelPostObject()

ilObjForumGUI::saveTopLevelPostObject ( )

Definition at line 2204 of file class.ilObjForumGUI.php.

2205 {
2206 $this->savePostObject();
2207 return;
2208 }

◆ setColumnSettings()

ilObjForumGUI::setColumnSettings ( ilColumnGUI  $column_gui)
protected

May be overwritten in subclasses.

Reimplemented from ilObjectGUI.

Definition at line 3890 of file class.ilObjForumGUI.php.

3891 {
3892 $column_gui->setBlockProperty('news', 'title', $this->lng->txt('frm_latest_postings'));
3893 $column_gui->setBlockProperty('news', 'prevent_aggregation', true);
3894 $column_gui->setRepositoryMode(true);
3895
3896 if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
3897 $news_set = new \ilSetting('news');
3898 if ($news_set->get('enable_rss_for_internal')) {
3899 $column_gui->setBlockProperty('news', 'settings', true);
3900 $column_gui->setBlockProperty('news', 'public_notifications_option', true);
3901 }
3902 }
3903 }
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.

References ilColumnGUI\setBlockProperty(), and ilColumnGUI\setRepositoryMode().

+ Here is the call graph for this function:

◆ setDisplayConfirmPostActivation()

ilObjForumGUI::setDisplayConfirmPostActivation (   $status = 0)

Definition at line 1682 of file class.ilObjForumGUI.php.

1683 {
1684 $this->display_confirm_post_activation = $status;
1685 }

◆ setSideBlocks()

ilObjForumGUI::setSideBlocks ( )
protected

Definition at line 4324 of file class.ilObjForumGUI.php.

4325 {
4326 $content = $this->getRightColumnHTML();
4327 if (!$this->ctrl->isAsynch()) {
4328 $content = implode('', [
4329 \ilRepositoryObjectSearchGUI::getSearchBlockHTML($this->lng->txt('frm_search')),
4330 $content,
4331 ]);
4332 }
4333 $this->tpl->setRightContent($content);
4334 }
getRightColumnHTML()
Display right column.
static getSearchBlockHTML($a_title)
Get standar search block html.

References ilRepositoryObjectSearchGUI\getSearchBlockHTML().

Referenced by executeCommand(), showThreadsObject(), and sortThreadsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showStatisticsObject()

ilObjForumGUI::showStatisticsObject ( )

if globally deactivated, skip!!! intrusion detected

Definition at line 1301 of file class.ilObjForumGUI.php.

1302 {
1304 if (!$this->settings->get('enable_fora_statistics', false)) {
1305 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1306 }
1307
1308 // if no read access -> intrusion detected
1309 if (!$this->access->checkAccess('read', '', (int) $_GET['ref_id'])) {
1310 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1311 }
1312
1313 // if read access and statistics disabled -> intrusion detected
1314 if (!$this->objProperties->isStatisticEnabled()) {
1315 // if write access and statistics disabled -> ok, for forum admin
1316 if ($this->access->checkAccess('write', '', (int) $_GET['ref_id'])) {
1317 ilUtil::sendInfo($this->lng->txt('frm_statistics_disabled_for_participants'));
1318 } else {
1319 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1320 }
1321 }
1322
1323 $this->object->Forum->setForumId($this->object->getId());
1324
1325 $tbl = new ilForumStatisticsTableGUI($this, 'showStatistics');
1326 $tbl->setId('il_frm_statistic_table_' . (int) $_GET['ref_id']);
1327 $tbl->setTitle(
1328 $this->lng->txt('statistic'),
1329 'icon_usr.svg',
1330 $this->lng->txt('obj_' . $this->object->getType())
1331 );
1332
1333 $data = $this->object->Forum->getUserStatistic($this->is_moderator);
1334 $result = array();
1335 $counter = 0;
1336 foreach ($data as $row) {
1337 $result[$counter]['ranking'] = $row[0];
1338 $result[$counter]['login'] = $row[1];
1339 $result[$counter]['lastname'] = $row[2];
1340 $result[$counter]['firstname'] = $row[3];
1341
1342 ++$counter;
1343 }
1344 $tbl->setData($result);
1345
1346 $this->tpl->setContent($tbl->getHTML());
1347 }
Class ilForumStatisticsTableGUI.

References $_GET, $data, $result, error(), ilUtil\sendInfo(), and settings().

+ Here is the call graph for this function:

◆ showThreadsObject()

ilObjForumGUI::showThreadsObject ( )

Definition at line 638 of file class.ilObjForumGUI.php.

639 {
640 $this->getSubTabs('showThreads');
641 $this->setSideBlocks();
642 $this->getCenterColumnHTML();
643 }
getSubTabs($subtab='showThreads')
getCenterColumnHTML()
Get center column.

References ilObjectGUI\getCenterColumnHTML(), getSubTabs(), and setSideBlocks().

Referenced by executeCommand(), markAllReadObject(), and updateThreadObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUserObject()

ilObjForumGUI::showUserObject ( )

Definition at line 3300 of file class.ilObjForumGUI.php.

3301 {
3302 $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
3303 $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
3304 $profile_gui->setAdditional($add);
3305 $profile_gui->setBackUrl(\ilUtil::stripSlashes($_GET['backurl']));
3306 $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
3307 }

References $_GET, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ sortThreadsObject()

ilObjForumGUI::sortThreadsObject ( )

Definition at line 645 of file class.ilObjForumGUI.php.

646 {
647 $this->getSubTabs('sortThreads');
648 $this->setSideBlocks();
649 $this->getCenterColumnHTML();
650 }

References ilObjectGUI\getCenterColumnHTML(), getSubTabs(), and setSideBlocks().

+ Here is the call graph for this function:

◆ toggleExplorerNodeStateObject()

ilObjForumGUI::toggleExplorerNodeStateObject ( )
protected

Toggle explorer node.

Definition at line 165 of file class.ilObjForumGUI.php.

165 : void
166 {
167 $exp = new ilForumExplorerGUI(
168 'frm_exp_' . $this->objCurrentTopic->getId(),
169 $this,
170 'viewThread',
171 $this->objCurrentTopic,
172 $this->objCurrentTopic->getFirstPostNode($this->is_moderator)
173 );
174 $exp->toggleExplorerNodeState();
175 }
Class ilForumExplorerGUI.

◆ toggleStickinessObject()

ilObjForumGUI::toggleStickinessObject ( )
protected

Definition at line 1711 of file class.ilObjForumGUI.php.

1712 {
1713 if (!$this->is_moderator) {
1714 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1715 }
1716
1717 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1718 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1719 }
1720
1721 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1722
1723 if ($this->objCurrentTopic->isSticky()) {
1724 $this->objCurrentTopic->unmakeSticky();
1725 } else {
1726 $this->objCurrentTopic->makeSticky();
1727 }
1728
1729 $this->viewThreadObject();
1730 }

References error().

+ Here is the call graph for this function:

◆ toggleThreadNotificationObject()

ilObjForumGUI::toggleThreadNotificationObject ( )
protected

Definition at line 1692 of file class.ilObjForumGUI.php.

1693 {
1694 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1695 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1696 }
1697
1698 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1699
1700 if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
1701 $this->objCurrentTopic->disableNotification($this->user->getId());
1702 \ilUtil::sendInfo($this->lng->txt('forums_notification_disabled'));
1703 } else {
1704 $this->objCurrentTopic->enableNotification($this->user->getId());
1705 \ilUtil::sendInfo($this->lng->txt('forums_notification_enabled'));
1706 }
1707
1708 $this->viewThreadObject();
1709 }

References error(), ilUtil\sendInfo(), and user().

+ Here is the call graph for this function:

◆ updateCustom()

ilObjForumGUI::updateCustom ( ilPropertyFormGUI  $a_form)
protected
Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

Definition at line 537 of file class.ilObjForumGUI.php.

538 {
539 $this->forum_settings_gui->updateCustomValues($a_form);
540 }

◆ updateThreadDraftObject()

ilObjForumGUI::updateThreadDraftObject ( )
protected

Definition at line 4529 of file class.ilObjForumGUI.php.

4530 {
4531 if (
4532 !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4533 !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4535 ) {
4536 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4537 }
4538
4539 $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4540 if ($draftId <= 0 || !$this->checkDraftAccess($draftId)) {
4541 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4542 }
4543
4544 $form = $this->buildThreadForm(true);
4545 if ($form->checkInput()) {
4546 $this->doCaptchaCheck();
4547
4549 $form->getInput('alias'),
4550 $this->objProperties->isAnonymized()
4551 );
4552
4553 $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
4554 $draft->setPostSubject($this->handleFormInput($form->getInput('subject'), false));
4555 $draft->setPostMessage(\ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0));
4556 $draft->setPostUserAlias($userAlias);
4557 $draft->setNotify((int) $form->getInput('notify'));
4558 $draft->setPostAuthorId($this->user->getId());
4559 $draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
4560 $draft->updateDraft();
4561
4562 $GLOBALS['ilAppEventHandler']->raise(
4563 'Modules/Forum',
4564 'updatedDraft',
4565 [
4566 'draftObj' => $draft,
4567 'obj_id' => $this->object->getId(),
4568 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4569 ]
4570 );
4571
4573 $form->getInput('message'),
4574 'frm~d:html',
4575 $draft->getDraftId(),
4576 'frm~d:html',
4577 $draft->getDraftId()
4578 );
4579
4580 $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
4581
4582 $files2delete = $form->getInput('del_file');
4583 if (is_array($files2delete) && count($files2delete) > 0) {
4584 $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4585 }
4586
4587 if ($this->objProperties->isFileUploadAllowed()) {
4588 $file = $_FILES['userfile'];
4589 if (is_array($file) && !empty($file)) {
4590 $draftFileData->storeUploadedFile($file);
4591 }
4592 }
4593
4594 \ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4595 $this->ctrl->clearParameters($this);
4596 $this->ctrl->redirect($this, 'showThreads');
4597 }
4598
4599 $form->setValuesByPost();
4600 $this->ctrl->setParameter($this, 'hist_check', 0);
4601 $this->ctrl->setParameter($this, 'draft_id', $draftId);
4602 $this->editThreadDraftObject($form);
4603 }
editThreadDraftObject(\ilPropertyFormGUI $form=null)

References $GLOBALS, ilRTE\_replaceMediaObjectImageSrc(), error(), ilForumUtil\getPublicUserAlias(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumUtil\moveMediaObjects(), ilForumPostDraft\newInstanceByDraftId(), and user().

+ Here is the call graph for this function:

◆ updateThreadObject()

ilObjForumGUI::updateThreadObject ( )

Definition at line 596 of file class.ilObjForumGUI.php.

597 {
598 if (!$this->is_moderator) {
599 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
600 }
601
602 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
603 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
604 }
605
606 if (!$this->objCurrentTopic->getId()) {
607 $this->showThreadsObject();
608 return;
609 }
610
611 $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
612
613 $form = $this->getThreadEditingForm($this->objCurrentTopic->getId());
614 if (!$form->checkInput()) {
615 $form->setValuesByPost();
616 $this->editThreadObject($this->objCurrentTopic->getId(), $form);
617 return;
618 }
619
620 $this->objCurrentTopic->setSubject($form->getInput('title'));
621 $this->objCurrentTopic->updateThreadTitle();
622
623 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
624 $this->showThreadsObject();
625 }

References editThreadObject(), ensureThreadBelongsToForum(), error(), getThreadEditingForm(), and showThreadsObject().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjForumGUI::$access

Definition at line 90 of file class.ilObjForumGUI.php.

◆ $confirmation_gui_html

ilObjForumGUI::$confirmation_gui_html = ''
private

Definition at line 80 of file class.ilObjForumGUI.php.

◆ $create_form_gui

ilObjForumGUI::$create_form_gui
private

Definition at line 56 of file class.ilObjForumGUI.php.

◆ $defaultSorting

ilObjForumGUI::$defaultSorting
private

Definition at line 32 of file class.ilObjForumGUI.php.

◆ $display_confirm_post_activation

ilObjForumGUI::$display_confirm_post_activation = 0
private

Definition at line 50 of file class.ilObjForumGUI.php.

◆ $error

ilObjForumGUI::$error

Definition at line 93 of file class.ilObjForumGUI.php.

◆ $forum_settings_gui

ilObjForumGUI::$forum_settings_gui
private

Definition at line 83 of file class.ilObjForumGUI.php.

Referenced by executeCommand().

◆ $forumObjects

ilObjForumGUI::$forumObjects = null
private

Definition at line 77 of file class.ilObjForumGUI.php.

◆ $globalScreen

ilObjForumGUI::$globalScreen
private

Definition at line 35 of file class.ilObjForumGUI.php.

◆ $hideToolbar

ilObjForumGUI::$hideToolbar = false
private

Definition at line 62 of file class.ilObjForumGUI.php.

◆ $httpRequest

ilObjForumGUI::$httpRequest
private

Definition at line 68 of file class.ilObjForumGUI.php.

◆ $ilHelp

ilObjForumGUI::$ilHelp

Definition at line 100 of file class.ilObjForumGUI.php.

◆ $ilNavigationHistory

ilObjForumGUI::$ilNavigationHistory

Definition at line 86 of file class.ilObjForumGUI.php.

◆ $ilObjDataCache

ilObjForumGUI::$ilObjDataCache

Definition at line 91 of file class.ilObjForumGUI.php.

◆ $is_moderator

ilObjForumGUI::$is_moderator = false
private

Definition at line 53 of file class.ilObjForumGUI.php.

◆ $locator

ilObjForumGUI::$locator

Definition at line 99 of file class.ilObjForumGUI.php.

◆ $modal_history

ilObjForumGUI::$modal_history = ''

Definition at line 38 of file class.ilObjForumGUI.php.

◆ $objCurrentPost

ilObjForumGUI::$objCurrentPost
private

Definition at line 47 of file class.ilObjForumGUI.php.

◆ $objCurrentTopic

ilObjForumGUI::$objCurrentTopic
private

Definition at line 44 of file class.ilObjForumGUI.php.

◆ $object

ilObjForumGUI::$object

Definition at line 65 of file class.ilObjForumGUI.php.

◆ $objProperties

ilObjForumGUI::$objProperties

Definition at line 41 of file class.ilObjForumGUI.php.

◆ $rbac

ilObjForumGUI::$rbac

Definition at line 98 of file class.ilObjForumGUI.php.

◆ $replyEditForm

ilObjForumGUI::$replyEditForm
private

Definition at line 59 of file class.ilObjForumGUI.php.

◆ $repositoryTree

ilObjForumGUI::$repositoryTree

Definition at line 97 of file class.ilObjForumGUI.php.

◆ $requestAction

ilObjForumGUI::$requestAction = ''
private

Definition at line 88 of file class.ilObjForumGUI.php.

◆ $settings

ilObjForumGUI::$settings

Definition at line 95 of file class.ilObjForumGUI.php.

◆ $sortationOptions

ilObjForumGUI::$sortationOptions
private
Initial value:
= [
ilForumProperties::VIEW_DATE_ASC => 'ascending_order',
ilForumProperties::VIEW_DATE_DESC => 'descending_order',
]

Definition at line 26 of file class.ilObjForumGUI.php.

◆ $tabs

ilObjForumGUI::$tabs

Definition at line 92 of file class.ilObjForumGUI.php.

◆ $toolbar

ilObjForumGUI::$toolbar

Definition at line 96 of file class.ilObjForumGUI.php.

◆ $uiFactory

ilObjForumGUI::$uiFactory
private

Definition at line 71 of file class.ilObjForumGUI.php.

◆ $uiRenderer

ilObjForumGUI::$uiRenderer
private

Definition at line 74 of file class.ilObjForumGUI.php.

◆ $user

ilObjForumGUI::$user

Definition at line 94 of file class.ilObjForumGUI.php.

◆ $viewModeOptions

ilObjForumGUI::$viewModeOptions
private
Initial value:
= [
ilForumProperties::VIEW_TREE => 'sort_by_posts',
]

Definition at line 20 of file class.ilObjForumGUI.php.


The documentation for this class was generated from the following file: