ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjForumGUI Class Reference

Class ilObjForumGUI. More...

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

Public Member Functions

 ensureThreadBelongsToForum ($objId, \ilForumTopic $thread)
 
 updateThreadObject ()
 
 showThreadsObject ()
 
 sortThreadsObject ()
 
 getSubTabs ($subtab='showThreads')
 
 cancelObject ()
 cancel action and go back to previous page @access public More...
 
 showStatisticsObject ()
 
 performDeleteThreadsObject ()
 
 confirmDeleteThreads ()
 
 confirmDeleteThreadDraftsObject ()
 
 performPostActivationObject ()
 
 askForPostActivationObject ()
 
 setDisplayConfirmPostActivation ($status=0)
 
 displayConfirmPostActivation ()
 
 toggleStickinessObject ()
 
 cancelPostObject ()
 
 cancelDraftObject ()
 
 createTopLevelPostObject ()
 
 saveTopLevelPostObject ()
 
 quoteTopLevelPostObject ()
 
 publishSelectedDraftObject ()
 
 publishDraftObject ($use_replyform=true)
 
 quotePostObject ()
 
 showUserObject ()
 
 performMoveThreadsObject ()
 
 cancelMoveThreadsObject ()
 
 deleteThreadDraftsObject ()
 
 createThreadObject ()
 
 checkEnableColumnEdit ()
 
 cloneWizardPageObject ()
 
 handleFormInput ($a_text, $a_stripslashes=true)
 
 prepareFormOutput ($a_text)
 
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 getIcon ($user_toggle_noti)
 
 markPostUnreadObject ()
 
 markPostReadObject ()
 
 isUserAllowedToDeactivateNotification ()
 
 removeFromDeskObject ()
 
 saveThreadSortingObject ()
 
 mergeThreadsObject ()
 
 confirmMergeThreadsObject ()
 
 cancelMergeThreads ()
 
 deliverZipFileObject ()
 
 restoreFromHistoryObject ()
 
 editDraftObject ()
 
 autosaveDraftAsyncObject ()
 
 autosaveThreadDraftAsyncObject ()
 
 checkDraftAccess ($draft_id)
 
 doHistoryCheck ($draft_id)
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 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...
 
- Public Member Functions inherited from ilDesktopItemHandling
 addToDeskObject ()
 Add desktop item @access public. More...
 
 removeFromDeskObject ()
 Remove from desktop @access public. More...
 

Data Fields

 $modal_history = ''
 
 $objProperties
 
 $object
 
 $ilias
 
 $access
 
 $error
 
 $settings
 
 $user
 
 $ilObjDataCache
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $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 ()
 
 addAutosave (ilPropertyFormGUI $form)
 
 getEditFormCustomValues (Array &$a_values)
 
 afterSave (ilObject $forumObj)
 
 setSideBlocks ()
 {} More...
 
 deleteMobsOfDraft ($draft_id, $message)
 todo: move to ilForumUtil More...
 
 deleteSelectedDraft (ilForumPostDraft $draft_obj=null)
 
- Protected Member Functions inherited from ilObjectGUI
 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 @access public More...
 
 setAdminTabs ()
 set admin tabs @access public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 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...
 
 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

 isHierarchicalView ()
 
 isTopLevelReplyCommand ()
 
 getThreadEditingForm ($a_thread_id)
 
 initForumCreateForm ($object_type)
 
 getReplyEditForm ()
 
 hideToolbar ($a_flag=null)
 
 getForumObjects ()
 
 getModifiedReOnSubject ($on_reply=false)
 
 isWritingWithPseudonymAllowed ()
 
 setTopicCreateDefaultValues ()
 
 updateUserNotifications ($update_all_users=false)
 
 initNotificationSettingsForm ()
 
 getUserNotificationTableData ($user_ids, ilForumNotification $frm_noti)
 
 isParentObjectCrsOrGrp ()
 

Private Attributes

 $objCurrentTopic
 
 $objCurrentPost
 
 $display_confirm_post_activation = 0
 
 $is_moderator = false
 
 $create_form_gui
 
 $create_topic_form_gui
 
 $replyEditForm
 
 $notificationSettingsForm
 
 $hideToolbar = false
 
 $forum_overview_setting = null
 
 $forumObjects
 
 $confirmation_gui_html = ''
 

Additional Inherited Members

- 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...
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

Detailed Description

Member Function Documentation

◆ addAutosave()

ilObjForumGUI::addAutosave ( ilPropertyFormGUI  $form)
protected
Parameters
ilPropertyFormGUI$form

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

189 {
191 {
193
194 $this->tpl->addJavascript('./Modules/Forum/js/autosave.js');
195 $autosave_cmd = 'autosaveDraftAsync';
196 if($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0)
197 {
198 $autosave_cmd = 'autosaveThreadDraftAsync';
199 }
200 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
201 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
202 $draft_id = $_GET['draft_id'] > 0 ? $_GET['draft_id']: 0;
203 $this->ctrl->setParameter($this, 'draft_id', $draft_id );
204 $this->ctrl->setParameter($this, 'action', $_GET['action']);
205 $this->tpl->addOnLoadCode("il.Language.setLangVar('saving', " . json_encode($this->lng->txt('saving')) . ");");
206
207 $this->tpl->addOnLoadCode('il.ForumDraftsAutosave.init(' . json_encode(array(
208 'loading_img_src' => ilUtil::getImagePath('loader.svg'),
209 'draft_id' => $draft_id,
210 'interval' => $interval * 1000,
211 'url' => $this->ctrl->getFormAction($this, $autosave_cmd, '', true, false),
212 'selectors' => array(
213 'form' => '#form_' . $form->getId()
214 )
215 )) . ');');
216 }
217 }
$_GET["client_id"]
getId()
Get Id.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

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

+ Here is the call graph for this function:

◆ afterSave()

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

Reimplemented from ilObjectGUI.

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

1420 {
1421 ilUtil::sendSuccess($this->lng->txt('frm_added'), true);
1422 $this->ctrl->setParameter($this, 'ref_id', $forumObj->getRefId());
1423 ilUtil::redirect($this->ctrl->getLinkTarget($this, 'createThread', '', false, false));
1424 }
getRefId()
get reference id @access public
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
http redirect to other script

References ilObject\getRefId(), ilUtil\redirect(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ askForPostActivationObject()

ilObjForumGUI::askForPostActivationObject ( )

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

1843 {
1844 if (!$this->is_moderator) {
1845 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1846 }
1847
1848 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1849 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1850 }
1851
1853
1854 $this->viewThreadObject();
1855 }
error($a_errmsg)
set error message @access public
setDisplayConfirmPostActivation($status=0)

References error(), and setDisplayConfirmPostActivation().

+ Here is the call graph for this function:

◆ autosaveDraftAsyncObject()

ilObjForumGUI::autosaveDraftAsyncObject ( )

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

6474 {
6475 global $ilUser;
6476
6477 if($ilUser->isAnonymous() || $_GET['action'] == 'ready_showreply')
6478 {
6479 exit();
6480 }
6481
6482 $reponse = new stdClass();
6483 $reponse->draft_id = 0;
6484
6486 {
6487 $replyform = $this->getReplyEditForm();
6488 $current_post_id =$this->objCurrentPost->getId();
6489
6490 $replyform->checkInput();
6491
6492 $form_autosave_values['subject'] = $replyform->getInput('subject');
6493 $form_autosave_values['message'] = $replyform->getInput('message');
6494 $form_autosave_values['notify'] = $replyform->getInput('notify');
6495 $form_autosave_values['alias'] = $replyform->getInput('alias');
6496
6497 if(isset($_GET['draft_id']) && (int)$_GET['draft_id'] > 0)
6498 {
6499 $draft_id = (int)$_GET['draft_id'];
6500 }
6501 else
6502 {
6503 $draft_id = $replyform->getInput('draft_id');
6504 }
6505 $user_alias = ilForumUtil::getPublicUserAlias($form_autosave_values['alias'], $this->objProperties->isAnonymized());
6506
6507 if((int)$draft_id > 0)
6508 {
6509 if($_GET['action'] == 'showreply')
6510 {
6511 $draftObj = ilForumPostDraft::newInstanceByDraftId((int)$draft_id);
6512 $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
6513 $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
6514
6515 $draftObj->setPostUserAlias($user_alias);
6516 $draftObj->setNotify((int)$form_autosave_values['notify']);
6517 $draftObj->setUpdateUserId($ilUser->getId());
6518 $draftObj->setPostAuthorId($ilUser->getId());
6519 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()));
6520
6521 $draftObj->updateDraft();
6522
6523 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
6524 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
6525 $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
6526
6527 foreach($uploadedObjects as $mob)
6528 {
6529 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
6531 }
6532
6533 foreach($oldMediaObjects as $mob)
6534 {
6536 }
6537
6538 foreach($curMediaObjects as $mob)
6539 {
6541 }
6542 }
6543 else
6544 {
6545 $draftObj = new ilForumDraftsHistory();
6546 $draftObj->setDraftId((int)$draft_id);
6547 $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
6548 $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
6549 $draftObj->addDraftToHistory();
6550
6551 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
6552 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
6553 $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
6554
6555 foreach($uploadedObjects as $mob)
6556 {
6557 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
6559 }
6560
6561 foreach($oldMediaObjects as $mob)
6562 {
6564 }
6565
6566 foreach($curMediaObjects as $mob)
6567 {
6569 }
6570 }
6571 }
6572 else
6573 {
6574 $draftObj = new ilForumPostDraft();
6575 $draftObj->setForumId(ilObjForum::lookupForumIdByRefId($this->ref_id));
6576 $draftObj->setThreadId($this->objCurrentTopic->getId());
6577 $draftObj->setPostId($current_post_id);
6578
6579 $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
6580 $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
6581
6582 $draftObj->setPostUserAlias($user_alias);
6583 $draftObj->setNotify((int)$form_autosave_values['notify']);
6584 $draftObj->setPostAuthorId($ilUser->getId());
6585 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()));
6586 $draftObj->saveDraft();
6587
6588 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
6589 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
6590 $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
6591
6592 foreach($uploadedObjects as $mob)
6593 {
6594 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
6596 }
6597
6598 foreach($oldMediaObjects as $mob)
6599 {
6601 }
6602
6603 foreach($curMediaObjects as $mob)
6604 {
6606 }
6607 }
6608 }
6609
6610 $reponse->draft_id = $draftObj->getDraftId();
6611 echo json_encode($reponse);
6612 exit();
6613 }
Class ilForumDraftHistory.
Class ilForumPostDraft.
static getPublicUserAlias($user_alias, $is_anonymized=false)
handleFormInput($a_text, $a_stripslashes=true)
static lookupForumIdByRefId($ref_id)
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
$ilUser
Definition: imgupload.php:18

