ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 
 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 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 ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 
- Public Member Functions inherited from ilDesktopItemHandling
 addToDeskObject ()
 Add desktop item public. More...
 
 removeFromDeskObject ()
 Remove from desktop 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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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 ()
 
 confirmDeleteThreadDraftsObject ()
 
 toggleThreadNotificationObject ()
 
 toggleStickinessObject ()
 
 deleteThreadDraftsObject ()
 
 createThreadObject ()
 
 publishThreadDraftObject ()
 
 addThreadObject ()
 
 enableForumNotificationObject ()
 
 disableForumNotificationObject ()
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addLocatorItems ()
 
 infoScreen ()
 
 markPostUnreadObject ()
 
 markPostReadObject ()
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 
 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 public More...
 
 setAdminTabs ()
 set admin tabs 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)
 
 isTopLevelReplyCommand ()
 
 getThreadEditingForm ($a_thread_id)
 
 deletePostingDraftObject ()
 
 revokeCensorshipObject ()
 
 addCensorshipObject ()
 
 getModalActions ()
 
 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
 
 $globalScreen
 
 $objCurrentTopic
 
 $objCurrentPost
 
 $display_confirm_post_activation = 0
 
 $is_moderator = false
 
 $replyEditForm
 
 $hideToolbar = false
 
 $httpRequest
 
 $http
 
 $uiFactory
 
 $uiRenderer
 
 $forumObjects = null
 
 $confirmation_gui_html = ''
 
 $forum_settings_gui
 
 $requestAction = ''
 
 $modalActionsContainer = []
 
 $selectedSorting
 

Additional Inherited Members

- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $_GET, $DIC, $is_moderator, ILIAS\GlobalScreen\Provider\__construct(), checkUsersViewMode(), ilForumProperties\getInstance(), ILIAS\FileDelivery\http(), initSessionStorage(), settings(), and user().

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

References $_GET, $DIC, ilObjectGUI\$ilErr, ilObjectGUI\$lng, ilObjectGUI\$ref_id, ilObject\_getAllReferences(), ilObject\_lookupObjectId(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ROOT_FOLDER_ID, and ilUtil\sendInfo().

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

◆ addCensorshipObject()

ilObjForumGUI::addCensorshipObject ( )
private

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

1635  {
1636  $this->handleCensorship();
1637  }

◆ addLocatorItems()

ilObjForumGUI::addLocatorItems ( )
protected

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

3868  {
3869  if ($this->object instanceof \ilObjForum) {
3870  $this->locator->addItem(
3871  $this->object->getTitle(),
3872  $this->ctrl->getLinkTarget($this),
3873  '',
3874  $this->object->getRefId()
3875  );
3876  }
3877  }
Class ilObjForum.

◆ addThreadObject()

ilObjForumGUI::addThreadObject ( )
protected

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

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

3794  {
3795  $draft = new \ilForumPostDraft();
3797  $draftId = (int) ($this->httpRequest->getParsedBody()['draft_id'] ?? 0);
3798  if ($draftId > 0) {
3799  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
3800  }
3801  }
3802 
3803  $this->createThread($draft, false);
3804  }
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...
+ Here is the call graph for this function:

◆ afterSave()

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

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

References ilObject\getRefId().

1173  {
1174  \ilUtil::sendSuccess($this->lng->txt('frm_added'), true);
1175  $this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
1176  $this->ctrl->redirect($this, 'createThread');
1177  }
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ askForPostActivationObject()

ilObjForumGUI::askForPostActivationObject ( )

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

References setDisplayConfirmPostActivation().

1681  {
1682  if (!$this->is_moderator) {
1683  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1684  }
1685 
1686  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1687  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1688  }
1689 
1690  $this->setDisplayConfirmPostActivation(true);
1691 
1692  $this->viewThreadObject();
1693  }
setDisplayConfirmPostActivation($status=0)
+ Here is the call graph for this function:

◆ autosaveDraftAsyncObject()

ilObjForumGUI::autosaveDraftAsyncObject ( )
protected

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

References $message, getReplyEditForm(), handleFormInput(), ILIAS\FileDelivery\http(), ilObjForum\lookupForumIdByRefId(), ilUtil\stripSlashes(), and user().

4913  {
4914  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4915  if (
4916  $this->requestAction !== 'ready_showreply' &&
4917  $this->access->checkAccess('read', '', $this->object->getRefId()) &&
4918  $this->access->checkAccess('add_reply', '', $this->object->getRefId())
4919  ) {
4920  $action = new \ilForumAutoSaveAsyncDraftAction(
4921  $this->user,
4922  $this->getReplyEditForm(),
4923  $this->objProperties,
4924  $this->objCurrentTopic,
4925  $this->objCurrentPost,
4926  function (string $message) : string {
4927  return $this->handleFormInput($message);
4928  },
4929  $draftId,
4930  (int) \ilObjForum::lookupForumIdByRefId($this->ref_id),
4931  \ilUtil::stripSlashes($this->requestAction)
4932  );
4933 
4934  $this->http->saveResponse($this->http->response()->withBody(
4935  \ILIAS\Filesystem\Stream\Streams::ofString(json_encode($action->executeAndGetResponseObject()))
4936  ));
4937  }
4938 
4939  $this->http->sendResponse();
4940  $this->http->close();
4941  }
Class ChatMainBarProvider .
static lookupForumIdByRefId($ref_id)
user()
Definition: user.php:4
static http()
Fetches the global http state from ILIAS.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
handleFormInput($a_text, $a_stripslashes=true)
$message
Definition: xapiexit.php:14
Class FlySystemFileAccessTest disabled disabled disabled.
+ Here is the call graph for this function:

◆ autosaveThreadDraftAsyncObject()

ilObjForumGUI::autosaveThreadDraftAsyncObject ( )
protected

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

References $message, buildThreadForm(), handleFormInput(), ILIAS\FileDelivery\http(), ilObjForum\lookupForumIdByRefId(), ilUtil\stripSlashes(), and user().

4944  {
4945  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4946  if (
4947  $this->requestAction !== 'ready_showreply' &&
4948  $this->access->checkAccess('read', '', $this->object->getRefId()) &&
4949  $this->access->checkAccess('add_thread', '', $this->object->getRefId())
4950  ) {
4951  $action = new \ilForumAutoSaveAsyncDraftAction(
4952  $this->user,
4953  $this->buildThreadForm(),
4954  $this->objProperties,
4955  $this->objCurrentTopic,
4956  $this->objCurrentPost,
4957  function (string $message) : string {
4958  return $this->handleFormInput($message, false);
4959  },
4960  $draftId,
4961  (int) \ilObjForum::lookupForumIdByRefId($this->ref_id),
4962  \ilUtil::stripSlashes($this->requestAction)
4963  );
4964 
4965  $this->http->saveResponse($this->http->response()->withBody(
4966  \ILIAS\Filesystem\Stream\Streams::ofString(json_encode($action->executeAndGetResponseObject()))
4967  ));
4968  }
4969 
4970  $this->http->sendResponse();
4971  $this->http->close();
4972  }
Class ChatMainBarProvider .
static lookupForumIdByRefId($ref_id)
user()
Definition: user.php:4
buildThreadForm($isDraft=false)
static http()
Fetches the global http state from ILIAS.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
handleFormInput($a_text, $a_stripslashes=true)
$message
Definition: xapiexit.php:14
Class FlySystemFileAccessTest disabled disabled disabled.
+ Here is the call graph for this function:

◆ buildThreadForm()

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

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

References decorateWithAutosave(), isWritingWithPseudonymAllowed(), and user().

Referenced by autosaveThreadDraftAsyncObject(), createThread(), createThreadObject(), editThreadDraftObject(), saveThreadAsDraftObject(), and updateThreadDraftObject().

3607  {
3608  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
3609  $allowNotification = !$this->objProperties->isAnonymized();
3610 
3611  $mail = new \ilMail($this->user->getId());
3612  if (!$this->rbac->system()->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
3613  $allowNotification = false;
3614  }
3615 
3616  $form = new \ilForumThreadFormGUI(
3617  $this,
3618  $this->objProperties,
3620  $allowNotification,
3621  $isDraft,
3622  $draftId
3623  );
3624 
3625  $this->decorateWithAutosave($form);
3626 
3627  return $form;
3628  }
This class represents a property form user interface.
user()
Definition: user.php:4
decorateWithAutosave(\ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelDraftObject()

ilObjForumGUI::cancelDraftObject ( )

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

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

1757  {
1758  $this->requestAction = '';
1759  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
1761  $history_obj = new ilForumDraftsHistory();
1762  $history_obj->getFirstAutosaveByDraftId((int) $_GET['draft_id']);
1763  $draft = ilForumPostDraft::newInstanceByDraftId((int) $_GET['draft_id']);
1764  $draft->setPostSubject($history_obj->getPostSubject());
1765  $draft->setPostMessage($history_obj->getPostMessage());
1766 
1768  $history_obj->getPostMessage(),
1770  $history_obj->getHistoryId(),
1772  $draft->getDraftId()
1773  );
1774 
1775  $draft->updateDraft();
1776 
1777  $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
1778  }
1779  }
1780  $this->ctrl->clearParameters($this);
1781  $this->viewThreadObject();
1782  }
$_GET["client_id"]
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
+ Here is the call graph for this function:

◆ cancelMoveThreadsObject()

ilObjForumGUI::cancelMoveThreadsObject ( )

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

References $_SESSION.

3469  {
3470  unset($_SESSION['threads2move']);
3471  $this->ctrl->redirect($this, 'showThreads');
3472  }
$_SESSION["AccountId"]

◆ cancelPostObject()

ilObjForumGUI::cancelPostObject ( )

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

References $_POST, and ilForumPostDraft\newInstanceByDraftId().

1746  {
1747  $this->requestAction = '';
1748  if (isset($_POST['draft_id']) && (int) $_POST['draft_id'] > 0) {
1749  $draft = ilForumPostDraft::newInstanceByDraftId((int) $_POST['draft_id']);
1750  $draft->deleteDraftsByDraftIds(array((int) $_POST['draft_id']));
1751  }
1752 
1753  $this->viewThreadObject();
1754  }
static newInstanceByDraftId($draft_id)
$_POST["username"]
+ Here is the call graph for this function:

◆ checkDraftAccess()

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

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

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

Referenced by doHistoryCheck(), editDraftObject(), and updateThreadDraftObject().

5257  : bool
5258  {
5259  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
5260  if (
5261  !$this->access->checkAccess('add_reply', '', $this->object->getRefId()) || $this->user->isAnonymous() ||
5262  ($draft instanceof \ilForumPostDraft && $this->user->getId() != $draft->getPostAuthorId())
5263  ) {
5264  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5265  }
5266 
5267  return true;
5268  }
user()
Definition: user.php:4
static newInstanceByDraftId($draft_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkUsersViewMode()

ilObjForumGUI::checkUsersViewMode ( )

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

References $_GET, $_SESSION, Vendor\Package\$e, $i, $mobs, $objCurrentTopic, $selectedSorting, $toolbar, ilObjMediaObject\_exists(), ilLink\_getLink(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjectGUI\addHeaderAction(), ilNavigationHistory\addItem(), ilFileDataForumDrafts\deliverFile(), displayConfirmPostActivation(), ensureThreadBelongsToForum(), ensureValidPageForCurrentPosting(), ForumGlobalScreenToolsProvider\FORUM_BASE_CONTROLLER, ForumGlobalScreenToolsProvider\FORUM_THEAD, ForumGlobalScreenToolsProvider\FORUM_THREAD_ROOT, ilSession\get(), getActivationFormHTML(), getCensorshipFormHTML(), ilObjectGUI\getCreationMode(), getForumObjects(), ilForumPost\getId(), ilLinkButton\getInstance(), ilSplitButtonGUI\getInstance(), getModalActions(), getReplyEditForm(), ilForumPostDraft\getSortedDrafts(), ilForumPostDraft\isSavePostDraftAllowed(), isTopLevelReplyCommand(), ilAccessKey\MARK_ALL_READ, ForumGlobalScreenToolsProvider\PAGE, ForumGlobalScreenToolsProvider\REF_ID, renderDraftContent(), renderPostContent(), renderSortationControl(), renderViewModeControl(), ilUtil\sendInfo(), ilSession\set(), ForumGlobalScreenToolsProvider\SHOW_FORUM_THREADS_TOOL, ilUtil\stripSlashes(), user(), ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

Referenced by __construct().

2703  : void
2704  {
2705  $this->selectedSorting = $this->objProperties->getDefaultView();
2706 
2707  if (in_array(\ilSession::get('viewmode'), [
2711  ])) {
2712  $this->selectedSorting = \ilSession::get('viewmode');
2713  }
2714 
2715  if (
2716  isset($this->httpRequest->getQueryParams()['viewmode']) &&
2717  (int) $this->httpRequest->getQueryParams()['viewmode'] !== (int) $this->selectedSorting
2718  ) {
2719  $this->selectedSorting = (int) $this->httpRequest->getQueryParams()['viewmode'];
2720  }
2721 
2722  if (!in_array($this->selectedSorting, [
2726  ])) {
2727  $this->selectedSorting = $this->objProperties->getDefaultView();
2728  }
2729 
2730  \ilSession::set('viewmode', $this->selectedSorting);
2731  }
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteThreadDraftsObject()

ilObjForumGUI::confirmDeleteThreadDraftsObject ( )
protected

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

References ilObject\_getIcon(), ilForumPostDraft\getDraftInstancesByUserId(), ilObject\getId(), ilUtil\infoPanel(), ilUtil\sendInfo(), showThreadsObject(), and user().

1508  {
1509  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1510  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1511  }
1512 
1513  $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()['draft_ids'] ?? []));
1514  if (0 === count($draftIds)) {
1515  \ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1516  $this->showThreadsObject();
1517  return;
1518  }
1519 
1520  $confirmation = new ilConfirmationGUI();
1521  $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteThreadDrafts'));
1522  $confirmation->setHeaderText($this->lng->txt('sure_delete_drafts'));
1523  $confirmation->setCancel($this->lng->txt('cancel'), 'showThreads');
1524  $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteThreadDrafts');
1525  $instances = \ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
1526  foreach ($draftIds as $draftId) {
1527  if (array_key_exists($draftId, $instances)) {
1528  $confirmation->addItem('draft_ids[]', $draftId, $instances[$draftId]->getPostSubject());
1529  }
1530  }
1531 
1532  $this->tpl->setContent($confirmation->getHTML());
1533  }
static getDraftInstancesByUserId($user_id)
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteThreads()

ilObjForumGUI::confirmDeleteThreads ( )

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

References $_POST, ensureThreadBelongsToForum(), hideToolbar(), ilUtil\sendInfo(), and showThreadsObject().

