ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
 showUserObject ()
 
 performThreadsActionObject ()
 
 performMoveThreadsObject ()
 
 cancelMoveThreadsObject ()
 
 moveThreadsObject ()
 
 handleFormInput ($a_text, $a_stripslashes=true)
 
 prepareFormOutput ($a_text)
 
 isUserAllowedToDeactivateNotification ()
 
 isParentObjectCrsOrGrp ()
 
 addToDeskObject ()
 Add desktop item public. More...
 
 removeFromDeskObject ()
 Remove from desktop public. More...
 
 mergeThreadsObject ()
 
 confirmMergeThreadsObject ()
 
 performMergeThreadsObject ()
 
 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 ()
 list childs of current object 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...
 

Static Public Member Functions

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

Data Fields

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

Protected Member Functions

 initSessionStorage ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 
 getEditFormCustomValues (array &$a_values)
 
 updateCustom (ilPropertyFormGUI $a_form)
 
 renderDraftContent (string $action, bool $render_drafts, $node, $edit_draft_id=null)
 
 renderPostContent (ilForumPost $node, string $action, $Start, $z)
 
 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...
 
 showMountWebfolderIcon ()
 
 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)
 
 isHierarchicalView ()
 
 isTopLevelReplyCommand ()
 
 getThreadEditingForm ($a_thread_id)
 
 deletePostingDraftObject ()
 
 revokeCensorshipObject ()
 
 addCensorshipObject ()
 
 getReplyEditForm ()
 
 hideToolbar ($a_flag=null)
 
 getForumObjects ()
 
 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 (string $action, $is_post=true, ilForumPost $node, $Start=0, ilForumPostDraft $draft=null)
 
 doHistoryCheck ($draftId)
 

Private Attributes

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

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $_GET, $DIC, ilForumProperties\getInstance(), initSessionStorage(), settings(), and user().

86  {
87  global $DIC;
88 
89  $this->ctrl = $DIC->ctrl();
90  $this->ctrl->saveParameter($this, array('ref_id', 'cmdClass'));
91 
92  $this->tpl = $DIC->ui()->mainTemplate();
93  $this->lng = $DIC->language();
94  $this->httpRequest = $DIC->http()->request();
95  $this->uiFactory = $DIC->ui()->factory();
96  $this->uiRenderer = $DIC->ui()->renderer();
97 
98  $this->access = $DIC->access();
99  $this->ilObjDataCache = $DIC['ilObjDataCache'];
100  $this->tabs = $DIC->tabs();
101  $this->error = $DIC['ilErr'];
102  $this->ilNavigationHistory = $DIC['ilNavigationHistory'];
103  $this->user = $DIC->user();
104  $this->settings = $DIC->settings();
105  $this->toolbar = $DIC->toolbar();
106  $this->repositoryTree = $DIC->repositoryTree();
107  $this->ilHelp = $DIC['ilHelp'];
108  $this->rbac = $DIC->rbac();
109  $this->locator = $DIC['ilLocator'];
110 
111  $this->type = 'frm';
112  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
113 
114  $this->lng->loadLanguageModule('forum');
115 
116  $this->initSessionStorage();
117 
118  $this->objProperties = \ilForumProperties::getInstance($this->ilObjDataCache->lookupObjId($_GET['ref_id']));
119 
120  // Stored due to performance issues
121  $this->is_moderator = $this->access->checkAccess('moderate_frm', '', $_GET['ref_id']);
122 
123  // Model of current topic/thread
124  $this->objCurrentTopic = new ilForumTopic((int) $_GET['thr_pk'], $this->is_moderator);
125 
126  // Model of current post
127  $this->objCurrentPost = new ilForumPost((int) $_GET['pos_pk'], $this->is_moderator);
128 
129  $this->requestAction = (string) ($this->httpRequest->getQueryParams()['action'] ?? '');
130  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
static getInstance($a_obj_id=0)
Online help application class.
Navigation History of Repository Items.
+ 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 1152 of file class.ilObjForumGUI.php.

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

1153  {
1154  global $DIC;
1155 
1156  $ilAccess = $DIC->access();
1157  $lng = $DIC->language();
1158  $ilErr = $DIC['ilErr'];
1159 
1160  if ($ilAccess->checkAccess('read', '', $a_target)) {
1161  if ($a_thread != 0) {
1162  $objTopic = new ilForumTopic($a_thread);
1163  if ($objTopic->getFrmObjId() &&
1164  $objTopic->getFrmObjId() != ilObject::_lookupObjectId($a_target)) {
1165  $ref_ids = ilObject::_getAllReferences($objTopic->getFrmObjId());
1166  foreach ($ref_ids as $ref_id) {
1167  if ($ilAccess->checkAccess('read', '', $ref_id)) {
1168  $new_ref_id = $ref_id;
1169  break;
1170  }
1171  }
1172 
1173  if (isset($new_ref_id) && $new_ref_id != $a_target) {
1174  ilUtil::redirect(ILIAS_HTTP_PATH . "/goto.php?target=frm_" . $new_ref_id . "_" . $a_thread . "_" . $a_posting);
1175  }
1176  }
1177 
1178  $_GET['ref_id'] = $a_target;
1179  $_GET['pos_pk'] = $a_posting;
1180  $_GET['thr_pk'] = $a_thread;
1181  $_GET['anchor'] = $a_posting;
1182  $_GET['cmdClass'] = 'ilObjForumGUI';
1183  $_GET['cmd'] = 'viewThread';
1184  $_GET['baseClass'] = 'ilRepositoryGUI';
1185  include_once('ilias.php');
1186  exit();
1187  } else {
1188  $_GET['ref_id'] = $a_target;
1189  $_GET['baseClass'] = 'ilRepositoryGUI';
1190  include_once('ilias.php');
1191  exit();
1192  }
1193  } elseif ($ilAccess->checkAccess('read', '', ROOT_FOLDER_ID)) {
1194  $_GET['target'] = '';
1195  $_GET['ref_id'] = ROOT_FOLDER_ID;
1196  ilUtil::sendInfo(sprintf(
1197  $lng->txt('msg_no_perm_read_item'),
1199  ), true);
1200  $_GET['baseClass'] = 'ilRepositoryGUI';
1201  include_once('ilias.php');
1202  exit();
1203  }
1204 
1205  $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
1206  }
global $DIC
Definition: saml.php:7
$_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)
exit
Definition: backend.php:16
static redirect($a_script)
+ Here is the call graph for this function:

◆ addCensorshipObject()

ilObjForumGUI::addCensorshipObject ( )
private

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

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

1443  {
1444  $this->handleCensorship();
1445  }
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjForumGUI::addLocatorItems ( )
protected

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

3475  {
3476  if ($this->object instanceof \ilObjForum) {
3477  $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this), '', $this->object->getRefId());
3478  }
3479  }
Class ilObjForum.

◆ addThreadObject()

ilObjForumGUI::addThreadObject ( )
protected

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

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

3401  {
3402  $draft = new \ilForumPostDraft();
3404  $draftId = (int) ($this->httpRequest->getParsedBody()['draft_id'] ?? 0);
3405  if ($draftId > 0) {
3406  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
3407  }
3408  }
3409 
3410  $this->createThread($draft, false);
3411  }
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:

◆ addToDeskObject()

ilObjForumGUI::addToDeskObject ( )

Add desktop item public.

Implements ilDesktopItemHandling.

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

References ilDesktopItemGUI\addToDesktop(), settings(), and showThreadsObject().

3679  {
3680  if (!(int) $this->settings->get('disable_my_offers')) {
3682  \ilUtil::sendSuccess($this->lng->txt('added_to_desktop'));
3683  }
3684 
3685  $this->showThreadsObject();
3686  }
settings()
Definition: settings.php:2
static addToDesktop()
Add desktop item public.
+ 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 1047 of file class.ilObjForumGUI.php.

References ilObject\getRefId().

1048  {
1049  \ilUtil::sendSuccess($this->lng->txt('frm_added'), true);
1050  $this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
1051  $this->ctrl->redirect($this, 'createThread');
1052  }
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ askForPostActivationObject()

ilObjForumGUI::askForPostActivationObject ( )

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

References setDisplayConfirmPostActivation().

1473  {
1474  if (!$this->is_moderator) {
1475  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1476  }
1477 
1478  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1479  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1480  }
1481 
1482  $this->setDisplayConfirmPostActivation(true);
1483 
1484  $this->viewThreadObject();
1485  }
setDisplayConfirmPostActivation($status=0)
+ Here is the call graph for this function:

◆ autosaveDraftAsyncObject()

ilObjForumGUI::autosaveDraftAsyncObject ( )
protected

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

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

4493  {
4494  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4495  if (
4496  $this->requestAction !== 'ready_showreply' &&
4497  $this->access->checkAccess('read', '', $this->object->getRefId()) &&
4498  $this->access->checkAccess('add_reply', '', $this->object->getRefId())
4499  ) {
4500  $action = new \ilForumAutoSaveAsyncDraftAction(
4501  $this->user,
4502  $this->getReplyEditForm(),
4503  $this->objProperties,
4504  $this->objCurrentTopic,
4505  $this->objCurrentPost,
4506  function (string $message) : string {
4507  return $this->handleFormInput($message);
4508  },
4509  $draftId,
4510  (int) \ilObjForum::lookupForumIdByRefId($this->ref_id),
4511  \ilUtil::stripSlashes($this->requestAction)
4512  );
4513 
4514  echo json_encode($action->executeAndGetResponseObject());
4515  }
4516 
4517  exit();
4518  }
$action
static lookupForumIdByRefId($ref_id)
user()
Definition: user.php:4
catch(Exception $e) $message
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
exit
Definition: backend.php:16
handleFormInput($a_text, $a_stripslashes=true)
+ Here is the call graph for this function:

◆ autosaveThreadDraftAsyncObject()

ilObjForumGUI::autosaveThreadDraftAsyncObject ( )
protected

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

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

4521  {
4522  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4523  if (
4524  $this->requestAction !== 'ready_showreply' &&
4525  $this->access->checkAccess('read', '', $this->object->getRefId()) &&
4526  $this->access->checkAccess('add_thread', '', $this->object->getRefId())
4527  ) {
4528  $action = new \ilForumAutoSaveAsyncDraftAction(
4529  $this->user,
4530  $this->buildThreadForm(),
4531  $this->objProperties,
4532  $this->objCurrentTopic,
4533  $this->objCurrentPost,
4534  function (string $message) : string {
4535  return $this->handleFormInput($message, false);
4536  },
4537  $draftId,
4538  (int) \ilObjForum::lookupForumIdByRefId($this->ref_id),
4539  \ilUtil::stripSlashes($this->requestAction)
4540  );
4541 
4542  echo json_encode($action->executeAndGetResponseObject());
4543  }
4544 
4545  exit();
4546  }
$action
static lookupForumIdByRefId($ref_id)
user()
Definition: user.php:4
buildThreadForm($isDraft=false)
catch(Exception $e) $message
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
exit
Definition: backend.php:16
handleFormInput($a_text, $a_stripslashes=true)
+ Here is the call graph for this function:

◆ buildThreadForm()

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

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

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

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

3217  {
3218  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
3219  $allowNotification = !$this->objProperties->isAnonymized();
3220 
3221  $mail = new \ilMail($this->user->getId());
3222  if (!$this->rbac->system()->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
3223  $allowNotification = false;
3224  }
3225 
3226  $form = new \ilForumThreadFormGUI(
3227  $this,
3228  $this->objProperties,
3230  $allowNotification,
3231  $isDraft,
3232  $draftId
3233  );
3234 
3235  $this->decorateWithAutosave($form);
3236 
3237  return $form;
3238  }
This class represents a property form user interface.
user()
Definition: user.php:4
if(isset($_POST['submit'])) $form
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 1548 of file class.ilObjForumGUI.php.

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

1549  {
1550  $this->requestAction = '';
1551  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
1553  $history_obj = new ilForumDraftsHistory();
1554  $history_obj->getFirstAutosaveByDraftId((int) $_GET['draft_id']);
1555  $draft = ilForumPostDraft::newInstanceByDraftId((int) $_GET['draft_id']);
1556  $draft->setPostSubject($history_obj->getPostSubject());
1557  $draft->setPostMessage($history_obj->getPostMessage());
1558 
1560  $history_obj->getPostMessage(),
1562  $history_obj->getHistoryId(),
1564  $draft->getDraftId()
1565  );
1566 
1567  $draft->updateDraft();
1568 
1569  $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
1570  }
1571  }
1572  $this->ctrl->clearParameters($this);
1573  $this->viewThreadObject();
1574  }
$_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 3085 of file class.ilObjForumGUI.php.

References $_SESSION.

3086  {
3087  unset($_SESSION['threads2move']);
3088  $this->ctrl->redirect($this, 'showThreads');
3089  }
$_SESSION["AccountId"]

◆ cancelPostObject()

ilObjForumGUI::cancelPostObject ( )

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

References $_POST, and ilForumPostDraft\newInstanceByDraftId().

1538  {
1539  $this->requestAction = '';
1540  if (isset($_POST['draft_id']) && (int) $_POST['draft_id'] > 0) {
1541  $draft = ilForumPostDraft::newInstanceByDraftId((int) $_POST['draft_id']);
1542  $draft->deleteDraftsByDraftIds(array( (int) $_POST['draft_id']));
1543  }
1544 
1545  $this->viewThreadObject();
1546  }
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 4760 of file class.ilObjForumGUI.php.

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

Referenced by editDraftObject().

4760  : bool
4761  {
4762  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
4763  if (
4764  !$this->access->checkAccess('add_reply', '', $this->object->getRefId()) || $this->user->isAnonymous() ||
4765  ($draft instanceof \ilForumPostDraft && $this->user->getId() != $draft->getPostAuthorId())
4766  ) {
4767  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4768  }
4769 
4770  return true;
4771  }
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:

◆ confirmDeleteThreadDraftsObject()

ilObjForumGUI::confirmDeleteThreadDraftsObject ( )
protected

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

References $_GET, ilForumPostDraft\getDraftInstancesByUserId(), ilObject\getId(), ilUtil\infoPanel(), isHierarchicalView(), ilUtil\sendInfo(), showThreadsObject(), user(), ilForumProperties\VIEW_DATE, and ilForumProperties\VIEW_TREE.

1301  {
1302  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1303  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1304  }
1305 
1306  $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()['draft_ids'] ?? []));
1307  if (0 === count($draftIds)) {
1308  \ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1309  $this->showThreadsObject();
1310  return;
1311  }
1312 
1313  $confirmation = new ilConfirmationGUI();
1314  $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteThreadDrafts'));
1315  $confirmation->setHeaderText($this->lng->txt('sure_delete_drafts'));
1316  $confirmation->setCancel($this->lng->txt('cancel'), 'showThreads');
1317  $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteThreadDrafts');
1318  $instances = \ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
1319  foreach ($draftIds as $draftId) {
1320  if (array_key_exists($draftId, $instances)) {
1321  $confirmation->addItem('draft_ids[]', $draftId, $instances[$draftId]->getPostSubject());
1322  }
1323  }
1324 
1325  $this->tpl->setContent($confirmation->getHTML());
1326  }
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 1259 of file class.ilObjForumGUI.php.

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

Referenced by performThreadsActionObject().

1260  {
1261  if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1262  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1263  return $this->showThreadsObject();
1264  }
1265 
1266  if (!$this->is_moderator) {
1267  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1268  }
1269 
1270  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1271  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1272  }
1273 
1274  $threads = [];
1275  array_walk($_POST['thread_ids'], function ($threadId) use (&$threads) {
1276  $thread = new \ilForumTopic($threadId);
1277  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
1278 
1279  $threads[] = $thread;
1280  });
1281 
1282  $c_gui = new ilConfirmationGUI();
1283 
1284  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteThreads'));
1285  $c_gui->setHeaderText($this->lng->txt('frm_sure_delete_threads'));
1286  $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
1287  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteThreads');
1288 
1289  foreach ($threads as $thread) {
1290  $c_gui->addItem('thread_ids[]', $thread->getId(), $thread->getSubject());
1291  }
1292 
1293  $this->confirmation_gui_html = $c_gui->getHTML();
1294 
1295  $this->hideToolbar(true);
1296 
1297  return $this->tpl->setContent($c_gui->getHTML());
1298  }
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 3795 of file class.ilObjForumGUI.php.

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