References $_GET, $ilUser, ilRTE\_getMediaObjects(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), exit, ilForumUtil\getPublicUserAlias(), getReplyEditForm(), handleFormInput(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilObjForum\lookupForumIdByRefId(), ilForumDraftsHistory\MEDIAOBJECT_TYPE, and ilForumPostDraft\MEDIAOBJECT_TYPE.

+ Here is the call graph for this function:

◆ autosaveThreadDraftAsyncObject()

ilObjForumGUI::autosaveThreadDraftAsyncObject ( )

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

6616 {
6617 global $ilUser;
6618
6619 if($ilUser->isAnonymous() || $_GET['action'] == 'ready_showreply')
6620 {
6621 exit();
6622 }
6623
6624 $reponse = new stdClass();
6625 $reponse->draft_id = 0;
6626
6628 {
6629 $this->initTopicCreateForm();
6630 $replyform = $this->create_topic_form_gui;
6631 $current_post_id = 0;
6632
6633
6634 $replyform->checkInput();
6635
6636 $form_autosave_values['subject'] = $replyform->getInput('subject');
6637 $form_autosave_values['message'] = $replyform->getInput('message');
6638 $form_autosave_values['notify'] = $replyform->getInput('notify');
6639 $form_autosave_values['alias'] = $replyform->getInput('alias');
6640
6641 if(isset($_GET['draft_id']) && (int)$_GET['draft_id'] > 0)
6642 {
6643 $draft_id = (int)$_GET['draft_id'];
6644 }
6645 else
6646 {
6647 $draft_id = $replyform->getInput('draft_id');
6648 }
6649 $user_alias = ilForumUtil::getPublicUserAlias($form_autosave_values['alias'], $this->objProperties->isAnonymized());
6650 if((int)$draft_id > 0)
6651 {
6652 if($_GET['action'] == 'showreply')
6653 {
6654 $draftObj = ilForumPostDraft::newInstanceByDraftId((int)$draft_id);
6655 $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
6656 $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
6657 $draftObj->setPostUserAlias($user_alias);
6658 $draftObj->setNotify((int)$form_autosave_values['notify']);
6659 $draftObj->setUpdateUserId($ilUser->getId());
6660 $draftObj->setPostAuthorId($ilUser->getId());
6661 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()));
6662
6663 $draftObj->updateDraft();
6664
6665 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
6666 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
6667 $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
6668
6669 foreach($uploadedObjects as $mob)
6670 {
6671 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
6673 }
6674
6675 foreach($oldMediaObjects as $mob)
6676 {
6678 }
6679
6680 foreach($curMediaObjects as $mob)
6681 {
6683 }
6684
6685 }
6686 else
6687 {
6688 $draftObj = new ilForumDraftsHistory();
6689 $draftObj->setDraftId((int)$draft_id);
6690 $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
6691 $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
6692 $draftObj->addDraftToHistory();
6693
6694 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
6695 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
6696 $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
6697
6698 foreach($uploadedObjects as $mob)
6699 {
6700 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
6702 }
6703
6704 foreach($oldMediaObjects as $mob)
6705 {
6707 }
6708
6709 foreach($curMediaObjects as $mob)
6710 {
6712 }
6713
6714 }
6715 }
6716 else
6717 {
6718 $draftObj = new ilForumPostDraft();
6719 $draftObj->setForumId(ilObjForum::lookupForumIdByRefId($this->ref_id));
6720 $draftObj->setThreadId($this->objCurrentTopic->getId());
6721 $draftObj->setPostId($current_post_id);
6722
6723 $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
6724 $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
6725
6726 $draftObj->setPostUserAlias($user_alias);
6727 $draftObj->setNotify((int)$form_autosave_values['notify']);
6728 $draftObj->setPostAuthorId($ilUser->getId());
6729 $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $ilUser->getId()));
6730 $draftObj->saveDraft();
6731
6732 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
6733 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
6734 $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
6735
6736 foreach($uploadedObjects as $mob)
6737 {
6738 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
6740 }
6741
6742 foreach($oldMediaObjects as $mob)
6743 {
6745 }
6746
6747 foreach($curMediaObjects as $mob)
6748 {
6750 }
6751
6752 }
6753 }
6754
6755 $reponse->draft_id = $draftObj->getDraftId();
6756 echo json_encode($reponse);
6757 exit();
6758 }

References $_GET, $create_topic_form_gui, $ilUser, ilRTE\_getMediaObjects(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), exit, ilForumUtil\getPublicUserAlias(), handleFormInput(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilObjForum\lookupForumIdByRefId(), ilForumDraftsHistory\MEDIAOBJECT_TYPE, and ilForumPostDraft\MEDIAOBJECT_TYPE.

+ Here is the call graph for this function:

◆ cancelDraftObject()

ilObjForumGUI::cancelDraftObject ( )

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

1925 {
1926 $_GET['action'] = '';
1927 if(isset($_GET['draft_id']) && (int)$_GET['draft_id'] > 0)
1928 {
1930 {
1931 $history_obj = new ilForumDraftsHistory();
1932 $history_obj->getFirstAutosaveByDraftId((int)$_GET['draft_id']);
1933 $draft = ilForumPostDraft::newInstanceByDraftId((int)$_GET['draft_id']);
1934 $draft->setPostSubject($history_obj->getPostSubject());
1935 $draft->setPostMessage($history_obj->getPostMessage());
1936
1937 ilForumUtil::moveMediaObjects($history_obj->getPostMessage(),
1938 ilForumDraftsHistory::MEDIAOBJECT_TYPE, $history_obj->getHistoryId(),
1939 ilForumPostDraft::MEDIAOBJECT_TYPE, $draft->getDraftId());
1940
1941 $draft->updateDraft();
1942
1943 $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
1944 }
1945 }
1946 $this->ctrl->clearParameters($this);
1947 $this->viewThreadObject();
1948 }
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)

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

+ Here is the call graph for this function:

◆ cancelMergeThreads()

ilObjForumGUI::cancelMergeThreads ( )

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

5787 {
5788 $this->showThreadsObject();
5789 }

References showThreadsObject().

+ Here is the call graph for this function:

◆ cancelMoveThreadsObject()

ilObjForumGUI::cancelMoveThreadsObject ( )

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

3981 {
3982 unset($_SESSION['threads2move']);
3983
3984 $this->ctrl->redirect($this, 'showThreads');
3985 }
$_SESSION["AccountId"]

References $_SESSION.

◆ cancelObject()

ilObjForumGUI::cancelObject ( )

cancel action and go back to previous page @access public

Reimplemented from ilObjectGUI.

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

1411 {
1412 ilUtil::sendInfo($this->lng->txt('msg_cancel'), true);
1413 ilUtil::redirect('ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id='.$_GET['ref_id']);
1414 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, ilUtil\redirect(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ cancelPostObject()

ilObjForumGUI::cancelPostObject ( )

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

1913 {
1914 $_GET['action'] = '';
1915 if(isset($_POST['draft_id']) && (int)$_POST['draft_id'] > 0)
1916 {
1917 $draft = ilForumPostDraft::newInstanceByDraftId((int)$_POST['draft_id']);
1918 $draft->deleteDraftsByDraftIds(array( (int)$_POST['draft_id']));
1919 }
1920
1921 $this->viewThreadObject();
1922 }
$_POST["username"]

References $_GET, and $_POST.

◆ checkDraftAccess()

ilObjForumGUI::checkDraftAccess (   $draft_id)
Parameters
$draft_id
Returns
bool

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

7011 {
7012 global $ilUser, $ilAccess, $ilErr, $lng;
7013
7014 $draft_obj = ilForumPostDraft::newInstanceByDraftId($draft_id);
7015
7016 if(!$ilAccess->checkAccess('add_reply', '', (int)$_GET['ref_id']) ||
7017 $ilUser->isAnonymous() ||
7018 ($draft_obj instanceof ilForumPostDraft && $ilUser->getId() != $draft_obj->getPostAuthorId()))
7019 {
7020 $ilErr->raiseError($lng->txt('permission_denied'), $ilErr->getMessage());
7021 }
7022 return true;
7023 }
global $ilErr
Definition: raiseError.php:16

References $_GET, $ilErr, $ilUser, and ilObjectGUI\$lng.

Referenced by editDraftObject().

+ Here is the caller graph for this function:

◆ checkEnableColumnEdit()

ilObjForumGUI::checkEnableColumnEdit ( )

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

4687 {
4688 return false;
4689 }

◆ cloneWizardPageObject()

ilObjForumGUI::cloneWizardPageObject ( )

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

4717 {
4718 global $ilObjDataCache;
4719
4720 if (!$_POST['clone_source'])
4721 {
4722 ilUtil::sendInfo($this->lng->txt('select_one'));
4723 if (isset($_SESSION['wizard_search_title']))
4724 {
4725 $this->searchCloneSourceObject();
4726 }
4727 else
4728 {
4729 $this->createObject();
4730 }
4731 return false;
4732 }
4733 $source_id = $_POST['clone_source'];
4734
4735 $new_type = $_REQUEST['new_type'];
4736 $this->ctrl->setParameter($this, 'clone_source', (int) $_POST['clone_source']);
4737 $this->ctrl->setParameter($this, 'new_type', $new_type);
4738
4739 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.frm_wizard_page.html', 'Modules/Forum');
4740 $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this));
4741 $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_'.$new_type.'.svg'));
4742 $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_'.$new_type));
4743 $this->tpl->setVariable('TXT_DUPLICATE', $this->lng->txt('frm_wizard_page'));
4744 $this->tpl->setVariable('INFO_THREADS', $this->lng->txt('fmr_copy_threads_info'));
4745 $this->tpl->setVariable('THREADS', $this->lng->txt('forums_threads'));
4746
4747 $forum_id = $ilObjDataCache->lookupObjId((int) $_POST['clone_source']);
4748 include_once('Modules/Forum/classes/class.ilForum.php');
4749 $threads = ilForum::_getThreads($forum_id, ilForum::SORT_TITLE);
4750 foreach ($threads as $thread_id => $title)
4751 {
4752 $this->tpl->setCurrentBlock('thread_row');
4753 $this->tpl->setVariable('CHECK_THREAD', ilUtil::formCheckbox(0, 'cp_options['.$source_id.'][threads][]', $thread_id));
4754 $this->tpl->setVariable('NAME_THREAD', $title);
4755 $this->tpl->parseCurrentBlock();
4756 }
4757 $this->tpl->setVariable('SELECT_ALL', $this->lng->txt('select_all'));
4758 $this->tpl->setVariable('JS_FIELD', 'cp_options['.$source_id.'][threads]');
4759 $this->tpl->setVariable('BTN_COPY', $this->lng->txt('obj_'.$new_type.'_duplicate'));
4760 if (isset($_SESSION['wizard_search_title']))
4761 {
4762 $this->tpl->setVariable('BACK_CMD', 'searchCloneSource');
4763 }
4764 else
4765 {
4766 $this->tpl->setVariable('BACK_CMD', 'create');
4767 }
4768 $this->tpl->setVariable('BTN_BACK', $this->lng->txt('btn_back'));
4769 }
const SORT_TITLE
static _getThreads($a_obj_id, $a_sort_mode=self::SORT_DATE)
Get thread infos of object.
createObject()
create new object form
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public