Referenced by performThreadsActionObject().

1467  {
1468  if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1469  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1470  return $this->showThreadsObject();
1471  }
1472 
1473  if (!$this->is_moderator) {
1474  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1475  }
1476 
1477  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1478  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1479  }
1480 
1481  $threads = [];
1482  array_walk($_POST['thread_ids'], function ($threadId) use (&$threads) {
1483  $thread = new \ilForumTopic($threadId);
1484  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
1485 
1486  $threads[] = $thread;
1487  });
1488 
1489  $c_gui = new ilConfirmationGUI();
1490 
1491  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteThreads'));
1492  $c_gui->setHeaderText($this->lng->txt('frm_sure_delete_threads'));
1493  $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
1494  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteThreads');
1495 
1496  foreach ($threads as $thread) {
1497  $c_gui->addItem('thread_ids[]', $thread->getId(), $thread->getSubject());
1498  }
1499 
1500  $this->confirmation_gui_html = $c_gui->getHTML();
1501 
1502  $this->hideToolbar(true);
1503 
1504  return $this->tpl->setContent($c_gui->getHTML());
1505  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
hideToolbar($a_flag=null)
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmMergeThreadsObject()

ilObjForumGUI::confirmMergeThreadsObject ( )

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

References ilForumTopic\_lookupDate(), ilForumTopic\_lookupTitle(), ensureThreadBelongsToForum(), ilForumTopic\lookupForumIdByTopicId(), mergeThreadsObject(), ilUtil\sendFailure(), ilUtil\sendInfo(), and showThreadsObject().

4174  {
4175  if (!$this->is_moderator) {
4176  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4177  }
4178 
4179  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4180  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4181  }
4182 
4183  $sourceThreadId = (int) ($this->httpRequest->getQueryParams()['merge_thread_id'] ?? 0);
4184  $targetThreadIds = array_values(
4185  array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
4186  );
4187 
4188  if (!($sourceThreadId > 0) || 1 !== count($targetThreadIds)) {
4189  \ilUtil::sendFailure($this->lng->txt('select_one'));
4190  $this->mergeThreadsObject();
4191  return;
4192  }
4193 
4194  $targetThreadId = current($targetThreadIds);
4195  if ($sourceThreadId == $targetThreadId) {
4196  \ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
4197  $this->showThreadsObject();
4198  return;
4199  }
4200 
4201  if (ilForumTopic::lookupForumIdByTopicId($sourceThreadId) != ilForumTopic::lookupForumIdByTopicId($targetThreadId)) {
4202  \ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
4203  $this->ctrl->clearParameters($this);
4204  $this->showThreadsObject();
4205  return;
4206  }
4207 
4208  if (\ilForumTopic::_lookupDate($sourceThreadId) < ilForumTopic::_lookupDate($targetThreadId)) {
4209  \ilUtil::sendInfo($this->lng->txt('switch_threads_for_merge'));
4210  }
4211 
4212  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $sourceThreadId));
4213  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $targetThreadId));
4214 
4215  $c_gui = new ilConfirmationGUI();
4216 
4217  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performMergeThreads'));
4218  $c_gui->setHeaderText($this->lng->txt('frm_sure_merge_threads'));
4219  $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
4220  $c_gui->setConfirm($this->lng->txt('confirm'), 'performMergeThreads');
4221 
4222  $c_gui->addItem(
4223  'thread_ids[]',
4224  $sourceThreadId,
4225  sprintf($this->lng->txt('frm_merge_src'), ilForumTopic::_lookupTitle($sourceThreadId))
4226  );
4227  $c_gui->addItem(
4228  'thread_ids[]',
4229  $targetThreadId,
4230  sprintf($this->lng->txt('frm_merge_target'), ilForumTopic::_lookupTitle($targetThreadId))
4231  );
4232  $this->tpl->setContent($c_gui->getHTML());
4233  }
static _lookupDate($thread_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
static _lookupTitle($a_topic_id)
Looks up the title/subject of a topic/thread.
static lookupForumIdByTopicId($a_topic_id)
Confirmation screen class.
+ 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 3652 of file class.ilObjForumGUI.php.

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

Referenced by addThreadObject(), and publishThreadDraftObject().

3653  {
3654  if (
3655  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
3656  !$this->access->checkAccess('read', '', $this->object->getRefId())
3657  ) {
3658  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3659  }
3660 
3661  $frm = $this->object->Forum;
3662  $frm->setForumId($this->object->getId());
3663  $frm->setForumRefId($this->object->getRefId());
3664  $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3665  $topicData = $frm->getOneTopic();
3666 
3667  $form = $this->buildThreadForm($createFromDraft);
3668  if ($form->checkInput()) {
3669  $this->doCaptchaCheck();
3670 
3671  $userIdForDisplayPurposes = $this->user->getId();
3672  if ($this->isWritingWithPseudonymAllowed()) {
3673  $userIdForDisplayPurposes = 0;
3674  }
3675 
3676  $status = 1;
3677  if (
3678  ($this->objProperties->isPostActivationEnabled() && !$this->is_moderator) ||
3679  $this->objCurrentPost->isAnyParentDeactivated()
3680  ) {
3681  $status = 0;
3682  }
3683 
3684  if ($createFromDraft) {
3685  $newThread = new \ilForumTopic(0, true, true);
3686  $newThread->setForumId($topicData['top_pk']);
3687  $newThread->setThrAuthorId($draft->getPostAuthorId());
3688  $newThread->setDisplayUserId($draft->getPostDisplayUserId());
3689  $newThread->setSubject($this->handleFormInput($form->getInput('subject'), false));
3690  $newThread->setUserAlias($draft->getPostUserAlias());
3691 
3692  $newPost = $frm->generateThread(
3693  $newThread,
3694  \ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0),
3695  $draft->getNotify(),
3696  $draft->getPostNotify(),
3697  $status
3698  );
3699  } else {
3700  $userAlias = \ilForumUtil::getPublicUserAlias(
3701  $form->getInput('alias'),
3702  $this->objProperties->isAnonymized()
3703  );
3704  $newThread = new \ilForumTopic(0, true, true);
3705  $newThread->setForumId($topicData['top_pk']);
3706  $newThread->setThrAuthorId($this->user->getId());
3707  $newThread->setDisplayUserId($userIdForDisplayPurposes);
3708  $newThread->setSubject($this->handleFormInput($form->getInput('subject'), false));
3709  $newThread->setUserAlias($userAlias);
3710 
3711  $newPost = $frm->generateThread(
3712  $newThread,
3713  \ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0),
3714  $form->getItemByPostVar('notify') ? (int) $form->getInput('notify') : 0,
3715  0, // #19980
3716  $status
3717  );
3718  }
3719 
3720  if ($this->objProperties->isFileUploadAllowed()) {
3721  $file = $_FILES['userfile'];
3722  if (is_array($file) && !empty($file)) {
3723  $fileData = new \ilFileDataForum($this->object->getId(), $newPost);
3724  $fileData->storeUploadedFile($file);
3725  }
3726  }
3727 
3728  $frm->setDbTable('frm_data');
3729  $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
3730  $frm->updateVisits($topicData['top_pk']);
3731 
3732  if ($createFromDraft) {
3733  $mediaObjects = \ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
3734  } else {
3735  $mediaObjects = \ilRTE::_getMediaObjects($form->getInput('message'), 0);
3736  }
3737  foreach ($mediaObjects as $mob) {
3738  if (\ilObjMediaObject::_exists($mob)) {
3739  \ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
3740  \ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
3741  }
3742  }
3743 
3744  if ($draft->getDraftId() > 0) {
3745  $draftHistory = new \ilForumDraftsHistory();
3746  $draftHistory->deleteHistoryByDraftIds([$draft->getDraftId()]);
3747  if ($this->objProperties->isFileUploadAllowed()) {
3748  $forumFileData = new \ilFileDataForum($this->object->getId(), $newPost);
3749  $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
3750  $draftFileData->moveFilesOfDraft($forumFileData->getForumPath(), $newPost);
3751  }
3752  $draft->deleteDraft();
3753  }
3754 
3755  $GLOBALS['ilAppEventHandler']->raise(
3756  'Modules/Forum',
3757  'createdPost',
3758  [
3759  'ref_id' => $this->object->getRefId(),
3760  'post' => new \ilForumPost($newPost),
3761  'notify_moderators' => !$status
3762  ]
3763  );
3764 
3765  \ilUtil::sendSuccess($this->lng->txt('forums_thread_new_entry'), true);
3766  $this->ctrl->redirect($this);
3767  }
3768 
3769  $form->setValuesByPost();
3770  if (!$this->objProperties->isAnonymized()) {
3771  $form->getItemByPostVar('alias')->setValue($this->user->getLogin());
3772  }
3773 
3774  $this->tpl->setContent($form->getHTML());
3775  }
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
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 _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
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...
user()
Definition: user.php:4
buildThreadForm($isDraft=false)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
handleFormInput($a_text, $a_stripslashes=true)
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createThreadObject()

ilObjForumGUI::createThreadObject ( )
protected

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

References buildThreadForm(), and ilObjectGUI\getHTML().

3631  {
3632  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3633  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3634  }
3635 
3636  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
3637  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3638  }
3639 
3640  $templateForWidthHandling = new \ilTemplate('tpl.create_thread_form.html', true, true, 'Modules/Forum');
3641  $templateForWidthHandling->setVariable('CREATE_FORM', $this->buildThreadForm()->getHTML());
3642  $templateForWidthHandling->parseCurrentBlock();
3643 
3644  $this->tpl->setContent($templateForWidthHandling->get());
3645  }
buildThreadForm($isDraft=false)
+ Here is the call graph for this function:

◆ createTopLevelPostObject()

ilObjForumGUI::createTopLevelPostObject ( )

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

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

2139  {
2140  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0 && !$this->user->isAnonymous()
2142  $draft_obj = new ilForumPostDraft(
2143  $this->user->getId(),
2144  $this->objCurrentPost->getId(),
2145  (int) $_GET['draft_id']
2146  );
2147  }
2148 
2149  if ($draft_obj instanceof ilForumPostDraft && $draft_obj->getDraftId() > 0) {
2150  $this->ctrl->setParameter($this, 'action', 'editdraft');
2151  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
2152  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
2153  $this->ctrl->setParameter($this, 'draft_id', $draft_obj->getDraftId());
2154  $this->ctrl->setParameter($this, 'page', 0);
2155  $this->ctrl->setParameter(
2156  $this,
2157  'orderby',
2158  \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
2159  );
2160  $this->ctrl->redirect($this, 'editDraft');
2161  } else {
2162  $this->viewThreadObject();
2163  }
2164  return;
2165  }
Class ilForumPostDraft.
$_GET["client_id"]
user()
Definition: user.php:4
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ decorateWithAutosave()

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

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

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

Referenced by buildThreadForm(), and getCensorshipFormHTML().

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

◆ deleteMobsOfDraft()

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

todo: move to ilForumUtil

Parameters
$draft_id
$message

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

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

Referenced by deleteSelectedDraft(), and deleteThreadDraftsObject().

4840  {
4841  // remove usage of deleted media objects
4842  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draft_id);
4843  $curMediaObjects = ilRTE::_getMediaObjects($message, 0);
4844  foreach ($oldMediaObjects as $oldMob) {
4845  $found = false;
4846  foreach ($curMediaObjects as $curMob) {
4847  if ($oldMob == $curMob) {
4848  $found = true;
4849  break;
4850  }
4851  }
4852  if (!$found) {
4853  if (ilObjMediaObject::_exists($oldMob)) {
4854  ilObjMediaObject::_removeUsage($oldMob, 'frm~d:html', $draft_id);
4855  $mob_obj = new ilObjMediaObject($oldMob);
4856  $mob_obj->delete();
4857  }
4858  }
4859  }
4860  }
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
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.
Class ilObjMediaObject.
$message
Definition: xapiexit.php:14
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deletePostingDraftObject()

ilObjForumGUI::deletePostingDraftObject ( )
private

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

References deleteSelectedDraft().

1625  {
1626  $this->deleteSelectedDraft();
1627  }
deleteSelectedDraft(ilForumPostDraft $draft_obj=null)
+ Here is the call graph for this function:

◆ deleteSelectedDraft()

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

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

References $_GET, $GLOBALS, ilFileDataForumDrafts\delete(), deleteMobsOfDraft(), ilForumPostDraft\isSavePostDraftAllowed(), and user().

Referenced by deletePostingDraftObject().

4866  {
4867  if (
4868  !$this->access->checkAccess('add_reply', '', (int) $_GET['ref_id']) ||
4869  $this->user->isAnonymous() ||
4870  ($draft_obj instanceof ilForumPostDraft && $this->user->getId() != $draft_obj->getPostAuthorId())) {
4871  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4872  }
4873 
4874  $post_id = $this->objCurrentPost->getId();
4875  if (!($draft_obj instanceof ilForumPostDraft)) {
4876  $draft_id_to_delete = (int) $_GET['draft_id'];
4877  $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, $draft_id_to_delete);
4878 
4879  if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete)) {
4880  $this->ctrl->clearParameters($this);
4881  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4882  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4883  $this->ctrl->redirect($this, 'viewThread');
4884  }
4885  }
4886 
4887  $this->deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
4888 
4889  $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_obj->getDraftId());
4890  $objFileDataForumDrafts->delete();
4891 
4893  $GLOBALS['ilAppEventHandler']->raise(
4894  'Modules/Forum',
4895  'deletedDraft',
4896  array(
4897  'draftObj' => $draft_obj,
4898  'obj_id' => $this->object->getId(),
4899  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
4900  )
4901  );
4902  }
4903  $draft_obj->deleteDraft();
4904 
4905  ilUtil::sendSuccess($this->lng->txt('delete_draft_successfully'), true);
4906  $this->ctrl->clearParameters($this);
4907  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4908  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4909  $this->ctrl->redirect($this, 'viewThread');
4910  }
Class ilForumPostDraft.
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
$_GET["client_id"]
This class handles all operations on files for the drafts of a forum object.
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteThreadDraftsObject()

ilObjForumGUI::deleteThreadDraftsObject ( )
protected

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

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