3796  {
3797  if (!$this->is_moderator) {
3798  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3799  }
3800 
3801  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3802  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3803  }
3804 
3805  $sourceThreadId = (int) ($this->httpRequest->getQueryParams()['merge_thread_id'] ?? 0);
3806  $targetThreadIds = array_values(
3807  array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
3808  );
3809 
3810  if (!($sourceThreadId > 0) || 1 !== count($targetThreadIds)) {
3811  \ilUtil::sendFailure($this->lng->txt('select_one'));
3812  $this->mergeThreadsObject();
3813  return;
3814  }
3815 
3816  $targetThreadId = current($targetThreadIds);
3817  if ($sourceThreadId == $targetThreadId) {
3818  \ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
3819  $this->showThreadsObject();
3820  return;
3821  }
3822 
3823  if (ilForumTopic::lookupForumIdByTopicId($sourceThreadId) != ilForumTopic::lookupForumIdByTopicId($targetThreadId)) {
3824  \ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
3825  $this->ctrl->clearParameters($this);
3826  $this->showThreadsObject();
3827  return;
3828  }
3829 
3830  if (\ilForumTopic::_lookupDate($sourceThreadId) < ilForumTopic::_lookupDate($targetThreadId)) {
3831  \ilUtil::sendInfo($this->lng->txt('switch_threads_for_merge'));
3832  }
3833 
3834  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $sourceThreadId));
3835  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $targetThreadId));
3836 
3837  $c_gui = new ilConfirmationGUI();
3838 
3839  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performMergeThreads'));
3840  $c_gui->setHeaderText($this->lng->txt('frm_sure_merge_threads'));
3841  $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
3842  $c_gui->setConfirm($this->lng->txt('confirm'), 'performMergeThreads');
3843 
3844  $c_gui->addItem(
3845  'thread_ids[]',
3846  $sourceThreadId,
3847  sprintf($this->lng->txt('frm_merge_src'), ilForumTopic::_lookupTitle($sourceThreadId))
3848  );
3849  $c_gui->addItem(
3850  'thread_ids[]',
3851  $targetThreadId,
3852  sprintf($this->lng->txt('frm_merge_target'), ilForumTopic::_lookupTitle($targetThreadId))
3853  );
3854  $this->tpl->setContent($c_gui->getHTML());
3855  }
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 3262 of file class.ilObjForumGUI.php.

References $form, $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().

3263  {
3264  if (
3265  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
3266  !$this->access->checkAccess('read', '', $this->object->getRefId())
3267  ) {
3268  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3269  }
3270 
3271  $frm = $this->object->Forum;
3272  $frm->setForumId($this->object->getId());
3273  $frm->setForumRefId($this->object->getRefId());
3274  $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3275  $topicData = $frm->getOneTopic();
3276 
3277  $form = $this->buildThreadForm($createFromDraft);
3278  if ($form->checkInput()) {
3279  $this->doCaptchaCheck();
3280 
3281  $userIdForDisplayPurposes = $this->user->getId();
3282  if ($this->isWritingWithPseudonymAllowed()) {
3283  $userIdForDisplayPurposes = 0;
3284  }
3285 
3286  $status = 1;
3287  if (
3288  ($this->objProperties->isPostActivationEnabled() && !$this->is_moderator) ||
3289  $this->objCurrentPost->isAnyParentDeactivated()
3290  ) {
3291  $status = 0;
3292  }
3293 
3294  if ($createFromDraft) {
3295  $newThread = new \ilForumTopic(0, true, true);
3296  $newThread->setForumId($topicData['top_pk']);
3297  $newThread->setThrAuthorId($draft->getPostAuthorId());
3298  $newThread->setDisplayUserId($draft->getPostDisplayUserId());
3299  $newThread->setSubject($this->handleFormInput($form->getInput('subject'), false));
3300  $newThread->setUserAlias($draft->getPostUserAlias());
3301 
3302  $newPost = $frm->generateThread(
3303  $newThread,
3304  \ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0),
3305  $draft->getNotify(),
3306  $draft->getPostNotify(),
3307  $status
3308  );
3309  } else {
3310  $userAlias = \ilForumUtil::getPublicUserAlias($form->getInput('alias'), $this->objProperties->isAnonymized());
3311  $newThread = new \ilForumTopic(0, true, true);
3312  $newThread->setForumId($topicData['top_pk']);
3313  $newThread->setThrAuthorId($this->user->getId());
3314  $newThread->setDisplayUserId($userIdForDisplayPurposes);
3315  $newThread->setSubject($this->handleFormInput($form->getInput('subject'), false));
3316  $newThread->setUserAlias($userAlias);
3317 
3318  $newPost = $frm->generateThread(
3319  $newThread,
3320  \ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0),
3321  $form->getItemByPostVar('notify') ? (int) $form->getInput('notify') : 0,
3322  0, // #19980
3323  $status
3324  );
3325  }
3326 
3327  if ($this->objProperties->isFileUploadAllowed()) {
3328  $file = $_FILES['userfile'];
3329  if (is_array($file) && !empty($file)) {
3330  $fileData = new \ilFileDataForum($this->object->getId(), $newPost);
3331  $fileData->storeUploadedFile($file);
3332  }
3333  }
3334 
3335  $frm->setDbTable('frm_data');
3336  $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
3337  $frm->updateVisits($topicData['top_pk']);
3338 
3339  if ($createFromDraft) {
3340  $mediaObjects = \ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
3341  } else {
3342  $mediaObjects = \ilRTE::_getMediaObjects($form->getInput('message'), 0);
3343  }
3344  foreach ($mediaObjects as $mob) {
3345  if (\ilObjMediaObject::_exists($mob)) {
3346  \ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
3347  \ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
3348  }
3349  }
3350 
3351  if ($draft->getDraftId() > 0) {
3352  $draftHistory = new \ilForumDraftsHistory();
3353  $draftHistory->deleteHistoryByDraftIds([$draft->getDraftId()]);
3354  if ($this->objProperties->isFileUploadAllowed()) {
3355  $forumFileData = new \ilFileDataForum($this->object->getId(), $newPost);
3356  $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
3357  $draftFileData->moveFilesOfDraft($forumFileData->getForumPath(), $newPost);
3358  }
3359  $draft->deleteDraft();
3360  }
3361 
3362  $GLOBALS['ilAppEventHandler']->raise(
3363  'Modules/Forum',
3364  'createdPost',
3365  [
3366  'ref_id' => $this->object->getRefId(),
3367  'post' => new \ilForumPost($newPost),
3368  'notify_moderators' => !$status
3369  ]
3370  );
3371 
3372  \ilUtil::sendSuccess($this->lng->txt('forums_thread_new_entry'), true);
3373  $this->ctrl->redirect($this);
3374  }
3375 
3376  $form->setValuesByPost();
3377  if (!$this->objProperties->isAnonymized()) {
3378  $form->getItemByPostVar('alias')->setValue($this->user->getLogin());
3379  }
3380 
3381  $this->tpl->setContent($form->getHTML());
3382  }
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(isset($_POST['submit'])) $form
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createThreadObject()

ilObjForumGUI::createThreadObject ( )
protected

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

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

3241  {
3242  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3243  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3244  }
3245 
3246  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
3247  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3248  }
3249 
3250  $templateForWidthHandling = new \ilTemplate('tpl.create_thread_form.html', true, true, 'Modules/Forum');
3251  $templateForWidthHandling->setVariable('CREATE_FORM', $this->buildThreadForm()->getHTML());
3252  $templateForWidthHandling->parseCurrentBlock();
3253 
3254  $this->tpl->setContent($templateForWidthHandling->get());
3255  }
buildThreadForm($isDraft=false)
+ Here is the call graph for this function:

◆ createTopLevelPostObject()

ilObjForumGUI::createTopLevelPostObject ( )

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

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

1923  {
1924  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0 && !$this->user->isAnonymous()
1926  $draft_obj = new ilForumPostDraft($this->user->getId(), $this->objCurrentPost->getId(), (int) $_GET['draft_id']);
1927  }
1928 
1929  if ($draft_obj instanceof ilForumPostDraft && $draft_obj->getDraftId() > 0) {
1930  $this->ctrl->setParameter($this, 'action', 'editdraft');
1931  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1932  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
1933  $this->ctrl->setParameter($this, 'draft_id', $draft_obj->getDraftId());
1934  $this->ctrl->setParameter($this, 'offset', 0);
1935  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
1936  $this->ctrl->redirect($this, 'editDraft');
1937  } else {
1938  $this->viewThreadObject();
1939  }
1940  return;
1941  }
Class ilForumPostDraft.
$_GET["client_id"]
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ decorateWithAutosave()

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

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

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

Referenced by buildThreadForm(), and getCensorshipFormHTML().

163  {
166 
167  $this->tpl->addJavascript('./Modules/Forum/js/autosave.js');
168  $autosave_cmd = 'autosaveDraftAsync';
169  if ($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0) {
170  $autosave_cmd = 'autosaveThreadDraftAsync';
171  }
172  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
173  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
174  $draft_id = (int) $_GET['draft_id'] > 0 ? (int) $_GET['draft_id'] : 0;
175  $this->ctrl->setParameter($this, 'draft_id', $draft_id);
176  $this->ctrl->setParameter($this, 'action', \ilUtil::stripSlashes($this->requestAction));
177  $this->tpl->addOnLoadCode(
178  "il.Language.setLangVar('saving', " . json_encode($this->lng->txt('saving')) . ");"
179  );
180 
181  $this->tpl->addOnLoadCode('il.ForumDraftsAutosave.init(' . json_encode(array(
182  'loading_img_src' => \ilUtil::getImagePath('loader.svg'),
183  'draft_id' => $draft_id,
184  'interval' => $interval * 1000,
185  'url' => $this->ctrl->getFormAction($this, $autosave_cmd, '', true, false),
186  'selectors' => array(
187  'form' => '#form_' . $form->getId()
188  )
189  )) . ');');
190  }
191  }
$_GET["client_id"]
if(isset($_POST['submit'])) $form
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 4421 of file class.ilObjForumGUI.php.

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

Referenced by deleteSelectedDraft(), and deleteThreadDraftsObject().

4422  {
4423  // remove usage of deleted media objects
4424  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draft_id);
4425  $curMediaObjects = ilRTE::_getMediaObjects($message, 0);
4426  foreach ($oldMediaObjects as $oldMob) {
4427  $found = false;
4428  foreach ($curMediaObjects as $curMob) {
4429  if ($oldMob == $curMob) {
4430  $found = true;
4431  break;
4432  }
4433  }
4434  if (!$found) {
4435  if (ilObjMediaObject::_exists($oldMob)) {
4436  ilObjMediaObject::_removeUsage($oldMob, 'frm~d:html', $draft_id);
4437  $mob_obj = new ilObjMediaObject($oldMob);
4438  $mob_obj->delete();
4439  }
4440  }
4441  }
4442  }
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.
catch(Exception $e) $message
Class ilObjMediaObject.
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 1432 of file class.ilObjForumGUI.php.

References deleteSelectedDraft().

1433  {
1434  $this->deleteSelectedDraft();
1435  }
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 4447 of file class.ilObjForumGUI.php.

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

Referenced by deletePostingDraftObject().

4448  {
4449  if (
4450  !$this->access->checkAccess('add_reply', '', (int) $_GET['ref_id']) ||
4451  $this->user->isAnonymous() ||
4452  ($draft_obj instanceof ilForumPostDraft && $this->user->getId() != $draft_obj->getPostAuthorId())) {
4453  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4454  }
4455 
4456  $post_id = $this->objCurrentPost->getId();
4457  if (!($draft_obj instanceof ilForumPostDraft)) {
4458  $draft_id_to_delete = (int) $_GET['draft_id'];
4459  $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, $draft_id_to_delete);
4460 
4461  if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete)) {
4462  $this->ctrl->clearParameters($this);
4463  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4464  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4465  $this->ctrl->redirect($this, 'viewThread');
4466  }
4467  }
4468 
4469  $this->deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
4470 
4471  $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_obj->getDraftId());
4472  $objFileDataForumDrafts->delete();
4473 
4475  $GLOBALS['ilAppEventHandler']->raise(
4476  'Modules/Forum',
4477  'deletedDraft',
4478  array('draftObj' => $draft_obj,
4479  'obj_id' => $this->object->getId(),
4480  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
4481  );
4482  }
4483  $draft_obj->deleteDraft();
4484 
4485  ilUtil::sendSuccess($this->lng->txt('delete_draft_successfully'), true);
4486  $this->ctrl->clearParameters($this);
4487  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4488  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4489  $this->ctrl->redirect($this, 'viewThread');
4490  }
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
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteThreadDraftsObject()

ilObjForumGUI::deleteThreadDraftsObject ( )
protected

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

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

3168  {
3169  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3170  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3171  }
3172 
3173  $draftIds = array_filter((array) ($this->httpRequest->getParsedBody()['draft_ids'] ?? []));
3174  if (0 === count($draftIds)) {
3175  $draftIds = array_filter([(int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0)]);
3176  }
3177 
3178  $instances = \ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
3179  $checkedDraftIds = [];
3180  foreach ($draftIds as $draftId) {
3181  if (array_key_exists($draftId, $instances)) {
3182  $checkedDraftIds[] = $draftId;
3183  $draft = $instances[$draftId];
3184 
3185  $this->deleteMobsOfDraft($draft->getDraftId(), $draft->getPostMessage());
3186 
3187  $draftFileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
3188  $draftFileData->delete();
3189 
3190  $GLOBALS['ilAppEventHandler']->raise(
3191  'Modules/Forum',
3192  'deletedDraft',
3193  [
3194  'draftObj' => $draft,
3195  'obj_id' => $this->object->getId(),
3196  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
3197  ]
3198  );
3199 
3200  $draft->deleteDraft();
3201  }
3202  }
3203 
3204  if (count($checkedDraftIds) > 1) {
3205  \ilUtil::sendInfo($this->lng->txt('delete_drafts_successfully'), true);
3206  } else {
3207  \ilUtil::sendInfo($this->lng->txt('delete_draft_successfully'), true);
3208  }
3209  $this->ctrl->redirect($this, 'showThreads');
3210  }
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ deliverDraftZipFileObject()

ilObjForumGUI::deliverDraftZipFileObject ( )
protected

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

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

3921  {
3922  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3923  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3924  }
3925 
3926  $draftId = $this->httpRequest->getQueryParams()['draft_id'] ?? 0;
3927  $draft = \ilForumPostDraft::newInstanceByDraftId((int) $draftId);
3928  if ($draft->getPostAuthorId() == $this->user->getId()) {
3929  $fileData = new \ilFileDataForumDrafts(0, $draft->getDraftId());
3930  if (!$fileData->deliverZipFile()) {
3931  $this->ctrl->redirect($this);
3932  }
3933  }
3934  }
user()
Definition: user.php:4
static newInstanceByDraftId($draft_id)
+ Here is the call graph for this function:

◆ deliverZipFileObject()

ilObjForumGUI::deliverZipFileObject ( )
protected

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

References ensureThreadBelongsToForum().

3940  {
3941  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3942  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3943  }
3944 
3945  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
3946 
3947  $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
3948  if (!$fileData->deliverZipFile()) {
3949  $this->ctrl->redirect($this);
3950  }
3951  }
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ disableForumNotificationObject()

ilObjForumGUI::disableForumNotificationObject ( )
protected

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

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

3434  {
3435  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3436  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3437  }
3438 
3439  $frm = $this->object->Forum;
3440  $frm->setForumId($this->object->getId());
3441  $frm->disableForumNotification($this->user->getId());
3442 
3443  if ((int) $this->objCurrentTopic->getId() > 0) {
3444  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3445  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'), true);
3446  $this->ctrl->redirect($this, 'viewThread');
3447  }
3448 
3449  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'));
3450  $this->showThreadsObject();
3451  }
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 1492 of file class.ilObjForumGUI.php.

References $display_confirm_post_activation.

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

1493  {
1495  }
+ 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 4823 of file class.ilObjForumGUI.php.

References $_GET, $action, ilRTE\_replaceMediaObjectImageSrc(), ilForumPost\getDisplayUserId(), ilForumPost\getImportName(), ilForumPost\getMessage(), getModifiedReOnSubject(), ilForumPost\getPosAuthorId(), getReplyEditForm(), ilForumPost\getUserAlias(), ilForumPost\isCensored(), ilForumPost\isOwner(), ilForum\prepareText(), and user().

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

4824  {
4825  if ($this->user->isAnonymous() && !$this->user->isCaptchaVerified() && \ilCaptchaUtil::isActiveForForum()) {
4826  $this->user->setCaptchaVerified(true);
4827  }
4828  }
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 4776 of file class.ilObjForumGUI.php.

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

Referenced by editDraftObject(), and editThreadDraftObject().