References $_POST, $_SESSION, $ilObjDataCache, $title, ilForum\_getThreads(), ilObjectGUI\createObject(), ilUtil\formCheckbox(), ilUtil\getImagePath(), ilUtil\sendInfo(), and ilForum\SORT_TITLE.

+ Here is the call graph for this function:

◆ confirmDeleteThreadDraftsObject()

ilObjForumGUI::confirmDeleteThreadDraftsObject ( )

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

1734 {
1735 global $ilUser;
1736
1737 if(!isset($_POST['draft_ids']) || !is_array($_POST['draft_ids']))
1738 {
1739 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1740 return $this->showThreadsObject();
1741 }
1742
1743 include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
1744 $c_gui = new ilConfirmationGUI();
1745
1746 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'deleteThreadDrafts'));
1747 $c_gui->setHeaderText($this->lng->txt('sure_delete_drafts'));
1748 $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
1749 $c_gui->setConfirm($this->lng->txt('confirm'), 'deleteThreadDrafts');
1751 foreach($_POST['draft_ids'] as $draft_id)
1752 {
1753 if(array_key_exists($draft_id, $instances))
1754 {
1755 $c_gui->addItem('draft_ids[]', $draft_id, $instances[$draft_id]->getPostSubject());
1756 }
1757 }
1758
1759 $this->confirmation_gui_html = $c_gui->getHTML();
1760
1761 $this->hideToolbar(true);
1762
1763 return $this->tpl->setContent($c_gui->getHTML());
1764 }
Confirmation screen class.
static getDraftInstancesByUserId($user_id)
hideToolbar($a_flag=null)

References $_POST, $ilUser, ilForumPostDraft\getDraftInstancesByUserId(), hideToolbar(), ilUtil\sendInfo(), and showThreadsObject().

+ Here is the call graph for this function:

◆ confirmDeleteThreads()

ilObjForumGUI::confirmDeleteThreads ( )

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

1692 {
1693 if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1694 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1695 return $this->showThreadsObject();
1696 }
1697
1698 if (!$this->is_moderator) {
1699 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1700 }
1701
1702 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1703 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1704 }
1705
1706 $threads = [];
1707 array_walk($_POST['thread_ids'], function($threadId) use (&$threads) {
1708 $thread = new \ilForumTopic($threadId);
1709 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $thread);
1710
1711 $threads[] = $thread;
1712 });
1713
1714 include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
1715 $c_gui = new ilConfirmationGUI();
1716
1717 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteThreads'));
1718 $c_gui->setHeaderText($this->lng->txt('frm_sure_delete_threads'));
1719 $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
1720 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteThreads');
1721
1722 foreach ($threads as $thread) {
1723 $c_gui->addItem('thread_ids[]', $thread->getId(), $thread->getSubject());
1724 }
1725
1726 $this->confirmation_gui_html = $c_gui->getHTML();
1727
1728 $this->hideToolbar(true);
1729
1730 return $this->tpl->setContent($c_gui->getHTML());
1731 }
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)

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

+ Here is the call graph for this function:

◆ confirmMergeThreadsObject()

ilObjForumGUI::confirmMergeThreadsObject ( )

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

5678 {
5679 if(!$this->is_moderator)
5680 {
5681 $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
5682 }
5683
5684 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
5685 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5686 }
5687
5688 if(!isset($_GET['merge_thread_id']) || !(int)$_GET['merge_thread_id'] || !is_array($_POST['thread_ids']) || count($_POST['thread_ids']) != 1)
5689 {
5690 ilUtil::sendFailure($this->lng->txt('select_one'));
5691 $this->mergeThreadsObject();
5692 return;
5693 }
5694
5695 $source_thread_id = (int)$_GET['merge_thread_id'];
5696 $target_thread_id = (int)current($_POST['thread_ids']);
5697
5698 if($source_thread_id == $target_thread_id)
5699 {
5700 ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
5701 $this->showThreadsObject();
5702 return;
5703 }
5704
5705 if(ilForumTopic::lookupForumIdByTopicId($source_thread_id) != ilForumTopic::lookupForumIdByTopicId($target_thread_id))
5706 {
5707 ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
5708 $this->ctrl->clearParameters($this);
5709 $this->showThreadsObject();
5710 return;
5711 }
5712
5713 if(ilForumTopic::_lookupDate($source_thread_id) < ilForumTopic::_lookupDate($target_thread_id))
5714 {
5715 ilUtil::sendInfo($this->lng->txt('switch_threads_for_merge'));
5716 }
5717
5718 $this->ensureThreadBelongsToForum((int)$this->object->getId(), new \ilForumTopic((int)$source_thread_id));
5719 $this->ensureThreadBelongsToForum((int)$this->object->getId(), new \ilForumTopic((int)$target_thread_id));
5720
5721 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
5722 $c_gui = new ilConfirmationGUI();
5723
5724 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performMergeThreads'));
5725 $c_gui->setHeaderText($this->lng->txt('frm_sure_merge_threads'));
5726 $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
5727 $c_gui->setConfirm($this->lng->txt('confirm'), 'performMergeThreads');
5728
5729 $c_gui->addItem('thread_ids[]', $source_thread_id, sprintf($this->lng->txt('frm_merge_src'), ilForumTopic::_lookupTitle($source_thread_id)));
5730 $c_gui->addItem('thread_ids[]', $target_thread_id, sprintf($this->lng->txt('frm_merge_target'), ilForumTopic::_lookupTitle($target_thread_id)));
5731
5732 $this->tpl->setContent($c_gui->getHTML());
5733 return;
5734 }
sprintf('%.4f', $callTime)
static lookupForumIdByTopicId($a_topic_id)
static _lookupDate($thread_id)
static _lookupTitle($a_topic_id)
Looks up the title/subject of a topic/thread.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
redirection script todo: (a better solution should control the processing via a xml file)

References $_GET, $_POST, ilForumTopic\_lookupDate(), ilForumTopic\_lookupTitle(), ensureThreadBelongsToForum(), error(), ilForumTopic\lookupForumIdByTopicId(), mergeThreadsObject(), ilUtil\sendFailure(), ilUtil\sendInfo(), showThreadsObject(), and sprintf.

+ Here is the call graph for this function:

◆ createThreadObject()

ilObjForumGUI::createThreadObject ( )

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

4316 {
4317 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4318 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4319 }
4320
4321 if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
4322 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4323 }
4324
4325 $this->initTopicCreateForm();
4327
4328 $create_form = new ilTemplate('tpl.create_thread_form.html', true, true, 'Modules/Forum');
4329 $create_form->setVariable('CREATE_FORM',$this->create_topic_form_gui->getHTML());
4330 $create_form->parseCurrentBlock();
4331
4332 $this->tpl->setContent($create_form->get());
4333 }
special template class to simplify handling of ITX/PEAR

References error(), and setTopicCreateDefaultValues().

+ Here is the call graph for this function:

◆ createTopLevelPostObject()

ilObjForumGUI::createTopLevelPostObject ( )

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

2369 {
2370 global $ilUser;
2371
2372 if(isset($_GET['draft_id']) && (int)$_GET['draft_id'] > 0 && !$ilUser->isAnonymous()
2374 {
2375 $draft_obj = new ilForumPostDraft($ilUser->getId(), $this->objCurrentPost->getId(), (int)$_GET['draft_id']);
2376 }
2377
2378 if($draft_obj instanceof ilForumPostDraft && $draft_obj->getDraftId() > 0)
2379 {
2380 $this->ctrl->setParameter($this, 'action', 'editdraft');
2381 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
2382 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
2383 $this->ctrl->setParameter($this, 'draft_id', $draft_obj->getDraftId());
2384 $this->ctrl->setParameter($this, 'offset', 0);
2385 $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
2386 $this->ctrl->redirect($this, 'editDraft');
2387 }
2388 else
2389 {
2390 $this->viewThreadObject();
2391 }
2392 return;
2393 }

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

+ Here is the call graph for this function:

◆ deleteMobsOfDraft()

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

todo: move to ilForumUtil

Parameters
$draft_id
$message

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

6389 {
6390 // remove usage of deleted media objects
6391 include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
6392 $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draft_id);
6393 $curMediaObjects = ilRTE::_getMediaObjects($message, 0);
6394 foreach($oldMediaObjects as $oldMob)
6395 {
6396 $found = false;
6397 foreach($curMediaObjects as $curMob)
6398 {
6399 if($oldMob == $curMob)
6400 {
6401 $found = true;
6402 break;
6403 }
6404 }
6405 if(!$found)
6406 {
6407 if(ilObjMediaObject::_exists($oldMob))
6408 {
6409 ilObjMediaObject::_removeUsage($oldMob,'frm~d:html', $draft_id);
6410 $mob_obj = new ilObjMediaObject($oldMob);
6411 $mob_obj->delete();
6412 }
6413 }
6414 }
6415 }
Class ilObjMediaObject.
static _exists($a_id, $a_reference=false, $a_type=NULL)
checks wether a lm content object with specified id exists or not

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

Referenced by deleteSelectedDraft(), and deleteThreadDraftsObject().

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

◆ deleteSelectedDraft()

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

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