3558  {
3559  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3560  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3561  }
3562 
3563  $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()['draft_ids'] ?? []));
3564  if (0 === count($draftIds)) {
3565  $draftIds = array_filter([(int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0)]);
3566  }
3567 
3568  $instances = \ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
3569  $checkedDraftIds = [];
3570  foreach ($draftIds as $draftId) {
3571  if (array_key_exists($draftId, $instances)) {
3572  $checkedDraftIds[] = $draftId;
3573  $draft = $instances[$draftId];
3574 
3575  $this->deleteMobsOfDraft($draft->getDraftId(), $draft->getPostMessage());
3576 
3577  $draftFileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
3578  $draftFileData->delete();
3579 
3580  $GLOBALS['ilAppEventHandler']->raise(
3581  'Modules/Forum',
3582  'deletedDraft',
3583  [
3584  'draftObj' => $draft,
3585  'obj_id' => $this->object->getId(),
3586  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
3587  ]
3588  );
3589 
3590  $draft->deleteDraft();
3591  }
3592  }
3593 
3594  if (count($checkedDraftIds) > 1) {
3595  \ilUtil::sendInfo($this->lng->txt('delete_drafts_successfully'), true);
3596  } else {
3597  \ilUtil::sendInfo($this->lng->txt('delete_draft_successfully'), true);
3598  }
3599  $this->ctrl->redirect($this, 'showThreads');
3600  }
static getDraftInstancesByUserId($user_id)
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ deliverDraftZipFileObject()

ilObjForumGUI::deliverDraftZipFileObject ( )
protected

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

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

4299  {
4300  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4301  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4302  }
4303 
4304  $draftId = $this->httpRequest->getQueryParams()['draft_id'] ?? 0;
4305  $draft = \ilForumPostDraft::newInstanceByDraftId((int) $draftId);
4306  if ($draft->getPostAuthorId() == $this->user->getId()) {
4307  $fileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
4308  if (!$fileData->deliverZipFile()) {
4309  $this->ctrl->redirect($this);
4310  }
4311  }
4312  }
user()
Definition: user.php:4
static newInstanceByDraftId($draft_id)
+ Here is the call graph for this function:

◆ deliverZipFileObject()

ilObjForumGUI::deliverZipFileObject ( )
protected

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

References ensureThreadBelongsToForum().

4318  {
4319  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4320  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4321  }
4322 
4323  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
4324 
4325  $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
4326  if (!$fileData->deliverZipFile()) {
4327  $this->ctrl->redirect($this);
4328  }
4329  }
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ disableForumNotificationObject()

ilObjForumGUI::disableForumNotificationObject ( )
protected

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

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

3827  {
3828  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3829  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3830  }
3831 
3832  $frm = $this->object->Forum;
3833  $frm->setForumId($this->object->getId());
3834  $frm->disableForumNotification($this->user->getId());
3835 
3836  if ((int) $this->objCurrentTopic->getId() > 0) {
3837  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3838  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'), true);
3839  $this->ctrl->redirect($this, 'viewThread');
3840  }
3841 
3842  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'));
3843  $this->showThreadsObject();
3844  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ displayConfirmPostActivation()

ilObjForumGUI::displayConfirmPostActivation ( )

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

References $display_confirm_post_activation.

Referenced by checkUsersViewMode(), renderPostContent(), and renderSplitButton().

1701  {
1703  }
+ Here is the caller graph for this function:

◆ 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 5327 of file class.ilObjForumGUI.php.

References $_GET, ilObjectGUI\$tpl, ilRTE\_replaceMediaObjectImageSrc(), ilForumPost\getDisplayUserId(), ilForumPost\getImportName(), ilForumPost\getMessage(), getModifiedReOnSubject(), ilForumPost\getPosAuthorId(), getReplyEditForm(), ilForumPost\getUserAlias(), ilForumPost\isCensored(), ilForumPost\isOwner(), ilForum\prepareText(), HTML_Template_IT\setVariable(), ilUtil\stripSlashes(), and user().

Referenced by createThread(), editDraftObject(), publishDraftObject(), saveThreadAsDraftObject(), saveTopLevelDraftObject(), and updateThreadDraftObject().

5328  {
5329  if ($this->user->isAnonymous() && !$this->user->isCaptchaVerified() && \ilCaptchaUtil::isActiveForForum()) {
5330  $this->user->setCaptchaVerified(true);
5331  }
5332  }
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doHistoryCheck()

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

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

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

Referenced by editDraftObject(), and editThreadDraftObject().

5274  {
5275  if (!$this->checkDraftAccess($draftId)) {
5276  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5277  }
5278 
5280  return;
5281  }
5282 
5284  $draftsFromHistory = \ilForumDraftsHistory::getInstancesByDraftId($draftId);
5285  if (is_array($draftsFromHistory) && sizeof($draftsFromHistory) > 0) {
5286  $modal = \ilModalGUI::getInstance();
5287  $modal->setHeading($this->lng->txt('restore_draft_from_autosave'));
5288  $modal->setId('frm_autosave_restore');
5289  $form_tpl = new \ilTemplate('tpl.restore_thread_draft.html', true, true, 'Modules/Forum');
5290 
5291  foreach ($draftsFromHistory as $key => $history_instance) {
5292  $accordion = new ilAccordionGUI();
5293  $accordion->setId('acc_' . $history_instance->getHistoryId());
5294 
5295  $form_tpl->setCurrentBlock('list_item');
5296  $message = \ilRTE::_replaceMediaObjectImageSrc($history_instance->getPostMessage(), 1);
5297 
5298  $history_date = ilDatePresentation::formatDate(new ilDateTime(
5299  $history_instance->getDraftDate(),
5301  ));
5302  $this->ctrl->setParameter($this, 'history_id', $history_instance->getHistoryId());
5303  $header = $history_date . ' - ' . $history_instance->getPostSubject();
5304  $accordion->addItem($header, $message . $this->uiRenderer->render(
5305  $this->uiFactory->button()->standard(
5306  $this->lng->txt('restore'),
5307  $this->ctrl->getLinkTarget($this, 'restoreFromHistory')
5308  )
5309  ));
5310 
5311  $form_tpl->setVariable('ACC_AUTO_SAVE', $accordion->getHtml());
5312  $form_tpl->parseCurrentBlock();
5313  }
5314 
5315  $form_tpl->setVariable('RESTORE_DATA_EXISTS', 'found_threat_history_to_restore');
5316  $modal->setBody($form_tpl->get());
5317  $modal->initJS();
5318  $this->modal_history = $modal->getHTML();
5319  } else {
5321  }
5322  }
const IL_CAL_DATETIME
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 formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static createDraftBackup($draft_id)
static getInstancesByDraftId($draft_id)
static getInstance()
Get instance.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$message
Definition: xapiexit.php:14
Accordion user interface class.
checkDraftAccess(int $draftId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editDraftObject()

ilObjForumGUI::editDraftObject ( )
protected

◆ editThreadDraftObject()

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

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

References $modal_history, ilRTE\_replaceMediaObjectImageSrc(), buildThreadForm(), doHistoryCheck(), and ilForumPostDraft\isSavePostDraftAllowed().

Referenced by updateThreadDraftObject().

4335  {
4336  if (
4337  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4338  !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4340  ) {
4341  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4342  }
4343 
4344  $frm = $this->object->Forum;
4345  $frm->setForumId($this->object->getId());
4346  $frm->setForumRefId($this->object->getRefId());
4347 
4348  $draft = new \ilForumPostDraft();
4349  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4350  if ($draftId > 0) {
4351  $draft = $draft->newInstanceByDraftId($draftId);
4352  }
4353 
4354  $historyCheck = (int) ($this->httpRequest->getQueryParams()['hist_check'] ?? 1);
4355  if (!($form instanceof \ilPropertyFormGUI) && $historyCheck > 0) {
4356  $this->doHistoryCheck($draft->getDraftId());
4357  }
4358 
4359  if (!$form instanceof \ilPropertyFormGUI) {
4360  $form = $this->buildThreadForm(true);
4361  $form->setValuesByArray([
4362  'alias' => $draft->getPostUserAlias(),
4363  'subject' => $draft->getPostSubject(),
4364  'message' => \ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($draft->getPostMessage(), 2), 1),
4365  'notify' => $draft->getNotify() ? true : false,
4366  'userfile' => '',
4367  'del_file' => []
4368  ]);
4369  } else {
4370  $this->ctrl->setParameter($this, 'draft_id', $draftId);
4371  }
4372 
4373  $this->tpl->setContent($form->getHTML() . $this->modal_history);
4374  }
This class represents a property form user interface.
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...
buildThreadForm($isDraft=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editThreadObject()

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

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

References ensureThreadBelongsToForum(), and getThreadEditingForm().

Referenced by performThreadsActionObject(), and updateThreadObject().

557  {
558  if (!$this->is_moderator) {
559  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
560  }
561 
562  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
563  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
564  }
565 
566  $thread = new \ilForumTopic($threadId);
567  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
568 
569  $this->tabs->activateTab('forums_threads');
570 
571  if (!($form instanceof \ilPropertyFormGUI)) {
572  $form = $this->getThreadEditingForm($threadId);
573  $form->setValuesByArray(array(
574  'title' => $thread->getSubject()
575  ));
576  }
577 
578  $this->tpl->setContent($form->getHTML());
579  }
This class represents a property form user interface.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
getThreadEditingForm($a_thread_id)
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableForumNotificationObject()

ilObjForumGUI::enableForumNotificationObject ( )
protected

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

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

3807  {
3808  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3809  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3810  }
3811 
3812  $frm = $this->object->Forum;
3813  $frm->setForumId($this->object->getId());
3814  $frm->enableForumNotification($this->user->getId());
3815 
3816  if ((int) $this->objCurrentTopic->getId() > 0) {
3817  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3818  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'), true);
3819  $this->ctrl->redirect($this, 'viewThread');
3820  }
3821 
3822  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'));
3823  $this->showThreadsObject();
3824  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ ensureThreadBelongsToForum()

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

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

References ilForumTopic\getForumId(), and ilObjForum\lookupForumIdByObjId().

Referenced by checkUsersViewMode(), confirmDeleteThreads(), confirmMergeThreadsObject(), deliverZipFileObject(), editThreadObject(), executeCommand(), getModalActions(), markPostReadObject(), markPostUnreadObject(), moveThreadsObject(), performDeleteThreadsObject(), performMergeThreadsObject(), performMoveThreadsObject(), performPostActivationObject(), performThreadsActionObject(), publishDraftObject(), quotePostObject(), saveThreadSortingObject(), toggleStickinessObject(), toggleThreadNotificationObject(), and updateThreadObject().

235  {
237  if ((int) $thread->getForumId() !== (int) $forumId) {
238  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
239  }
240  }
static lookupForumIdByObjId($obj_id)
$objId
Definition: xapitoken.php:39
+ 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 187 of file class.ilObjForumGUI.php.

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

Referenced by checkUsersViewMode().