4777  {
4779  return;
4780  }
4781 
4783  $draftsFromHistory = \ilForumDraftsHistory::getInstancesByDraftId($draftId);
4784  if (is_array($draftsFromHistory) && sizeof($draftsFromHistory) > 0) {
4785  $modal = \ilModalGUI::getInstance();
4786  $modal->setHeading($this->lng->txt('restore_draft_from_autosave'));
4787  $modal->setId('frm_autosave_restore');
4788  $form_tpl = new \ilTemplate('tpl.restore_thread_draft.html', true, true, 'Modules/Forum');
4789 
4790  foreach ($draftsFromHistory as $key => $history_instance) {
4791  $accordion = new ilAccordionGUI();
4792  $accordion->setId('acc_' . $history_instance->getHistoryId());
4793 
4794  $form_tpl->setCurrentBlock('list_item');
4795  $message = \ilRTE::_replaceMediaObjectImageSrc($history_instance->getPostMessage(), 1);
4796 
4797  $history_date = ilDatePresentation::formatDate(new ilDateTime($history_instance->getDraftDate(), IL_CAL_DATETIME));
4798  $this->ctrl->setParameter($this, 'history_id', $history_instance->getHistoryId());
4799  $header = $history_date . ' - ' . $history_instance->getPostSubject();
4800  $accordion->addItem($header, $message . $this->uiRenderer->render(
4801  $this->uiFactory->button()->standard(
4802  $this->lng->txt('restore'),
4803  $this->ctrl->getLinkTarget($this, 'restoreFromHistory')
4804  )
4805  ));
4806 
4807  $form_tpl->setVariable('ACC_AUTO_SAVE', $accordion->getHtml());
4808  $form_tpl->parseCurrentBlock();
4809  }
4810 
4811  $form_tpl->setVariable('RESTORE_DATA_EXISTS', 'found_threat_history_to_restore');
4812  $modal->setBody($form_tpl->get());
4813  $modal->initJS();
4814  $this->modal_history = $modal->getHTML();
4815  } else {
4817  }
4818  }
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.
catch(Exception $e) $message
static createDraftBackup($draft_id)
Date and time handling
static getInstancesByDraftId($draft_id)
static getInstance()
Get instance.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
Accordion user interface class.
$key
Definition: croninfo.php:18
+ 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 3956 of file class.ilObjForumGUI.php.

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

Referenced by updateThreadDraftObject().

3957  {
3958  if (
3959  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
3960  !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
3962  ) {
3963  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3964  }
3965 
3966  $frm = $this->object->Forum;
3967  $frm->setForumId($this->object->getId());
3968  $frm->setForumRefId($this->object->getRefId());
3969 
3970  $draft = new \ilForumPostDraft();
3971  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
3972  if ($draftId > 0) {
3973  $draft = $draft->newInstanceByDraftId($draftId);
3974  }
3975 
3976  $historyCheck = (int) ($this->httpRequest->getQueryParams()['hist_check'] ?? 1);
3977  if (!($form instanceof \ilPropertyFormGUI) && $historyCheck > 0) {
3978  $this->doHistoryCheck($draft->getDraftId());
3979  }
3980 
3981  if (!$form instanceof \ilPropertyFormGUI) {
3982  $form = $this->buildThreadForm(true);
3983  $form->setValuesByArray([
3984  'alias' => $draft->getPostUserAlias(),
3985  'subject' => $draft->getPostSubject(),
3986  'message' => \ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($draft->getPostMessage(), 2), 1),
3987  'notify' => $draft->getNotify() ? true : false,
3988  'userfile' => '',
3989  'del_file' => []
3990  ]);
3991  } else {
3992  $this->ctrl->setParameter($this, 'draft_id', $draftId);
3993  }
3994 
3995  $this->tpl->setContent($form->getHTML() . $this->modal_history);
3996  }
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)
if(isset($_POST['submit'])) $form
+ 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 445 of file class.ilObjForumGUI.php.

References $form, ensureThreadBelongsToForum(), and getThreadEditingForm().

Referenced by performThreadsActionObject(), and updateThreadObject().

446  {
447  if (!$this->is_moderator) {
448  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
449  }
450 
451  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
452  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
453  }
454 
455  $thread = new \ilForumTopic($threadId);
456  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
457 
458  $this->tabs->activateTab('forums_threads');
459 
460  if (!($form instanceof \ilPropertyFormGUI)) {
461  $form = $this->getThreadEditingForm($threadId);
462  $form->setValuesByArray(array(
463  'title' => $thread->getSubject()
464  ));
465  }
466 
467  $this->tpl->setContent($form->getHTML());
468  }
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 3413 of file class.ilObjForumGUI.php.

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

3414  {
3415  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3416  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3417  }
3418 
3419  $frm = $this->object->Forum;
3420  $frm->setForumId($this->object->getId());
3421  $frm->enableForumNotification($this->user->getId());
3422 
3423  if ((int) $this->objCurrentTopic->getId() > 0) {
3424  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3425  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'), true);
3426  $this->ctrl->redirect($this, 'viewThread');
3427  }
3428 
3429  \ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'));
3430  $this->showThreadsObject();
3431  }
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 151 of file class.ilObjForumGUI.php.

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

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

152  {
153  $forumId = \ilObjForum::lookupForumIdByObjId($objId);
154  if ((int) $thread->getForumId() !== (int) $forumId) {
155  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
156  }
157  }
static lookupForumIdByObjId($obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjForumGUI::executeCommand ( )

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

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

Referenced by performThreadsActionObject().

219  {
220  $next_class = $this->ctrl->getNextClass($this);
221  $cmd = $this->ctrl->getCmd();
222 
223  $exclude_cmds = array(
224  'viewThread', 'markPostUnread','markPostRead', 'showThreadNotification',
225  'performPostActivation',
226  'askForPostActivation', 'askForPostDeactivation',
227  'toggleThreadNotification', 'toggleThreadNotificationTab',
228  'toggleStickiness', 'cancelPost', 'savePost', 'saveTopLevelPost', 'createTopLevelPost', 'quotePost', 'getQuotationHTMLAsynch',
229  'autosaveDraftAsync', 'autosaveThreadDraftAsync',
230  'saveAsDraft', 'editDraft', 'updateDraft', 'deliverDraftZipFile', 'deliverZipFile', 'cancelDraft',
231  'deleteThreadDrafts',
232  'deletePosting', 'deletePostingDraft', 'revokeCensorship', 'addCensorship',
233  );
234 
235  if (!in_array($cmd, $exclude_cmds)) {
236  $this->prepareOutput();
237  }
238 
239  if (!$this->getCreationMode() && !$this->ctrl->isAsynch() && $this->access->checkAccess('read', '', $_GET['ref_id'])) {
241  (int) $_GET['ref_id'],
242  \ilLink::_getLink((int) $_GET['ref_id'], 'frm'),
243  'frm'
244  );
245  }
246 
247  switch ($next_class) {
248  case 'ilforumsettingsgui':
250  $this->ctrl->forwardCommand($forum_settings_gui);
251  break;
252 
253  case 'ilrepositoryobjectsearchgui':
254  $this->addHeaderAction();
255  $this->setSideBlocks();
256  $this->tabs->activateTab("forums_threads");
257  $this->ctrl->setReturn($this, 'view');
258  $search_gui = new ilRepositoryObjectSearchGUI(
259  $this->object->getRefId(),
260  $this,
261  'view'
262  );
263  $this->ctrl->forwardCommand($search_gui);
264  break;
265 
266  case 'ilpermissiongui':
267  $perm_gui = new ilPermissionGUI($this);
268  $this->ctrl->forwardCommand($perm_gui);
269  break;
270 
271  case 'ilforumexportgui':
272  $fex_gui = new ilForumExportGUI();
273  $this->ctrl->forwardCommand($fex_gui);
274  exit();
275  break;
276 
277  case 'ilforummoderatorsgui':
278  $fm_gui = new ilForumModeratorsGUI();
279  $this->ctrl->forwardCommand($fm_gui);
280  break;
281 
282  case 'ilinfoscreengui':
283  $this->infoScreen();
284  break;
285 
286  case 'ilcolumngui':
287  $this->showThreadsObject();
288  break;
289 
290  case 'ilpublicuserprofilegui':
291  $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
292  $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
293  $profile_gui->setAdditional($add);
294  $ret = $this->ctrl->forwardCommand($profile_gui);
295  $this->tpl->setContent($ret);
296  break;
297 
298  case 'ilobjectcopygui':
299  $cp = new ilObjectCopyGUI($this);
300  $cp->setType('frm');
301  $this->ctrl->forwardCommand($cp);
302  break;
303 
304  case 'ilexportgui':
305  $this->tabs->activateTab('export');
306  $exp = new ilExportGUI($this);
307  $exp->addFormat('xml');
308  $this->ctrl->forwardCommand($exp);
309  break;
310 
311  case "ilratinggui":
312  if (!$this->objProperties->isIsThreadRatingEnabled() || $this->user->isAnonymous()) {
313  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
314  }
315 
316  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
317  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
318  }
319 
320  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
321 
322  $rating_gui = new ilRatingGUI();
323  $rating_gui->setObject($this->object->getId(), $this->object->getType(), $this->objCurrentTopic->getId(), 'thread');
324 
325  $this->ctrl->setParameter($this, 'thr_pk', (int) $this->objCurrentTopic->getId());
326  $this->ctrl->forwardCommand($rating_gui);
327 
328  $avg = ilRating::getOverallRatingForObject($this->object->getId(), $this->object->getType(), (int) $this->objCurrentTopic->getId(), 'thread');
329  $this->objCurrentTopic->setAverageRating($avg['avg']);
330  $this->objCurrentTopic->update();
331 
332  $this->ctrl->redirect($this, "showThreads");
333  break;
334 
335  case 'ilcommonactiondispatchergui':
337  $this->ctrl->forwardCommand($gui);
338  break;
339 
340  case "ilcontainernewssettingsgui":
342  $forum_settings_gui->settingsTabs();
343 
344  $this->lng->loadLanguageModule('cont');
345  $this->tabs_gui->activateSubTab('cont_news_settings');
346  $news_set_gui = new ilContainerNewsSettingsGUI($this);
347  $news_set_gui->setNewsBlockForced(true);
348  $news_set_gui->setPublicNotification(true);
349  $this->ctrl->forwardCommand($news_set_gui);
350  break;
351 
352  default:
353  // alex, 11 Jan 2011:
354  // I inserted this workaround due to bug report 6971.
355  // In general the command handling is quite obscure here.
356  // The form action of the table should be filled
357  // with $ilCtrl->getFormAction(..) not with $ilCtrl->getLinkTarget(..)
358  // Commands should be determined with $ilCtrl->getCmd() not
359  // with accessing $_POST['selected_cmd'], since this is internal
360  // of ilTable2GUI/ilCtrl and may change.
361  if (isset($_POST['select_cmd2'])) {
362  $_POST['selected_cmd'] = $_POST["selected_cmd2"];
363  }
364 
365  if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] != null) {
366  $member_cmd = array('enableAdminForceNoti', 'disableAdminForceNoti', 'enableHideUserToggleNoti', 'disableHideUserToggleNoti');
367  in_array($_POST['selected_cmd'], $member_cmd) ? $cmd = $_POST['selected_cmd'] : $cmd = 'performThreadsAction';
368  } elseif (!$cmd && !$_POST['selected_cmd']) {
369  $cmd = 'showThreads';
370  }
371 
372  $cmd .= 'Object';
373  $this->$cmd();
374 
375  break;
376  }
377 
378  // suppress for topic level
379  if ($cmd != 'viewThreadObject' && $cmd != 'showUserObject') {
380  $this->addHeaderAction();
381  }
382  }
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.
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.
exit
Definition: backend.php:16
$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 1615 of file class.ilObjForumGUI.php.

References $_GET, and ilUtil\stripSlashes().

Referenced by getForumObjects().

1616  {
1617  $form_tpl = new ilTemplate('tpl.frm_activation_post_form.html', true, true, 'Modules/Forum');
1618  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1619  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1620  $this->ctrl->setParameter($this, 'orderby', ilUtil::stripSlashes($_GET['orderby']));
1621  $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPostActivation'));
1622  $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1623  $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1624  $form_tpl->setVariable('TXT_ACT', $this->lng->txt('activate_post_txt'));
1625  $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('activate_only_current'));
1626  $form_tpl->setVariable('CMD_CONFIRM', 'performPostActivation');
1627  $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1628  $form_tpl->setVariable('CMD_CANCEL', 'viewThread');
1629  $this->ctrl->clearParameters($this);
1630 
1631  return $form_tpl->get();
1632  }
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
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 1634 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(), ilTextInputGUI\setMaxLength(), ilFormPropertyGUI\setRequired(), ilUtil\stripSlashes(), and user().

Referenced by getForumObjects().

1635  {
1636  $frm = $this->object->Forum;
1637  $form_tpl = new ilTemplate('tpl.frm_censorship_post_form.html', true, true, 'Modules/Forum');
1638 
1639  $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1640  $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1641  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1642  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1643  $this->ctrl->setParameter($this, 'orderby', ilUtil::stripSlashes($_GET['orderby']));
1644  $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'viewThread'));
1645  $this->ctrl->clearParameters($this);
1646  $form_tpl->setVariable('TXT_CENS_MESSAGE', $this->lng->txt('forums_the_post'));
1647  $form_tpl->setVariable('TXT_CENS_COMMENT', $this->lng->txt('forums_censor_comment') . ':');
1648  $form_tpl->setVariable('CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1649 
1650  if ($this->objCurrentPost->isCensored()) {
1651  $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor2_post'));
1652  $form_tpl->setVariable('YES_BUTTON', $this->lng->txt('confirm'));
1653  $form_tpl->setVariable('NO_BUTTON', $this->lng->txt('cancel'));
1654  $form_tpl->setVariable('CMD_REVOKE_CENSORSHIP', 'revokeCensorship');
1655  $form_tpl->setVariable('CMD_CANCEL_REVOKE_CENSORSHIP', 'viewThread');
1656  } else {
1657  $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor_post'));
1658  $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1659  $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('confirm'));
1660  $form_tpl->setVariable('CMD_ADD_CENSORSHIP', 'addCensorship');
1661  $form_tpl->setVariable('CMD_CANCEL_ADD_CENSORSHIP', 'viewThread');
1662  }
1663 
1664  return $form_tpl->get();
1665  }
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
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 537 of file class.ilObjForumGUI.php.

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

538  {
539  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
540  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
541  }
542 
543  $cmd = $this->ctrl->getCmd();
544  $frm = $this->object->Forum;
545  $frm->setForumId($this->object->getId());
546  $frm->setForumRefId($this->object->getRefId());
547  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
548 
549  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_liste.html', 'Modules/Forum');
550 
551  if ((int) strlen($this->confirmation_gui_html)) {
552  $this->tpl->setVariable('CONFIRMATION_GUI', $this->confirmation_gui_html);
553  }
554 
555  // Create topic button
556  if ($this->access->checkAccess('add_thread', '', $this->object->getRefId()) && !$this->hideToolbar()) {
557  $btn = ilLinkButton::getInstance();
558  $btn->setUrl($this->ctrl->getLinkTarget($this, 'createThread'));
559  $btn->setCaption('forums_new_thread');
560  $this->toolbar->addStickyItem($btn);
561  }
562 
563  // Mark all topics as read button
564  if ($this->user->getId() != ANONYMOUS_USER_ID && !(int) strlen($this->confirmation_gui_html)) {
565  $this->toolbar->addButton(
566  $this->lng->txt('forums_mark_read'),
567  $this->ctrl->getLinkTarget($this, 'markAllRead'),
568  '',
570  );
571  $this->ctrl->clearParameters($this);
572  }
573 
576  $this->user->getId(),
577  ilObjForum::lookupForumIdByObjId($this->object->getId())
578  );
579  if (count($drafts) > 0) {
580  $draftsTable = new ilForumDraftsTableGUI(
581  $this,
582  $cmd,
583  $this->access->checkAccess('add_thread', '', $this->object->getRefId())
584  );
585  $draftsTable->setData($drafts);
586  $this->tpl->setVariable('THREADS_DRAFTS_TABLE', $draftsTable->getHTML());
587  }
588  }
589 
590  // Import information: Topic (variable $topicData) means frm object, not thread
591  $topicData = $frm->getOneTopic();
592  if ($topicData) {
593  // Visit-Counter
594  $frm->setDbTable('frm_data');
595  $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
596  $frm->updateVisits($topicData['top_pk']);
597 
598  if (!in_array($cmd, array('showThreads', 'sortThreads'))) {
599  $cmd = 'showThreads';
600  }
601 
603  $this,
604  $cmd,
605  '',
606  (int) $_GET['ref_id'],
607  $topicData,
608  $this->is_moderator,
609  $this->settings->get('forum_overview')
610  );
611  $tbl->init();
612  $tbl->setMapper($frm)->fetchData();
613  $this->tpl->setVariable('THREADS_TABLE', $tbl->getHTML());
614  }
615 
616  // Permanent link
617  $permalink = new ilPermanentLinkGUI('frm', $this->object->getRefId());
618  $this->tpl->setVariable('PRMLINK', $permalink->getHTML());
619  }
static getThreadDraftData($post_author_id, $forum_id)
settings()
Definition: settings.php:2
Class for permanent links.
static lookupForumIdByObjId($obj_id)
$_GET["client_id"]
$tbl
Definition: example_048.php:81
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 406 of file class.ilObjForumGUI.php.

407  {
408  $this->forum_settings_gui->getCustomValues($a_values);
409  }

◆ getForumObjects()

ilObjForumGUI::getForumObjects ( )
private

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