6421 {
6422 global $ilUser, $ilAccess, $ilErr, $lng;
6423
6424 if(
6425 !$ilAccess->checkAccess('add_reply', '', (int)$_GET['ref_id']) ||
6426 $ilUser->isAnonymous() ||
6427 ($draft_obj instanceof ilForumPostDraft && $ilUser->getId() != $draft_obj->getPostAuthorId()))
6428 {
6429 $ilErr->raiseError($lng->txt('permission_denied'), $ilErr->getMessage());
6430 }
6431
6432 $post_id = $this->objCurrentPost->getId();
6433 if(!($draft_obj instanceof ilForumPostDraft))
6434 {
6435 $draft_id_to_delete = (int)$_GET['draft_id'];
6436 $draft_obj = new ilForumPostDraft($ilUser->getId(), $post_id, $draft_id_to_delete);
6437
6438 if(!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete))
6439 {
6440 $this->ctrl->clearParameters($this);
6441 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
6442 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
6443 $this->ctrl->redirect($this, 'viewThread');
6444 }
6445 }
6446
6447 $this->deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
6448
6449 // delete attachments of draft
6450 $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_obj->getDraftId());
6451 $objFileDataForumDrafts->delete();
6452
6454 {
6455 $GLOBALS['ilAppEventHandler']->raise(
6456 'Modules/Forum',
6457 'deletedDraft',
6458 array('draftObj' => $draft_obj,
6459 'obj_id' => $this->object->getId(),
6460 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
6461 );
6462 }
6463 // delete draft
6464 $draft_obj->deleteDraft();
6465
6466 ilUtil::sendSuccess($this->lng->txt('delete_draft_successfully'), true);
6467 $this->ctrl->clearParameters($this);
6468 $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
6469 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
6470 $this->ctrl->redirect($this, 'viewThread');
6471 }
This class handles all operations on files for the drafts of a forum object.
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $_GET, $GLOBALS, $ilErr, $ilUser, ilObjectGUI\$lng, deleteMobsOfDraft(), ilForumPostDraft\isSavePostDraftAllowed(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteThreadDraftsObject()

ilObjForumGUI::deleteThreadDraftsObject ( )

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

4251 {
4252 global $ilUser;
4253
4254 $draft_ids = array();
4255 if(isset($_GET['draft_id']) && (int)$_GET['draft_id'] > 0)
4256 {
4257 $draft_ids = array((int)$_GET['draft_id']);
4258 }
4259 elseif(isset($_POST['draft_ids']) && is_array($_POST['draft_ids']))
4260 {
4261 $draft_ids = $_POST['draft_ids'];
4262 }
4264 $checked_draft_ids = array();
4265 foreach($draft_ids as $draft_id)
4266 {
4267 if(array_key_exists($draft_id, $instances))
4268 {
4269 $checked_draft_ids[] = $draft_id;
4270 $draftObj = $instances[$draft_id];
4271
4272 $this->deleteMobsOfDraft($draftObj->getDraftId(), $draftObj->getPostMessage());
4273
4274 // delete attachments of draft
4275 $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draftObj->getDraftId());
4276 $objFileDataForumDrafts->delete();
4277
4279 {
4280 $GLOBALS['ilAppEventHandler']->raise(
4281 'Modules/Forum',
4282 'deletedDraft',
4283 array('draftObj' => $draftObj,
4284 'obj_id' => $this->object->getId(),
4285 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
4286 );
4287 }
4288 // delete draft
4289 $draftObj->deleteDraft();
4290 }
4291 }
4292
4293 if(count($checked_draft_ids) > 1)
4294 {
4295 ilUtil::sendInfo($this->lng->txt('delete_drafts_successfully'), true);
4296 }
4297 else
4298 {
4299 ilUtil::sendInfo($this->lng->txt('delete_draft_successfully'), true);
4300 }
4301
4302 $this->ctrl->redirect($this, 'showThreads');
4303 }

References $_GET, $_POST, $GLOBALS, $ilUser, deleteMobsOfDraft(), ilForumPostDraft\getDraftInstancesByUserId(), ilForumPostDraft\isSavePostDraftAllowed(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ deliverZipFileObject()

ilObjForumGUI::deliverZipFileObject ( )

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

5828 {
5829 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
5830 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5831 }
5832
5833 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $this->objCurrentPost->getThread());
5834
5835 $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
5836 if (!$fileData->deliverZipFile()) {
5837 $this->ctrl->redirect($this);
5838 }
5839 }

References ensureThreadBelongsToForum(), and error().

+ Here is the call graph for this function:

◆ displayConfirmPostActivation()

ilObjForumGUI::displayConfirmPostActivation ( )

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

1863 {
1865 }

References $display_confirm_post_activation.

◆ doHistoryCheck()

ilObjForumGUI::doHistoryCheck (   $draft_id)
Parameters
$draft_id

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

7029 {
7030
7031 require_once './Services/jQuery/classes/class.iljQueryUtil.php';
7033
7034 $modal = '';
7036 {
7037 $history_instances = ilForumDraftsHistory::getInstancesByDraftId($draft_id);
7038 if(is_array($history_instances) && sizeof($history_instances) > 0)
7039 {
7040 require_once 'Services/UIComponent/Modal/classes/class.ilModalGUI.php';
7041 $modal = ilModalGUI::getInstance();
7042 $modal->setHeading($this->lng->txt('restore_draft_from_autosave'));
7043 $modal->setId('frm_autosave_restore');
7044 $form_tpl = new ilTemplate('tpl.restore_thread_draft.html', true, true, 'Modules/Forum');
7045 include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
7046
7047 foreach($history_instances as $key => $history_instance)
7048 {
7049 $acc_autosave = new ilAccordionGUI();
7050 $acc_autosave->setId('acc_'.$history_instance->getHistoryId());
7051
7052 $form_tpl->setCurrentBlock('list_item');
7053 $post_message = ilRTE::_replaceMediaObjectImageSrc($history_instance->getPostMessage(), 1);
7054
7055 $history_date = ilDatePresentation::formatDate(new ilDateTime($history_instance->getDraftDate(), IL_CAL_DATETIME));
7056 $restore_btn = ilLinkButton::getInstance();
7057 $restore_btn->addCSSClass('restore_btn');
7058 $this->ctrl->setParameter($this, 'history_id', $history_instance->getHistoryId());
7059 $restore_btn->setUrl($this->ctrl->getLinkTarget($this, 'restoreFromHistory'));
7060 $restore_btn->setCaption($this->lng->txt('restore'), false);
7061
7062 $acc_autosave->addItem($history_date.' - '. $history_instance->getPostSubject(), $post_message . $restore_btn->render());
7063
7064 $form_tpl->setVariable('ACC_AUTO_SAVE', $acc_autosave->getHtml());
7065 $form_tpl->parseCurrentBlock();
7066 }
7067
7068 $form_tpl->setVariable('RESTORE_DATA_EXISTS', 'found_threat_history_to_restore');
7069 $modal->setBody($form_tpl->get());
7070 $modal->initJS();
7071 $this->modal_history = $modal->getHTML();
7072 }
7073 else
7074 {
7076 }
7077 }
7078 }
const IL_CAL_DATETIME
Accordion user interface class.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static getInstancesByDraftId($draft_id)
static createDraftBackup($draft_id)
static getInstance()
Factory.
static getInstance()
Get instance.
static initjQuery($a_tpl=null)
Init jQuery.

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

Referenced by editDraftObject().

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

◆ editDraftObject()

ilObjForumGUI::editDraftObject ( )

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

6252 {
6254 {
6255 $draft_id = (int)$_GET['draft_id'];
6256 if($this->checkDraftAccess($draft_id))
6257 {
6258 $this->doHistoryCheck($draft_id);
6259 }
6260 }
6261
6262 $this->viewThreadObject();
6263 return true;
6264 }
checkDraftAccess($draft_id)

References $_GET, checkDraftAccess(), doHistoryCheck(), and ilForumPostDraft\isAutoSavePostDraftAllowed().

+ Here is the call graph for this function:

◆ ensureThreadBelongsToForum()

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

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

178 {
179 $forumId = \ilObjForum::lookupForumIdByObjId($objId);
180 if ((int)$thread->getForumId() !== (int)$forumId) {
181 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
182 }
183 }
static lookupForumIdByObjId($obj_id)

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

Referenced by confirmDeleteThreads(), confirmMergeThreadsObject(), deliverZipFileObject(), markPostReadObject(), markPostUnreadObject(), performDeleteThreadsObject(), performMoveThreadsObject(), performPostActivationObject(), saveThreadSortingObject(), toggleStickinessObject(), and updateThreadObject().

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

◆ getEditFormCustomValues()

ilObjForumGUI::getEditFormCustomValues ( Array &  $a_values)
protected

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

496 {
497 $a_values["desc"] = $this->object->getLongDescription();
498 $a_values['default_view'] = $this->objProperties->getDefaultView();
499 $a_values['anonymized'] = $this->objProperties->isAnonymized();
500 $a_values['statistics_enabled'] = $this->objProperties->isStatisticEnabled();
501 $a_values['post_activation'] = $this->objProperties->isPostActivationEnabled();
502 $a_values['subject_setting'] = $this->objProperties->getSubjectSetting();
503 $a_values['mark_mod_posts'] = $this->objProperties->getMarkModeratorPosts();
504 $a_values['thread_sorting'] = $this->objProperties->getThreadSorting();
505 $a_values['thread_rating'] = $this->objProperties->isIsThreadRatingEnabled();
506
507 $default_view =
508 in_array((int)$this->objProperties->getDefaultView(), array(ilForumProperties::VIEW_DATE_ASC, ilForumProperties::VIEW_DATE_DESC))
511 $a_values['default_view'] = $default_view;
512
513 $default_view_sort_dir =
514 (int)$this->objProperties->getDefaultView() != (int)ilForumProperties::VIEW_TREE
515 ? (int)$this->objProperties->getDefaultView()
517
518 $a_values['default_view_sort_dir'] = $default_view_sort_dir;
519 $a_values['file_upload_allowed'] = (bool)$this->objProperties->getFileUploadAllowed();
520 }

References ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

◆ getForumObjects()

ilObjForumGUI::getForumObjects ( )
private

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

2955 {
2956 if(null === $this->forumObjects)
2957 {
2958 $forumObj = $this->object;
2959 $file_obj = new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
2960 $frm = $forumObj->Forum;
2961 $frm->setForumId($forumObj->getId());
2962 $frm->setForumRefId($forumObj->getRefId());
2963
2964 $this->forumObjects['forumObj'] = $forumObj;
2965 $this->forumObjects['frm'] = $frm;
2966 $this->forumObjects['file_obj'] = $file_obj;
2967 }
2968
2969 return $this->forumObjects;
2970 }
This class handles all operations on files for the forum object.

References $forumObjects, and $object.

Referenced by publishDraftObject().

+ Here is the caller graph for this function:

◆ getIcon()

ilObjForumGUI::getIcon (   $user_toggle_noti)

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

4962 {
4963 $icon = $user_toggle_noti
4964 ? "<img src=\"".ilUtil::getImagePath("icon_ok.svg")."\" alt=\"".$this->lng->txt("enabled")."\" title=\"".$this->lng->txt("enabled")."\" border=\"0\" vspace=\"0\"/>"
4965 : "<img src=\"".ilUtil::getImagePath("icon_not_ok.svg")."\" alt=\"".$this->lng->txt("disabled")."\" title=\"".$this->lng->txt("disabled")."\" border=\"0\" vspace=\"0\"/>";
4966 return $icon;
4967 }

Referenced by getUserNotificationTableData().

+ Here is the caller graph for this function:

◆ getModifiedReOnSubject()

ilObjForumGUI::getModifiedReOnSubject (   $on_reply = false)
private

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