192  {
193  if ($firstForumPost->getId() == $this->objCurrentPost->getId()) {
194  return;
195  }
196 
197  if (count($subtree_nodes) > 0 && $this->objCurrentPost->getId() > 0) {
198  $isCurrentPostingInPage = array_filter($pagedPostings, function (ilForumPost $posting) {
199  return $posting->getId() == $this->objCurrentPost->getId();
200  });
201 
202  if (0 === count($isCurrentPostingInPage)) {
203  $pageOfCurrentPosting = 0;
204  $i = 0;
205  foreach ($subtree_nodes as $node) {
206  if ($i > 0 && 0 === $i % $pageSize) {
207  ++$pageOfCurrentPosting;
208  }
209 
210  if ($node->getId() == $this->objCurrentPost->getId()) {
211  break;
212  }
213 
214  ++$i;
215  }
216 
217  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
218  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
219  $this->ctrl->setParameter($this, 'page', $pageOfCurrentPosting);
220  $this->ctrl->setParameter(
221  $this,
222  'orderby',
223  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
224  );
225  $this->ctrl->redirect($this, 'viewThread', $this->objCurrentPost->getId());
226  }
227  }
228  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjForumGUI::executeCommand ( )

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

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

Referenced by performThreadsActionObject().

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

◆ getActivationFormHTML()

ilObjForumGUI::getActivationFormHTML ( )

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

References ilUtil\stripSlashes().

Referenced by checkUsersViewMode().

1785  {
1786  $form_tpl = new ilTemplate('tpl.frm_activation_post_form.html', true, true, 'Modules/Forum');
1787  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1788  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1789  $this->ctrl->setParameter(
1790  $this,
1791  'orderby',
1792  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
1793  );
1794  $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPostActivation'));
1795  $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1796  $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1797  $form_tpl->setVariable('TXT_ACT', $this->lng->txt('activate_post_txt'));
1798  $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('activate_only_current'));
1799  $form_tpl->setVariable('CMD_CONFIRM', 'performPostActivation');
1800  $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1801  $form_tpl->setVariable('CMD_CANCEL', 'viewThread');
1802  $this->ctrl->clearParameters($this);
1803 
1804  return $form_tpl->get();
1805  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCensorshipFormHTML()

ilObjForumGUI::getCensorshipFormHTML ( )

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

References $_GET, $_POST, ilHtmlPurifierFactory\_getInstanceByType(), ilObjAdvancedEditing\_getRichTextEditorUserState(), ilRTE\_getRTEClassname(), ilObjAdvancedEditing\_setRichTextEditorUserState(), decorateWithAutosave(), getForumObjects(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilForumPostDraft\isSavePostDraftAllowed(), isTopLevelReplyCommand(), isWritingWithPseudonymAllowed(), ilForumPostDraft\lookupAutosaveInterval(), ilFileWizardInputGUI\setFilenames(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilUtil\stripSlashes(), and user().

Referenced by checkUsersViewMode().

1808  {
1809  $frm = $this->object->Forum;
1810  $form_tpl = new ilTemplate('tpl.frm_censorship_post_form.html', true, true, 'Modules/Forum');
1811 
1812  $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1813  $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1814  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1815  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1816  $this->ctrl->setParameter(
1817  $this,
1818  'orderby',
1819  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
1820  );
1821  $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'viewThread'));
1822  $this->ctrl->clearParameters($this);
1823  $form_tpl->setVariable('TXT_CENS_MESSAGE', $this->lng->txt('forums_the_post'));
1824  $form_tpl->setVariable('TXT_CENS_COMMENT', $this->lng->txt('forums_censor_comment') . ':');
1825  $form_tpl->setVariable('CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1826 
1827  if ($this->objCurrentPost->isCensored()) {
1828  $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor2_post'));
1829  $form_tpl->setVariable('YES_BUTTON', $this->lng->txt('confirm'));
1830  $form_tpl->setVariable('NO_BUTTON', $this->lng->txt('cancel'));
1831  $form_tpl->setVariable('CMD_REVOKE_CENSORSHIP', 'revokeCensorship');
1832  $form_tpl->setVariable('CMD_CANCEL_REVOKE_CENSORSHIP', 'viewThread');
1833  } else {
1834  $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor_post'));
1835  $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1836  $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('confirm'));
1837  $form_tpl->setVariable('CMD_ADD_CENSORSHIP', 'addCensorship');
1838  $form_tpl->setVariable('CMD_CANCEL_ADD_CENSORSHIP', 'viewThread');
1839  }
1840 
1841  return $form_tpl->get();
1842  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContent()

ilObjForumGUI::getContent ( )

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

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

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

◆ getEditFormCustomValues()

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

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

518  {
519  $this->forum_settings_gui->getCustomValues($a_values);
520  }

◆ getForumObjects()

ilObjForumGUI::getForumObjects ( )
private

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

References $forumObjects, and $object.

Referenced by checkUsersViewMode(), editDraftObject(), getCensorshipFormHTML(), getModalActions(), performPostActivationObject(), publishDraftObject(), quotePostObject(), and saveTopLevelDraftObject().

2687  {
2688  if (null === $this->forumObjects) {
2689  $forumObj = $this->object;
2690  $file_obj = new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
2691  $frm = $forumObj->Forum;
2692  $frm->setForumId($forumObj->getId());
2693  $frm->setForumRefId($forumObj->getRefId());
2694 
2695  $this->forumObjects['forumObj'] = $forumObj;
2696  $this->forumObjects['frm'] = $frm;
2697  $this->forumObjects['file_obj'] = $file_obj;
2698  }
2699 
2700  return $this->forumObjects;
2701  }
This class handles all operations on files for the forum object.
+ Here is the caller graph for this function:

◆ getModalActions()

ilObjForumGUI::getModalActions ( )
private
Returns
string

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

References $_POST, $is_moderator, $message, ensureThreadBelongsToForum(), getForumObjects(), and handleFormInput().

Referenced by checkUsersViewMode().

1642  : string
1643  {
1644  $modalString = '';
1645  foreach ($this->modalActionsContainer as $modal) {
1646  $modalString .= $this->uiRenderer->render($modal);
1647  }
1648 
1649  return $modalString;
1650  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModifiedReOnSubject()

ilObjForumGUI::getModifiedReOnSubject (   $on_reply = false)
private

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

Referenced by doCaptchaCheck().

3212  {
3213  $subject = $this->objCurrentPost->getSubject();
3214  $re_txt = $this->lng->txt('post_reply');
3215 
3216  $re_txt_with_num = str_replace(':', '(', $re_txt);
3217  $search_length = strlen($re_txt_with_num);
3218  $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
3219 
3220  if ($comp == 0) {
3221  $modified_subject = $subject;
3222  if ($on_reply == true) {
3223  // i.e. $subject = "Re(12):"
3224  $str_pos_start = strpos($subject, '(');
3225  $str_pos_end = strpos($subject, ')');
3226 
3227  $length = ((int) $str_pos_end - (int) $str_pos_start);
3228  $str_pos_start++;
3229  $txt_number = substr($subject, $str_pos_start, $length - 1);
3230 
3231  if (is_numeric($txt_number)) {
3232  $re_count = (int) $txt_number + 1;
3233  $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr(
3234  $subject,
3235  $str_pos_end
3236  );
3237  }
3238  }
3239  } else {
3240  $re_count = substr_count($subject, $re_txt);
3241  if ($re_count >= 1 && $on_reply == true) {
3242  $subject = str_replace($re_txt, '', $subject);
3243 
3244  // i.e. $subject = "Re: Re: Re: ... " -> "Re(4):"
3245  $re_count++;
3246  $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
3247  } elseif ($re_count >= 1 && $on_reply == false) {
3248  // possibility to modify the subject only for output
3249  // i.e. $subject = "Re: Re: Re: ... " -> "Re(3):"
3250  $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
3251  } elseif ($re_count == 0) {
3252  // the first reply to a thread
3253  $modified_subject = $this->lng->txt('post_reply') . ' ' . $this->objCurrentPost->getSubject();
3254  }
3255  }
3256  return $modified_subject;
3257  }
+ Here is the caller graph for this function:

◆ getReplyEditForm()

ilObjForumGUI::getReplyEditForm ( )
private
Returns
ilPropertyFormGUI

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

References $replyEditForm.

Referenced by autosaveDraftAsyncObject(), checkUsersViewMode(), doCaptchaCheck(), editDraftObject(), publishDraftObject(), quotePostObject(), renderDraftContent(), and saveTopLevelDraftObject().

2127  {
2128  if (null === $this->replyEditForm) {
2129  $this->initReplyEditForm();
2130  }
2131 
2132  return $this->replyEditForm;
2133  }
+ Here is the caller graph for this function:

◆ getSubTabs()

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

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

References $is_moderator.

Referenced by showThreadsObject(), and sortThreadsObject().

641  {
642  if ($this->objProperties->getThreadSorting() == 1 && $this->is_moderator) {
643  $this->tabs->addSubTabTarget(
644  'show',
645  $this->ctrl->getLinkTarget($this, 'showThreads'),
646  'showThreads',
647  get_class($this),
648  '',
649  $subtab == 'showThreads' ? true : false
650  );
651 
652  if ($this->object->getNumStickyThreads() > 1) {
653  $this->tabs->addSubTabTarget(
654  'sticky_threads_sorting',
655  $this->ctrl->getLinkTarget($this, 'sortThreads'),
656  'sortThreads',
657  '',
658  $subtab == 'sortThreads' ? true : false
659  );
660  }
661  }
662  }
+ Here is the caller graph for this function:

◆ getTabs()

ilObjForumGUI::getTabs ( )
protected

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

References $_GET, and settings().

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

Referenced by editThreadObject(), and updateThreadObject().

535  {
536  $form = new ilPropertyFormGUI();
537  $this->ctrl->setParameter($this, 'thr_pk', $a_thread_id);
538  $form->setFormAction($this->ctrl->getFormAction($this, 'updateThread'));
539 
540  $ti_prop = new ilTextInputGUI($this->lng->txt('title'), 'title');
541  $ti_prop->setRequired(true);
542  $ti_prop->setMaxLength(255);
543  $ti_prop->setSize(50);
544  $form->addItem($ti_prop);
545 
546  $form->addCommandButton('updateThread', $this->lng->txt('save'));
547  $form->addCommandButton('showThreads', $this->lng->txt('cancel'));
548 
549  return $form;
550  }
This class represents a property form user interface.
+ Here is the caller graph for this function:

◆ handleFormInput()

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

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

References ilUtil\stripSlashes().

Referenced by autosaveDraftAsyncObject(), autosaveThreadDraftAsyncObject(), createThread(), editDraftObject(), getModalActions(), publishDraftObject(), saveThreadAsDraftObject(), saveTopLevelDraftObject(), and updateThreadDraftObject().

3880  {
3881  $a_text = str_replace("<", "&lt;", $a_text);
3882  $a_text = str_replace(">", "&gt;", $a_text);
3883  if ($a_stripslashes) {
3884  $a_text = ilUtil::stripSlashes($a_text);
3885  }
3886 
3887  return $a_text;
3888  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideToolbar()

ilObjForumGUI::hideToolbar (   $a_flag = null)
private

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

References $hideToolbar.

Referenced by confirmDeleteThreads(), getContent(), and moveThreadsObject().

2611  {
2612  if (null === $a_flag) {
2613  return $this->hideToolbar;
2614  }
2615 
2616  $this->hideToolbar = $a_flag;
2617  return $this;
2618  }
hideToolbar($a_flag=null)
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjForumGUI::infoScreen ( )
protected

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

Referenced by executeCommand(), and infoScreenObject().

3899  {
3900  if (
3901  !$this->access->checkAccess('visible', '', $this->object->getRefId()) &&
3902  !$this->access->checkAccess('read', '', $this->object->getRefId())
3903  ) {
3904  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
3905  }
3906 
3907  $info = new \ilInfoScreenGUI($this);
3908  $info->enablePrivateNotes();
3909  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
3910  $this->ctrl->forwardCommand($info);
3911  }
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjForumGUI::infoScreenObject ( )

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

References infoScreen().

499  {
500  $this->ctrl->setCmd('showSummary');
501  $this->ctrl->setCmdClass('ilinfoscreengui');
502  $this->infoScreen();
503  }
+ Here is the call graph for this function:

◆ initEditCustomForm()

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

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

509  {
510  $this->forum_settings_gui = new ilForumSettingsGUI($this);
511  $this->forum_settings_gui->getCustomForm($a_form);
512  }
Class ilForumSettingsGUI.

◆ initHeaderAction()

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

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

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

3955  {
3956  $lg = parent::initHeaderAction();
3957 
3958  if ((int) $this->objCurrentTopic->getId() > 0) {
3959  $container_obj = null; // Workaround: Do not show "desktop actions" in thread view
3960  $lg->setContainerObject($container_obj);
3961  }
3962 
3963  if (!($lg instanceof \ilObjForumListGUI) || !$this->settings->get('forum_notification')) {
3964  return $lg;
3965  }
3966 
3967  if ($this->user->isAnonymous() || !$this->access->checkAccess('read', '', $this->object->getRefId())) {
3968  return $lg;
3969  }
3970 
3971  $frm = $this->object->Forum;
3972  $frm->setForumId($this->object->getId());
3973  $frm->setForumRefId($this->object->getRefId());
3974  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3975 
3976  $isForumNotificationEnabled = $frm->isForumNotificationEnabled($this->user->getId());
3977  $userMayDisableNotifications = $this->isUserAllowedToDeactivateNotification();
3978 
3979  if ((int) $this->objCurrentTopic->getId() > 0) {
3980  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3981  }
3982 
3983  if ($this->isParentObjectCrsOrGrp()) {
3984  // special behaviour for CRS/GRP-Forum notification!!
3985  if ($isForumNotificationEnabled && $userMayDisableNotifications) {
3986  $lg->addCustomCommand(
3987  $this->ctrl->getLinkTarget($this, 'disableForumNotification'),
3988  'forums_disable_forum_notification'
3989  );
3990  } elseif (!$isForumNotificationEnabled) {
3991  $lg->addCustomCommand(
3992  $this->ctrl->getLinkTarget($this, 'enableForumNotification'),
3993  'forums_enable_forum_notification'
3994  );
3995  }
3996  } elseif ($isForumNotificationEnabled) {
3997  $lg->addCustomCommand(
3998  $this->ctrl->getLinkTarget($this, 'disableForumNotification'),
3999  'forums_disable_forum_notification'
4000  );
4001  } else {
4002  $lg->addCustomCommand(
4003  $this->ctrl->getLinkTarget($this, 'enableForumNotification'),
4004  'forums_enable_forum_notification'
4005  );
4006  }
4007 
4008  $isThreadNotificationEnabled = false;
4009  if ((int) $this->objCurrentTopic->getId() > 0) {
4010  $isThreadNotificationEnabled = $this->objCurrentTopic->isNotificationEnabled($this->user->getId());
4011  if ($isThreadNotificationEnabled) {
4012  $lg->addCustomCommand(
4013  $this->ctrl->getLinkTarget($this, 'toggleThreadNotification'),
4014  'forums_disable_notification'
4015  );
4016  } else {
4017  $lg->addCustomCommand(
4018  $this->ctrl->getLinkTarget($this, 'toggleThreadNotification'),
4019  'forums_enable_notification'
4020  );
4021  }
4022  }
4023  $this->ctrl->setParameter($this, 'thr_pk', '');
4024 
4025  if ($isForumNotificationEnabled || $isThreadNotificationEnabled) {
4026  $lg->addHeaderIcon(
4027  'not_icon',
4028  ilUtil::getImagePath('notification_on.svg'),
4029  $this->lng->txt('frm_notification_activated')
4030  );
4031  } else {
4032  $lg->addHeaderIcon(
4033  'not_icon',
4034  ilUtil::getImagePath('notification_off.svg'),
4035  $this->lng->txt('frm_notification_deactivated')
4036  );
4037  }
4038 
4039  return $lg;
4040  }
settings()
Definition: settings.php:2
Class ilObjForumListGUI.
user()
Definition: user.php:4
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ initSessionStorage()

ilObjForumGUI::initSessionStorage ( )
protected

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

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

Referenced by __construct().

151  {
152  $forumValues = \ilSession::get('frm');
153  if (!is_array($forumValues)) {
154  $forumValues = [];
155  \ilSession::set('frm', $forumValues);
156  }
157 
158  $threadId = $this->httpRequest->getQueryParams()['thr_pk'] ?? 0;
159  if ((int) $threadId > 0 && !is_array($forumValues[(int) $threadId])) {
160  $forumValues[(int) $threadId] = [];
161  \ilSession::set('frm', $forumValues);
162  }
163  }
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isParentObjectCrsOrGrp()

ilObjForumGUI::isParentObjectCrsOrGrp ( )

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

Referenced by initHeaderAction(), and isUserAllowedToDeactivateNotification().

4065  : bool
4066  {
4067  $grpRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'grp');
4068  $crsRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'crs');
4069 
4070  return ($grpRefId > 0 || $crsRefId > 0);
4071  }
+ Here is the caller graph for this function:

◆ isTopLevelReplyCommand()

ilObjForumGUI::isTopLevelReplyCommand ( )
private
Returns
bool

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

Referenced by checkUsersViewMode(), and getCensorshipFormHTML().

279  : bool
280  {
281  return in_array(
282  strtolower($this->ctrl->getCmd()),
283  array_map('strtolower', array('createTopLevelPost', 'saveTopLevelPost', 'saveTopLevelDraft'))
284  );
285  }
+ Here is the caller graph for this function:

◆ isUserAllowedToDeactivateNotification()

ilObjForumGUI::isUserAllowedToDeactivateNotification ( )

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

References $_GET, isParentObjectCrsOrGrp(), and user().

Referenced by initHeaderAction().

4043  {
4044  if ($this->objProperties->getNotificationType() == 'default') {
4045  return true;
4046  }
4047 
4048  if ($this->objProperties->isUserToggleNoti() == 0) {
4049  return true;
4050  }
4051 
4052  if ($this->isParentObjectCrsOrGrp()) {
4053  $frm_noti = new ilForumNotification((int) $_GET['ref_id']);
4054  $frm_noti->setUserId($this->user->getId());
4055 
4056  $user_toggle = (int) $frm_noti->isUserToggleNotification();
4057  if ($user_toggle == 0 && $this->objProperties->isUserToggleNoti() == 0) {
4058  return true;
4059  }
4060  }
4061 
4062  return false;
4063  }
$_GET["client_id"]
Class ilForumNotification.
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isWritingWithPseudonymAllowed()

ilObjForumGUI::isWritingWithPseudonymAllowed ( )
private

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

Referenced by buildThreadForm(), createThread(), editDraftObject(), getCensorshipFormHTML(), publishDraftObject(), saveThreadAsDraftObject(), saveTopLevelDraftObject(), and updateThreadDraftObject().

3549  : bool
3550  {
3551  if ($this->objProperties->isAnonymized() && (!$this->is_moderator || !$this->objProperties->getMarkModeratorPosts())) {
3552  return true;
3553  }
3554  return false;
3555  }
+ Here is the caller graph for this function:

◆ markAllReadObject()

ilObjForumGUI::markAllReadObject ( )

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

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

616  {
617  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
618  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
619  }
620 
621  $this->object->markAllThreadsRead($this->user->getId());
622  ilUtil::sendInfo($this->lng->txt('forums_all_threads_marked_read'));
623  $this->showThreadsObject();
624  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ markPostReadObject()

ilObjForumGUI::markPostReadObject ( )
protected

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

References ensureThreadBelongsToForum(), and user().

3934  {
3935  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3936  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3937  }
3938 
3939  if ((int) $this->objCurrentTopic->getId() > 0 && (int) $this->objCurrentPost->getId() > 0) {
3940  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
3941 
3942  $this->object->markPostRead(
3943  $this->user->getId(),
3944  (int) $this->objCurrentTopic->getId(),
3945  (int) $this->objCurrentPost->getId()
3946  );
3947  }
3948  $this->viewThreadObject();
3949  }
user()
Definition: user.php:4
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ markPostUnreadObject()

ilObjForumGUI::markPostUnreadObject ( )
protected

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

References ensureThreadBelongsToForum(), and user().

3917  {
3918  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3919  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3920  }
3921 
3922  if ((int) $this->objCurrentPost->getId() > 0) {
3923  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
3924 
3925  $this->object->markPostUnread($this->user->getId(), (int) $this->objCurrentPost->getId());
3926  }
3927  $this->viewThreadObject();
3928  }
user()
Definition: user.php:4
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ mergeThreadsObject()