References $_GET, $_SESSION, $form, $forumObjects, $i, $mobs, $objCurrentTopic, $object, PHPMailer\PHPMailer\$params, $toolbar, ilObjMediaObject\_exists(), ilLink\_getLink(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjectGUI\addHeaderAction(), ilNavigationHistory\addItem(), ilFileDataForumDrafts\deliverFile(), displayConfirmPostActivation(), ensureThreadBelongsToForum(), getActivationFormHTML(), getCensorshipFormHTML(), ilObjectGUI\getCreationMode(), ilLinkButton\getInstance(), ilSplitButtonGUI\getInstance(), ilForumPostDraft\getInstancesByUserIdAndThreadId(), getReplyEditForm(), isHierarchicalView(), ilForumPostDraft\isSavePostDraftAllowed(), isTopLevelReplyCommand(), ilUtil\Linkbar(), ilAccessKey\MARK_ALL_READ, renderDraftContent(), renderPostContent(), ilUtil\sendInfo(), ilForumExplorerGUI\setThread(), ilUtil\stripSlashes(), user(), ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, and ilForumProperties\VIEW_TREE.

Referenced by addCensorshipObject(), editDraftObject(), getCensorshipFormHTML(), performPostActivationObject(), publishDraftObject(), quotePostObject(), and updateThreadDraftObject().

2437  {
2438  if (null === $this->forumObjects) {
2439  $forumObj = $this->object;
2440  $file_obj = new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
2441  $frm = $forumObj->Forum;
2442  $frm->setForumId($forumObj->getId());
2443  $frm->setForumRefId($forumObj->getRefId());
2444 
2445  $this->forumObjects['forumObj'] = $forumObj;
2446  $this->forumObjects['frm'] = $frm;
2447  $this->forumObjects['file_obj'] = $file_obj;
2448  }
2449 
2450  return $this->forumObjects;
2451  }
This class handles all operations on files for the forum object.
+ 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 2832 of file class.ilObjForumGUI.php.

Referenced by doCaptchaCheck().

2833  {
2834  $subject = $this->objCurrentPost->getSubject();
2835  $re_txt = $this->lng->txt('post_reply');
2836 
2837  $re_txt_with_num = str_replace(':', '(', $re_txt);
2838  $search_length = strlen($re_txt_with_num);
2839  $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
2840 
2841  if ($comp == 0) {
2842  $modified_subject = $subject;
2843  if ($on_reply == true) {
2844  // i.e. $subject = "Re(12):"
2845  $str_pos_start = strpos($subject, '(');
2846  $str_pos_end = strpos($subject, ')');
2847 
2848  $length = ((int) $str_pos_end - (int) $str_pos_start);
2849  $str_pos_start++;
2850  $txt_number = substr($subject, $str_pos_start, $length - 1);
2851 
2852  if (is_numeric($txt_number)) {
2853  $re_count = (int) $txt_number + 1;
2854  $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
2855  }
2856  }
2857  } else {
2858  $re_count = substr_count($subject, $re_txt);
2859  if ($re_count >= 1 && $on_reply == true) {
2860  $subject = str_replace($re_txt, '', $subject);
2861 
2862  // i.e. $subject = "Re: Re: Re: ... " -> "Re(4):"
2863  $re_count++;
2864  $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
2865  } elseif ($re_count >= 1 && $on_reply == false) {
2866  // possibility to modify the subject only for output
2867  // i.e. $subject = "Re: Re: Re: ... " -> "Re(3):"
2868  $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
2869  } elseif ($re_count == 0) {
2870  // the first reply to a thread
2871  $modified_subject = $this->lng->txt('post_reply') . ' ' . $this->objCurrentPost->getSubject();
2872  }
2873  }
2874  return $modified_subject;
2875  }
+ Here is the caller graph for this function:

◆ getReplyEditForm()

ilObjForumGUI::getReplyEditForm ( )
private
Returns
ilPropertyFormGUI

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

References $replyEditForm.

Referenced by autosaveDraftAsyncObject(), doCaptchaCheck(), editDraftObject(), getForumObjects(), publishDraftObject(), quotePostObject(), renderDraftContent(), and updateThreadDraftObject().

1911  {
1912  if (null === $this->replyEditForm) {
1913  $this->initReplyEditForm();
1914  }
1915 
1916  return $this->replyEditForm;
1917  }
+ Here is the caller graph for this function:

◆ getSubTabs()

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

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

References $is_moderator.

Referenced by showThreadsObject(), and sortThreadsObject().

530  {
531  if ($this->objProperties->getThreadSorting() == 1 && $this->is_moderator) {
532  $this->tabs->addSubTabTarget('show', $this->ctrl->getLinkTarget($this, 'showThreads'), 'showThreads', get_class($this), '', $subtab == 'showThreads'? true : false);
533  $this->tabs->addSubTabTarget('sorting_header', $this->ctrl->getLinkTarget($this, 'sortThreads'), 'sortThreads', get_class($this), '', $subtab == 'sortThreads'? true : false);
534  }
535  }
+ Here is the caller graph for this function:

◆ getTabs()

ilObjForumGUI::getTabs ( )
protected

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

References $_GET, and settings().

1055  {
1056  $this->ilHelp->setScreenIdComponent("frm");
1057 
1058  $this->ctrl->setParameter($this, 'ref_id', $this->ref_id);
1059 
1060  $active = array(
1061  '', 'showThreads', 'view', 'markAllRead',
1062  'enableForumNotification', 'disableForumNotification', 'moveThreads', 'performMoveThreads',
1063  'cancelMoveThreads', 'performThreadsAction', 'createThread', 'addThread',
1064  'showUser', 'confirmDeleteThreads',
1065  'merge','mergeThreads', 'performMergeThreads'
1066  );
1067 
1068  (in_array($this->ctrl->getCmd(), $active)) ? $force_active = true : $force_active = false;
1069  $this->tabs->addTarget('forums_threads', $this->ctrl->getLinkTarget($this, 'showThreads'), $this->ctrl->getCmd(), get_class($this), '', $force_active);
1070 
1071  // info tab
1072  if ($this->access->checkAccess('visible', '', $this->ref_id) || $this->access->checkAccess('read', '', $this->ref_id)) {
1073  $force_active = ($this->ctrl->getNextClass() == 'ilinfoscreengui' || strtolower($_GET['cmdClass']) == 'ilnotegui') ? true : false;
1074  $this->tabs->addTarget(
1075  'info_short',
1076  $this->ctrl->getLinkTargetByClass(array('ilobjforumgui', 'ilinfoscreengui'), 'showSummary'),
1077  array('showSummary', 'infoScreen'),
1078  '',
1079  '',
1080  $force_active
1081  );
1082  }
1083 
1084  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1085  $force_active = ($this->ctrl->getCmd() == 'edit') ? true : false;
1086  $this->tabs->addTarget('settings', $this->ctrl->getLinkTarget($this, 'edit'), 'edit', get_class($this), '', $force_active);
1087  }
1088 
1089  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1090  $this->tabs->addTarget('frm_moderators', $this->ctrl->getLinkTargetByClass('ilForumModeratorsGUI', 'showModerators'), 'showModerators', get_class($this));
1091  }
1092 
1093  if ($this->settings->get('enable_fora_statistics', false) &&
1094  ($this->objProperties->isStatisticEnabled() || $this->access->checkAccess('write', '', $this->ref_id))) {
1095  $force_active = ($this->ctrl->getCmd() == 'showStatistics') ? true : false;
1096  $this->tabs->addTarget('frm_statistics', $this->ctrl->getLinkTarget($this, 'showStatistics'), 'showStatistics', get_class($this), '', $force_active); //false
1097  }
1098 
1099  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1100  $this->tabs->addTarget('export', $this->ctrl->getLinkTargetByClass('ilexportgui', ''), '', 'ilexportgui');
1101  }
1102 
1103  if ($this->access->checkAccess('edit_permission', '', $this->ref_id)) {
1104  $this->tabs->addTarget('perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), 'perm'), array('perm', 'info', 'owner'), 'ilpermissiongui');
1105  }
1106  }
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 423 of file class.ilObjForumGUI.php.

References $form, and ilFormPropertyGUI\setRequired().

Referenced by editThreadObject(), and updateThreadObject().

424  {
425  $form = new ilPropertyFormGUI();
426  $this->ctrl->setParameter($this, 'thr_pk', $a_thread_id);
427  $form->setFormAction($this->ctrl->getFormAction($this, 'updateThread'));
428 
429  $ti_prop = new ilTextInputGUI($this->lng->txt('title'), 'title');
430  $ti_prop->setRequired(true);
431  $ti_prop->setMaxLength(255);
432  $ti_prop->setSize(50);
433  $form->addItem($ti_prop);
434 
435  $form->addCommandButton('updateThread', $this->lng->txt('save'));
436  $form->addCommandButton('showThreads', $this->lng->txt('cancel'));
437 
438  return $form;
439  }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleFormInput()

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

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

References ilUtil\stripSlashes().

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

3482  {
3483  $a_text = str_replace("<", "&lt;", $a_text);
3484  $a_text = str_replace(">", "&gt;", $a_text);
3485  if ($a_stripslashes) {
3486  $a_text = ilUtil::stripSlashes($a_text);
3487  }
3488 
3489  return $a_text;
3490  }
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 2368 of file class.ilObjForumGUI.php.

References $hideToolbar.

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

2369  {
2370  if (null === $a_flag) {
2371  return $this->hideToolbar;
2372  }
2373 
2374  $this->hideToolbar = $a_flag;
2375  return $this;
2376  }
hideToolbar($a_flag=null)
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjForumGUI::infoScreen ( )
protected

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

References $info.

Referenced by executeCommand(), and infoScreenObject().

3501  {
3502  if (
3503  !$this->access->checkAccess('visible', '', $this->object->getRefId()) &&
3504  !$this->access->checkAccess('read', '', $this->object->getRefId())
3505  ) {
3506  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
3507  }
3508 
3509  $info = new \ilInfoScreenGUI($this);
3510  $info->enablePrivateNotes();
3511  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
3512  $this->ctrl->forwardCommand($info);
3513  }
$info
Definition: index.php:5
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjForumGUI::infoScreenObject ( )

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

References infoScreen().

388  {
389  $this->ctrl->setCmd('showSummary');
390  $this->ctrl->setCmdClass('ilinfoscreengui');
391  $this->infoScreen();
392  }
+ Here is the call graph for this function:

◆ initEditCustomForm()

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

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

398  {
399  $this->forum_settings_gui = new ilForumSettingsGUI($this);
400  $this->forum_settings_gui->getCustomForm($a_form);
401  }
Class ilForumSettingsGUI.

◆ initHeaderAction()

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

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

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

3557  {
3558  $lg = parent::initHeaderAction();
3559 
3560  if ((int) $this->objCurrentTopic->getId() > 0) {
3561  $container_obj = null; // Workaround: Do not show "desktop actions" in thread view
3562  $lg->setContainerObject($container_obj);
3563  }
3564 
3565  if (!($lg instanceof \ilObjForumListGUI) || !$this->settings->get('forum_notification')) {
3566  return $lg;
3567  }
3568 
3569  if ($this->user->isAnonymous() || !$this->access->checkAccess('read', '', $this->object->getRefId())) {
3570  return $lg;
3571  }
3572 
3573  $frm = $this->object->Forum;
3574  $frm->setForumId($this->object->getId());
3575  $frm->setForumRefId($this->object->getRefId());
3576  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3577 
3578  $isForumNotificationEnabled = $frm->isForumNotificationEnabled($this->user->getId());
3579  $userMayDisableNotifications = $this->isUserAllowedToDeactivateNotification();
3580 
3581  if ((int) $this->objCurrentTopic->getId() > 0) {
3582  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3583  }
3584 
3585  if ($this->isParentObjectCrsOrGrp()) {
3586  // special behaviour for CRS/GRP-Forum notification!!
3587  if ($isForumNotificationEnabled && $userMayDisableNotifications) {
3588  $lg->addCustomCommand(
3589  $this->ctrl->getLinkTarget($this, 'disableForumNotification'),
3590  'forums_disable_forum_notification'
3591  );
3592  } elseif (!$isForumNotificationEnabled) {
3593  $lg->addCustomCommand(
3594  $this->ctrl->getLinkTarget($this, 'enableForumNotification'),
3595  'forums_enable_forum_notification'
3596  );
3597  }
3598  } elseif ($isForumNotificationEnabled) {
3599  $lg->addCustomCommand(
3600  $this->ctrl->getLinkTarget($this, 'disableForumNotification'),
3601  'forums_disable_forum_notification'
3602  );
3603  } else {
3604  $lg->addCustomCommand(
3605  $this->ctrl->getLinkTarget($this, 'enableForumNotification'),
3606  'forums_enable_forum_notification'
3607  );
3608  }
3609 
3610  $isThreadNotificationEnabled = false;
3611  if ((int) $this->objCurrentTopic->getId() > 0) {
3612  $isThreadNotificationEnabled = $this->objCurrentTopic->isNotificationEnabled($this->user->getId());
3613  if ($isThreadNotificationEnabled) {
3614  $lg->addCustomCommand(
3615  $this->ctrl->getLinkTarget($this, 'toggleThreadNotification'),
3616  'forums_disable_notification'
3617  );
3618  } else {
3619  $lg->addCustomCommand(
3620  $this->ctrl->getLinkTarget($this, 'toggleThreadNotification'),
3621  'forums_enable_notification'
3622  );
3623  }
3624  }
3625  $this->ctrl->setParameter($this, 'thr_pk', '');
3626 
3627  if ($isForumNotificationEnabled || $isThreadNotificationEnabled) {
3628  $lg->addHeaderIcon(
3629  'not_icon',
3630  ilUtil::getImagePath('notification_on.svg'),
3631  $this->lng->txt('frm_notification_activated')
3632  );
3633  } else {
3634  $lg->addHeaderIcon(
3635  'not_icon',
3636  ilUtil::getImagePath('notification_off.svg'),
3637  $this->lng->txt('frm_notification_deactivated')
3638  );
3639  }
3640 
3641  return $lg;
3642  }
$lg
Definition: example_018.php:62
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 132 of file class.ilObjForumGUI.php.

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

Referenced by __construct().

133  {
134  $forumValues = \ilSession::get('frm');
135  if (!is_array($forumValues)) {
136  $forumValues = [];
137  \ilSession::set('frm', $forumValues);
138  }
139 
140  $threadId = $this->httpRequest->getQueryParams()['thr_pk'] ?? 0;
141  if ((int) $threadId > 0 && !is_array($forumValues[(int) $threadId])) {
142  $forumValues[(int) $threadId] = [];
143  \ilSession::set('frm', $forumValues);
144  }
145  }
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:

◆ isHierarchicalView()

ilObjForumGUI::isHierarchicalView ( )
private
Returns
bool

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

References $_SESSION, ilForumProperties\VIEW_DATE, and ilForumProperties\VIEW_TREE.

Referenced by confirmDeleteThreadDraftsObject(), and getForumObjects().

196  : bool
197  {
198  return (
199  $_SESSION['viewmode'] == 'answers' ||
201  ) || !(
202  $_SESSION['viewmode'] == 'date' ||
204  );
205  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ isParentObjectCrsOrGrp()

ilObjForumGUI::isParentObjectCrsOrGrp ( )

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

Referenced by initHeaderAction(), and isUserAllowedToDeactivateNotification().

3667  : bool
3668  {
3669  $grpRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'grp');
3670  $crsRefId = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'crs');
3671 
3672  return ($grpRefId > 0 || $crsRefId > 0);
3673  }
+ Here is the caller graph for this function:

◆ isTopLevelReplyCommand()

ilObjForumGUI::isTopLevelReplyCommand ( )
private
Returns
bool

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

Referenced by getCensorshipFormHTML(), and getForumObjects().

210  : bool
211  {
212  return in_array(
213  strtolower($this->ctrl->getCmd()),
214  array_map('strtolower', array('createTopLevelPost', 'saveTopLevelPost'))
215  );
216  }
+ Here is the caller graph for this function:

◆ isUserAllowedToDeactivateNotification()

ilObjForumGUI::isUserAllowedToDeactivateNotification ( )

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

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

Referenced by initHeaderAction().

3645  {
3646  if ($this->objProperties->getNotificationType() == 'default') {
3647  return true;
3648  }
3649 
3650  if ($this->objProperties->isUserToggleNoti() == 0) {
3651  return true;
3652  }
3653 
3654  if ($this->isParentObjectCrsOrGrp()) {
3655  $frm_noti = new ilForumNotification((int) $_GET['ref_id']);
3656  $frm_noti->setUserId($this->user->getId());
3657 
3658  $user_toggle = (int) $frm_noti->isUserToggleNotification();
3659  if ($user_toggle == 0 && $this->objProperties->isUserToggleNoti() == 0) {
3660  return true;
3661  }
3662  }
3663 
3664  return false;
3665  }
$_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 3159 of file class.ilObjForumGUI.php.

Referenced by buildThreadForm(), createThread(), getCensorshipFormHTML(), and publishDraftObject().

3159  : bool
3160  {
3161  if ($this->objProperties->isAnonymized() && (!$this->is_moderator || !$this->objProperties->getMarkModeratorPosts())) {
3162  return true;
3163  }
3164  return false;
3165  }
+ Here is the caller graph for this function:

◆ markAllReadObject()

ilObjForumGUI::markAllReadObject ( )

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

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

505  {
506  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
507  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
508  }
509 
510  $this->object->markAllThreadsRead($this->user->getId());
511  ilUtil::sendInfo($this->lng->txt('forums_all_threads_marked_read'));
512  $this->showThreadsObject();
513  }
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 3535 of file class.ilObjForumGUI.php.

References ensureThreadBelongsToForum(), and user().

3536  {
3537  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3538  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3539  }
3540 
3541  if ((int) $this->objCurrentTopic->getId() > 0 && (int) $this->objCurrentPost->getId() > 0) {
3542  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
3543 
3544  $this->object->markPostRead(
3545  $this->user->getId(),
3546  (int) $this->objCurrentTopic->getId(),
3547  (int) $this->objCurrentPost->getId()
3548  );
3549  }
3550  $this->viewThreadObject();
3551  }
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 3518 of file class.ilObjForumGUI.php.

References ensureThreadBelongsToForum(), and user().

3519  {
3520  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3521  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3522  }
3523 
3524  if ((int) $this->objCurrentPost->getId() > 0) {
3525  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
3526 
3527  $this->object->markPostUnread($this->user->getId(), (int) $this->objCurrentPost->getId());
3528  }
3529  $this->viewThreadObject();
3530  }
user()
Definition: user.php:4
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ mergeThreadsObject()

ilObjForumGUI::mergeThreadsObject ( )

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

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

Referenced by confirmMergeThreadsObject(), and performThreadsActionObject().

3731  {
3732  if (!$this->is_moderator) {
3733  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3734  }
3735 
3736  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3737  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3738  }
3739 
3740  $threadIdToMerge = (int) ($this->httpRequest->getQueryParams()['merge_thread_id'] ?? 0);
3741  if (!($threadIdToMerge > 0)) {
3742  $threadIds = array_values(
3743  array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
3744  );
3745  if (1 === count($threadIds)) {
3746  $threadIdToMerge = current($threadIds);
3747  } else {
3748  \ilUtil::sendInfo($this->lng->txt('select_one'));
3749  $this->showThreadsObject();
3750  return;
3751  }
3752  }
3753 
3754  $frm = $this->object->Forum;
3755  $frm->setForumId($this->object->getId());
3756  $frm->setForumRefId($this->object->getRefId());
3757 
3758  $threadToMerge = new ilForumTopic($threadIdToMerge);
3759 
3760  if (\ilForum::_lookupObjIdForForumId($threadToMerge->getForumId()) != $frm->getForumId()) {
3761  \ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
3762  $this->showThreadsObject();
3763  return;
3764  }
3765 
3766  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3767 
3768  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_liste.html', 'Modules/Forum');
3769 
3770  $topicData = $frm->getOneTopic();
3771  if ($topicData) {
3772  $this->ctrl->setParameter($this, 'merge_thread_id', $threadIdToMerge);
3773  $tbl = new \ilForumTopicTableGUI(
3774  $this,
3775  'mergeThreads',
3776  '',
3777  (int) $this->httpRequest->getQueryParams()['ref_id'],
3778  $topicData,
3780  $this->settings->get('forum_overview')
3781  );
3782  $tbl->setSelectedThread($threadToMerge);
3783  $tbl->setMapper($frm)->fetchData();
3784  $tbl->init();
3785  $this->tpl->setVariable('THREADS_TABLE', $tbl->getHTML());
3786  } else {
3787  \ilUtil::sendFailure($this->lng->txt('select_one'));
3788  $this->showThreadsObject();
3789  }
3790  }
static _lookupObjIdForForumId($a_for_id)
settings()
Definition: settings.php:2
$tbl
Definition: example_048.php:81
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 3091 of file class.ilObjForumGUI.php.

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

Referenced by performMoveThreadsObject(), and performThreadsActionObject().

3092  {
3093  if (!$this->is_moderator) {
3094  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3095  }
3096 
3097  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3098  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3099  }
3100 
3101  $threads2move = $_SESSION['threads2move'];
3102  if (!is_array($threads2move) || !count($threads2move)) {
3103  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3104  $this->ctrl->redirect($this, 'showThreads');
3105  }
3106 
3107  $threads = [];
3108  $isModerator = $this->is_moderator;
3109  array_walk($threads2move, function ($threadId) use (&$threads, $isModerator) {
3110  $thread = new \ilForumTopic($threadId, $isModerator);
3111  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3112 
3113  $threads[] = $thread;
3114  });
3115 
3116  $exp = new ilForumMoveTopicsExplorer($this, 'moveThreads');
3117  $exp->setPathOpen($this->object->getRefId());
3118  $exp->setNodeSelected(isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id'] ? (int) $_POST['frm_ref_id'] : 0);
3119  $exp->setCurrentFrmRefId($this->object->getRefId());
3120  $exp->setHighlightedNode($this->object->getRefId());
3121  if (!$exp->handleCommand()) {
3122  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_move.html', 'Modules/Forum');
3123 
3124  if (!$this->hideToolbar()) {
3125  $this->toolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this));
3126  }
3127 
3128  $tblThr = new ilTable2GUI($this);
3129  $tblThr->setId('il_frm_thread_move_table_' . $this->object->getRefId());
3130  $tblThr->setTitle($this->lng->txt('move_chosen_topics'));
3131  $tblThr->addColumn($this->lng->txt('subject'), 'top_name', '100%');
3132  $tblThr->disable('header');
3133  $tblThr->disable('footer');
3134  $tblThr->disable('linkbar');
3135  $tblThr->disable('sort');
3136  $tblThr->disable('linkbar');
3137  $tblThr->setLimit(PHP_INT_MAX);
3138  $tblThr->setRowTemplate('tpl.forums_threads_move_thr_row.html', 'Modules/Forum');
3139  $tblThr->setDefaultOrderField('is_sticky');
3140  $counter = 0;
3141  $result = array();
3142  foreach ($threads as $thread) {
3143  $result[$counter]['num'] = $counter + 1;
3144  $result[$counter]['thr_subject'] = $thread->getSubject();
3145  ++$counter;
3146  }
3147  $tblThr->setData($result);
3148  $this->tpl->setVariable('THREADS_TABLE', $tblThr->getHTML());
3149 
3150  $this->tpl->setVariable('FRM_SELECTION_TREE', $exp->getHTML());
3151  $this->tpl->setVariable('CMD_SUBMIT', 'performMoveThreads');
3152  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('move'));
3153  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'performMoveThreads'));
3154  }
3155 
3156  return true;
3157  }
$_SESSION["AccountId"]
$result
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
hideToolbar($a_flag=null)
Class ilTable2GUI.
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 1208 of file class.ilObjForumGUI.php.

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

1209  {
1210  if (!$this->is_moderator) {
1211  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1212  }
1213 
1214  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1215  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1216  }
1217 
1218  if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1219  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1220  return $this->showThreadsObject();
1221  }
1222 
1223  $forumObj = new ilObjForum($this->object->getRefId());
1224  $this->objProperties->setObjId($forumObj->getId());
1225 
1226  $frm = new ilForum();
1227 
1228  $success_message = "forums_thread_deleted";
1229  if (count($_POST['thread_ids']) > 1) {
1230  $success_message = "forums_threads_deleted";
1231  }
1232 
1233  $threadIds = [];
1234  if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'])) {
1235  $threadIds = $_POST['thread_ids'];
1236  }
1237 
1238  $threads = [];
1239  array_walk($threadIds, function ($threadId) use (&$threads) {
1240  $thread = new \ilForumTopic($threadId);
1241  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
1242 
1243  $threads[] = $thread;
1244  });
1245 
1246  foreach ($threads as $thread) {
1247  $frm->setForumId($forumObj->getId());
1248  $frm->setForumRefId($forumObj->getRefId());
1249 
1250  $first_node = $frm->getFirstPostNode($thread->getId());
1251  if ((int) $first_node['pos_pk']) {
1252  $frm->deletePost($first_node['pos_pk']);
1253  ilUtil::sendInfo($this->lng->txt($success_message), true);
1254  }
1255  }
1256  $this->ctrl->redirect($this, 'showThreads');
1257  }
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 3860 of file class.ilObjForumGUI.php.

References ensureThreadBelongsToForum(), ilUtil\sendFailure(), and showThreadsObject().

3861  {
3862  if (!$this->is_moderator) {
3863  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3864  }
3865 
3866  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3867  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3868  }
3869 
3870  $threadIds = array_values(
3871  array_filter(array_map('intval', (array) $this->httpRequest->getParsedBody()['thread_ids'] ?? []))
3872  );
3873  if (2 !== count($threadIds)) {
3874  ilUtil::sendFailure($this->lng->txt('select_one'));
3875  $this->showThreadsObject();
3876  return;
3877  }
3878 
3879  if ((int) $threadIds[0] === (int) $threadIds[1]) {
3880  ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
3881  $this->showThreadsObject();
3882  return;
3883  }
3884 
3885  try {
3886  $frm = new \ilForum();
3887  $frm->setForumId($this->object->getId());
3888  $frm->setForumRefId($this->object->getRefId());
3889 
3890  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $threadIds[0]));
3891  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $threadIds[1]));
3892 
3893  $frm->mergeThreads((int) $threadIds[0], (int) $threadIds[1]);
3894  \ilUtil::sendSuccess($this->lng->txt('merged_threads_successfully'));
3895  } catch (\ilException $e) {
3896  \ilUtil::sendFailure($this->lng->txt($e->getMessage()));
3897  }
3898 
3899  $this->showThreadsObject();
3900  }
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 3033 of file class.ilObjForumGUI.php.

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

3034  {
3035  if (!$this->is_moderator) {
3036  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3037  }
3038 
3039  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3040  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3041  }
3042 
3043  $threads2move = $_SESSION['threads2move'];
3044  if (!is_array($threads2move) || !count($threads2move)) {
3045  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3046  $this->ctrl->redirect($this, 'showThreads');
3047  }
3048 
3049  if (!$this->access->checkAccess('read', '', (int) $_POST['frm_ref_id'])) {
3050  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3051  }
3052 
3053  $threads = [];
3054  array_walk($threads2move, function ($threadId) use (&$threads) {
3055  $thread = new \ilForumTopic($threadId);
3056  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3057 
3058  $threads[] = $threadId;
3059  });
3060 
3061  if (isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id']) {
3062  $errorMessages = $this->object->Forum->moveThreads(
3063  (array) $_SESSION['threads2move'],
3064  $this->object->getRefId(),
3065  $this->ilObjDataCache->lookupObjId($_POST['frm_ref_id'])
3066  );
3067 
3068  if (array() !== $errorMessages) {
3070  implode("<br><br>", $errorMessages),
3071  true
3072  );
3073  return $this->ctrl->redirectByClass('ilObjForumGUI', 'showThreads');
3074  }
3075 
3076  unset($_SESSION['threads2move']);
3077  ilUtil::sendInfo($this->lng->txt('threads_moved_successfully'), true);
3078  $this->ctrl->redirect($this, 'showThreads');
3079  } else {
3080  ilUtil::sendInfo($this->lng->txt('no_forum_selected'));
3081  $this->moveThreadsObject();
3082  }
3083  }
$_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 1367 of file class.ilObjForumGUI.php.

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

1368  {
1369  if (!$this->is_moderator) {
1370  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1371  }
1372 
1373  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1374  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1375  }
1376 
1377  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
1378 
1379  $this->objCurrentPost->activatePost();
1380  $GLOBALS['ilAppEventHandler']->raise(
1381  'Modules/Forum',
1382  'activatedPost',
1383  array(
1384  'ref_id' => $this->object->getRefId(),
1385  'post' => $this->objCurrentPost
1386  )
1387  );
1388  ilUtil::sendInfo($this->lng->txt('forums_post_was_activated'), true);
1389 
1390  $this->viewThreadObject();
1391  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ performThreadsActionObject()

ilObjForumGUI::performThreadsActionObject ( )

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

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

2916  {
2917  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2918  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2919  }
2920 
2921  unset($_SESSION['threads2move']);
2922 
2923  if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'])) {
2924  if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] == 'move') {
2925  if ($this->is_moderator) {
2926  $_SESSION['threads2move'] = $_POST['thread_ids'];
2927  $this->moveThreadsObject();
2928  }
2929  } elseif ($_POST['selected_cmd'] == 'enable_notifications' && $this->settings->get('forum_notification') != 0) {
2930  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
2931  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
2932  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
2933  $tmp_obj->enableNotification($this->user->getId());
2934  }
2935 
2936  $this->ctrl->redirect($this, 'showThreads');
2937  } elseif ($_POST['selected_cmd'] == 'disable_notifications' && $this->settings->get('forum_notification') != 0) {
2938  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
2939  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
2940  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
2941  $tmp_obj->disableNotification($this->user->getId());
2942  }
2943 
2944  $this->ctrl->redirect($this, 'showThreads');
2945  } elseif ($_POST['selected_cmd'] == 'close') {
2946  if ($this->is_moderator) {
2947  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
2948  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
2949  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
2950  $tmp_obj->close();
2951  }
2952  }
2953  ilUtil::sendSuccess($this->lng->txt('selected_threads_closed'), true);
2954  $this->ctrl->redirect($this, 'showThreads');
2955  } elseif ($_POST['selected_cmd'] == 'reopen') {
2956  if ($this->is_moderator) {
2957  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
2958  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
2959  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
2960  $tmp_obj->reopen();
2961  }
2962  }
2963 
2964  ilUtil::sendSuccess($this->lng->txt('selected_threads_reopened'), true);
2965  $this->ctrl->redirect($this, 'showThreads');
2966  } elseif ($_POST['selected_cmd'] == 'makesticky') {
2967  if ($this->is_moderator) {
2968  $message = $this->lng->txt('sel_threads_make_sticky');
2969 
2970  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
2971  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
2972  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
2973  $makeSticky = $tmp_obj->makeSticky();
2974 
2975  if (!$makeSticky) {
2976  $message = $this->lng->txt('sel_threads_already_sticky');
2977  }
2978  }
2979  }
2980  if ($message != null) {
2981  ilUtil::sendInfo($message, true);
2982  }
2983  $this->ctrl->redirect($this, 'showThreads');
2984  } elseif ($_POST['selected_cmd'] == 'unmakesticky') {
2985  if ($this->is_moderator) {
2986  $message = $this->lng->txt('sel_threads_make_unsticky');
2987  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
2988  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
2989  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
2990  $unmakeSticky = $tmp_obj->unmakeSticky();
2991  if (!$unmakeSticky) {
2992  $message = $this->lng->txt('sel_threads_already_unsticky');
2993  }
2994  }
2995  }
2996 
2997  if ($message != null) {
2998  ilUtil::sendInfo($message, true);
2999  }
3000  $this->ctrl->redirect($this, 'showThreads');
3001  } elseif ($_POST['selected_cmd'] == 'editThread') {
3002  if ($this->is_moderator) {
3003  $count = count($_POST['thread_ids']);
3004  if ($count != 1) {
3005  ilUtil::sendInfo($this->lng->txt('select_max_one_thread'), true);
3006  $this->ctrl->redirect($this, 'showThreads');
3007  } else {
3008  foreach ($_POST['thread_ids'] as $thread_id) {
3009  return $this->editThreadObject($thread_id, null);
3010  }
3011  }
3012  }
3013 
3014  $this->ctrl->redirect($this, 'showThreads');
3015  } elseif ($_POST['selected_cmd'] == 'html') {
3016  $this->ctrl->setCmd('exportHTML');
3017  $this->ctrl->setCmdClass('ilForumExportGUI');
3018  $this->executeCommand();
3019  } elseif ($_POST['selected_cmd'] == 'confirmDeleteThreads') {
3020  $this->confirmDeleteThreads();
3021  } elseif ($_POST['selected_cmd'] == 'merge') {
3022  $this->mergeThreadsObject();
3023  } else {
3024  ilUtil::sendInfo($this->lng->txt('topics_please_select_one_action'), true);
3025  $this->ctrl->redirect($this, 'showThreads');
3026  }
3027  } else {
3028  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3029  $this->ctrl->redirect($this, 'showThreads');
3030  }
3031  }
settings()
Definition: settings.php:2
$_SESSION["AccountId"]
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
catch(Exception $e) $message
editThreadObject($threadId, ilPropertyFormGUI $form=null)
$i
Definition: disco.tpl.php:19
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
$_POST["username"]
+ Here is the call graph for this function:

◆ prepareFormOutput()

ilObjForumGUI::prepareFormOutput (   $a_text)

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

References ilUtil\prepareFormOutput().

3493  {
3494  $a_text = str_replace("&lt;", "<", $a_text);
3495  $a_text = str_replace("&gt;", ">", $a_text);
3496  $a_text = ilUtil::prepareFormOutput($a_text);
3497  return $a_text;
3498  }
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 1959 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().