3653 {
3654 $subject = $this->objCurrentPost->getSubject();
3655 $re_txt = $this->lng->txt('post_reply');
3656
3657 $re_txt_with_num = str_replace(':', '(',$re_txt);
3658 $search_length = strlen($re_txt_with_num);
3659 $comp = substr_compare($re_txt_with_num, substr($subject, 0 , $search_length), 0, $search_length);
3660
3661 if($comp == 0)
3662 {
3663 $modified_subject = $subject;
3664 if($on_reply == true)
3665 {
3666 // i.e. $subject = "Re(12):"
3667 $str_pos_start = strpos($subject, '(');
3668 $str_pos_end = strpos($subject, ')');
3669
3670 $length = ((int)$str_pos_end - (int)$str_pos_start);
3671 $str_pos_start++;
3672 $txt_number = substr($subject, $str_pos_start, $length - 1);
3673
3674 if(is_numeric($txt_number))
3675 {
3676 $re_count = (int)$txt_number + 1;
3677 $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
3678 }
3679 }
3680 }
3681 else
3682 {
3683 $re_count = substr_count($subject, $re_txt);
3684 if($re_count >= 1 && $on_reply == true)
3685 {
3686 $subject = str_replace($re_txt, '', $subject);
3687
3688 // i.e. $subject = "Re: Re: Re: ... " -> "Re(4):"
3689 $re_count++;
3690 $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count).' '.trim($subject);
3691 }
3692 else if($re_count >= 1 && $on_reply == false)
3693 {
3694 // possibility to modify the subject only for output
3695 // i.e. $subject = "Re: Re: Re: ... " -> "Re(3):"
3696 $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count).' '.trim($subject);
3697 }
3698 else if($re_count == 0)
3699 {
3700 // the first reply to a thread
3701 $modified_subject = $this->lng->txt('post_reply').' '. $this->objCurrentPost->getSubject();
3702 }
3703 }
3704 return $modified_subject;
3705 }

References sprintf.

◆ getReplyEditForm()

ilObjForumGUI::getReplyEditForm ( )
private
Returns
ilPropertyFormGUI

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

2356 {
2357 if(null === $this->replyEditForm)
2358 {
2359 $this->initReplyEditForm();
2360 }
2361
2362 return $this->replyEditForm;
2363 }

References $replyEditForm.

Referenced by autosaveDraftAsyncObject(), publishDraftObject(), and quotePostObject().

+ Here is the caller graph for this function:

◆ getSubTabs()

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

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

693 {
694 global $ilTabs;
695
696 if($this->objProperties->getThreadSorting() == 1 && $this->is_moderator)
697 {
698 $ilTabs->addSubTabTarget('show', $this->ctrl->getLinkTarget($this, 'showThreads'), 'showThreads', get_class($this), '', $subtab=='showThreads'? true : false );
699 $ilTabs->addSubTabTarget('sorting_header', $this->ctrl->getLinkTarget($this, 'sortThreads'), 'sortThreads', get_class($this), '', $subtab=='sortThreads'? true : false );
700 }
701 }

Referenced by showThreadsObject(), and sortThreadsObject().

+ Here is the caller graph for this function:

◆ getThreadEditingForm()

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

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

572 {
573 $form = new ilPropertyFormGUI();
574 $this->ctrl->setParameter($this, 'thr_pk', $a_thread_id);
575 $form->setFormAction($this->ctrl->getFormAction($this, 'updateThread'));
576
577 $ti_prop = new ilTextInputGUI($this->lng->txt('title'), 'title');
578 $ti_prop->setRequired(true);
579 $ti_prop->setMaxLength(255);
580 $ti_prop->setSize(50);
581 $form->addItem($ti_prop);
582
583 $form->addCommandButton('updateThread', $this->lng->txt('save'));
584 $form->addCommandButton('showThreads', $this->lng->txt('cancel'));
585
586 return $form;
587 }
This class represents a property form user interface.
This class represents a text property in a property form.

Referenced by updateThreadObject().

+ Here is the caller graph for this function:

◆ getUserNotificationTableData()

ilObjForumGUI::getUserNotificationTableData (   $user_ids,
ilForumNotification  $frm_noti 
)
private

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

5037 {
5038 $counter = 0;
5039 $users = array();
5040 foreach($user_ids as $user_id)
5041 {
5042 $frm_noti->setUserId($user_id);
5043 $user_toggle_noti = $frm_noti->isUserToggleNotification();
5044 $icon_ok = $this->getIcon(!$user_toggle_noti);
5045
5046 $users[$counter]['user_id'] = ilUtil::formCheckbox(0, 'user_id[]', $user_id);
5047 $users[$counter]['login'] = ilObjUser::_lookupLogin($user_id);
5048 $name = ilObjUser::_lookupName($user_id);
5049 $users[$counter]['firstname'] = $name['firstname'];
5050 $users[$counter]['lastname'] = $name['lastname'];
5051 $users[$counter]['user_toggle_noti'] = $icon_ok;
5052 $counter++;
5053 }
5054 return $users;
5055 }
getIcon($user_toggle_noti)
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
$counter

References $counter, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\formCheckbox(), getIcon(), ilForumNotification\isUserToggleNotification(), and ilForumNotification\setUserId().

+ Here is the call graph for this function:

◆ handleFormInput()

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

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

4784 {
4785 $a_text = str_replace("<", "&lt;", $a_text);
4786 $a_text = str_replace(">", "&gt;", $a_text);
4787 if($a_stripslashes)
4788 $a_text = ilUtil::stripSlashes($a_text);
4789
4790 return $a_text;
4791 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References ilUtil\stripSlashes().

Referenced by autosaveDraftAsyncObject(), and autosaveThreadDraftAsyncObject().

+ 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 2885 of file class.ilObjForumGUI.php.

2886 {
2887 if(null === $a_flag)
2888 {
2889 return $this->hideToolbar;
2890 }
2891
2892 $this->hideToolbar = $a_flag;
2893 return $this;
2894 }

References $hideToolbar, and hideToolbar().

Referenced by confirmDeleteThreadDraftsObject(), confirmDeleteThreads(), and hideToolbar().

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

◆ infoScreenObject()

ilObjForumGUI::infoScreenObject ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

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

4807 {
4808 $this->ctrl->setCmd('showSummary');
4809 $this->ctrl->setCmdClass('ilinfoscreengui');
4810 $this->infoScreen();
4811 }

◆ initForumCreateForm()

ilObjForumGUI::initForumCreateForm (   $object_type)
private
Parameters
string$object_type

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

1341 {
1342 $this->create_form_gui = new ilPropertyFormGUI();
1343 $this->create_form_gui->setTableWidth('600px');
1344
1345 $this->create_form_gui->setTitle($this->lng->txt('frm_new'));
1346 $this->create_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
1347
1348 // form action
1349 $this->ctrl->setParameter($this, 'new_type', $object_type);
1350 $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
1351
1352 // title
1353 $title_gui = new ilTextInputGUI($this->lng->txt('title'), 'title');
1354 $title_gui->setSize(min(40, ilObject::TITLE_LENGTH));
1355 $title_gui->setMaxLength(ilObject::TITLE_LENGTH);
1356 $this->create_form_gui->addItem($title_gui);
1357
1358 // description
1359 $description_gui = new ilTextAreaInputGUI($this->lng->txt('desc'), 'desc');
1360 $description_gui->setCols(40);
1361 $description_gui->setRows(2);
1362 $this->create_form_gui->addItem($description_gui);
1363
1364 // view sorting threads
1365 $sort_man = new ilCheckboxInputGUI($this->lng->txt('sorting_manual_sticky'), 'thread_sorting');
1366 $sort_man->setInfo($this->lng->txt('sticky_threads_always_on_top'));
1367 $sort_man->setValue(1);
1368 $this->create_form_gui->addItem($sort_man);
1369
1370 // view
1371 $view_group_gui = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'sort');
1372 $view_hir = new ilRadioOption($this->lng->txt('order_by').' '.$this->lng->txt('answers'), ilForumProperties::VIEW_TREE);
1373 $view_group_gui->addOption($view_hir);
1374 $view_dat = new ilRadioOption($this->lng->txt('order_by').' '.$this->lng->txt('date'), ilForumProperties::VIEW_DATE);
1375 $view_group_gui->addOption($view_dat);
1376 $this->create_form_gui->addItem($view_group_gui);
1377 $view_direction_group_gui = new ilRadioGroupInputGUI('', 'default_view_sort_dir');
1378 $view_desc = new ilRadioOption($this->lng->txt('frm_post_sort_desc'), ilForumProperties::VIEW_DATE_DESC);
1379 $view_direction_group_gui->addOption($view_desc);
1380 $view_asc = new ilRadioOption($this->lng->txt('frm_post_sort_asc'), ilForumProperties::VIEW_DATE_ASC);
1381 $view_direction_group_gui->addOption($view_asc);
1382 $view_dat->addSubItem($view_direction_group_gui);
1383
1384 // anonymized or not
1385 $anonymize_gui = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized');
1386 $anonymize_gui->setInfo($this->lng->txt('frm_anonymous_posting_desc'));
1387 $anonymize_gui->setValue(1);
1388
1389 if($this->ilias->getSetting('enable_anonymous_fora', false))
1390 $anonymize_gui->setDisabled(true);
1391 $this->create_form_gui->addItem($anonymize_gui);
1392
1393 // statistics enabled or not
1394 $statistics_gui = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled');
1395 $statistics_gui->setInfo($this->lng->txt('frm_statistics_enabled_desc'));
1396 $statistics_gui->setValue(1);
1397 if(!$this->ilias->getSetting('enable_fora_statistics', false))
1398 $statistics_gui->setDisabled(true);
1399 $this->create_form_gui->addItem($statistics_gui);
1400
1401 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation');
1402 $cb_prop->setValue('1');
1403 $cb_prop->setInfo($this->lng->txt('post_activation_desc'));
1404 $this->create_form_gui->addItem($cb_prop);
1405
1406 $this->create_form_gui->addCommandButton('save', $this->lng->txt('save'));
1407 $this->create_form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
1408 }
This class represents a checkbox property in a property form.
const TITLE_LENGTH
max length of object title
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text area property in a property form.

References ilUtil\getImagePath(), ilObject\TITLE_LENGTH, ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

+ Here is the call graph for this function:

◆ initNotificationSettingsForm()

ilObjForumGUI::initNotificationSettingsForm ( )
private

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