ilObjForumGUI::mergeThreadsObject ( )

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

References $is_moderator, ilForum\_lookupObjIdForForumId(), ilUtil\sendFailure(), ilUtil\sendInfo(), settings(), and showThreadsObject().

Referenced by confirmMergeThreadsObject(), and performThreadsActionObject().

4103  {
4104  if (!$this->is_moderator) {
4105  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4106  }
4107 
4108  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4109  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4110  }
4111 
4112  $threadIdToMerge = (int) ($this->httpRequest->getQueryParams()['merge_thread_id'] ?? 0);
4113  if (!($threadIdToMerge > 0)) {
4114  $threadIds = array_values(
4115  array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
4116  );
4117  if (1 === count($threadIds)) {
4118  $threadIdToMerge = current($threadIds);
4119  } else {
4120  \ilUtil::sendInfo($this->lng->txt('select_one'));
4121  $this->showThreadsObject();
4122  return;
4123  }
4124  }
4125 
4126  $frm = $this->object->Forum;
4127  $frm->setForumId($this->object->getId());
4128  $frm->setForumRefId($this->object->getRefId());
4129 
4130  $threadToMerge = new ilForumTopic($threadIdToMerge);
4131 
4132  if (\ilForum::_lookupObjIdForForumId($threadToMerge->getForumId()) != $frm->getForumId()) {
4133  \ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
4134  $this->showThreadsObject();
4135  return;
4136  }
4137 
4138  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4139 
4140  $threadsTemplate = new \ilTemplate(
4141  'tpl.forums_threads_liste.html',
4142  true,
4143  true,
4144  'Modules/Forum'
4145  );
4146 
4147  $topicData = $frm->getOneTopic();
4148  if ($topicData) {
4149  $this->ctrl->setParameter($this, 'merge_thread_id', $threadIdToMerge);
4150  $tbl = new \ilForumTopicTableGUI(
4151  $this,
4152  'mergeThreads',
4153  '',
4154  (int) $this->httpRequest->getQueryParams()['ref_id'],
4155  $topicData,
4157  $this->settings->get('forum_overview')
4158  );
4159  $tbl->setSelectedThread($threadToMerge);
4160  $tbl->setMapper($frm)->fetchData();
4161  $tbl->init();
4162  $threadsTemplate->setVariable('THREADS_TABLE', $tbl->getHTML());
4163  $this->tpl->setContent($threadsTemplate->get());
4164  } else {
4165  \ilUtil::sendFailure($this->lng->txt('select_one'));
4166  $this->showThreadsObject();
4167  }
4168  }
static _lookupObjIdForForumId($a_for_id)
settings()
Definition: settings.php:2
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveThreadsObject()

ilObjForumGUI::moveThreadsObject ( )

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

References $_POST, $_SESSION, $is_moderator, $result, ensureThreadBelongsToForum(), hideToolbar(), and ilUtil\sendInfo().

Referenced by performMoveThreadsObject(), and performThreadsActionObject().

3475  {
3476  if (!$this->is_moderator) {
3477  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3478  }
3479 
3480  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3481  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3482  }
3483 
3484  $threads2move = $_SESSION['threads2move'];
3485  if (!is_array($threads2move) || !count($threads2move)) {
3486  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3487  $this->ctrl->redirect($this, 'showThreads');
3488  }
3489 
3490  $threads = [];
3491  $isModerator = $this->is_moderator;
3492  array_walk($threads2move, function ($threadId) use (&$threads, $isModerator) {
3493  $thread = new \ilForumTopic($threadId, $isModerator);
3494  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3495 
3496  $threads[] = $thread;
3497  });
3498 
3499  $exp = new ilForumMoveTopicsExplorer($this, 'moveThreads');
3500  $exp->setPathOpen($this->object->getRefId());
3501  $exp->setNodeSelected(isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id'] ? (int) $_POST['frm_ref_id'] : 0);
3502  $exp->setCurrentFrmRefId($this->object->getRefId());
3503  $exp->setHighlightedNode($this->object->getRefId());
3504  if (!$exp->handleCommand()) {
3505  $moveThreadTemplate = new ilTemplate(
3506  'tpl.forums_threads_move.html',
3507  true,
3508  true,
3509  'Modules/Forum'
3510  );
3511 
3512  if (!$this->hideToolbar()) {
3513  $this->toolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this));
3514  }
3515 
3516  $tblThr = new ilTable2GUI($this);
3517  $tblThr->setId('il_frm_thread_move_table_' . $this->object->getRefId());
3518  $tblThr->setTitle($this->lng->txt('move_chosen_topics'));
3519  $tblThr->addColumn($this->lng->txt('subject'), 'top_name', '100%');
3520  $tblThr->disable('header');
3521  $tblThr->disable('footer');
3522  $tblThr->disable('linkbar');
3523  $tblThr->disable('sort');
3524  $tblThr->disable('linkbar');
3525  $tblThr->setLimit(PHP_INT_MAX);
3526  $tblThr->setRowTemplate('tpl.forums_threads_move_thr_row.html', 'Modules/Forum');
3527  $tblThr->setDefaultOrderField('is_sticky');
3528  $counter = 0;
3529  $result = array();
3530  foreach ($threads as $thread) {
3531  $result[$counter]['num'] = $counter + 1;
3532  $result[$counter]['thr_subject'] = $thread->getSubject();
3533  ++$counter;
3534  }
3535  $tblThr->setData($result);
3536  $moveThreadTemplate->setVariable('THREADS_TABLE', $tblThr->getHTML());
3537 
3538  $moveThreadTemplate->setVariable('FRM_SELECTION_TREE', $exp->getHTML());
3539  $moveThreadTemplate->setVariable('CMD_SUBMIT', 'performMoveThreads');
3540  $moveThreadTemplate->setVariable('TXT_SUBMIT', $this->lng->txt('move'));
3541  $moveThreadTemplate->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'performMoveThreads'));
3542 
3543  $this->tpl->setContent($moveThreadTemplate->get());
3544  }
3545 
3546  return true;
3547  }
$_SESSION["AccountId"]
$result
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
hideToolbar($a_flag=null)
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performDeleteThreadsObject()

ilObjForumGUI::performDeleteThreadsObject ( )

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

References $_POST, ensureThreadBelongsToForum(), ilUtil\sendInfo(), and showThreadsObject().

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

◆ performMergeThreadsObject()

ilObjForumGUI::performMergeThreadsObject ( )

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

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

4239  {
4240  if (!$this->is_moderator) {
4241  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4242  }
4243 
4244  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4245  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4246  }
4247 
4248  $threadIds = array_values(
4249  array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
4250  );
4251  if (2 !== count($threadIds)) {
4252  ilUtil::sendFailure($this->lng->txt('select_one'));
4253  $this->showThreadsObject();
4254  return;
4255  }
4256 
4257  if ((int) $threadIds[0] === (int) $threadIds[1]) {
4258  ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
4259  $this->showThreadsObject();
4260  return;
4261  }
4262 
4263  try {
4264  $frm = new \ilForum();
4265  $frm->setForumId($this->object->getId());
4266  $frm->setForumRefId($this->object->getRefId());
4267 
4268  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $threadIds[0]));
4269  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $threadIds[1]));
4270 
4271  $frm->mergeThreads((int) $threadIds[0], (int) $threadIds[1]);
4272  \ilUtil::sendSuccess($this->lng->txt('merged_threads_successfully'));
4273  } catch (\ilException $e) {
4274  \ilUtil::sendFailure($this->lng->txt($e->getMessage()));
4275  }
4276 
4277  $this->showThreadsObject();
4278  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ performMoveThreadsObject()

ilObjForumGUI::performMoveThreadsObject ( )

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

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

3416  {
3417  if (!$this->is_moderator) {
3418  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3419  }
3420 
3421  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3422  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3423  }
3424 
3425 
3426  $threads2move = $_SESSION['threads2move'];
3427  if (!is_array($threads2move) || !count($threads2move)) {
3428  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3429  $this->ctrl->redirect($this, 'showThreads');
3430  }
3431 
3432  if (!$this->access->checkAccess('read', '', (int) $_POST['frm_ref_id'])) {
3433  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3434  }
3435 
3436  $threads = [];
3437  array_walk($threads2move, function ($threadId) use (&$threads) {
3438  $thread = new \ilForumTopic($threadId);
3439  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3440 
3441  $threads[] = $threadId;
3442  });
3443 
3444  if (isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id']) {
3445  $errorMessages = $this->object->Forum->moveThreads(
3446  (array) $_SESSION['threads2move'],
3447  $this->object->getRefId(),
3448  $this->ilObjDataCache->lookupObjId($_POST['frm_ref_id'])
3449  );
3450 
3451  if (array() !== $errorMessages) {
3453  implode("<br><br>", $errorMessages),
3454  true
3455  );
3456  return $this->ctrl->redirectByClass('ilObjForumGUI', 'showThreads');
3457  }
3458 
3459  unset($_SESSION['threads2move']);
3460  ilUtil::sendInfo($this->lng->txt('threads_moved_successfully'), true);
3461  $this->ctrl->redirect($this, 'showThreads');
3462  } else {
3463  ilUtil::sendInfo($this->lng->txt('no_forum_selected'));
3464  $this->moveThreadsObject();
3465  }
3466  }
$_SESSION["AccountId"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
$_POST["username"]
+ Here is the call graph for this function:

◆ performPostActivationObject()

ilObjForumGUI::performPostActivationObject ( )

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

References $GLOBALS, $objCurrentPost, ensureThreadBelongsToForum(), getForumObjects(), ilUtil\sendInfo(), and user().

1560  {
1561  if (!$this->is_moderator) {
1562  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1563  }
1564 
1565  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1566  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1567  }
1568 
1569  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
1570 
1571  $this->objCurrentPost->activatePost();
1572  $GLOBALS['ilAppEventHandler']->raise(
1573  'Modules/Forum',
1574  'activatedPost',
1575  array(
1576  'ref_id' => $this->object->getRefId(),
1577  'post' => $this->objCurrentPost
1578  )
1579  );
1580  ilUtil::sendInfo($this->lng->txt('forums_post_was_activated'), true);
1581 
1582  $this->viewThreadObject();
1583  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ performThreadsActionObject()

ilObjForumGUI::performThreadsActionObject ( )

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

References $_POST, $_SESSION, $i, $message, confirmDeleteThreads(), editThreadObject(), ensureThreadBelongsToForum(), executeCommand(), mergeThreadsObject(), moveThreadsObject(), ilUtil\sendInfo(), settings(), and user().

3298  {
3299  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3300  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3301  }
3302 
3303  unset($_SESSION['threads2move']);
3304 
3305  if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'])) {
3306  if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] == 'move') {
3307  if ($this->is_moderator) {
3308  $_SESSION['threads2move'] = $_POST['thread_ids'];
3309  $this->moveThreadsObject();
3310  }
3311  } elseif ($_POST['selected_cmd'] == 'enable_notifications' && $this->settings->get('forum_notification') != 0) {
3312  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3313  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3314  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3315  $tmp_obj->enableNotification($this->user->getId());
3316  }
3317 
3318  $this->ctrl->redirect($this, 'showThreads');
3319  } elseif ($_POST['selected_cmd'] == 'disable_notifications' && $this->settings->get('forum_notification') != 0) {
3320  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3321  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3322  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3323  $tmp_obj->disableNotification($this->user->getId());
3324  }
3325 
3326  $this->ctrl->redirect($this, 'showThreads');
3327  } elseif ($_POST['selected_cmd'] == 'close') {
3328  if ($this->is_moderator) {
3329  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3330  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3331  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3332  $tmp_obj->close();
3333  }
3334  }
3335  ilUtil::sendSuccess($this->lng->txt('selected_threads_closed'), true);
3336  $this->ctrl->redirect($this, 'showThreads');
3337  } elseif ($_POST['selected_cmd'] == 'reopen') {
3338  if ($this->is_moderator) {
3339  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3340  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3341  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3342  $tmp_obj->reopen();
3343  }
3344  }
3345 
3346  ilUtil::sendSuccess($this->lng->txt('selected_threads_reopened'), true);
3347  $this->ctrl->redirect($this, 'showThreads');
3348  } elseif ($_POST['selected_cmd'] == 'makesticky') {
3349  if ($this->is_moderator) {
3350  $message = $this->lng->txt('sel_threads_make_sticky');
3351 
3352  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3353  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3354  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3355  $makeSticky = $tmp_obj->makeSticky();
3356 
3357  if (!$makeSticky) {
3358  $message = $this->lng->txt('sel_threads_already_sticky');
3359  }
3360  }
3361  }
3362  if ($message != null) {
3363  ilUtil::sendInfo($message, true);
3364  }
3365  $this->ctrl->redirect($this, 'showThreads');
3366  } elseif ($_POST['selected_cmd'] == 'unmakesticky') {
3367  if ($this->is_moderator) {
3368  $message = $this->lng->txt('sel_threads_make_unsticky');
3369  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3370  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3371  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3372  $unmakeSticky = $tmp_obj->unmakeSticky();
3373  if (!$unmakeSticky) {
3374  $message = $this->lng->txt('sel_threads_already_unsticky');
3375  }
3376  }
3377  }
3378 
3379  if ($message != null) {
3380  ilUtil::sendInfo($message, true);
3381  }
3382  $this->ctrl->redirect($this, 'showThreads');
3383  } elseif ($_POST['selected_cmd'] == 'editThread') {
3384  if ($this->is_moderator) {
3385  $count = count($_POST['thread_ids']);
3386  if ($count != 1) {
3387  ilUtil::sendInfo($this->lng->txt('select_max_one_thread'), true);
3388  $this->ctrl->redirect($this, 'showThreads');
3389  } else {
3390  foreach ($_POST['thread_ids'] as $thread_id) {
3391  return $this->editThreadObject($thread_id, null);
3392  }
3393  }
3394  }
3395 
3396  $this->ctrl->redirect($this, 'showThreads');
3397  } elseif ($_POST['selected_cmd'] == 'html') {
3398  $this->ctrl->setCmd('exportHTML');
3399  $this->ctrl->setCmdClass('ilForumExportGUI');
3400  $this->executeCommand();
3401  } elseif ($_POST['selected_cmd'] == 'confirmDeleteThreads') {
3402  $this->confirmDeleteThreads();
3403  } elseif ($_POST['selected_cmd'] == 'merge') {
3404  $this->mergeThreadsObject();
3405  } else {
3406  ilUtil::sendInfo($this->lng->txt('topics_please_select_one_action'), true);
3407  $this->ctrl->redirect($this, 'showThreads');
3408  }
3409  } else {
3410  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3411  $this->ctrl->redirect($this, 'showThreads');
3412  }
3413  }
settings()
Definition: settings.php:2
$_SESSION["AccountId"]
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
editThreadObject($threadId, ilPropertyFormGUI $form=null)
$message
Definition: xapiexit.php:14
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
$_POST["username"]
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ prepareFormOutput()