1960  {
1961  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1962  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1963  }
1964 
1965  if (!$this->access->checkAccess('add_reply', '', $this->object->getRefId())) {
1966  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1967  }
1968 
1969  if (!$this->objCurrentTopic->getId()) {
1970  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_deleted'), true);
1971  $this->ctrl->redirect($this);
1972  }
1973 
1974  if ($this->objCurrentTopic->isClosed()) {
1975  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_closed'), true);
1976  $this->ctrl->redirect($this);
1977  }
1978 
1979  if (!$this->objCurrentPost->getId()) {
1980  $this->requestAction = '';
1981  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_parent_deleted'));
1982  $this->viewThreadObject();
1983  return;
1984  }
1985 
1986  $post_id = $this->objCurrentPost->getId();
1987 
1988  $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, (int) $_GET['draft_id']);
1989 
1990  if ($use_replyform) {
1991  $oReplyEditForm = $this->getReplyEditForm();
1992  // @Nadia: Why do we need this additional check here (with this check mandatory fields are NOT checked, so I suggest to remove it): && !$draft_obj instanceof ilForumPostDraft
1993  if (!$oReplyEditForm->checkInput()) {
1994  $oReplyEditForm->setValuesByPost();
1995  return $this->viewThreadObject();
1996  }
1997  $post_subject = $oReplyEditForm->getInput('subject');
1998  $post_message = $oReplyEditForm->getInput('message');
1999  $mob_direction = 0;
2000  } else {
2001  $post_subject = $draft_obj->getPostSubject();
2002  $post_message = $draft_obj->getPostMessage();
2003  $mob_direction = 1;
2004  }
2005 
2006  if ($draft_obj->getDraftId() > 0) {
2007  // init objects
2008  $oForumObjects = $this->getForumObjects();
2009  $frm = $oForumObjects['frm'];
2010  $frm->setMDB2WhereCondition(' top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
2011 
2012  // reply: new post
2013  $status = 1;
2014  $send_activation_mail = 0;
2015 
2016  if ($this->objProperties->isPostActivationEnabled()) {
2017  if (!$this->is_moderator) {
2018  $status = 0;
2019  $send_activation_mail = 1;
2020  } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
2021  $status = 0;
2022  }
2023  }
2024 
2025  $newPost = $frm->generatePost(
2026  $draft_obj->getForumId(),
2027  $draft_obj->getThreadId(),
2028  $this->user->getId(),
2029  $draft_obj->getPostDisplayUserId(),
2030  ilRTE::_replaceMediaObjectImageSrc($post_message, $mob_direction),
2031  $draft_obj->getPostId(),
2032  (int) $draft_obj->getNotify(),
2033  $this->handleFormInput($post_subject, false),
2034  $draft_obj->getPostUserAlias(),
2035  '',
2036  $status,
2037  $send_activation_mail
2038  );
2039 
2040  $this->object->markPostRead($this->user->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
2041 
2042  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
2043 
2044  foreach ($uploadedObjects as $mob) {
2045  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
2046  ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
2047  }
2048  ilForumUtil::saveMediaObjects($post_message, 'frm:html', $newPost, $mob_direction);
2049 
2050  if ($this->objProperties->isFileUploadAllowed()) {
2051  $file = $_FILES['userfile'];
2052  if (is_array($file) && !empty($file)) {
2053  $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost);
2054  $tmp_file_obj->storeUploadedFile($file);
2055  }
2056 
2057  //move files of draft to posts directory
2058  $oFDForum = new ilFileDataForum($this->object->getId(), $newPost);
2059  $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_obj->getDraftId());
2060 
2061  $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
2062  $oFDForumDrafts->delete();
2063  }
2064 
2066  $GLOBALS['ilAppEventHandler']->raise(
2067  'Modules/Forum',
2068  'publishedDraft',
2069  array('draftObj' => $draft_obj,
2070  'obj_id' => $this->object->getId(),
2071  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
2072  );
2073  }
2074  $draft_obj->deleteDraft();
2075 
2076  $GLOBALS['ilAppEventHandler']->raise(
2077  'Modules/Forum',
2078  'createdPost',
2079  array(
2080  'ref_id' => $this->object->getRefId(),
2081  'post' => new ilForumPost($newPost),
2082  'notify_moderators' => (bool) $send_activation_mail
2083  )
2084  );
2085 
2086  $message = '';
2087  if (!$this->is_moderator && !$status) {
2088  $message .= $this->lng->txt('forums_post_needs_to_be_activated');
2089  } else {
2090  $message .= $this->lng->txt('forums_post_new_entry');
2091  }
2092 
2093  $_SESSION['frm'][(int) $_GET['thr_pk']]['openTreeNodes'][] = (int) $this->objCurrentPost->getId();
2094 
2095  $this->ctrl->clearParameters($this);
2096  ilUtil::sendSuccess($message, true);
2097  $this->ctrl->setParameter($this, 'pos_pk', $newPost);
2098  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
2099 
2100  $this->ctrl->redirect($this, 'viewThread');
2101  }
2102  }
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
catch(Exception $e) $message
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)
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ publishSelectedDraftObject()

ilObjForumGUI::publishSelectedDraftObject ( )

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

References $_GET, and publishDraftObject().

1953  {
1954  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
1955  $this->publishDraftObject(false);
1956  }
1957  }
$_GET["client_id"]
publishDraftObject($use_replyform=true)
+ Here is the call graph for this function:

◆ publishThreadDraftObject()

ilObjForumGUI::publishThreadDraftObject ( )
protected

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

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

3385  {
3387  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3388  }
3389 
3390  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
3391  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
3392 
3393  if ((int) $draft->getDraftId() <= 0) {
3394  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3395  }
3396 
3397  $this->createThread($draft, true);
3398  }
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 2378 of file class.ilObjForumGUI.php.

References $_POST, $html, ilRTE\_replaceMediaObjectImageSrc(), ensureThreadBelongsToForum(), exit, getForumObjects(), and getReplyEditForm().

2379  {
2380  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2381  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2382  }
2383 
2384  if (!is_array($_POST['del_file'])) {
2385  $_POST['del_file'] = array();
2386  }
2387 
2388  if ($this->objCurrentTopic->isClosed()) {
2389  $this->requestAction = '';
2390  return $this->viewThreadObject();
2391  }
2392 
2393  $oReplyEditForm = $this->getReplyEditForm();
2394 
2395  // remove mandatory fields
2396  $oReplyEditForm->getItemByPostVar('subject')->setRequired(false);
2397  $oReplyEditForm->getItemByPostVar('message')->setRequired(false);
2398 
2399  $oReplyEditForm->checkInput();
2400 
2401  // add mandatory fields
2402  $oReplyEditForm->getItemByPostVar('subject')->setRequired(true);
2403  $oReplyEditForm->getItemByPostVar('message')->setRequired(true);
2404 
2405  $this->requestAction = 'showreply';
2406 
2407  $this->viewThreadObject();
2408  }
$_POST["username"]
+ Here is the call graph for this function:

◆ removeFromDeskObject()

ilObjForumGUI::removeFromDeskObject ( )

Remove from desktop public.

Implements ilDesktopItemHandling.

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

References ilDesktopItemGUI\removeFromDesktop(), settings(), and showThreadsObject().

3692  {
3693  if (!(int) $this->settings->get('disable_my_offers')) {
3695  \ilUtil::sendSuccess($this->lng->txt('removed_from_desktop'));
3696  }
3697 
3698  $this->showThreadsObject();
3699  }
settings()
Definition: settings.php:2
static removeFromDesktop()
Remove item from personal desktop public.
+ Here is the call graph for this function:

◆ renderDraftContent()

ilObjForumGUI::renderDraftContent ( string  $action,
bool  $render_drafts,
  $node,
  $edit_draft_id = null 
)
protected
Parameters
string$action
bool$render_drafts
$node
null$edit_draft_id
Returns
bool
Exceptions
ilSplitButtonException

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

References $_GET, $modal_history, ilForum\_isModerator(), ilRTE\_replaceMediaObjectImageSrc(), ilGlyphGUI\ATTACHMENT, ilGlyphGUI\get(), ilLinkButton\getInstance(), ilForumPostDraft\getInstancesByUserIdAndThreadId(), getReplyEditForm(), ilUtil\prepareFormOutput(), renderSplitButton(), and user().

Referenced by getForumObjects().

630  {
631  if (!$render_drafts) {
632  return false;
633  }
634 
635  $frm = $this->object->Forum;
636 
637  $draftsObjects = ilForumPostDraft::getInstancesByUserIdAndThreadId($this->user->getId(), $this->objCurrentTopic->getId());
638  $drafts = $draftsObjects[$node->getId()];
639 
640  if (is_array($drafts)) {
641  foreach ($drafts as $draft) {
642  if (!$draft instanceof ilForumPostDraft) {
643  continue 1;
644  }
645 
646  if (isset($edit_draft_id) && $edit_draft_id == $node->getId()) {
647  // do not render a draft that is in 'edit'-mode
648  return false;
649  }
650 
651  $tmp_file_obj = new ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
652  $filesOfDraft = $tmp_file_obj->getFilesOfPost();
653  ksort($filesOfDraft);
654 
655  if (count($filesOfDraft)) {
656  if ($action !== 'showdraft') {
657  foreach ($filesOfDraft as $file) {
658  $this->tpl->setCurrentBlock('attachment_download_row');
659  $this->ctrl->setParameter($this, 'draft_id', $tmp_file_obj->getDraftId());
660  $this->ctrl->setParameter($this, 'file', $file['md5']);
661  $this->tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread'));
662  $this->tpl->setVariable('TXT_FILENAME', $file['name']);
663  $this->ctrl->setParameter($this, 'file', '');
664  $this->ctrl->setParameter($this, 'draft_id', '');
665  $this->ctrl->clearParameters($this);
666  $this->tpl->parseCurrentBlock();
667  }
668 
669  $this->tpl->setCurrentBlock('attachments');
670  $this->tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt('forums_attachments'));
671  $this->tpl->setVariable('DOWNLOAD_IMG', ilGlyphGUI::get(ilGlyphGUI::ATTACHMENT, $this->lng->txt('forums_download_attachment')));
672  if (count($filesOfDraft) > 1) {
673  $download_zip_button = ilLinkButton::getInstance();
674  $download_zip_button->setCaption($this->lng->txt('download'), false);
675  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
676  $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 'deliverDraftZipFile'));
677  $this->ctrl->setParameter($this, 'draft_id', '');
678  $this->tpl->setVariable('DOWNLOAD_ZIP', $download_zip_button->render());
679  }
680  $this->tpl->parseCurrentBlock();
681  }
682  }
683 
684  // render splitButton for drafts
685  $this->renderSplitButton($action, false, $node, (int) $_GET['offset'], $draft);
686 
687  // highlight drafts
688  $rowCol = 'tblrowmarked';
689  // set row color
690  $this->tpl->setVariable('ROWCOL', ' ' . $rowCol);
691  $this->tpl->setVariable('DEPTH', (int) ($node->getDepth() - 1));
692 
693  // Author
694  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
695  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
696  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
697 
698  $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
699 
700  $this->ctrl->setParameter($this, 'backurl', $backurl);
701  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
702  $this->ctrl->setParameter($this, 'user', $draft->getPostDisplayUserId());
703 
704  $authorinfo = new ilForumAuthorInformation(
705  $draft->getPostAuthorId(),
706  $draft->getPostDisplayUserId(),
707  $draft->getPostUserAlias(),
708  '',
709  array(
710  'href' => $this->ctrl->getLinkTarget($this, 'showUser')
711  )
712  );
713 
714  $this->ctrl->clearParameters($this);
715 
716  if ($authorinfo->hasSuffix()) {
717  $this->tpl->setVariable('AUTHOR', $authorinfo->getSuffix());
718  $this->tpl->setVariable('USR_NAME', $draft->getPostUserAlias());
719  } else {
720  $this->tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName());
721  if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized()) {
722  $this->tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true));
723  }
724  }
725  $this->tpl->setVariable('DRAFT_ANCHOR', 'draft_' . $draft->getDraftId());
726 
727  $this->tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture());
728  $this->tpl->setVariable('USR_ICON_ALT', ilUtil::prepareFormOutput($authorinfo->getAuthorShortName()));
729  if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $draft->getPostAuthorId())) {
730  if ($authorinfo->getAuthor()->getGender() == 'f') {
731  $this->tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_f'));
732  } elseif ($authorinfo->getAuthor()->getGender() == 'm') {
733  $this->tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_m'));
734  } elseif ($authorinfo->getAuthor()->getGender() == 'n') {
735  $this->tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_n'));
736  }
737  }
738 
739  // get create- and update-dates
740  if ($draft->getUpdateUserId() > 0) {
741  $spanClass = 'small';
742 
743  if (ilForum::_isModerator($this->ref_id, $node->getUpdateUserId())) {
744  $spanClass = 'moderator_small';
745  }
746 
747  $draft->setPostUpdate($draft->getPostUpdate());
748 
749  $this->ctrl->setParameter($this, 'backurl', $backurl);
750  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
751  $this->ctrl->setParameter($this, 'user', $node->getUpdateUserId());
752  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
753 
754  $authorinfo = new ilForumAuthorInformation(
755  $draft->getPostAuthorId(),
756  $draft->getUpdateUserId(),
757  $draft->getPostUserAlias(),
758  '',
759  array(
760  'href' => $this->ctrl->getLinkTarget($this, 'showUser')
761  )
762  );
763 
764  $this->ctrl->clearParameters($this);
765 
766  $this->tpl->setVariable('POST_UPDATE_TXT', $this->lng->txt('edited_on') . ': ' . $frm->convertDate($draft->getPostUpdate()) . ' - ' . strtolower($this->lng->txt('by')));
767  $this->tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
768  if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
769  $this->tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true));
770  }
771  }
772  // Author end
773 
774  // prepare post
775  $draft->setPostMessage($frm->prepareText($draft->getPostMessage()));
776 
777  $this->tpl->setVariable('SUBJECT', $draft->getPostSubject());
778  $this->tpl->setVariable('POST_DATE', $frm->convertDate($draft->getPostDate()));
779 
780  if (!$node->isCensored() || ($this->objCurrentPost->getId() == $node->getId() && $action === 'censor')) {
781  $spanClass = "";
782 
783  if (ilForum::_isModerator($this->ref_id, $draft->getPostDisplayUserId())) {
784  $spanClass = 'moderator';
785  }
786 
787  if ($draft->getPostMessage() == strip_tags($draft->getPostMessage())) {
788  // We can be sure, that there are not html tags
789  $draft->setPostMessage(nl2br($draft->getPostMessage()));
790  }
791 
792  if ($spanClass != "") {
793  $this->tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($draft->getPostMessage(), 1) . "</span>");
794  } else {
795  $this->tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($draft->getPostMessage(), 1));
796  }
797  }
798 
799  if (!$this->objCurrentTopic->isClosed() && $action === 'deletedraft') {
800  if ($this->user->getId() != ANONYMOUS_USER_ID && $draft->getDraftId() == (int) $_GET['draft_id']) {
801  // confirmation: delete
802  $this->tpl->setVariable('FORM', $this->getDeleteDraftFormHTML());
803  }
804  } elseif ($action === 'editdraft' && (int) $draft->getDraftId() == (int) $_GET['draft_id']) {
805  $oEditReplyForm = $this->getReplyEditForm();
806  $this->tpl->setVariable('EDIT_DRAFT_ANCHOR', 'draft_edit_' . $draft->getDraftId());
807  $this->tpl->setVariable('DRAFT_FORM', $oEditReplyForm->getHTML() . $this->modal_history);
808  }
809 
810  $this->tpl->parseCurrentBlock();
811  }
812  return true;
813  }
814  return true;
815  }
Class ilForumPostDraft.
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
renderSplitButton(string $action, $is_post=true, ilForumPost $node, $Start=0, ilForumPostDraft $draft=null)
$action
$_GET["client_id"]
static getInstancesByUserIdAndThreadId($user_id, $thread_id)
static get($a_glyph, $a_text="")
Get glyph html.
This class handles all operations on files for the drafts of a forum object.
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderPostContent()

ilObjForumGUI::renderPostContent ( ilForumPost  $node,
string  $action,
  $Start,
  $z 
)
protected
Parameters
ilForumPost$node
string$action
$Start
$z
Returns
bool
Exceptions
ilSplitButtonException

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

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

Referenced by getForumObjects().