4927 {
4928 if(null === $this->notificationSettingsForm)
4929 {
4930 $form = new ilPropertyFormGUI();
4931 $form->setFormAction($this->ctrl->getFormAction($this, 'updateNotificationSettings'));
4932 $form->setTitle($this->lng->txt('forums_notification_settings'));
4933
4934 $radio_grp = new ilRadioGroupInputGUI('','notification_type');
4935 $radio_grp->setValue('default');
4936
4937 $opt_default = new ilRadioOption($this->lng->txt("user_decides_notification"), 'default');
4938 $opt_0 = new ilRadioOption($this->lng->txt("settings_for_all_members"), 'all_users');
4939 $opt_1 = new ilRadioOption($this->lng->txt("settings_per_users"), 'per_user');
4940
4941 $radio_grp->addOption($opt_default, 'default');
4942 $radio_grp->addOption($opt_0, 'all_users');
4943 $radio_grp->addOption($opt_1, 'per_user');
4944
4945 $chb_2 = new ilCheckboxInputGUI($this->lng->txt('user_toggle_noti'), 'usr_toggle');
4946 $chb_2->setValue(1);
4947
4948 $opt_0->addSubItem($chb_2);
4949 $form->addItem($radio_grp);
4950
4951 $form->addCommandButton('updateNotificationSettings', $this->lng->txt('save'));
4952
4953 $this->notificationSettingsForm = $form;
4954
4955 return false;
4956 }
4957
4958 return true;
4959 }

◆ initSessionStorage()

ilObjForumGUI::initSessionStorage ( )
protected

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

158 {
159 $sess = ilSession::get('frm');
160 if(!is_array($sess))
161 {
162 $sess = array();
163 ilSession::set('frm', $sess);
164 }
165
166 if(isset($_GET['thr_fk']) && !is_array($sess[(int)$_GET['thr_fk']]))
167 {
168 $sess[(int)$_GET['thr_fk']] = array();
169 ilSession::set('frm', $sess);
170 }
171 }
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.

References $_GET, $sess, ilSession\get(), and ilSession\set().

+ Here is the call graph for this function:

◆ isHierarchicalView()

ilObjForumGUI::isHierarchicalView ( )
private
Returns
bool

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

223 {
224 return (
225 $_SESSION['viewmode'] == 'answers' ||
227 ) || !(
228 $_SESSION['viewmode'] == 'date' ||
230 );
231 }

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

◆ isParentObjectCrsOrGrp()

ilObjForumGUI::isParentObjectCrsOrGrp ( )
private

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

5483 {
5484 global $tree;
5485
5486 // check if there a parent-node is a grp or crs
5487 $grp_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
5488 $crs_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
5489
5490 if($grp_ref_id == 0 && $crs_ref_id == 0)
5491 {
5492 return false;
5493 }
5494 return true;
5495 }

References ilObjectGUI\$tree.

Referenced by isUserAllowedToDeactivateNotification().

+ Here is the caller graph for this function:

◆ isTopLevelReplyCommand()

ilObjForumGUI::isTopLevelReplyCommand ( )
private
Returns
bool

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

237 {
238 return in_array(
239 strtolower($this->ctrl->getCmd()),
240 array_map('strtolower', array('createTopLevelPost', 'quoteTopLevelPost', 'saveTopLevelPost'))
241 );
242 }

◆ isUserAllowedToDeactivateNotification()

ilObjForumGUI::isUserAllowedToDeactivateNotification ( )

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

5452 {
5453 if($this->objProperties->getNotificationType() == 'default')
5454 {
5455 return true;
5456 }
5457
5458 if($this->objProperties->isUserToggleNoti() == 0)
5459 {
5460 return true;
5461 }
5462
5463 if($this->isParentObjectCrsOrGrp())
5464 {
5465 global $ilUser;
5466
5467 include_once 'Modules/Forum/classes/class.ilForumNotification.php';
5468
5469 $frm_noti = new ilForumNotification((int) $_GET['ref_id']);
5470 $frm_noti->setUserId($ilUser->getId());
5471
5472 $user_toggle = (int)$frm_noti->isUserToggleNotification();
5473 if($user_toggle == 0)
5474 {
5475 return true;
5476 }
5477 }
5478
5479 return false;
5480 }
Class ilForumNotification.

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

+ Here is the call graph for this function:

◆ isWritingWithPseudonymAllowed()

ilObjForumGUI::isWritingWithPseudonymAllowed ( )
private

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

4066 {
4067 if($this->objProperties->isAnonymized()
4068 && (!$this->is_moderator || ($this->is_moderator && !$this->objProperties->getMarkModeratorPosts())))
4069 {
4070 return true;
4071 }
4072 return false;
4073 }

◆ markPostReadObject()

ilObjForumGUI::markPostReadObject ( )

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

5339 {
5340 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
5341 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5342 }
5343
5344 if ((int)$this->objCurrentTopic->getId() > 0 && (int)$this->objCurrentPost->getId() > 0) {
5345 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $this->objCurrentPost->getThread());
5346
5347 $this->object->markPostRead(
5348 $this->user->getId(), (int)$this->objCurrentTopic->getId(), (int)$this->objCurrentPost->getId()
5349 );
5350 }
5351 $this->viewThreadObject();
5352 }
user()
Definition: user.php:4

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

+ Here is the call graph for this function:

◆ markPostUnreadObject()

ilObjForumGUI::markPostUnreadObject ( )

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

5325 {
5326 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
5327 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5328 }
5329
5330 if ((int)$this->objCurrentPost->getId() > 0) {
5331 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $this->objCurrentPost->getThread());
5332
5333 $this->object->markPostUnread($this->user->getId(), (int)$this->objCurrentPost->getId());
5334 }
5335 $this->viewThreadObject();
5336 }

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

+ Here is the call graph for this function:

◆ mergeThreadsObject()

ilObjForumGUI::mergeThreadsObject ( )

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

5609 {
5610 if(!$this->is_moderator)
5611 {
5612 $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
5613 }
5614
5615 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
5616 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5617 }
5618
5619 $selected_thread_id = 0;
5620 if(isset($_GET['merge_thread_id']) && (int)$_GET['merge_thread_id'])
5621 {
5622 $selected_thread_id = (int)$_GET['merge_thread_id'];
5623 }
5624 else if(isset($_POST['thread_ids']) && count((array)$_POST['thread_ids']) == 1)
5625 {
5626 $selected_thread_id = (int)current($_POST['thread_ids']);
5627 }
5628 else
5629 {
5630 ilUtil::sendInfo($this->lng->txt('select_one'));
5631 $this->showThreadsObject();
5632 return;
5633 }
5634
5635 if($selected_thread_id)
5636 {
5637 $frm = $this->object->Forum;
5638 $frm->setForumId($this->object->getId());
5639 $frm->setForumRefId($this->object->getRefId());
5640
5641 $selected_thread_obj = new ilForumTopic($selected_thread_id);
5642
5643 if(ilForum::_lookupObjIdForForumId($selected_thread_obj->getForumId()) != $frm->getForumId())
5644 {
5645 ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
5646 $this->showThreadsObject();
5647 return;
5648 }
5649
5650 $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
5651
5652 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_liste.html', 'Modules/Forum');
5653
5654 $topicData = $frm->getOneTopic();
5655 if($topicData)
5656 {
5657 include_once 'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
5658 $this->ctrl->setParameter($this, 'merge_thread_id', $selected_thread_id);
5659 $tbl = new ilForumTopicTableGUI($this, 'mergeThreads', '', (int)$_GET['ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
5660 $tbl->setSelectedThread($selected_thread_obj);
5661 $tbl->setMapper($frm)->fetchData();
5662 $tbl->init();
5663 $this->tpl->setVariable('THREADS_TABLE', $tbl->getHTML());
5664 }
5665 else
5666 {
5667 ilUtil::sendFailure($this->lng->txt('select_one'));
5668 $this->showThreadsObject();
5669 return;
5670 }
5671 }
5672 }
Class ilForumTopicTableGUI.
static _lookupObjIdForForumId($a_for_id)
$tbl
Definition: example_048.php:81

References $_GET, $_POST, $tbl, ilForum\_lookupObjIdForForumId(), error(), ilUtil\sendFailure(), ilUtil\sendInfo(), and showThreadsObject().

Referenced by confirmMergeThreadsObject().

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

◆ performDeleteThreadsObject()

ilObjForumGUI::performDeleteThreadsObject ( )

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

1639 {
1640 if (!$this->is_moderator) {
1641 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1642 }
1643
1644 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1645 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1646 }
1647
1648 if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1649 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1650 return $this->showThreadsObject();
1651 }
1652
1653 require_once 'Modules/Forum/classes/class.ilForum.php';
1654 require_once 'Modules/Forum/classes/class.ilObjForum.php';
1655 $forumObj = new ilObjForum($this->object->getRefId());
1656 $this->objProperties->setObjId($forumObj->getId());
1657
1658 $frm = new ilForum();
1659
1660 $success_message = "forums_thread_deleted";
1661 if (count($_POST['thread_ids']) > 1) {
1662 $success_message = "forums_threads_deleted";
1663 }
1664
1665 $threadIds = [];
1666 if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'] )) {
1667 $threadIds = $_POST['thread_ids'];
1668 }
1669
1670 $threads = [];
1671 array_walk($threadIds, function($threadId) use (&$threads) {
1672 $thread = new \ilForumTopic($threadId);
1673 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $thread);
1674
1675 $threads[] = $thread;
1676 });
1677
1678 foreach ($threads as $thread) {
1679 $frm->setForumId($forumObj->getId());
1680 $frm->setForumRefId($forumObj->getRefId());
1681
1682 $first_node = $frm->getFirstPostNode($thread->getId());
1683 if ((int)$first_node['pos_pk']) {
1684 $frm->deletePost($first_node['pos_pk']);
1685 ilUtil::sendInfo($this->lng->txt($success_message), true);
1686 }
1687 }
1688 $this->ctrl->redirect($this, 'showThreads');
1689 }
Class Forum core functions for forum.
Class ilObjForum.

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

+ Here is the call graph for this function:

◆ performMoveThreadsObject()

ilObjForumGUI::performMoveThreadsObject ( )

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

3938 {
3939 if (!$this->is_moderator) {
3940 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3941 }
3942
3943 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3944 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3945 }
3946
3947 $threads2move = $_SESSION['threads2move'];
3948 if (!is_array($threads2move) || !count($threads2move)) {
3949 ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3950 $this->ctrl->redirect($this, 'showThreads');
3951 }
3952
3953 if (!$this->access->checkAccess('read', '', (int)$_POST['frm_ref_id'])) {
3954 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3955 }
3956
3957 $threads = [];
3958 array_walk($threads2move, function($threadId) use (&$threads) {
3959 $thread = new \ilForumTopic($threadId);
3960 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $thread);
3961
3962 $threads[] = $threadId;
3963 });
3964
3965 if (isset($_POST['frm_ref_id']) && (int)$_POST['frm_ref_id']) {
3966 $this->object->Forum->moveThreads(
3967 $threads, $this->object->getRefId(),
3968 $this->ilObjDataCache->lookupObjId((int)$_POST['frm_ref_id'])
3969 );
3970
3971 unset($_SESSION['threads2move']);
3972 ilUtil::sendInfo($this->lng->txt('threads_moved_successfully'), true);
3973 $this->ctrl->redirect($this, 'showThreads');
3974 } else {
3975 ilUtil::sendInfo($this->lng->txt('no_forum_selected'));
3976 $this->moveThreadsObject();
3977 }
3978 }

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