ilObjForumGUI::prepareFormOutput (   $a_text)

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

References ilUtil\prepareFormOutput().

3891  {
3892  $a_text = str_replace("&lt;", "<", $a_text);
3893  $a_text = str_replace("&gt;", ">", $a_text);
3894  $a_text = ilUtil::prepareFormOutput($a_text);
3895  return $a_text;
3896  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
+ Here is the call graph for this function:

◆ publishDraftObject()

ilObjForumGUI::publishDraftObject (   $use_replyform = true)

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

References $_GET, $_POST, $_SESSION, $GLOBALS, $message, $objCurrentPost, $objCurrentTopic, ilObjMediaObject\_exists(), ilRTE\_getMediaObjects(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), ilFileDataForum\delete(), ilForumPostDraft\deleteDraft(), doCaptchaCheck(), ensureThreadBelongsToForum(), ilNewsItem\getFirstNewsIdForContext(), getForumObjects(), getReplyEditForm(), handleFormInput(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilForumPostDraft\isSavePostDraftAllowed(), isWritingWithPseudonymAllowed(), ilForumUtil\moveMediaObjects(), ilForumUtil\saveMediaObjects(), ilUtil\sendFailure(), ilFileDataForum\storeUploadedFile(), and user().

Referenced by publishSelectedDraftObject().

2184  {
2185  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2186  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2187  }
2188 
2189  if (!$this->access->checkAccess('add_reply', '', $this->object->getRefId())) {
2190  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2191  }
2192 
2193  if (!$this->objCurrentTopic->getId()) {
2194  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_deleted'), true);
2195  $this->ctrl->redirect($this);
2196  }
2197 
2198  if ($this->objCurrentTopic->isClosed()) {
2199  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_closed'), true);
2200  $this->ctrl->redirect($this);
2201  }
2202 
2203  if (!$this->objCurrentPost->getId()) {
2204  $this->requestAction = '';
2205  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_parent_deleted'));
2206  $this->viewThreadObject();
2207  return;
2208  }
2209 
2210  $post_id = $this->objCurrentPost->getId();
2211 
2212  $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, (int) $_GET['draft_id']);
2213 
2214  if ($use_replyform) {
2215  $oReplyEditForm = $this->getReplyEditForm();
2216  if (!$oReplyEditForm->checkInput()) {
2217  $oReplyEditForm->setValuesByPost();
2218  return $this->viewThreadObject();
2219  }
2220  $post_subject = $oReplyEditForm->getInput('subject');
2221  $post_message = $oReplyEditForm->getInput('message');
2222  $mob_direction = 0;
2223  } else {
2224  $post_subject = $draft_obj->getPostSubject();
2225  $post_message = $draft_obj->getPostMessage();
2226  $mob_direction = 1;
2227  }
2228 
2229  if ($draft_obj->getDraftId() > 0) {
2230  // init objects
2231  $oForumObjects = $this->getForumObjects();
2232  $frm = $oForumObjects['frm'];
2233  $frm->setMDB2WhereCondition(' top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
2234 
2235  // reply: new post
2236  $status = 1;
2237  $send_activation_mail = 0;
2238 
2239  if ($this->objProperties->isPostActivationEnabled()) {
2240  if (!$this->is_moderator) {
2241  $status = 0;
2242  $send_activation_mail = 1;
2243  } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
2244  $status = 0;
2245  }
2246  }
2247 
2248  $newPost = $frm->generatePost(
2249  $draft_obj->getForumId(),
2250  $draft_obj->getThreadId(),
2251  $this->user->getId(),
2252  $draft_obj->getPostDisplayUserId(),
2253  ilRTE::_replaceMediaObjectImageSrc($post_message, $mob_direction),
2254  $draft_obj->getPostId(),
2255  (int) $draft_obj->getNotify(),
2256  $this->handleFormInput($post_subject, false),
2257  $draft_obj->getPostUserAlias(),
2258  '',
2259  $status,
2260  $send_activation_mail
2261  );
2262 
2263  $this->object->markPostRead(
2264  $this->user->getId(),
2265  (int) $this->objCurrentTopic->getId(),
2266  (int) $this->objCurrentPost->getId()
2267  );
2268 
2269  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
2270 
2271  foreach ($uploadedObjects as $mob) {
2272  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
2273  ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
2274  }
2275  ilForumUtil::saveMediaObjects($post_message, 'frm:html', $newPost, $mob_direction);
2276 
2277  if ($this->objProperties->isFileUploadAllowed()) {
2278  $file = $_FILES['userfile'];
2279  if (is_array($file) && !empty($file)) {
2280  $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost);
2281  $tmp_file_obj->storeUploadedFile($file);
2282  }
2283 
2284  //move files of draft to posts directory
2285  $oFDForum = new ilFileDataForum($this->object->getId(), $newPost);
2286  $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_obj->getDraftId());
2287 
2288  $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
2289  $oFDForumDrafts->delete();
2290  }
2291 
2293  $GLOBALS['ilAppEventHandler']->raise(
2294  'Modules/Forum',
2295  'publishedDraft',
2296  array(
2297  'draftObj' => $draft_obj,
2298  'obj_id' => $this->object->getId(),
2299  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed()
2300  )
2301  );
2302  }
2303  $draft_obj->deleteDraft();
2304 
2305  $GLOBALS['ilAppEventHandler']->raise(
2306  'Modules/Forum',
2307  'createdPost',
2308  array(
2309  'ref_id' => $this->object->getRefId(),
2310  'post' => new ilForumPost($newPost),
2311  'notify_moderators' => (bool) $send_activation_mail
2312  )
2313  );
2314 
2315  $message = '';
2316  if (!$this->is_moderator && !$status) {
2317  $message .= $this->lng->txt('forums_post_needs_to_be_activated');
2318  } else {
2319  $message .= $this->lng->txt('forums_post_new_entry');
2320  }
2321 
2322  $_SESSION['frm'][(int) $_GET['thr_pk']]['openTreeNodes'][] = (int) $this->objCurrentPost->getId();
2323 
2324  $this->ctrl->clearParameters($this);
2325  ilUtil::sendSuccess($message, true);
2326  $this->ctrl->setParameter($this, 'pos_pk', $newPost);
2327  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
2328 
2329  $this->ctrl->redirect($this, 'viewThread');
2330  }
2331  }
Class ilForumPostDraft.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$_SESSION["AccountId"]
$_GET["client_id"]
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)
This class handles all operations on files for the drafts of a forum 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 _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...
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class handles all operations on files for the forum object.
handleFormInput($a_text, $a_stripslashes=true)
$message
Definition: xapiexit.php:14
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.
storeUploadedFile($files)
Store uploaded files in filesystem.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ publishSelectedDraftObject()

ilObjForumGUI::publishSelectedDraftObject ( )

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

References $_GET, and publishDraftObject().

2177  {
2178  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
2179  $this->publishDraftObject(false);
2180  }
2181  }
$_GET["client_id"]
publishDraftObject($use_replyform=true)
+ Here is the call graph for this function:

◆ publishThreadDraftObject()

ilObjForumGUI::publishThreadDraftObject ( )
protected

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

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

3778  {
3780  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3781  }
3782 
3783  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
3784  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
3785 
3786  if ((int) $draft->getDraftId() <= 0) {
3787  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3788  }
3789 
3790  $this->createThread($draft, true);
3791  }
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...
+ Here is the call graph for this function:

◆ quotePostObject()

ilObjForumGUI::quotePostObject ( )

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

References $_POST, ilRTE\_replaceMediaObjectImageSrc(), ensureThreadBelongsToForum(), getForumObjects(), getReplyEditForm(), and ILIAS\FileDelivery\http().

2621  {
2622  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2623  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2624  }
2625 
2626  if (!is_array($_POST['del_file'])) {
2627  $_POST['del_file'] = array();
2628  }
2629 
2630  if ($this->objCurrentTopic->isClosed()) {
2631  $this->requestAction = '';
2632  return $this->viewThreadObject();
2633  }
2634 
2635  $oReplyEditForm = $this->getReplyEditForm();
2636 
2637  // remove mandatory fields
2638  $oReplyEditForm->getItemByPostVar('subject')->setRequired(false);
2639  $oReplyEditForm->getItemByPostVar('message')->setRequired(false);
2640 
2641  $oReplyEditForm->checkInput();
2642 
2643  // add mandatory fields
2644  $oReplyEditForm->getItemByPostVar('subject')->setRequired(true);
2645  $oReplyEditForm->getItemByPostVar('message')->setRequired(true);
2646 
2647  $this->requestAction = 'showreply';
2648 
2649  $this->viewThreadObject();
2650  }
$_POST["username"]
+ 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 760 of file class.ilObjForumGUI.php.

References $_GET, $modal_history, ilForum\_isModerator(), ilRTE\_replaceMediaObjectImageSrc(), ilGlyphGUI\ATTACHMENT, ilGlyphGUI\get(), ilForumPost\getDepth(), ilForumPost\getId(), ilLinkButton\getInstance(), getReplyEditForm(), ilForumPost\getThreadId(), ilForumPost\getUpdateUserId(), ilForumPost\isCensored(), ilTemplate\parseCurrentBlock(), ilUtil\prepareFormOutput(), renderSplitButton(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), user(), and ilForumProperties\VIEW_TREE.

Referenced by checkUsersViewMode().

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

References $is_moderator, $object, ilForum\_isModerator(), ilRTE\_replaceMediaObjectImageSrc(), ilGlyphGUI\ATTACHMENT, displayConfirmPostActivation(), ilGlyphGUI\get(), ilForumPost\getCensorshipComment(), ilForumPost\getChangeDate(), ilForumPost\getCreateDate(), ilForumPost\getDepth(), ilForumPost\getDisplayUserId(), ilFileDataForum\getFilesOfPost(), 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(), ilTemplate\parseCurrentBlock(), ilUtil\prepareFormOutput(), renderSplitButton(), ilForumPost\setChangeDate(), ilTemplate\setCurrentBlock(), ilForumPost\setMessage(), HTML_Template_IT\setVariable(), ilUtil\stripSlashes(), ilUtil\switchColor(), and user().

Referenced by checkUsersViewMode().

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

◆ renderSortationControl()

ilObjForumGUI::renderSortationControl ( int  $currentSorting)
private

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

References $sortationOptions.

Referenced by checkUsersViewMode().