826  {
827  $forumObj = $this->object;
828  $frm = $this->object->Forum;
829 
830  // download post attachments
831  $tmp_file_obj = new ilFileDataForum($forumObj->getId(), $node->getId());
832 
833  $filesOfPost = $tmp_file_obj->getFilesOfPost();
834  ksort($filesOfPost);
835  if (count($filesOfPost)) {
836  if ($node->getId() != $this->objCurrentPost->getId() || $action !== 'showedit') {
837  foreach ($filesOfPost as $file) {
838  $this->tpl->setCurrentBlock('attachment_download_row');
839  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
840  $this->ctrl->setParameter($this, 'file', $file['md5']);
841  $this->tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread'));
842  $this->tpl->setVariable('TXT_FILENAME', $file['name']);
843  $this->ctrl->clearParameters($this);
844  $this->tpl->parseCurrentBlock();
845  }
846  $this->tpl->setCurrentBlock('attachments');
847  $this->tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $this->lng->txt('forums_attachments'));
848  $this->tpl->setVariable('DOWNLOAD_IMG', ilGlyphGUI::get(ilGlyphGUI::ATTACHMENT, $this->lng->txt('forums_download_attachment')));
849  if (count($filesOfPost) > 1) {
850  $download_zip_button = ilLinkButton::getInstance();
851  $download_zip_button->setCaption($this->lng->txt('download'), false);
852  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
853  $download_zip_button->setUrl($this->ctrl->getLinkTarget($this, 'deliverZipFile'));
854 
855  $this->tpl->setVariable('DOWNLOAD_ZIP', $download_zip_button->render());
856  }
857 
858  $this->tpl->parseCurrentBlock();
859  }
860  }
861  // render splitbutton for posts
862  $this->renderSplitButton($action, true, $node, $Start);
863 
864  // anker for every post
865  $this->tpl->setVariable('POST_ANKER', $node->getId());
866 
867  //permanent link for every post
868  $this->tpl->setVariable('TXT_PERMA_LINK', $this->lng->txt('perma_link'));
869  $this->tpl->setVariable('PERMA_TARGET', '_top');
870 
871  if (!$node->isActivated() && !$this->objCurrentTopic->isClosed() && $this->is_moderator) {
872  $rowCol = 'ilPostingNeedsActivation';
873  } elseif ($this->objProperties->getMarkModeratorPosts() == 1) {
874  if ($node->getIsAuthorModerator() === null && $is_moderator = ilForum::_isModerator($_GET['ref_id'], $node->getPosAuthorId())) {
875  $rowCol = 'ilModeratorPosting';
876  } elseif ($node->getIsAuthorModerator()) {
877  $rowCol = 'ilModeratorPosting';
878  } else {
879  $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2');
880  }
881  } else {
882  $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2');
883  }
884 
885  if (
886  (!in_array($action, ['delete', 'censor']) && !$this->displayConfirmPostActivation()) ||
887  $this->objCurrentPost->getId() != $node->getId()
888  ) {
889  $this->tpl->setVariable('ROWCOL', ' ' . $rowCol);
890  } else {
891  // highlight censored posts
892  $rowCol = 'tblrowmarked';
893  }
894 
895  // post is censored
896  if ($node->isCensored()) {
897  // display censorship advice
898  if ($action !== 'censor') {
899  $this->tpl->setVariable('TXT_CENSORSHIP_ADVICE', $this->lng->txt('post_censored_comment_by_moderator'));
900  }
901 
902  // highlight censored posts
903  $rowCol = 'tblrowmarked';
904  }
905 
906  // set row color
907  $this->tpl->setVariable('ROWCOL', ' ' . $rowCol);
908  $this->tpl->setVariable('DEPTH', (int) ($node->getDepth() - 1));
909  // if post is not activated display message for the owner
910  if (!$node->isActivated() && $node->isOwner($this->user->getId())) {
911  $this->tpl->setVariable('POST_NOT_ACTIVATED_YET', $this->lng->txt('frm_post_not_activated_yet'));
912  }
913 
914  // Author
915  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
916  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
917  $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $node->getId()));
918  $this->ctrl->clearParameters($this);
919 
920  $this->ctrl->setParameter($this, 'backurl', $backurl);
921  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
922  $this->ctrl->setParameter($this, 'user', $node->getDisplayUserId());
923 
924  $authorinfo = new ilForumAuthorInformation(
925  $node->getPosAuthorId(),
926  $node->getDisplayUserId(),
927  $node->getUserAlias(),
928  $node->getImportName(),
929  array(
930  'href' => $this->ctrl->getLinkTarget($this, 'showUser')
931  )
932  );
933 
934  $this->ctrl->clearParameters($this);
935 
936  if ($authorinfo->hasSuffix()) {
937  $this->tpl->setVariable('AUTHOR', $authorinfo->getSuffix());
938  if (!$authorinfo->isDeleted()) {
939  $this->tpl->setVariable('USR_NAME', $authorinfo->getAlias());
940  }
941  } else {
942  $this->tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName());
943  if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized()) {
944  $this->tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true));
945  }
946  }
947 
948  $this->tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture());
949  $this->tpl->setVariable('USR_ICON_ALT', ilUtil::prepareFormOutput($authorinfo->getAuthorShortName()));
950  if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $node->getPosAuthorId())) {
951  if ($authorinfo->getAuthor()->getGender() == 'f') {
952  $this->tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_f'));
953  } elseif ($authorinfo->getAuthor()->getGender() == 'm') {
954  $this->tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_m'));
955  }
956  }
957 
958  // get create- and update-dates
959  if ($node->getUpdateUserId() > 0) {
960  $spanClass = 'small';
961 
962  if (ilForum::_isModerator($this->ref_id, $node->getUpdateUserId())) {
963  $spanClass = 'moderator_small';
964  }
965 
966  $node->setChangeDate($node->getChangeDate());
967 
968  $this->ctrl->setParameter($this, 'backurl', $backurl);
969  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
970  $this->ctrl->setParameter($this, 'user', $node->getUpdateUserId());
971 
972  $update_user_id = $node->getUpdateUserId();
973  if ($node->getPosAuthorId() == $node->getUpdateUserId()
974  && $node->getDisplayUserId() == 0) {
975  $update_user_id = $node->getDisplayUserId();
976  }
977 
978  $authorinfo = new ilForumAuthorInformation(
979  $node->getPosAuthorId(),
980  $update_user_id,
981  $node->getUserAlias(),
982  $node->getImportName(),
983  array(
984  'href' => $this->ctrl->getLinkTarget($this, 'showUser')
985  )
986  );
987 
988  $this->ctrl->clearParameters($this);
989 
990  $this->tpl->setVariable('POST_UPDATE_TXT', $this->lng->txt('edited_on') . ': ' . $frm->convertDate($node->getChangeDate()) . ' - ' . strtolower($this->lng->txt('by')));
991  $this->tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
992  if ($authorinfo->getAuthorName(true) && !$this->objProperties->isAnonymized() && !$authorinfo->hasSuffix()) {
993  $this->tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true));
994  }
995  } // if ($node->getUpdateUserId() > 0)*/
996  // Author end
997 
998  // prepare post
999  $node->setMessage($frm->prepareText($node->getMessage()));
1000 
1001  if ($this->user->getId() == ANONYMOUS_USER_ID ||
1002  $node->isPostRead()
1003  ) {
1004  $this->tpl->setVariable('SUBJECT', $node->getSubject());
1005  } else {
1006  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
1007  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
1008  $this->ctrl->setParameter($this, 'offset', $Start);
1009  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
1010  $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
1011  $mark_post_target = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId());
1012 
1013  $this->tpl->setVariable('SUBJECT', "<a href=\"" . $mark_post_target . "\"><b>" . $node->getSubject() . "</b></a>");
1014  }
1015 
1016  $this->tpl->setVariable('POST_DATE', $frm->convertDate($node->getCreateDate()));
1017 
1018  if (!$node->isCensored() ||
1019  ($this->objCurrentPost->getId() == $node->getId() && $action === 'censor')
1020  ) {
1021  $spanClass = "";
1022  if (ilForum::_isModerator($this->ref_id, $node->getDisplayUserId())) {
1023  $spanClass = 'moderator';
1024  }
1025  // possible bugfix for mantis #8223
1026  if ($node->getMessage() == strip_tags($node->getMessage())) {
1027  // We can be sure, that there are not html tags
1028  $node->setMessage(nl2br($node->getMessage()));
1029  }
1030 
1031  if ($spanClass != "") {
1032  $this->tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1) . "</span>");
1033  } else {
1034  $this->tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1));
1035  }
1036  } else {
1037  $this->tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($node->getCensorshipComment()) . "</span>");
1038  }
1039 
1040  $this->tpl->parseCurrentBlock();
1041  return true;
1042  }
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
renderSplitButton(string $action, $is_post=true, ilForumPost $node, $Start=0, ilForumPostDraft $draft=null)
$_SESSION["AccountId"]
$action
$_GET["client_id"]
isOwner($a_user_id=0)
static get($a_glyph, $a_text="")
Get glyph html.
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
setMessage($a_message)
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
This class handles all operations on files for the forum object.
setChangeDate($a_changedate)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSplitButton()

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

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

References $_GET, $_SESSION, ilObjectGUI\$actions, $i, $is_moderator, $url, displayConfirmPostActivation(), ilForumPost\getForumId(), ilForumPost\getId(), ilLinkButton\getInstance(), ilSplitButtonGUI\getInstance(), ilForumPostDraft\getInstancesByUserIdAndThreadId(), ilForumPost\getThreadId(), ilForumPost\hasReplies(), ilForumPost\isActivated(), ilForumPost\isCensored(), ilForumPost\isOwner(), ilForumPost\isPostRead(), and user().

Referenced by renderDraftContent(), and renderPostContent().

4557  {
4558  $actions = array();
4559  if ($is_post) {
4560  if ($this->objCurrentPost->getId() != $node->getId() || (
4561  !in_array($action, ['showreply', 'showedit', 'censor', 'delete']) && !$this->displayConfirmPostActivation()
4562  )) {
4563  if ($this->is_moderator || $node->isActivated() || $node->isOwner($this->user->getId())) {
4564  // button: reply
4565  if (!$this->objCurrentTopic->isClosed() && $node->isActivated() &&
4566  $this->access->checkAccess('add_reply', '', (int) $_GET['ref_id']) &&
4567  !$node->isCensored()
4568  ) {
4569  $this->ctrl->setParameter($this, 'action', 'showreply');
4570  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4571  $this->ctrl->setParameter($this, 'offset', $Start);
4572  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4573  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
4574 
4575  if (!isset($draftsObjects[$node->getId()])) {
4576  $actions['reply_to_postings'] = $this->ctrl->getLinkTarget(
4577  $this, 'viewThread',
4578  'reply_' . $node->getId()
4579  );
4580  }
4581 
4582  $this->ctrl->clearParameters($this);
4583  }
4584 
4585  // button: edit article
4586  if (!$this->objCurrentTopic->isClosed() &&
4587  ($node->isOwner($this->user->getId()) || $this->is_moderator) &&
4588  !$node->isCensored() &&
4589  $this->user->getId() != ANONYMOUS_USER_ID
4590  ) {
4591  $this->ctrl->setParameter($this, 'action', 'showedit');
4592  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4593  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
4594  $this->ctrl->setParameter($this, 'offset', $Start);
4595  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4596 
4597  $actions['edit'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
4598 
4599  $this->ctrl->clearParameters($this);
4600  }
4601 
4602  // button: mark read
4603  if ($this->user->getId() != ANONYMOUS_USER_ID && !$node->isPostRead()) {
4604  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4605  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
4606  $this->ctrl->setParameter($this, 'offset', $Start);
4607  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4608  $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
4609 
4610  $actions['frm_mark_as_read'] = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId());
4611 
4612  $this->ctrl->clearParameters($this);
4613  }
4614 
4615  // button: mark unread
4616  if ($this->user->getId() != ANONYMOUS_USER_ID &&
4617  $node->isPostRead()
4618  ) {
4619  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4620  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
4621  $this->ctrl->setParameter($this, 'offset', $Start);
4622  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4623  $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
4624 
4625  $actions['frm_mark_as_unread'] = $this->ctrl->getLinkTarget($this, 'markPostUnread', $node->getId());
4626 
4627  $this->ctrl->clearParameters($this);
4628  }
4629 
4630  // button: print
4631  if (!$node->isCensored()) {
4632  $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId());
4633  $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId());
4634  $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId());
4635 
4636  $actions['print'] = $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost');
4637 
4638  $this->ctrl->clearParameters($this);
4639  }
4640 
4641  # buttons for every post except the "active"
4642  if (!$this->objCurrentTopic->isClosed() &&
4643  ($this->is_moderator ||
4644  ($node->isOwner($this->user->getId()) && !$node->hasReplies())) &&
4645  $this->user->getId() != ANONYMOUS_USER_ID
4646  ) {
4647  // button: delete
4648  $this->ctrl->setParameter($this, 'action', 'delete');
4649  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4650  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
4651  $this->ctrl->setParameter($this, 'offset', $Start);
4652  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4653 
4654  $actions['delete'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
4655 
4656  $this->ctrl->clearParameters($this);
4657  }
4658 
4659  if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
4660  // button: censor
4661  $this->ctrl->setParameter($this, 'action', 'censor');
4662  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4663  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
4664  $this->ctrl->setParameter($this, 'offset', $Start);
4665  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4666  if ($node->isCensored()) {
4667  $actions['frm_revoke_censorship'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
4668  } else {
4669  $actions['frm_censorship'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
4670  }
4671 
4672  $this->ctrl->clearParameters($this);
4673 
4674  // button: activation/deactivation
4675  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4676  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
4677  $this->ctrl->setParameter($this, 'offset', $Start);
4678  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4679 
4680  if (!$node->isActivated()) {
4681  $actions['activate_post'] = $this->ctrl->getLinkTarget($this, 'askForPostActivation', $node->getId());
4682  }
4683 
4684  $this->ctrl->clearParameters($this);
4685  }
4686  }
4687  }
4688  } else {
4689  if (!isset($draft)) {
4690  $draftsObjects = ilForumPostDraft::getInstancesByUserIdAndThreadId($this->user->getId(), $this->objCurrentTopic->getId());
4691  $draft = $draftsObjects[$node->getId()];
4692  }
4693  // get actions for drafts
4694  $this->ctrl->setParameter($this, 'action', 'publishdraft');
4695  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4696  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
4697  $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
4698  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
4699  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4700  $actions['publish'] = $this->ctrl->getLinkTarget($this, 'publishSelectedDraft', $node->getId());
4701  $this->ctrl->clearParameters($this);
4702 
4703  $this->ctrl->setParameter($this, 'action', 'editdraft');
4704  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4705  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
4706  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
4707  $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
4708  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4709  $actions['edit'] = $this->ctrl->getLinkTarget($this, 'editDraft', 'draft_edit_' . $draft->getDraftId());
4710  $this->ctrl->clearParameters($this);
4711 
4712  $this->ctrl->setParameter($this, 'action', 'deletedraft');
4713  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
4714  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
4715  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
4716  $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
4717  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
4718  $actions['delete'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
4719  $this->ctrl->clearParameters($this);
4720 
4721  if (isset($_GET['draft_id']) && $action === 'editdraft') {
4722  $actions = array();
4723  }
4724  }
4725 
4726  $this->tpl->setCurrentBlock('posts_row');
4727  if (count($actions) > 0) {
4728  $action_button = ilSplitButtonGUI::getInstance();
4729 
4730  $i = 0;
4731  foreach ($actions as $lng_id => $url) {
4732  if ($i == 0) {
4733  $sb_item = ilLinkButton::getInstance();
4734  $sb_item->setCaption($lng_id);
4735  $sb_item->setUrl($url);
4736 
4737  $action_button->setDefaultButton($sb_item);
4738  ++$i;
4739  } else {
4740  $sb_item = ilLinkButton::getInstance();
4741  $sb_item->setCaption($lng_id);
4742  $sb_item->setUrl($url);
4743 
4744  $action_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($sb_item));
4745  }
4746  }
4747 
4748  if ($is_post) {
4749  $this->tpl->setVariable('COMMANDS', $action_button->render());
4750  } elseif (!in_array($action, ['deletedraft', 'editdraft']) && !$this->objCurrentTopic->isClosed()) {
4751  $this->tpl->setVariable('COMMANDS', $action_button->render());
4752  }
4753  }
4754  }
$_SESSION["AccountId"]
$action
$_GET["client_id"]
isOwner($a_user_id=0)
static getInstancesByUserIdAndThreadId($user_id, $thread_id)
user()
Definition: user.php:4
$i
Definition: disco.tpl.php:19
$url
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restoreFromHistoryObject()

ilObjForumGUI::restoreFromHistoryObject ( )
protected

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

References ilForumPostDraft\createDraftBackup().

3999  {
4000  $historyId = (int) ($this->httpRequest->getQueryParams()['history_id'] ?? 0);
4001  $history = new \ilForumDraftsHistory($historyId);
4002 
4003  $draft = $history->rollbackAutosave();
4004  if ($draft->getThreadId() == 0 && $draft->getPostId() == 0) {
4005  $this->ctrl->setParameter($this, 'draft_id', $history->getDraftId());
4006  $this->ctrl->redirect($this, 'editThreadDraft');
4007  }
4008 
4009  $this->ctrl->clearParameters($this);
4010  $this->ctrl->setParameter($this, 'pos_pk', $draft->getPostId());
4011  $this->ctrl->setParameter($this, 'thr_pk', $draft->getThreadId());
4012  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
4013  $this->ctrl->setParameter($this, 'action', 'editdraft');
4014 
4015  // create draft backup before redirect!
4016  \ilForumPostDraft::createDraftBackup((int) $draft->getDraftId());
4017 
4018  $this->ctrl->redirect($this, 'viewThread');
4019  }
static createDraftBackup($draft_id)
+ Here is the call graph for this function:

◆ revokeCensorshipObject()

ilObjForumGUI::revokeCensorshipObject ( )
private

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

1438  {
1439  $this->handleCensorship(true);
1440  }

◆ saveThreadAsDraftObject()

ilObjForumGUI::saveThreadAsDraftObject ( )
protected

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

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

4022  {
4023  if (
4024  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4025  !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4027  ) {
4028  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4029  }
4030 
4031  $autoSavedDraftId = (int) ($this->httpRequest->getParsedBody()['draft_id'] ?? 0);
4032  if ($autoSavedDraftId <= 0) {
4033  $autoSavedDraftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4034  }
4035 
4036  $frm = $this->object->Forum;
4037  $frm->setForumId($this->object->getId());
4038  $frm->setForumRefId($this->object->getRefId());
4039  $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4040  $topicData = $frm->getOneTopic();
4041 
4042  $form = $this->buildThreadForm();
4043  if ($form->checkInput()) {
4044  $this->doCaptchaCheck();
4045 
4046  if (0 === $autoSavedDraftId) {
4047  $draft = new \ilForumPostDraft();
4048  } else {
4049  $draft = \ilForumPostDraft::newInstanceByDraftId($autoSavedDraftId);
4050  }
4051 
4052  $draft->setForumId($topicData['top_pk']);
4053  $draft->setThreadId(0);
4054  $draft->setPostId(0);
4055  $draft->setPostSubject($this->handleFormInput($form->getInput('subject'), false));
4056  $draft->setPostMessage(\ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0));
4057  $userAlias = \ilForumUtil::getPublicUserAlias($form->getInput('alias'), $this->objProperties->isAnonymized());
4058  $draft->setPostUserAlias($userAlias);
4059  $draft->setNotify((int) $form->getInput('notify'));
4060  $draft->setPostAuthorId($this->user->getId());
4061  $draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
4062 
4063  if (0 === $autoSavedDraftId) {
4064  $draftId = $draft->saveDraft();
4065  } else {
4066  $draft->updateDraft();
4067  $draftId = $draft->getDraftId();
4068  }
4069 
4070  $GLOBALS['ilAppEventHandler']->raise(
4071  'Modules/Forum',
4072  'savedAsDraft',
4073  [
4074  'draftObj' => $draft,
4075  'obj_id' => $this->object->getId(),
4076  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4077  ]
4078  );
4079 
4080  \ilForumUtil::moveMediaObjects($form->getInput('message'), 'frm~d:html', $draftId, 'frm~d:html', $draftId);
4081 
4082  $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draftId);
4083 
4084  $files2delete = $form->getInput('del_file');
4085  if (is_array($files2delete) && count($files2delete) > 0) {
4086  $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4087  }
4088 
4089  if ($this->objProperties->isFileUploadAllowed()) {
4090  $file = $_FILES['userfile'];
4091  if (is_array($file) && !empty($file)) {
4092  $draftFileData->storeUploadedFile($file);
4093  }
4094  }
4095 
4096  \ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4097  $this->ctrl->clearParameters($this);
4098  $this->ctrl->redirect($this, 'showThreads');
4099  }
4100 
4101  $this->requestAction = substr($this->requestAction, 6); // @nmatuschek: Why this, I don't get it???
4102  $form->setValuesByPost();
4103  $this->ctrl->setParameter($this, 'draft_id', $autoSavedDraftId);
4104  $this->tpl->setContent($form->getHTML());
4105  }
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(isset($_POST['submit'])) $form
static newInstanceByDraftId($draft_id)
handleFormInput($a_text, $a_stripslashes=true)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ saveThreadSortingObject()

ilObjForumGUI::saveThreadSortingObject ( )
protected

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

References ensureThreadBelongsToForum().

3702  {
3703  if (!$this->is_moderator) {
3704  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3705  }
3706 
3707  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3708  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3709  }
3710 
3711  $threadIdToSortValueMap = (array) ($this->httpRequest->getParsedBody()['thread_sorting'] ?? []);
3712 
3713  array_walk($threadIdToSortValueMap, function ($sortValue, $threadId) {
3714  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic($threadId));
3715  });
3716 
3717  foreach ($threadIdToSortValueMap as $threadId => $sortValue) {
3718  $sortValue = str_replace(',', '.', $sortValue);
3719  $sortValue = (float) $sortValue * 100;
3720  $this->object->setThreadSorting((int) $threadId, $sortValue);
3721  }
3722 
3723  \ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
3724  $this->ctrl->redirect($this, 'showThreads');
3725  }
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ saveTopLevelPostObject()

ilObjForumGUI::saveTopLevelPostObject ( )

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

1947  {
1948  $this->savePostObject();
1949  return;
1950  }

◆ setColumnSettings()

ilObjForumGUI::setColumnSettings ( ilColumnGUI  $column_gui)
protected

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

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

3457  {
3458  $column_gui->setBlockProperty('news', 'title', $this->lng->txt('frm_latest_postings'));
3459  $column_gui->setBlockProperty('news', 'prevent_aggregation', true);
3460  $column_gui->setRepositoryMode(true);
3461 
3462  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
3463  $news_set = new \ilSetting('news');
3464  if ($news_set->get('enable_rss_for_internal')) {
3465  $column_gui->setBlockProperty('news', 'settings', true);
3466  $column_gui->setBlockProperty('news', 'public_notifications_option', true);
3467  }
3468  }
3469  }
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 1487 of file class.ilObjForumGUI.php.

Referenced by askForPostActivationObject().

1488  {
1489  $this->display_confirm_post_activation = $status;
1490  }
+ Here is the caller graph for this function:

◆ setSideBlocks()

ilObjForumGUI::setSideBlocks ( )
protected

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

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

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

3906  {
3907  $content = $this->getRightColumnHTML();
3908  if (!$this->ctrl->isAsynch()) {
3909  $content = implode('', [
3910  \ilRepositoryObjectSearchGUI::getSearchBlockHTML($this->lng->txt('frm_search')),
3911  $content,
3912  ]);
3913  }
3914  $this->tpl->setRightContent($content);
3915  }
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 1108 of file class.ilObjForumGUI.php.

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

1109  {
1111  if (!$this->settings->get('enable_fora_statistics', false)) {
1112  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1113  }
1114 
1115  // if no read access -> intrusion detected
1116  if (!$this->access->checkAccess('read', '', (int) $_GET['ref_id'])) {
1117  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1118  }
1119 
1120  // if read access and statistics disabled -> intrusion detected
1121  if (!$this->objProperties->isStatisticEnabled()) {
1122  // if write access and statistics disabled -> ok, for forum admin
1123  if ($this->access->checkAccess('write', '', (int) $_GET['ref_id'])) {
1124  ilUtil::sendInfo($this->lng->txt('frm_statistics_disabled_for_participants'));
1125  } else {
1126  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1127  }
1128  }
1129 
1130  $this->object->Forum->setForumId($this->object->getId());
1131 
1132  $tbl = new ilForumStatisticsTableGUI($this, 'showStatistics');
1133  $tbl->setId('il_frm_statistic_table_' . (int) (int) $_GET['ref_id']);
1134  $tbl->setTitle($this->lng->txt('statistic'), 'icon_usr.svg', $this->lng->txt('obj_' . $this->object->getType()));
1135 
1136  $data = $this->object->Forum->getUserStatistic($this->is_moderator);
1137  $result = array();
1138  $counter = 0;
1139  foreach ($data as $row) {
1140  $result[$counter]['ranking'] = $row[0];
1141  $result[$counter]['login'] = $row[1];
1142  $result[$counter]['lastname'] = $row[2];
1143  $result[$counter]['firstname'] = $row[3];
1144 
1145  ++$counter;
1146  }
1147  $tbl->setData($result);
1148 
1149  $this->tpl->setContent($tbl->getHTML());
1150  }
Class ilForumStatisticsTableGUI.
settings()
Definition: settings.php:2
$result
$_GET["client_id"]
$tbl
Definition: example_048.php:81
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$row
+ Here is the call graph for this function:

◆ showThreadsObject()

ilObjForumGUI::showThreadsObject ( )

◆ showUserObject()

ilObjForumGUI::showUserObject ( )

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

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

2878  {
2879  $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
2880  $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
2881  $profile_gui->setAdditional($add);
2882  $profile_gui->setBackUrl(\ilUtil::stripSlashes($_GET['backurl']));
2883  $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
2884  }
$_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 522 of file class.ilObjForumGUI.php.

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

523  {
524  $this->getSubTabs('sortThreads');
525  $this->setSideBlocks();
526  $this->getCenterColumnHTML();
527  }
getSubTabs($subtab='showThreads')
getCenterColumnHTML()
Get center column.
+ Here is the call graph for this function:

◆ toggleStickinessObject()

ilObjForumGUI::toggleStickinessObject ( )
protected

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

References $objCurrentTopic, and ensureThreadBelongsToForum().

1517  {
1518  if (!$this->is_moderator) {
1519  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1520  }
1521 
1522  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1523  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1524  }
1525 
1526  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1527 
1528  if ($this->objCurrentTopic->isSticky()) {
1529  $this->objCurrentTopic->unmakeSticky();
1530  } else {
1531  $this->objCurrentTopic->makeSticky();
1532  }
1533 
1534  $this->viewThreadObject();
1535  }
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
+ Here is the call graph for this function:

◆ toggleThreadNotificationObject()

ilObjForumGUI::toggleThreadNotificationObject ( )
protected

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

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

1498  {
1499  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1500  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1501  }
1502 
1503  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1504 
1505  if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
1506  $this->objCurrentTopic->disableNotification($this->user->getId());
1507  \ilUtil::sendInfo($this->lng->txt('forums_notification_disabled'));
1508  } else {
1509  $this->objCurrentTopic->enableNotification($this->user->getId());
1510  \ilUtil::sendInfo($this->lng->txt('forums_notification_enabled'));
1511  }
1512 
1513  $this->viewThreadObject();
1514  }
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 414 of file class.ilObjForumGUI.php.

415  {
416  $this->forum_settings_gui->updateCustomValues($a_form);
417  }

◆ updateThreadDraftObject()

ilObjForumGUI::updateThreadDraftObject ( )
protected

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

References $_GET, $_POST, $_SESSION, $form, $GLOBALS, ilRTE\_replaceMediaObjectImageSrc(), buildThreadForm(), doCaptchaCheck(), editThreadDraftObject(), getForumObjects(), ilForumUtil\getPublicUserAlias(), getReplyEditForm(), handleFormInput(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumUtil\moveMediaObjects(), ilForumPostDraft\newInstanceByDraftId(), ilUtil\sendFailure(), ilFileDataForumDrafts\storeUploadedFile(), and user().

4108  {
4109  if (
4110  !$this->access->checkAccess('add_thread', '', $this->object->getRefId()) ||
4111  !$this->access->checkAccess('read', '', $this->object->getRefId()) ||
4113  ) {
4114  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4115  }
4116 
4117  $draftId = (int) ($this->httpRequest->getQueryParams()['draft_id'] ?? 0);
4118  if ($draftId <= 0) {
4119  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4120  }
4121 
4122  $form = $this->buildThreadForm(true);
4123  if ($form->checkInput()) {
4124  $this->doCaptchaCheck();
4125 
4126  $userAlias = \ilForumUtil::getPublicUserAlias($form->getInput('alias'), $this->objProperties->isAnonymized());
4127 
4128  $draft = \ilForumPostDraft::newInstanceByDraftId($draftId);
4129  $draft->setPostSubject($this->handleFormInput($form->getInput('subject'), false));
4130  $draft->setPostMessage(\ilRTE::_replaceMediaObjectImageSrc($form->getInput('message'), 0));
4131  $draft->setPostUserAlias($userAlias);
4132  $draft->setNotify((int) $form->getInput('notify'));
4133  $draft->setPostAuthorId($this->user->getId());
4134  $draft->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
4135  $draft->updateDraft();
4136 
4137  $GLOBALS['ilAppEventHandler']->raise(
4138  'Modules/Forum',
4139  'updatedDraft',
4140  [
4141  'draftObj' => $draft,
4142  'obj_id' => $this->object->getId(),
4143  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed(),
4144  ]
4145  );
4146 
4148  $form->getInput('message'),
4149  'frm~d:html',
4150  $draft->getDraftId(),
4151  'frm~d:html',
4152  $draft->getDraftId()
4153  );
4154 
4155  $draftFileData = new \ilFileDataForumDrafts($this->object->getId(), $draft->getDraftId());
4156 
4157  $files2delete = $form->getInput('del_file');
4158  if (is_array($files2delete) && count($files2delete) > 0) {
4159  $draftFileData->unlinkFilesByMD5Filenames($files2delete);
4160  }
4161 
4162  if ($this->objProperties->isFileUploadAllowed()) {
4163  $file = $_FILES['userfile'];
4164  if (is_array($file) && !empty($file)) {
4165  $draftFileData->storeUploadedFile($file);
4166  }
4167  }
4168 
4169  \ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4170  $this->ctrl->clearParameters($this);
4171  $this->ctrl->redirect($this, 'showThreads');
4172  }
4173 
4174  $form->setValuesByPost();
4175  $this->ctrl->setParameter($this, 'hist_check', 0);
4176  $this->ctrl->setParameter($this, 'draft_id', $draftId);
4177  $this->editThreadDraftObject($form);
4178  }
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(isset($_POST['submit'])) $form
static newInstanceByDraftId($draft_id)
handleFormInput($a_text, $a_stripslashes=true)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

◆ updateThreadObject()

ilObjForumGUI::updateThreadObject ( )

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

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

474  {
475  if (!$this->is_moderator) {
476  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
477  }
478 
479  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
480  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
481  }
482 
483  if (!$this->objCurrentTopic->getId()) {
484  $this->showThreadsObject();
485  return;
486  }
487 
488  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
489 
490  $form = $this->getThreadEditingForm($this->objCurrentTopic->getId());
491  if (!$form->checkInput()) {
492  $form->setValuesByPost();
493  $this->editThreadObject($this->objCurrentTopic->getId(), $form);
494  return;
495  }
496 
497  $this->objCurrentTopic->setSubject($form->getInput('title'));
498  $this->objCurrentTopic->updateThreadTitle();
499 
500  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
501  $this->showThreadsObject();
502  }
if(isset($_POST['submit'])) $form
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 73 of file class.ilObjForumGUI.php.

◆ $confirmation_gui_html

ilObjForumGUI::$confirmation_gui_html = ''
private

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

◆ $create_form_gui

ilObjForumGUI::$create_form_gui
private

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

◆ $display_confirm_post_activation

ilObjForumGUI::$display_confirm_post_activation = 0
private

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

Referenced by displayConfirmPostActivation().

◆ $error

ilObjForumGUI::$error

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

◆ $forum_settings_gui

ilObjForumGUI::$forum_settings_gui
private

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

Referenced by executeCommand().

◆ $forumObjects

ilObjForumGUI::$forumObjects = null
private

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

Referenced by getForumObjects().

◆ $hideToolbar

ilObjForumGUI::$hideToolbar = false
private

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

Referenced by hideToolbar().

◆ $httpRequest

ilObjForumGUI::$httpRequest
private

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

◆ $ilHelp

ilObjForumGUI::$ilHelp

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

◆ $ilNavigationHistory

ilObjForumGUI::$ilNavigationHistory

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

◆ $ilObjDataCache

ilObjForumGUI::$ilObjDataCache

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

◆ $is_moderator

ilObjForumGUI::$is_moderator = false
private

◆ $locator

ilObjForumGUI::$locator

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

◆ $modal_history

ilObjForumGUI::$modal_history = ''

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

Referenced by editThreadDraftObject(), and renderDraftContent().

◆ $objCurrentPost

ilObjForumGUI::$objCurrentPost
private

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

Referenced by performPostActivationObject(), and publishDraftObject().

◆ $objCurrentTopic

◆ $object

ilObjForumGUI::$object

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

Referenced by getForumObjects(), and renderPostContent().

◆ $objProperties

ilObjForumGUI::$objProperties

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

◆ $rbac

ilObjForumGUI::$rbac

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

◆ $replyEditForm

ilObjForumGUI::$replyEditForm
private

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

Referenced by getReplyEditForm().

◆ $repositoryTree

ilObjForumGUI::$repositoryTree

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

◆ $requestAction

ilObjForumGUI::$requestAction = ''
private

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

◆ $settings

ilObjForumGUI::$settings

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

◆ $tabs

ilObjForumGUI::$tabs

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

◆ $toolbar

ilObjForumGUI::$toolbar

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

Referenced by getForumObjects().

◆ $uiFactory

ilObjForumGUI::$uiFactory
private

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

◆ $uiRenderer

ilObjForumGUI::$uiRenderer
private

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

◆ $user

ilObjForumGUI::$user

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


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