+ Here is the call graph for this function:

◆ performPostActivationObject()

ilObjForumGUI::performPostActivationObject ( )

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

1817 {
1818 if (!$this->is_moderator) {
1819 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1820 }
1821
1822 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1823 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1824 }
1825
1826 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $this->objCurrentPost->getThread());
1827
1828 $this->objCurrentPost->activatePost();
1829 $GLOBALS['ilAppEventHandler']->raise(
1830 'Modules/Forum',
1831 'activatedPost',
1832 array(
1833 'ref_id' => $this->object->getRefId(),
1834 'post' => $this->objCurrentPost
1835 )
1836 );
1837 ilUtil::sendInfo($this->lng->txt('forums_post_was_activated'), true);
1838
1839 $this->viewThreadObject();
1840 }

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

+ Here is the call graph for this function:

◆ prepareFormOutput()

ilObjForumGUI::prepareFormOutput (   $a_text)

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

4794 {
4795 $a_text = str_replace("&lt;", "<", $a_text);
4796 $a_text = str_replace("&gt;", ">", $a_text);
4797 $a_text = ilUtil::prepareFormOutput($a_text);
4798 return $a_text;
4799 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ publishDraftObject()

ilObjForumGUI::publishDraftObject (   $use_replyform = true)

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

2422 {
2423 global $ilUser, $lng;
2424
2425 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2426 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2427 }
2428
2429 if (!$this->access->checkAccess('add_reply', '', $this->object->getRefId())) {
2430 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2431 }
2432
2433 if($this->objCurrentTopic->isClosed())
2434 {
2435 $_GET['action'] = '';
2436 return $this->viewThreadObject();
2437 }
2438
2439 $post_id = $this->objCurrentPost->getId();
2440
2441 $draft_obj = new ilForumPostDraft($ilUser->getId(), $post_id, (int)$_GET['draft_id']);
2442
2443 if($use_replyform)
2444 {
2445 $oReplyEditForm = $this->getReplyEditForm();
2446 if(!$oReplyEditForm->checkInput() && !$draft_obj instanceof ilForumPostDraft)
2447 {
2448 $oReplyEditForm->setValuesByPost();
2449 return $this->viewThreadObject();
2450 }
2451 $post_subject = $oReplyEditForm->getInput('subject');
2452 $post_message = $oReplyEditForm->getInput('message');
2453 $mob_direction = 0;
2454 }
2455 else
2456 {
2457 $post_subject = $draft_obj->getPostSubject();
2458 $post_message = $draft_obj->getPostMessage();
2459 $mob_direction = 1;
2460 }
2461
2462 if($draft_obj->getDraftId() > 0)
2463 {
2464 // init objects
2465 $oForumObjects = $this->getForumObjects();
2466 $frm = $oForumObjects['frm'];
2467 $frm->setMDB2WhereCondition(' top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
2468
2469 // reply: new post
2470 $status = 1;
2471 $send_activation_mail = 0;
2472
2473 if($this->objProperties->isPostActivationEnabled())
2474 {
2475 if(!$this->is_moderator)
2476 {
2477 $status = 0;
2478 $send_activation_mail = 1;
2479 }
2480 else if($this->objCurrentPost->isAnyParentDeactivated())
2481 {
2482 $status = 0;
2483 }
2484 }
2485
2486 $newPost = $frm->generatePost(
2487 $draft_obj->getForumId(),
2488 $draft_obj->getThreadId(),
2489 $ilUser->getId(),
2490 $draft_obj->getPostDisplayUserId(),
2491 ilRTE::_replaceMediaObjectImageSrc($post_message, $mob_direction),
2492 $draft_obj->getPostId(),
2493 (int)$draft_obj->getNotify(),
2494 $this->handleFormInput($post_subject , false),
2495 $draft_obj->getPostUserAlias(),
2496 '',
2497 $status,
2498 $send_activation_mail
2499 );
2500
2501 $this->object->markPostRead($ilUser->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
2502
2503 $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
2504
2505 foreach($uploadedObjects as $mob)
2506 {
2507 ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
2508 ilObjMediaObject::_saveUsage($mob,'frm:html', $newPost);
2509 }
2510 ilForumUtil::saveMediaObjects($post_message, 'frm:html', $newPost, $mob_direction);
2511
2512 if($this->objProperties->isFileUploadAllowed())
2513 {
2514 $file = $_FILES['userfile'];
2515 if(is_array($file) && !empty($file))
2516 {
2517 $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost);
2518 $tmp_file_obj->storeUploadedFile($file);
2519 }
2520
2521 //move files of draft to posts directory
2522 $oFDForum = new ilFileDataForum($this->object->getId(), $newPost);
2523 $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_obj->getDraftId());
2524
2525 $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
2526 $oFDForumDrafts->delete();
2527 }
2528
2530 {
2531 $GLOBALS['ilAppEventHandler']->raise(
2532 'Modules/Forum',
2533 'publishedDraft',
2534 array('draftObj' => $draft_obj,
2535 'obj_id' => $this->object->getId(),
2536 'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
2537 );
2538 }
2539 $draft_obj->deleteDraft();
2540
2541 $GLOBALS['ilAppEventHandler']->raise(
2542 'Modules/Forum',
2543 'createdPost',
2544 array(
2545 'ref_id' => $this->object->getRefId(),
2546 'post' => new ilForumPost($newPost),
2547 'notify_moderators' => (bool)$send_activation_mail
2548 )
2549 );
2550
2551 $message = '';
2552 if(!$this->is_moderator && !$status)
2553 {
2554 $message .= $lng->txt('forums_post_needs_to_be_activated');
2555 }
2556 else
2557 {
2558 $message .= $lng->txt('forums_post_new_entry');
2559 }
2560
2561 $_SESSION['frm'][(int)$_GET['thr_pk']]['openTreeNodes'][] = (int)$this->objCurrentPost->getId();
2562
2563 $this->ctrl->clearParameters($this);
2564 ilUtil::sendSuccess($message, true);
2565 $this->ctrl->setParameter($this, 'pos_pk', $newPost);
2566 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
2567
2568 $this->ctrl->redirect($this, 'viewThread');
2569 }
2570 }
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $_GET, $_SESSION, $file, $GLOBALS, $ilUser, ilObjectGUI\$lng, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), error(), getForumObjects(), getReplyEditForm(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumUtil\saveMediaObjects(), and ilUtil\sendSuccess().

Referenced by publishSelectedDraftObject().

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

◆ publishSelectedDraftObject()

ilObjForumGUI::publishSelectedDraftObject ( )

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

2414 {
2415 if(isset($_GET['draft_id']) && (int)$_GET['draft_id'] > 0)
2416 {
2417 $this->publishDraftObject(false);
2418 }
2419 }
publishDraftObject($use_replyform=true)

References $_GET, and publishDraftObject().

+ Here is the call graph for this function:

◆ quotePostObject()

ilObjForumGUI::quotePostObject ( )

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

2897 {
2898 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2899 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2900 }
2901
2902 if(!is_array($_POST['del_file'])) $_POST['del_file'] = array();
2903
2904 if($this->objCurrentTopic->isClosed())
2905 {
2906 $_GET['action'] = '';
2907 return $this->viewThreadObject();
2908 }
2909
2910 $oReplyEditForm = $this->getReplyEditForm();
2911
2912 // remove mandatory fields
2913 $oReplyEditForm->getItemByPostVar('subject')->setRequired(false);
2914 $oReplyEditForm->getItemByPostVar('message')->setRequired(false);
2915
2916 $oReplyEditForm->checkInput();
2917
2918 // add mandatory fields
2919 $oReplyEditForm->getItemByPostVar('subject')->setRequired(true);
2920 $oReplyEditForm->getItemByPostVar('message')->setRequired(true);
2921
2922 $_GET['action'] = 'showreply';
2923
2924 $this->viewThreadObject();
2925 }

References $_GET, $_POST, error(), and getReplyEditForm().

Referenced by quoteTopLevelPostObject().

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

◆ quoteTopLevelPostObject()

ilObjForumGUI::quoteTopLevelPostObject ( )

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

2408 {
2409 $this->quotePostObject();
2410 return;
2411 }

References quotePostObject().

+ Here is the call graph for this function:

◆ removeFromDeskObject()

ilObjForumGUI::removeFromDeskObject ( )
See also
ilDesktopItemHandling::removeFromDesk()

Implements ilDesktopItemHandling.

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

5563 {
5564 global $ilSetting, $lng;
5565
5566 if((int)$ilSetting->get('disable_my_offers'))
5567 {
5568 $this->showThreadsObject();
5569 return;
5570 }
5571
5572 include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
5574 ilUtil::sendSuccess($lng->txt("removed_from_desktop"));
5575 $this->showThreadsObject();
5576 }
static removeFromDesktop()
Remove item from personal desktop @access public.
global $ilSetting
Definition: privfeed.php:17

References $ilSetting, ilObjectGUI\$lng, ilDesktopItemGUI\removeFromDesktop(), ilUtil\sendSuccess(), and showThreadsObject().

+ Here is the call graph for this function:

◆ restoreFromHistoryObject()

ilObjForumGUI::restoreFromHistoryObject ( )

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

5893 {
5894 $history_id = ((int)$_GET['history_id']);
5895 $history = new ilForumDraftsHistory($history_id);
5896
5897 $draft = $history->rollbackAutosave();
5898
5899 if($draft->getThreadId() == 0 && $draft->getPostId() == 0)
5900 {
5901 $this->ctrl->setParameter($this, 'draft_id', $history->getDraftId());
5902 $this->ctrl->redirect($this, 'editThreadDraft');
5903 }
5904
5905 $this->ctrl->clearParameters($this);
5906 $this->ctrl->setParameter($this, 'pos_pk', $draft->getPostId());
5907 $this->ctrl->setParameter($this, 'thr_pk', $draft->getThreadId());
5908 $this->ctrl->setParameter($this, 'draft_id',$draft->getDraftId());
5909 $this->ctrl->setParameter($this, 'action', 'editdraft');
5910
5911 // create draft backup before redirect!
5912 ilForumPostDraft::createDraftBackup((int)$draft->getDraftId());
5913
5914 $this->ctrl->redirect($this, 'viewThread');
5915 }

References $_GET, and ilForumPostDraft\createDraftBackup().

+ Here is the call graph for this function:

◆ saveThreadSortingObject()

ilObjForumGUI::saveThreadSortingObject ( )

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

5579 {
5580 $_POST['thread_sorting'] ? $thread_sorting = $_POST['thread_sorting'] :$thread_sorting = array();
5581
5582 if (!$this->is_moderator) {
5583 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5584 }
5585
5586 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
5587 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5588 }
5589
5590 array_walk($thread_sorting, function($sortValue, $threadId) {
5591 $this->ensureThreadBelongsToForum((int)$this->object->getId(), new \ilForumTopic($threadId));
5592 });
5593
5594 foreach($thread_sorting as $thr_pk=>$sorting_value)
5595 {
5596 $sorting_value = str_replace(',','.',$sorting_value);
5597 $sorting_value = (float)$sorting_value * 100;
5598 $this->object->setThreadSorting($thr_pk,$sorting_value);
5599 }
5600 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
5601 $this->showThreadsObject();
5602 return true;
5603 }

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

+ Here is the call graph for this function:

◆ saveTopLevelPostObject()

ilObjForumGUI::saveTopLevelPostObject ( )

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

2399 {
2400 $this->savePostObject();
2401 return;
2402 }

◆ setDisplayConfirmPostActivation()

ilObjForumGUI::setDisplayConfirmPostActivation (   $status = 0)

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

1858 {
1859 $this->display_confirm_post_activation = $status;
1860 }

Referenced by askForPostActivationObject().

+ Here is the caller graph for this function:

◆ setSideBlocks()

ilObjForumGUI::setSideBlocks ( )
protected

{}

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

5795 {
5796 $rgt_content = '';
5797 if(!$GLOBALS['ilCtrl']->isAsynch())
5798 {
5799 require_once 'Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
5800 $rgt_content = ilRepositoryObjectSearchGUI::getSearchBlockHTML($this->lng->txt('frm_search'));
5801 }
5802 $this->tpl->setRightContent($rgt_content . $this->getRightColumnHTML());
5803 }
getRightColumnHTML()
Display right column.
static getSearchBlockHTML($a_title)
Get standar search block html.

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

Referenced by showThreadsObject(), and sortThreadsObject().

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

◆ setTopicCreateDefaultValues()

ilObjForumGUI::setTopicCreateDefaultValues ( )
private

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

4306 {
4307 $this->create_topic_form_gui->setValuesByArray(array(
4308 'subject' => '',
4309 'message' => '',
4310 'userfile' => '',
4311 'notify' => 0
4312 ));
4313 }

Referenced by createThreadObject().

+ Here is the caller graph for this function:

◆ showStatisticsObject()

ilObjForumGUI::showStatisticsObject ( )

if globally deactivated, skip!!! intrusion detected

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

1525 {
1527 if (!$this->settings->get('enable_fora_statistics', false)) {
1528 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1529 }
1530
1531 // if no read access -> intrusion detected
1532 if (!$this->access->checkAccess('read', '', (int)$_GET['ref_id'])) {
1533 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1534 }
1535
1536 // if read access and statistics disabled -> intrusion detected
1537 if (!$this->objProperties->isStatisticEnabled()) {
1538 // if write access and statistics disabled -> ok, for forum admin
1539 if ($this->access->checkAccess('write', '', (int)$_GET['ref_id'])) {
1540 ilUtil::sendInfo($this->lng->txt('frm_statistics_disabled_for_participants'));
1541 } else {
1542 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1543 }
1544 }
1545
1546 $this->object->Forum->setForumId($this->object->getId());
1547
1548 require_once 'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
1549
1550 $tbl = new ilForumStatisticsTableGUI($this, 'showStatistics');
1551 $tbl->setId('il_frm_statistic_table_'. (int)$_GET['ref_id']);
1552 $tbl->setTitle($this->lng->txt('statistic'), 'icon_usr.svg', $this->lng->txt('obj_'.$this->object->getType()));
1553
1554 $data = $this->object->Forum->getUserStatistic($this->is_moderator);
1555 $result = array();
1556 $counter = 0;
1557 foreach($data as $row)
1558 {
1559 $result[$counter]['ranking'] = $row[0];
1560 $result[$counter]['login'] = $row[1];
1561 $result[$counter]['lastname'] = $row[2];
1562 $result[$counter]['firstname'] = $row[3];
1563
1564 ++$counter;
1565 }
1566 $tbl->setData($result);
1567
1568 $this->tpl->setContent($tbl->getHTML());
1569 }
$result
Class ilForumStatisticsTableGUI.
settings()
Definition: settings.php:2

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

+ Here is the call graph for this function:

◆ showThreadsObject()

ilObjForumGUI::showThreadsObject ( )

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

679 {
680 $this->getSubTabs('showThreads');
681 $this->setSideBlocks();
682 $this->getCenterColumnHTML();
683 }
getSubTabs($subtab='showThreads')
getCenterColumnHTML()
Get center column.

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

Referenced by cancelMergeThreads(), confirmDeleteThreadDraftsObject(), confirmDeleteThreads(), confirmMergeThreadsObject(), mergeThreadsObject(), performDeleteThreadsObject(), removeFromDeskObject(), saveThreadSortingObject(), and updateThreadObject().

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

◆ showUserObject()

ilObjForumGUI::showUserObject ( )

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

3708 {
3709 // we could actually call ilpublicuserprofilegui directly, this method
3710 // is not needed - but sadly used throughout the forum code
3711 // see above in execute command
3712
3713 include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
3714 $profile_gui = new ilPublicUserProfileGUI((int)$_GET['user']);
3715 $add = $this->getUserProfileAdditional((int)$_GET['ref_id'], (int)$_GET['user']);
3716 $profile_gui->setAdditional($add);
3717 $profile_gui->setBackUrl(\ilUtil::stripSlashes($_GET['backurl']));
3718 $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
3719 }
GUI class for public user profile presentation.

References $_GET, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ sortThreadsObject()

ilObjForumGUI::sortThreadsObject ( )

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

685 {
686 $this->getSubTabs('sortThreads');
687 $this->setSideBlocks();
688 $this->getCenterColumnHTML(true);
689 }

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

+ Here is the call graph for this function:

◆ toggleStickinessObject()

ilObjForumGUI::toggleStickinessObject ( )

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

1892 {
1893 if (!$this->is_moderator) {
1894 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1895 }
1896
1897 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1898 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1899 }
1900
1901 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $this->objCurrentTopic);
1902
1903 if ($this->objCurrentTopic->isSticky()) {
1904 $this->objCurrentTopic->unmakeSticky();
1905 } else {
1906 $this->objCurrentTopic->makeSticky();
1907 }
1908
1909 $this->viewThreadObject();
1910 }

References ensureThreadBelongsToForum(), and error().

+ Here is the call graph for this function:

◆ updateThreadObject()

ilObjForumGUI::updateThreadObject ( )

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

629 {
630 if(!$this->is_moderator)
631 {
632 $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
633 }
634
635 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
636 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
637 }
638
639 if (!$this->objCurrentTopic->getId()) {
640 $this->showThreadsObject();
641 return;
642 }
643
644 $this->ensureThreadBelongsToForum((int)$this->object->getId(), $this->objCurrentTopic);
645
646 $form = $this->getThreadEditingForm($this->objCurrentTopic->getId());
647 if(!$form->checkInput())
648 {
649 $form->setValuesByPost();
650 $this->editThreadObject($this->objCurrentTopic->getId(), $form);
651 return;
652 }
653
654 $this->objCurrentTopic->setSubject($form->getInput('title'));
655 $this->objCurrentTopic->updateThreadTitle();
656
657 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
658 $this->showThreadsObject();
659 }
getThreadEditingForm($a_thread_id)

References ensureThreadBelongsToForum(), error(), getThreadEditingForm(), ilUtil\sendSuccess(), and showThreadsObject().

+ Here is the call graph for this function:

◆ updateUserNotifications()

ilObjForumGUI::updateUserNotifications (   $update_all_users = false)
private

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

4891 {
4892 include_once 'Modules/Forum/classes/class.ilForumNotification.php';
4893
4894 $oParticipants = $this->getParticipantsObject();
4895
4896 $frm_noti = new ilForumNotification($this->object->getRefId());
4897 $moderator_ids = ilForum::_getModerators($this->object->getRefId());
4898
4899 $admin_ids = $oParticipants->getAdmins();
4900 $member_ids = $oParticipants->getMembers();
4901 $tutor_ids = $oParticipants->getTutors();
4902
4903 $all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
4904 $all_forum_users= array_unique($all_forum_users);
4905
4906 $all_notis = $frm_noti->read();
4907
4908 foreach($all_forum_users as $user_id)
4909 {
4910 $frm_noti->setUserId($user_id);
4911
4912 $frm_noti->setAdminForce(1);
4913 $frm_noti->setUserToggle($this->objProperties->isUserToggleNoti());
4914
4915 if(array_key_exists($user_id, $all_notis) && $update_all_users)
4916 {
4917 $frm_noti->update();
4918 }
4919 else if($frm_noti->existsNotification() == false)
4920 {
4921 $frm_noti->insertAdminForce();
4922 }
4923 }
4924 }
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)

References ilForum\_getModerators().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjForumGUI::$access

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

◆ $confirmation_gui_html

ilObjForumGUI::$confirmation_gui_html = ''
private

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

◆ $create_form_gui

ilObjForumGUI::$create_form_gui
private

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

◆ $create_topic_form_gui

ilObjForumGUI::$create_topic_form_gui
private

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

Referenced by autosaveThreadDraftAsyncObject().

◆ $display_confirm_post_activation

ilObjForumGUI::$display_confirm_post_activation = 0
private

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

Referenced by displayConfirmPostActivation().

◆ $error

ilObjForumGUI::$error

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

◆ $forum_overview_setting

ilObjForumGUI::$forum_overview_setting = null
private

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

◆ $forumObjects

ilObjForumGUI::$forumObjects
private

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

Referenced by getForumObjects().

◆ $hideToolbar

ilObjForumGUI::$hideToolbar = false
private

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

Referenced by hideToolbar().

◆ $ilias

ilObjForumGUI::$ilias

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

◆ $ilObjDataCache

ilObjForumGUI::$ilObjDataCache

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

Referenced by cloneWizardPageObject().

◆ $is_moderator

ilObjForumGUI::$is_moderator = false
private

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

◆ $modal_history

ilObjForumGUI::$modal_history = ''

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

◆ $notificationSettingsForm

ilObjForumGUI::$notificationSettingsForm
private

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

◆ $objCurrentPost

ilObjForumGUI::$objCurrentPost
private

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

◆ $objCurrentTopic

ilObjForumGUI::$objCurrentTopic
private

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

◆ $object

ilObjForumGUI::$object

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

Referenced by getForumObjects().

◆ $objProperties

ilObjForumGUI::$objProperties

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

◆ $replyEditForm

ilObjForumGUI::$replyEditForm
private

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

Referenced by getReplyEditForm().

◆ $settings

ilObjForumGUI::$settings

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

◆ $user

ilObjForumGUI::$user

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


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