3187  : void
3188  {
3189  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3190  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
3191  $target = $this->ctrl->getLinkTarget(
3192  $this,
3193  'viewThread',
3194  '',
3195  false,
3196  false
3197  );
3198 
3199  $translatedSortationOptions = array_map(function ($value) {
3200  return $this->lng->txt($value);
3202 
3203  $sortingDirectionViewControl = $this->uiFactory
3204  ->viewControl()
3205  ->sortation($translatedSortationOptions)
3206  ->withLabel($this->lng->txt($this->sortationOptions[$currentSorting]))
3207  ->withTargetURL($target, 'viewmode');
3208  $this->toolbar->addComponent($sortingDirectionViewControl);
3209  }
+ Here is the caller graph for this function:

◆ 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 4983 of file class.ilObjForumGUI.php.

References $_GET, ilObjectGUI\$actions, $i, $url, displayConfirmPostActivation(), ilForumPost\getForumId(), ilForumPost\getId(), ilLinkButton\getInstance(), ilSplitButtonGUI\getInstance(), ilForumPost\getThreadId(), ilForumPost\hasReplies(), ilForumPost\isActivated(), ilForumPost\isCensored(), ilForumPost\isOwner(), ilForumPost\isPostRead(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), ilUtil\stripSlashes(), user(), and ILIAS\UI\Implementation\Component\withOnLoadCode().

Referenced by renderDraftContent(), and renderPostContent().

4990  {
4991  $actions = [];
4992  $modalActions = [];
4993  if ($is_post) {
4994  if (
4995  $this->objCurrentPost->getId() != $node->getId() || (
4996  !in_array($action, ['showreply', 'showedit', 'censor', 'delete'], true) &&
4998  )
4999  ) {
5000  if ($this->is_moderator || $node->isActivated() || $node->isOwner($this->user->getId())) {
5001  if ($this->is_moderator && !$this->objCurrentTopic->isClosed() && !$node->isActivated()) {
5002  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5003  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5004  $this->ctrl->setParameter($this, 'page', $pageIndex);
5005  $this->ctrl->setParameter(
5006  $this,
5007  'orderby',
5008  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5009  );
5010  $actions['activate_post'] = $this->ctrl->getLinkTarget(
5011  $this,
5012  'askForPostActivation',
5013  $node->getId()
5014  );
5015  $this->ctrl->clearParameters($this);
5016  }
5017 
5018  if (
5019  !$this->objCurrentTopic->isClosed() && $node->isActivated() && !$node->isCensored() &&
5020  $this->access->checkAccess('add_reply', '', (int) $this->object->getRefId())
5021  ) {
5022  $this->ctrl->setParameter($this, 'action', 'showreply');
5023  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5024  $this->ctrl->setParameter($this, 'page', $pageIndex);
5025  $this->ctrl->setParameter(
5026  $this,
5027  'orderby',
5028  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5029  );
5030  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5031  $actions['reply_to_postings'] = $this->ctrl->getLinkTarget(
5032  $this,
5033  'viewThread',
5034  'reply_' . $node->getId()
5035  );
5036  $this->ctrl->clearParameters($this);
5037  }
5038 
5039  if (
5040  !$this->objCurrentTopic->isClosed() &&
5041  !$node->isCensored() &&
5042  !$this->user->isAnonymous() &&
5043  ($node->isOwner($this->user->getId()) || $this->is_moderator)
5044  ) {
5045  $this->ctrl->setParameter($this, 'action', 'showedit');
5046  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5047  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5048  $this->ctrl->setParameter($this, 'page', $pageIndex);
5049  $this->ctrl->setParameter(
5050  $this,
5051  'orderby',
5052  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5053  );
5054  $actions['edit'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5055  $this->ctrl->clearParameters($this);
5056  }
5057 
5058  if (!$this->user->isAnonymous()) {
5059  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5060  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5061  $this->ctrl->setParameter($this, 'page', $pageIndex);
5062  $this->ctrl->setParameter(
5063  $this,
5064  'orderby',
5065  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5066  );
5067  $this->ctrl->setParameter($this, 'viewmode', $this->selectedSorting);
5068 
5069  $read_undread_txt = 'frm_mark_as_read';
5070  $read_undread_cmd = 'markPostRead';
5071  if ($node->isPostRead()) {
5072  $read_undread_txt = 'frm_mark_as_unread';
5073  $read_undread_cmd = 'markPostUnread';
5074  }
5075  $actions[$read_undread_txt] = $this->ctrl->getLinkTarget(
5076  $this,
5077  $read_undread_cmd,
5078  $node->getId()
5079  );
5080 
5081  $this->ctrl->clearParameters($this);
5082  }
5083 
5084  if (!$node->isCensored()) {
5085  $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId());
5086  $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId());
5087  $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId());
5088 
5089  $actions['print'] = $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost');
5090 
5091  $this->ctrl->clearParameters($this);
5092  }
5093 
5094  if (
5095  !$this->objCurrentTopic->isClosed() &&
5096  !$this->user->isAnonymous() &&
5097  ($this->is_moderator || ($node->isOwner($this->user->getId()) && !$node->hasReplies()))
5098  ) {
5099  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5100  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5101  $this->ctrl->setParameter($this, 'page', $pageIndex);
5102  $this->ctrl->setParameter(
5103  $this,
5104  'orderby',
5105  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5106  );
5107  $actions['delete'] = $this->ctrl->getFormAction($this, 'deletePosting');
5108  $this->ctrl->clearParameters($this);
5109  }
5110 
5111  if ($this->is_moderator && !$this->objCurrentTopic->isClosed()) {
5112  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5113  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5114  $this->ctrl->setParameter($this, 'page', $pageIndex);
5115  $this->ctrl->setParameter(
5116  $this,
5117  'orderby',
5118  ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5119  );
5120  if ($node->isCensored()) {
5121  $this->ctrl->setParameter($this, 'action', 'viewThread');
5122  $actions['frm_revoke_censorship'] = $this->ctrl->getFormAction($this, 'revokeCensorship');
5123  } else {
5124  $actions['frm_censorship'] = $this->ctrl->getFormAction($this, 'addCensorship');
5125  }
5126  $this->ctrl->clearParameters($this);
5127  }
5128  }
5129  }
5130  } elseif ($_GET['draft_id'] != $draft->getDraftId() || !in_array($action, ['deletedraft', 'editdraft'])) {
5131  // get actions for drafts
5132  $this->ctrl->setParameter($this, 'action', 'publishdraft');
5133  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5134  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5135  $this->ctrl->setParameter($this, 'page', $pageIndex);
5136  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5137  $this->ctrl->setParameter(
5138  $this,
5139  'orderby',
5140  \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5141  );
5142  $actions['publish'] = $this->ctrl->getLinkTarget($this, 'publishSelectedDraft', $node->getId());
5143  $this->ctrl->clearParameters($this);
5144 
5145  $this->ctrl->setParameter($this, 'action', 'editdraft');
5146  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5147  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5148  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5149  $this->ctrl->setParameter($this, 'page', $pageIndex);
5150  $this->ctrl->setParameter(
5151  $this,
5152  'orderby',
5153  \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5154  );
5155  $actions['edit'] = $this->ctrl->getLinkTarget($this, 'editDraft', 'draft_edit_' . $draft->getDraftId());
5156  $this->ctrl->clearParameters($this);
5157 
5158  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5159  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5160  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5161  $this->ctrl->setParameter($this, 'page', $pageIndex);
5162  $this->ctrl->setParameter(
5163  $this,
5164  'orderby',
5165  \ilUtil::stripSlashes($this->httpRequest->getQueryParams()['orderby'])
5166  );
5167  $actions['delete'] = $this->ctrl->getFormAction($this, 'deletePostingDraft');
5168  $this->ctrl->clearParameters($this);
5169 
5170  if (isset($_GET['draft_id']) && $action === 'editdraft') {
5171  $actions = [];
5172  }
5173  }
5174 
5175  $tpl->setCurrentBlock('posts_row');
5176  if (count($actions) > 0 && !$this->objCurrentTopic->isClosed()) {
5177  $action_button = ilSplitButtonGUI::getInstance();
5178 
5179  $i = 0;
5180  foreach ($actions as $lng_id => $url) {
5181  if ($i === 0) {
5182  $sb_item = ilLinkButton::getInstance();
5183  $sb_item->setCaption($lng_id);
5184  $sb_item->setUrl($url);
5185 
5186  $action_button->setDefaultButton($sb_item);
5187  ++$i;
5188  } else {
5189  if ('frm_revoke_censorship' === $lng_id || 'frm_censorship' === $lng_id) {
5190  $modalTemplate = new ilTemplate("tpl.forums_censor_modal.html", true, true, 'Modules/Forum');
5191  $formID = uniqid('form');
5192  $modalTemplate->setVariable('FORM_ID', $formID);
5193 
5194  if ($node->isCensored()) {
5195  $modalTemplate->setVariable('BODY', $this->lng->txt('forums_info_censor2_post'));
5196  } else {
5197  $modalTemplate->setVariable('BODY', $this->lng->txt('forums_info_censor_post'));
5198  $modalTemplate->touchBlock('message');
5199  }
5200 
5201  $modalTemplate->setVariable('FORM_ACTION', $url);
5202 
5203  $content = $this->uiFactory->legacy($modalTemplate->get());
5204  $submitBtn = $this->uiFactory->button()->primary($this->lng->txt('submit'), '#')->withOnLoadCode(
5205  static function (string $id) use ($formID) : string {
5206  return "$('#{$id}').click(function() { $('#{$formID}').submit(); return false; });";
5207  }
5208  );
5209  $modal = $this->uiFactory->modal()->roundtrip($this->lng->txt($lng_id), $content)->withActionButtons([$submitBtn]);
5210  $sb_item = $this->uiFactory->button()->shy($this->lng->txt($lng_id), '#')->withOnClick(
5211  $modal->getShowSignal()
5212  );
5213 
5214  $this->modalActionsContainer[] = $modal;
5215 
5216  $action_button->addMenuItem(new ilUiLinkToSplitButtonMenuItemAdapter($sb_item, $this->uiRenderer));
5217  continue;
5218  } elseif ('delete' === $lng_id) {
5219  $modal = $this->uiFactory->modal()->interruptive(
5220  $this->lng->txt($lng_id),
5221  strpos($url, 'deletePostingDraft') !== false ?
5222  $this->lng->txt('forums_info_delete_draft') :
5223  $this->lng->txt('forums_info_delete_post'),
5224  $url
5225  )->withActionButtonLabel(
5226  strpos($url, 'deletePostingDraft') !== false ? 'deletePostingDraft' : 'deletePosting'
5227  );
5228 
5229  $deleteAction = $this->uiFactory->button()->shy($this->lng->txt($lng_id), '#')->withOnClick(
5230  $modal->getShowSignal()
5231  );
5232 
5233  $this->modalActionsContainer[] = $modal;
5234 
5235  $action_button->addMenuItem(
5236  new ilUiLinkToSplitButtonMenuItemAdapter($deleteAction, $this->uiRenderer)
5237  );
5238  continue;
5239  }
5240 
5241  $sb_item = ilLinkButton::getInstance();
5242  $sb_item->setCaption($lng_id);
5243  $sb_item->setUrl($url);
5244 
5245  $action_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($sb_item));
5246  }
5247  }
5248 
5249  $tpl->setVariable('COMMANDS', $action_button->render());
5250  }
5251  }
$_GET["client_id"]
isOwner($a_user_id=0)
user()
Definition: user.php:4
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:615
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
$url
$i
Definition: metadata.php:24
+ 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 3157 of file class.ilObjForumGUI.php.

References ilForumProperties\VIEW_DATE_ASC.

Referenced by checkUsersViewMode().

3157  : void
3158  {
3159  $translationKeys = [];
3160  foreach ($this->viewModeOptions as $sortingConstantKey => $languageKey) {
3161  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3162  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
3163  $this->ctrl->setParameter($this, 'viewmode', $sortingConstantKey);
3164 
3165  $translationKeys[$this->lng->txt($languageKey)] = $this->ctrl->getLinkTarget(
3166  $this,
3167  'viewThread',
3168  '',
3169  false,
3170  false
3171  );
3172 
3173  $this->ctrl->clearParameters($this);
3174  }
3175 
3176  if ($currentViewMode > ilForumProperties::VIEW_DATE_ASC) {
3177  $currentViewMode = ilForumProperties::VIEW_DATE_ASC;
3178  }
3179 
3180  $sortViewControl = $this->uiFactory
3181  ->viewControl()
3182  ->mode($translationKeys, $this->lng->txt($this->viewModeOptions[$currentViewMode]))
3183  ->withActive($this->lng->txt($this->viewModeOptions[$currentViewMode]));
3184  $this->toolbar->addComponent($sortViewControl);
3185  }
+ Here is the caller graph for this function:

◆ restoreFromHistoryObject()

ilObjForumGUI::restoreFromHistoryObject ( )
protected

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

References ilForumPostDraft\createDraftBackup().

4377  {
4378  $historyId = (int) ($this->httpRequest->getQueryParams()['history_id'] ?? 0);
4379  $history = new \ilForumDraftsHistory($historyId);
4380 
4381  $draft = $history->rollbackAutosave();
4382  if ($draft->getThreadId() == 0 && $draft->getPostId() == 0) {
4383  $this->ctrl->setParameter($this, 'draft_id', $history->getDraftId());
4384  $this->ctrl->redirect($this, 'editThreadDraft');
4385  }
4386 
4387  $this->ctrl->clearParameters($this);
4388  $this->ctrl->setParameter($this, 'pos_pk', $draft->getPostId());
4389  $this->ctrl->setParameter($this, 'thr_pk', $draft->getThreadId());
4390  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
4391  $this->ctrl->setParameter($this, 'action', 'editdraft');
4392 
4393  // create draft backup before redirect!
4394  \ilForumPostDraft::createDraftBackup((int) $draft->getDraftId());
4395 
4396  $this->ctrl->redirect($this, 'viewThread');
4397  }
static createDraftBackup($draft_id)
+ Here is the call graph for this function:

◆ revokeCensorshipObject()

ilObjForumGUI::revokeCensorshipObject ( )
private

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

1630  {
1631  $this->handleCensorship(true);
1632  }

◆ saveThreadAsDraftObject()

ilObjForumGUI::saveThreadAsDraftObject ( )
protected

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

References $GLOBALS, ilRTE\_replaceMediaObjectImageSrc(), buildThreadForm(), doCaptchaCheck(), ilForumUtil\getPublicUserAlias(), handleFormInput(), ilForumPostDraft\isSavePostDraftAllowed(), isWritingWithPseudonymAllowed(), ilForumUtil\moveMediaObjects(), ilForumPostDraft\newInstanceByDraftId(), and user().

4400  {
4401  if (
4402  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4403  !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4405  ) {
4406  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4407  }
4408 
4409  $autoSavedDraftId = (int) ($this->httpRequest->getParsedBody()['draft_id'] ?? 0);
4410  if ($autoSavedDraftId <= 0) {
4411  $autoSavedDraftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4412  }
4413 
4414  $frm = $this->object->Forum;
4415  $frm->setForumId($this->object->getId());
4416  $frm->setForumRefId($this->object->getRefId());
4417  $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4418  $topicData = $frm->getOneTopic();
4419 
4420  $form = $this->buildThreadForm();
4421  if ($form->checkInput()) {
4422  $this->doCaptchaCheck();
4423 
4424  if (0 === $autoSavedDraftId) {
4425  $draft = new \ilForumPostDraft();
4426  } else {
4427  $draft = \ilForumPostDraft::newInstanceByDraftId($autoSavedDraftId);
4428  }
4429 
4430  $draft->setForumId($topicData['top_pk']);
4431  $draft->setThreadId(0);
4432  $draft->setPostId(0);
4433  $draft->setPostSubject($this->handleFormInput($form->getInput('subject'), false));
4434  $draft->setPostMessage(\ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0));
4435  $userAlias = \ilForumUtil::getPublicUserAlias(
4436  $form->getInput('alias'),
4437  $this->objProperties->isAnonymized()
4438  );
4439  $draft->setPostUserAlias($userAlias);
4440  $draft->setNotify((int) $form->getInput('notify'));
4441  $draft->setPostAuthorId($this->user->getId());
4442  $draft->setPostDisplayUserId($this->isWritingWithPseudonymAllowed() ? 0 : $this->user->getId());
4443 
4444  if (0 === $autoSavedDraftId) {
4445  $draftId = $draft->saveDraft();
4446  } else {
4447  $draft->updateDraft();
4448  $draftId = $draft->getDraftId();
4449  }
4450 
4451  $GLOBALS['ilAppEventHandler']->raise(
4452  'Modules/Forum',
4453  'savedAsDraft',
4454  [
4455  'draftObj' => $draft,
4456  'obj_id' => $this->object->getId(),
4457  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4458  ]
4459  );
4460 
4461  \ilForumUtil::moveMediaObjects($form->getInput('message'), 'frm~d:html', $draftId, 'frm~d:html', $draftId);
4462 
4463  $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draftId);
4464 
4465  $files2delete = $form->getInput('del_file');
4466  if (is_array($files2delete) && count($files2delete) > 0) {
4467  $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4468  }
4469 
4470  if ($this->objProperties->isFileUploadAllowed()) {
4471  $file = $_FILES['userfile'];
4472  if (is_array($file) && !empty($file)) {
4473  $draftFileData->storeUploadedFile($file);
4474  }
4475  }
4476 
4477  \ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4478  $this->ctrl->clearParameters($this);
4479  $this->ctrl->redirect($this, 'showThreads');
4480  }
4481 
4482  $this->requestAction = substr($this->requestAction, 6); // @nmatuschek: Why this, I don't get it???
4483  $form->setValuesByPost();
4484  $this->ctrl->setParameter($this, 'draft_id', $autoSavedDraftId);
4485  $this->tpl->setContent($form->getHTML());
4486  }
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 moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
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...
user()
Definition: user.php:4
buildThreadForm($isDraft=false)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static newInstanceByDraftId($draft_id)
handleFormInput($a_text, $a_stripslashes=true)
+ Here is the call graph for this function:

◆ saveThreadSortingObject()

ilObjForumGUI::saveThreadSortingObject ( )
protected

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

References ensureThreadBelongsToForum().

4074  {
4075  if (!$this->is_moderator) {
4076  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4077  }
4078 
4079  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4080  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4081  }
4082 
4083  $threadIdToSortValueMap = (array) ($this->httpRequest->getParsedBody()['thread_sorting'] ?? []);
4084 
4085  array_walk($threadIdToSortValueMap, function ($sortValue, $threadId) {
4086  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic($threadId));
4087  });
4088 
4089  foreach ($threadIdToSortValueMap as $threadId => $sortValue) {
4090  $sortValue = str_replace(',', '.', $sortValue);
4091  $sortValue = (float) $sortValue * 100;
4092  $this->object->setThreadSorting((int) $threadId, $sortValue);
4093  }
4094 
4095  \ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
4096  $this->ctrl->redirect($this, 'showThreads');
4097  }
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ saveTopLevelDraftObject()

◆ saveTopLevelPostObject()

ilObjForumGUI::saveTopLevelPostObject ( )

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

2171  {
2172  $this->savePostObject();
2173  return;
2174  }

◆ setColumnSettings()

ilObjForumGUI::setColumnSettings ( ilColumnGUI  $column_gui)
protected

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

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

3850  {
3851  $column_gui->setBlockProperty('news', 'title', $this->lng->txt('frm_latest_postings'));
3852  $column_gui->setBlockProperty('news', 'prevent_aggregation', true);
3853  $column_gui->setRepositoryMode(true);
3854 
3855  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
3856  $news_set = new \ilSetting('news');
3857  if ($news_set->get('enable_rss_for_internal')) {
3858  $column_gui->setBlockProperty('news', 'settings', true);
3859  $column_gui->setBlockProperty('news', 'public_notifications_option', true);
3860  }
3861  }
3862  }
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.
+ Here is the call graph for this function:

◆ setDisplayConfirmPostActivation()

ilObjForumGUI::setDisplayConfirmPostActivation (   $status = 0)

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

Referenced by askForPostActivationObject().

1696  {
1697  $this->display_confirm_post_activation = $status;
1698  }
+ Here is the caller graph for this function:

◆ setSideBlocks()

ilObjForumGUI::setSideBlocks ( )
protected

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

References ilObjectGUI\getRightColumnHTML(), and ilRepositoryObjectSearchGUI\getSearchBlockHTML().

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

4284  {
4285  $content = $this->getRightColumnHTML();
4286  if (!$this->ctrl->isAsynch()) {
4287  $content = implode('', [
4288  \ilRepositoryObjectSearchGUI::getSearchBlockHTML($this->lng->txt('frm_search')),
4289  $content,
4290  ]);
4291  }
4292  $this->tpl->setRightContent($content);
4293  }
static getSearchBlockHTML($a_title)
Get standar search block html.
getRightColumnHTML()
Display right column.
+ 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 1296 of file class.ilObjForumGUI.php.

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

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

◆ showThreadsObject()

ilObjForumGUI::showThreadsObject ( )

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

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

Referenced by confirmDeleteThreadDraftsObject(), confirmDeleteThreads(), confirmMergeThreadsObject(), disableForumNotificationObject(), enableForumNotificationObject(), executeCommand(), markAllReadObject(), mergeThreadsObject(), performDeleteThreadsObject(), performMergeThreadsObject(), and updateThreadObject().

627  {
628  $this->getSubTabs('showThreads');
629  $this->setSideBlocks();
630  $this->getCenterColumnHTML();
631  }
getSubTabs($subtab='showThreads')
getCenterColumnHTML()
Get center column.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUserObject()

ilObjForumGUI::showUserObject ( )

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

References $_GET, ilObjectFactory\getInstanceByRefId(), and ilUtil\stripSlashes().

3260  {
3261  $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
3262  $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
3263  $profile_gui->setAdditional($add);
3264  $profile_gui->setBackUrl(\ilUtil::stripSlashes($_GET['backurl']));
3265  $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
3266  }
$_GET["client_id"]
GUI class for public user profile presentation.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ sortThreadsObject()

ilObjForumGUI::sortThreadsObject ( )

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

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

634  {
635  $this->getSubTabs('sortThreads');
636  $this->setSideBlocks();
637  $this->getCenterColumnHTML();
638  }
getSubTabs($subtab='showThreads')
getCenterColumnHTML()
Get center column.
+ Here is the call graph for this function:

◆ toggleExplorerNodeStateObject()

ilObjForumGUI::toggleExplorerNodeStateObject ( )
protected

Toggle explorer node.

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

References $objCurrentTopic, and ilTreeExplorerGUI\toggleExplorerNodeState().

168  : void
169  {
170  $exp = new ilForumExplorerGUI(
171  'frm_exp_' . $this->objCurrentTopic->getId(),
172  $this,
173  'viewThread',
175  $this->objCurrentTopic->getFirstPostNode($this->is_moderator)
176  );
177  $exp->toggleExplorerNodeState();
178  }
Class ilForumExplorerGUI.
toggleExplorerNodeState()
Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed...
+ Here is the call graph for this function:

◆ toggleStickinessObject()

ilObjForumGUI::toggleStickinessObject ( )
protected

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

References $objCurrentTopic, and ensureThreadBelongsToForum().

1725  {
1726  if (!$this->is_moderator) {
1727  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1728  }
1729 
1730  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1731  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1732  }
1733 
1734  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1735 
1736  if ($this->objCurrentTopic->isSticky()) {
1737  $this->objCurrentTopic->unmakeSticky();
1738  } else {
1739  $this->objCurrentTopic->makeSticky();
1740  }
1741 
1742  $this->viewThreadObject();
1743  }
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ toggleThreadNotificationObject()

ilObjForumGUI::toggleThreadNotificationObject ( )
protected

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

References $objCurrentTopic, ensureThreadBelongsToForum(), ilUtil\sendInfo(), and user().

1706  {
1707  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1708  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1709  }
1710 
1711  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1712 
1713  if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
1714  $this->objCurrentTopic->disableNotification($this->user->getId());
1715  \ilUtil::sendInfo($this->lng->txt('forums_notification_disabled'));
1716  } else {
1717  $this->objCurrentTopic->enableNotification($this->user->getId());
1718  \ilUtil::sendInfo($this->lng->txt('forums_notification_enabled'));
1719  }
1720 
1721  $this->viewThreadObject();
1722  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ updateCustom()

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

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

526  {
527  $this->forum_settings_gui->updateCustomValues($a_form);
528  }

◆ updateThreadDraftObject()

ilObjForumGUI::updateThreadDraftObject ( )
protected

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

References $GLOBALS, ilRTE\_replaceMediaObjectImageSrc(), buildThreadForm(), checkDraftAccess(), doCaptchaCheck(), editThreadDraftObject(), ilForumUtil\getPublicUserAlias(), handleFormInput(), ilForumPostDraft\isSavePostDraftAllowed(), isWritingWithPseudonymAllowed(), ilForumUtil\moveMediaObjects(), ilForumPostDraft\newInstanceByDraftId(), and user().

4489  {
4490  if (
4491  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4492  !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4494  ) {
4495  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4496  }
4497 
4498  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4499  if ($draftId <= 0 || !$this->checkDraftAccess($draftId)) {
4500  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4501  }
4502 
4503  $form = $this->buildThreadForm(true);
4504  if ($form->checkInput()) {
4505  $this->doCaptchaCheck();
4506 
4507  $userAlias = \ilForumUtil::getPublicUserAlias(
4508  $form->getInput('alias'),
4509  $this->objProperties->isAnonymized()
4510  );
4511 
4512  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
4513  $draft->setPostSubject($this->handleFormInput($form->getInput('subject'), false));
4514  $draft->setPostMessage(\ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0));
4515  $draft->setPostUserAlias($userAlias);
4516  $draft->setNotify((int) $form->getInput('notify'));
4517  $draft->setPostAuthorId($this->user->getId());
4518  $draft->setPostDisplayUserId($this->isWritingWithPseudonymAllowed() ? 0 : $this->user->getId());
4519  $draft->updateDraft();
4520 
4521  $GLOBALS['ilAppEventHandler']->raise(
4522  'Modules/Forum',
4523  'updatedDraft',
4524  [
4525  'draftObj' => $draft,
4526  'obj_id' => $this->object->getId(),
4527  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4528  ]
4529  );
4530 
4532  $form->getInput('message'),
4533  'frm~d:html',
4534  $draft->getDraftId(),
4535  'frm~d:html',
4536  $draft->getDraftId()
4537  );
4538 
4539  $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
4540 
4541  $files2delete = $form->getInput('del_file');
4542  if (is_array($files2delete) && count($files2delete) > 0) {
4543  $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4544  }
4545 
4546  if ($this->objProperties->isFileUploadAllowed()) {
4547  $file = $_FILES['userfile'];
4548  if (is_array($file) && !empty($file)) {
4549  $draftFileData->storeUploadedFile($file);
4550  }
4551  }
4552 
4553  \ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4554  $this->ctrl->clearParameters($this);
4555  $this->ctrl->redirect($this, 'showThreads');
4556  }
4557 
4558  $form->setValuesByPost();
4559  $this->ctrl->setParameter($this, 'hist_check', 0);
4560  $this->ctrl->setParameter($this, 'draft_id', $draftId);
4561  $this->editThreadDraftObject($form);
4562  }
editThreadDraftObject(\ilPropertyFormGUI $form=null)
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 moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
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...
user()
Definition: user.php:4
buildThreadForm($isDraft=false)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static newInstanceByDraftId($draft_id)
handleFormInput($a_text, $a_stripslashes=true)
checkDraftAccess(int $draftId)
+ Here is the call graph for this function:

◆ updateThreadObject()

ilObjForumGUI::updateThreadObject ( )

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

References $objCurrentTopic, editThreadObject(), ensureThreadBelongsToForum(), getThreadEditingForm(), and showThreadsObject().

585  {
586  if (!$this->is_moderator) {
587  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
588  }
589 
590  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
591  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
592  }
593 
594  if (!$this->objCurrentTopic->getId()) {
595  $this->showThreadsObject();
596  return;
597  }
598 
599  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
600 
601  $form = $this->getThreadEditingForm($this->objCurrentTopic->getId());
602  if (!$form->checkInput()) {
603  $form->setValuesByPost();
604  $this->editThreadObject($this->objCurrentTopic->getId(), $form);
605  return;
606  }
607 
608  $this->objCurrentTopic->setSubject($form->getInput('title'));
609  $this->objCurrentTopic->updateThreadTitle();
610 
611  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
612  $this->showThreadsObject();
613  }
editThreadObject($threadId, ilPropertyFormGUI $form=null)
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
getThreadEditingForm($a_thread_id)
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjForumGUI::$access

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

◆ $confirmation_gui_html

ilObjForumGUI::$confirmation_gui_html = ''
private

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

◆ $display_confirm_post_activation

ilObjForumGUI::$display_confirm_post_activation = 0
private

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

Referenced by displayConfirmPostActivation().

◆ $error

ilObjForumGUI::$error

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

◆ $forum_settings_gui

ilObjForumGUI::$forum_settings_gui
private

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

Referenced by executeCommand().

◆ $forumObjects

ilObjForumGUI::$forumObjects = null
private

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

Referenced by getForumObjects().

◆ $globalScreen

ilObjForumGUI::$globalScreen
private

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

◆ $hideToolbar

ilObjForumGUI::$hideToolbar = false
private

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

Referenced by hideToolbar().

◆ $http

ilObjForumGUI::$http
private

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

◆ $httpRequest

ilObjForumGUI::$httpRequest
private

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

◆ $ilHelp

ilObjForumGUI::$ilHelp

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

◆ $ilNavigationHistory

ilObjForumGUI::$ilNavigationHistory

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

◆ $ilObjDataCache

ilObjForumGUI::$ilObjDataCache

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

◆ $is_moderator

ilObjForumGUI::$is_moderator = false
private

◆ $locator

ilObjForumGUI::$locator

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

◆ $modal_history

ilObjForumGUI::$modal_history = ''

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

Referenced by editThreadDraftObject(), and renderDraftContent().

◆ $modalActionsContainer

ilObjForumGUI::$modalActionsContainer = []
private

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

◆ $objCurrentPost

ilObjForumGUI::$objCurrentPost
private

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

Referenced by performPostActivationObject(), and publishDraftObject().

◆ $objCurrentTopic

◆ $object

ilObjForumGUI::$object

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

Referenced by getForumObjects(), and renderPostContent().

◆ $objProperties

ilObjForumGUI::$objProperties

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

◆ $rbac

ilObjForumGUI::$rbac

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

◆ $replyEditForm

ilObjForumGUI::$replyEditForm
private

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

Referenced by getReplyEditForm().

◆ $repositoryTree

ilObjForumGUI::$repositoryTree

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

◆ $requestAction

ilObjForumGUI::$requestAction = ''
private

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

◆ $selectedSorting

ilObjForumGUI::$selectedSorting
private

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

Referenced by checkUsersViewMode().

◆ $settings

ilObjForumGUI::$settings

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

◆ $sortationOptions

ilObjForumGUI::$sortationOptions
private
Initial value:
= [
ilForumProperties::VIEW_DATE_ASC => 'ascending_order'

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

Referenced by renderSortationControl().

◆ $tabs

ilObjForumGUI::$tabs

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

◆ $toolbar

ilObjForumGUI::$toolbar

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

Referenced by checkUsersViewMode().

◆ $uiFactory

ilObjForumGUI::$uiFactory
private

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

◆ $uiRenderer

ilObjForumGUI::$uiRenderer
private

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

◆ $user

ilObjForumGUI::$user

Definition at line 93 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: