ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjForumGUI Class Reference

Class ilObjForumGUI. More...

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

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
 
 ensureThreadBelongsToForum ($objId, \ilForumTopic $thread)
 
 executeCommand ()
 
 infoScreenObject ()
 
 editThreadObject ($a_thread_id, ilPropertyFormGUI $form=null)
 
 updateThreadObject ()
 
 markAllReadObject ()
 
 showThreadsObject ()
 
 sortThreadsObject ()
 
 getSubTabs ($subtab='showThreads')
 
 getContent ()
 
 cancelObject ()
 
 showStatisticsObject ()
 
 performDeleteThreadsObject ()
 
 confirmDeleteThreads ()
 
 confirmDeleteThreadDraftsObject ()
 
 performPostActivationObject ()
 
 askForPostActivationObject ()
 
 setDisplayConfirmPostActivation ($status=0)
 
 displayConfirmPostActivation ()
 
 toggleThreadNotificationObject ()
 
 toggleStickinessObject ()
 
 cancelPostObject ()
 
 cancelDraftObject ()
 
 getActivationFormHTML ()
 
 getCensorshipFormHTML ()
 
 createTopLevelPostObject ()
 
 saveTopLevelPostObject ()
 
 quoteTopLevelPostObject ()
 
 publishSelectedDraftObject ()
 
 publishDraftObject ($use_replyform=true)
 
 quotePostObject ()
 
 showUserObject ()
 
 performThreadsActionObject ()
 
 performMoveThreadsObject ()
 
 cancelMoveThreadsObject ()
 
 moveThreadsObject ()
 
 deleteThreadDraftsObject ()
 
 createThreadObject ()
 
 publishThreadDraftObject ($a_prevent_redirect=false)
 
 addThreadObject ($a_prevent_redirect=false)
 
 enableForumNotificationObject ()
 
 disableForumNotificationObject ()
 
 checkEnableColumnEdit ()
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 cloneWizardPageObject ()
 
 addLocatorItems ()
 
 handleFormInput ($a_text, $a_stripslashes=true)
 
 prepareFormOutput ($a_text)
 
 infoScreen ()
 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...
 
 markPostUnreadObject ()
 
 markPostReadObject ()
 
 isUserAllowedToDeactivateNotification ()
 
 isParentObjectCrsOrGrp ()
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
 saveThreadSortingObject ()
 
 mergeThreadsObject ()
 
 confirmMergeThreadsObject ()
 
 performMergeThreadsObject ()
 
 cancelMergeThreads ()
 
 deliverDraftZipFileObject ()
 
 deliverZipFileObject ()
 
 editThreadDraftObject ($form=null)
 
 restoreFromHistoryObject ()
 
 saveThreadAsDraftObject ()
 
 updateThreadDraftObject ()
 
 editDraftObject ()
 
 autosaveDraftAsyncObject ()
 
 autosaveThreadDraftAsyncObject ()
 
 checkDraftAccess ($draft_id)
 
 doHistoryCheck ($draft_id)
 
 doCaptchaCheck ()
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Static Public Member Functions

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

Data Fields

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

Protected Member Functions

 initSessionStorage ()
 
 addAutosave (ilPropertyFormGUI $form)
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 
 getEditFormCustomValues (array &$a_values)
 
 updateCustom (ilPropertyFormGUI $a_form)
 
 renderDraftContent ($render_drafts, $node, $edit_draft_id=null)
 
 renderPostContent (ilForumPost $node, $Start, $z)
 
 afterSave (ilObject $forumObj)
 
 getTabs ()
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 
 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 public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Private Member Functions

 isHierarchicalView ()
 
 isTopLevelReplyCommand ()
 
 getThreadEditingForm ($a_thread_id)
 
 initForumCreateForm ($object_type)
 
 getReplyEditForm ()
 
 hideToolbar ($a_flag=null)
 
 getForumObjects ()
 
 getModifiedReOnSubject ($on_reply=false)
 
 isWritingWithPseudonymAllowed ()
 
 initTopicCreateForm ($edit_draft=false)
 
 setTopicCreateDefaultValues ()
 
 renderSplitButton ($is_post=true, ilForumPost $node, $Start=0, ilForumPostDraft $draft=null)
 

Private Attributes

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

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

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

123  {
124  global $DIC;
125 
126  $this->ctrl = $DIC->ctrl();
127  $this->ctrl->saveParameter($this, array('ref_id', 'cmdClass'));
128 
129  $this->tpl = $DIC->ui()->mainTemplate();
130  $this->lng = $DIC->language();
131 
132  $this->access = $DIC->access();
133  $this->ilObjDataCache = $DIC['ilObjDataCache'];
134  $this->tabs = $DIC->tabs();
135  $this->error = $DIC['ilErr'];
136  $this->ilNavigationHistory = $DIC['ilNavigationHistory'];
137  $this->user = $DIC->user();
138  $this->settings = $DIC->settings();
139  $this->toolbar = $DIC->toolbar();
140  $this->repositoryTree = $DIC->repositoryTree();
141  $this->ilHelp = $DIC['ilHelp'];
142  $this->rbac = $DIC->rbac();
143  $this->locator = $DIC['ilLocator'];
144 
145  $this->type = 'frm';
146  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
147 
148  $this->lng->loadLanguageModule('forum');
149 
150  $this->initSessionStorage();
151 
152  // Forum properties
153  $this->objProperties = ilForumProperties::getInstance($this->ilObjDataCache->lookupObjId($_GET['ref_id']));
154 
155  // Stored due to performance issues
156  $this->is_moderator = $this->access->checkAccess('moderate_frm', '', $_GET['ref_id']);
157 
158  // Model of current topic/thread
159  $this->objCurrentTopic = new ilForumTopic((int) $_GET['thr_pk'], $this->is_moderator);
160 
161  // Model of current post
162  $this->objCurrentPost = new ilForumPost((int) $_GET['pos_pk'], $this->is_moderator);
163 
164  $this->forum_overview_setting = $this->settings->get('forum_overview');
165  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
static getInstance($a_obj_id=0)
Online help application class.
Navigation History of Repository Items.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

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

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

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

1253  {
1254  global $DIC;
1255 
1256  $ilAccess = $DIC->access();
1257  $lng = $DIC->language();
1258  $ilErr = $DIC['ilErr'];
1259 
1260  if ($ilAccess->checkAccess('read', '', $a_target)) {
1261  if ($a_thread != 0) {
1262  $objTopic = new ilForumTopic($a_thread);
1263  if ($objTopic->getFrmObjId() &&
1264  $objTopic->getFrmObjId() != ilObject::_lookupObjectId($a_target)) {
1265  $ref_ids = ilObject::_getAllReferences($objTopic->getFrmObjId());
1266  foreach ($ref_ids as $ref_id) {
1267  if ($ilAccess->checkAccess('read', '', $ref_id)) {
1268  $new_ref_id = $ref_id;
1269  break;
1270  }
1271  }
1272 
1273  if (isset($new_ref_id) && $new_ref_id != $a_target) {
1274  ilUtil::redirect(ILIAS_HTTP_PATH . "/goto.php?target=frm_" . $new_ref_id . "_" . $a_thread . "_" . $a_posting);
1275  }
1276  }
1277 
1278  $_GET['ref_id'] = $a_target;
1279  $_GET['pos_pk'] = $a_posting;
1280  $_GET['thr_pk'] = $a_thread;
1281  $_GET['anchor'] = $a_posting;
1282  $_GET['cmdClass'] = 'ilObjForumGUI';
1283  $_GET['cmd'] = 'viewThread';
1284  $_GET['baseClass'] = 'ilRepositoryGUI';
1285 
1286  include_once('ilias.php');
1287  exit();
1288  } else {
1289  $_GET['ref_id'] = $a_target;
1290  $_GET['baseClass'] = 'ilRepositoryGUI';
1291  include_once('ilias.php');
1292  exit();
1293  }
1294  } elseif ($ilAccess->checkAccess('read', '', ROOT_FOLDER_ID)) {
1295  $_GET['target'] = '';
1296  $_GET['ref_id'] = ROOT_FOLDER_ID;
1297  ilUtil::sendInfo(sprintf(
1298  $lng->txt('msg_no_perm_read_item'),
1300  ), true);
1301  $_GET['baseClass'] = 'ilRepositoryGUI';
1302  include('ilias.php');
1303  exit();
1304  }
1305 
1306  $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
1307  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjectId($a_ref_id)
lookup object id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupObjId($a_id)
static redirect($a_script)
+ Here is the call graph for this function:

◆ addAutosave()

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

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

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

Referenced by getCensorshipFormHTML(), and initTopicCreateForm().

197  {
200 
201  $this->tpl->addJavascript('./Modules/Forum/js/autosave.js');
202  $autosave_cmd = 'autosaveDraftAsync';
203  if ($this->objCurrentPost->getId() == 0 && $this->objCurrentPost->getThreadId() == 0) {
204  $autosave_cmd = 'autosaveThreadDraftAsync';
205  }
206  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
207  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
208  $draft_id = $_GET['draft_id'] > 0 ? $_GET['draft_id']: 0;
209  $this->ctrl->setParameter($this, 'draft_id', $draft_id);
210  $this->ctrl->setParameter($this, 'action', $_GET['action']);
211  $this->tpl->addOnLoadCode("il.Language.setLangVar('saving', " . json_encode($this->lng->txt('saving')) . ");");
212 
213  $this->tpl->addOnLoadCode('il.ForumDraftsAutosave.init(' . json_encode(array(
214  'loading_img_src' => ilUtil::getImagePath('loader.svg'),
215  'draft_id' => $draft_id,
216  'interval' => $interval * 1000,
217  'url' => $this->ctrl->getFormAction($this, $autosave_cmd, '', true, false),
218  'selectors' => array(
219  'form' => '#form_' . $form->getId()
220  )
221  )) . ');');
222  }
223  }
$_GET["client_id"]
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getId()
Get Id.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjForumGUI::addLocatorItems ( )

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

References object.

3961  {
3962  if ($this->object instanceof ilObject) {
3963  $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ''), '', $this->object->getRefId());
3964  }
3965  }
Create new PHPExcel object
obj_idprivate

◆ addThreadObject()

ilObjForumGUI::addThreadObject (   $a_prevent_redirect = false)

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

References $_POST, $file, $GLOBALS, ilObjMediaObject\_exists(), ilRTE\_getMediaObjects(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), array, doCaptchaCheck(), ilForumUtil\getPublicUserAlias(), handleFormInput(), initTopicCreateForm(), ilForumPostDraft\isSavePostDraftAllowed(), isWritingWithPseudonymAllowed(), ilForumPostDraft\newInstanceByDraftId(), object, ilUtil\sendSuccess(), ilFileDataForum\storeUploadedFile(), and user().

3737  {
3738  $frm = $this->object->Forum;
3739  $frm->setForumId($this->object->getId());
3740  $frm->setForumRefId($this->object->getRefId());
3741 
3742  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
3743  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3744  }
3745 
3746  $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3747 
3748  $topicData = $frm->getOneTopic();
3749 
3750  $this->initTopicCreateForm();
3751  if ($this->create_topic_form_gui->checkInput()) {
3752  $this->doCaptchaCheck();
3753 
3754  if ($this->isWritingWithPseudonymAllowed()) {
3755  if (!strlen($this->create_topic_form_gui->getInput('alias'))) {
3756  $user_alias = $this->lng->txt('forums_anonymous');
3757  } else {
3758  $user_alias = $this->create_topic_form_gui->getInput('alias');
3759  }
3760  $display_user_id = 0;
3761  } else {
3762  $user_alias = $this->user->getLogin();
3763  $display_user_id = $this->user->getId();
3764  }
3765  $user_alias = ilForumUtil::getPublicUserAlias($this->create_topic_form_gui->getInput('alias'), $this->objProperties->isAnonymized());
3766  $status = 1;
3767  if (
3768  $this->objProperties->isPostActivationEnabled() &&
3769  !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
3770  ) {
3771  $status = 0;
3772  }
3773 
3774  $newThread = new ilForumTopic(0, true, true);
3775  $newThread->setForumId($topicData['top_pk']);
3776  $newThread->setThrAuthorId($this->user->getId());
3777  $newThread->setDisplayUserId($display_user_id);
3778  $newThread->setSubject($this->handleFormInput($this->create_topic_form_gui->getInput('subject'), false));
3779  $newThread->setUserAlias($user_alias);
3780 
3781  $newPost = $frm->generateThread(
3782  $newThread,
3783  ilRTE::_replaceMediaObjectImageSrc($this->create_topic_form_gui->getInput('message'), 0),
3784  $this->create_topic_form_gui->getItemByPostVar('notify') ? (int) $this->create_topic_form_gui->getInput('notify') : 0,
3785  0, // #19980
3786  $status
3787  );
3788 
3789  if ($this->objProperties->isFileUploadAllowed()) {
3790  $file = $_FILES['userfile'];
3791  if (is_array($file) && !empty($file)) {
3792  $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost);
3793  $tmp_file_obj->storeUploadedFile($file);
3794  }
3795  }
3796 
3797  // Visit-Counter
3798  $frm->setDbTable('frm_data');
3799  $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
3800  $frm->updateVisits($topicData['top_pk']);
3801 
3802  $frm->setMDB2WhereCondition(
3803  'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
3804  array('integer', 'text'),
3805  array($topicData['top_pk'], $this->create_topic_form_gui->getInput('subject'))
3806  );
3807 
3808  // copy temporary media objects (frm~)
3809  include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
3810  $mediaObjects = ilRTE::_getMediaObjects($this->create_topic_form_gui->getInput('message'), 0);
3811  foreach ($mediaObjects as $mob) {
3812  if (ilObjMediaObject::_exists($mob)) {
3813  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
3814  ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
3815  }
3816  }
3817 
3819  if (isset($_POST['draft_id']) && $_POST['draft_id'] > 0) {
3820  $draft_obj = ilForumPostDraft::newInstanceByDraftId($_POST['draft_id']);
3821  //delete history
3822  $history_obj = new ilForumDraftsHistory();
3823  $history_obj->deleteHistoryByDraftIds(array($draft_obj->getDraftId()));
3824 
3825  if ($this->objProperties->isFileUploadAllowed()) {
3826  //move files of draft to posts directory
3827  $oFDForum = new ilFileDataForum($this->object->getId(), $newPost);
3828  $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_obj->getDraftId());
3829 
3830  $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
3831  }
3832  $draft_obj->deleteDraft();
3833  }
3834  }
3835  $GLOBALS['ilAppEventHandler']->raise(
3836  'Modules/Forum',
3837  'createdPost',
3838  array(
3839  'ref_id' => $this->object->getRefId(),
3840  'post' => new ilForumPost($newPost),
3841  'notify_moderators' => !$status
3842  )
3843  );
3844 
3845  if (!$a_prevent_redirect) {
3846  ilUtil::sendSuccess($this->lng->txt('forums_thread_new_entry'), true);
3847  $this->ctrl->redirect($this);
3848  } else {
3849  return $newPost;
3850  }
3851  } else {
3852  $this->create_topic_form_gui->setValuesByPost();
3853 
3854  if (!$this->objProperties->isAnonymized()) {
3855  $this->create_topic_form_gui->getItemByPostVar('alias')->setValue($this->user->getLogin());
3856  }
3857 
3858  return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
3859  }
3860  }
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getPublicUserAlias($user_alias, $is_anonymized=false)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
This class handles all operations on files for the drafts of a forum object.
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
user()
Definition: user.php:4
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
initTopicCreateForm($edit_draft=false)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
This class handles all operations on files for the forum object.
handleFormInput($a_text, $a_stripslashes=true)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
$_POST["username"]
storeUploadedFile($files)
Store uploaded files in filesystem.
+ Here is the call graph for this function:

◆ addToDeskObject()

ilObjForumGUI::addToDeskObject ( )
See also
ilDesktopItemHandling::addToDesk()

Implements ilDesktopItemHandling.

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

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

4164  {
4165  if ((int) $this->settings->get('disable_my_offers')) {
4166  $this->showThreadsObject();
4167  return;
4168  }
4169 
4170  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4172  ilUtil::sendSuccess($this->lng->txt("added_to_desktop"));
4173  $this->showThreadsObject();
4174  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static addToDesktop()
Add desktop item public.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ afterSave()

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

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

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

1146  {
1147  ilUtil::sendSuccess($this->lng->txt('frm_added'), true);
1148  $this->ctrl->setParameter($this, 'ref_id', $forumObj->getRefId());
1149  ilUtil::redirect($this->ctrl->getLinkTarget($this, 'createThread', '', false, false));
1150  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getRefId()
get reference id public
static redirect($a_script)
+ Here is the call graph for this function:

◆ askForPostActivationObject()

ilObjForumGUI::askForPostActivationObject ( )

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

References setDisplayConfirmPostActivation().

1497  {
1498  if (!$this->is_moderator) {
1499  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1500  }
1501 
1502  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1503  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1504  }
1505 
1506  $this->setDisplayConfirmPostActivation(true);
1507 
1508  $this->viewThreadObject();
1509  }
setDisplayConfirmPostActivation($status=0)
+ Here is the call graph for this function:

◆ autosaveDraftAsyncObject()

ilObjForumGUI::autosaveDraftAsyncObject ( )

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

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

4961  {
4962  if ($this->user->isAnonymous() || $_GET['action'] == 'ready_showreply') {
4963  exit();
4964  }
4965 
4966  $reponse = new stdClass();
4967  $reponse->draft_id = 0;
4968 
4970  $replyform = $this->getReplyEditForm();
4971  $current_post_id =$this->objCurrentPost->getId();
4972 
4973  $replyform->checkInput();
4974 
4975  $form_autosave_values['subject'] = $replyform->getInput('subject');
4976  $form_autosave_values['message'] = $replyform->getInput('message');
4977  $form_autosave_values['notify'] = $replyform->getInput('notify');
4978  $form_autosave_values['alias'] = $replyform->getInput('alias');
4979 
4980  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
4981  $draft_id = (int) $_GET['draft_id'];
4982  } else {
4983  $draft_id = $replyform->getInput('draft_id');
4984  }
4985  $user_alias = ilForumUtil::getPublicUserAlias($form_autosave_values['alias'], $this->objProperties->isAnonymized());
4986 
4987  if ((int) $draft_id > 0) {
4988  if ($_GET['action'] == 'showreply') {
4989  $draftObj = ilForumPostDraft::newInstanceByDraftId((int) $draft_id);
4990  $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
4991  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
4992 
4993  $draftObj->setPostUserAlias($user_alias);
4994  $draftObj->setNotify((int) $form_autosave_values['notify']);
4995  $draftObj->setUpdateUserId($this->user->getId());
4996  $draftObj->setPostAuthorId($this->user->getId());
4997  $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
4998 
4999  $draftObj->updateDraft();
5000 
5001  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
5002  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
5003  $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
5004 
5005  foreach ($uploadedObjects as $mob) {
5006  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
5007  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5008  }
5009 
5010  foreach ($oldMediaObjects as $mob) {
5011  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5012  }
5013 
5014  foreach ($curMediaObjects as $mob) {
5015  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5016  }
5017  } else {
5018  $draftObj = new ilForumDraftsHistory();
5019  $draftObj->setDraftId((int) $draft_id);
5020  $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
5021  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
5022  $draftObj->addDraftToHistory();
5023 
5024  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
5025  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
5026  $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
5027 
5028  foreach ($uploadedObjects as $mob) {
5029  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
5030  ilObjMediaObject::_saveUsage($mob, ilForumDraftsHistory::MEDIAOBJECT_TYPE, $draftObj->getHistoryId());
5031  }
5032 
5033  foreach ($oldMediaObjects as $mob) {
5034  ilObjMediaObject::_saveUsage($mob, ilForumDraftsHistory::MEDIAOBJECT_TYPE, $draftObj->getHistoryId());
5035  }
5036 
5037  foreach ($curMediaObjects as $mob) {
5038  ilObjMediaObject::_saveUsage($mob, ilForumDraftsHistory::MEDIAOBJECT_TYPE, $draftObj->getHistoryId());
5039  }
5040  }
5041  } else {
5042  $draftObj = new ilForumPostDraft();
5043  $draftObj->setForumId(ilObjForum::lookupForumIdByRefId($this->ref_id));
5044  $draftObj->setThreadId($this->objCurrentTopic->getId());
5045  $draftObj->setPostId($current_post_id);
5046 
5047  $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
5048  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
5049 
5050  $draftObj->setPostUserAlias($user_alias);
5051  $draftObj->setNotify((int) $form_autosave_values['notify']);
5052  $draftObj->setPostAuthorId($this->user->getId());
5053  $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
5054  $draftObj->saveDraft();
5055 
5056  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
5057  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
5058  $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
5059 
5060  foreach ($uploadedObjects as $mob) {
5061  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
5062  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5063  }
5064 
5065  foreach ($oldMediaObjects as $mob) {
5066  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5067  }
5068 
5069  foreach ($curMediaObjects as $mob) {
5070  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5071  }
5072  }
5073  }
5074 
5075  $reponse->draft_id = $draftObj->getDraftId();
5076  echo json_encode($reponse);
5077  exit();
5078  }
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
Class ilForumPostDraft.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static getPublicUserAlias($user_alias, $is_anonymized=false)
$_GET["client_id"]
static lookupForumIdByRefId($ref_id)
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
user()
Definition: user.php:4
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
handleFormInput($a_text, $a_stripslashes=true)
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
+ Here is the call graph for this function:

◆ autosaveThreadDraftAsyncObject()

ilObjForumGUI::autosaveThreadDraftAsyncObject ( )

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

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

5081  {
5082  if ($this->user->isAnonymous() || $_GET['action'] == 'ready_showreply') {
5083  exit();
5084  }
5085 
5086  $reponse = new stdClass();
5087  $reponse->draft_id = 0;
5088 
5090  $this->initTopicCreateForm();
5091  $replyform = $this->create_topic_form_gui;
5092  $current_post_id = 0;
5093 
5094 
5095  $replyform->checkInput();
5096 
5097  $form_autosave_values['subject'] = $replyform->getInput('subject');
5098  $form_autosave_values['message'] = $replyform->getInput('message');
5099  $form_autosave_values['notify'] = $replyform->getInput('notify');
5100  $form_autosave_values['alias'] = $replyform->getInput('alias');
5101 
5102  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
5103  $draft_id = (int) $_GET['draft_id'];
5104  } else {
5105  $draft_id = $replyform->getInput('draft_id');
5106  }
5107  $user_alias = ilForumUtil::getPublicUserAlias($form_autosave_values['alias'], $this->objProperties->isAnonymized());
5108  if ((int) $draft_id > 0) {
5109  if ($_GET['action'] == 'showreply') {
5110  $draftObj = ilForumPostDraft::newInstanceByDraftId((int) $draft_id);
5111  $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
5112  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
5113  $draftObj->setPostUserAlias($user_alias);
5114  $draftObj->setNotify((int) $form_autosave_values['notify']);
5115  $draftObj->setUpdateUserId($this->user->getId());
5116  $draftObj->setPostAuthorId($this->user->getId());
5117  $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
5118 
5119  $draftObj->updateDraft();
5120 
5121  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
5122  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
5123  $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
5124 
5125  foreach ($uploadedObjects as $mob) {
5126  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
5127  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5128  }
5129 
5130  foreach ($oldMediaObjects as $mob) {
5131  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5132  }
5133 
5134  foreach ($curMediaObjects as $mob) {
5135  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5136  }
5137  } else {
5138  $draftObj = new ilForumDraftsHistory();
5139  $draftObj->setDraftId((int) $draft_id);
5140  $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
5141  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
5142  $draftObj->addDraftToHistory();
5143 
5144  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
5145  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
5146  $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
5147 
5148  foreach ($uploadedObjects as $mob) {
5149  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
5150  ilObjMediaObject::_saveUsage($mob, ilForumDraftsHistory::MEDIAOBJECT_TYPE, $draftObj->getHistoryId());
5151  }
5152 
5153  foreach ($oldMediaObjects as $mob) {
5154  ilObjMediaObject::_saveUsage($mob, ilForumDraftsHistory::MEDIAOBJECT_TYPE, $draftObj->getHistoryId());
5155  }
5156 
5157  foreach ($curMediaObjects as $mob) {
5158  ilObjMediaObject::_saveUsage($mob, ilForumDraftsHistory::MEDIAOBJECT_TYPE, $draftObj->getHistoryId());
5159  }
5160  }
5161  } else {
5162  $draftObj = new ilForumPostDraft();
5163  $draftObj->setForumId(ilObjForum::lookupForumIdByRefId($this->ref_id));
5164  $draftObj->setThreadId($this->objCurrentTopic->getId());
5165  $draftObj->setPostId($current_post_id);
5166 
5167  $draftObj->setPostSubject($this->handleFormInput($form_autosave_values['subject'], false));
5168  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($form_autosave_values['message'], 0));
5169 
5170  $draftObj->setPostUserAlias($user_alias);
5171  $draftObj->setNotify((int) $form_autosave_values['notify']);
5172  $draftObj->setPostAuthorId($this->user->getId());
5173  $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
5174  $draftObj->saveDraft();
5175 
5176  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
5177  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draftObj->getDraftId());
5178  $curMediaObjects = ilRTE::_getMediaObjects($form_autosave_values['message'], 0);
5179 
5180  foreach ($uploadedObjects as $mob) {
5181  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
5182  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5183  }
5184 
5185  foreach ($oldMediaObjects as $mob) {
5186  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5187  }
5188 
5189  foreach ($curMediaObjects as $mob) {
5190  ilObjMediaObject::_saveUsage($mob, ilForumPostDraft::MEDIAOBJECT_TYPE, $draftObj->getDraftId());
5191  }
5192  }
5193  }
5194 
5195  $reponse->draft_id = $draftObj->getDraftId();
5196  echo json_encode($reponse);
5197  exit();
5198  }
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
Class ilForumPostDraft.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static getPublicUserAlias($user_alias, $is_anonymized=false)
$_GET["client_id"]
static lookupForumIdByRefId($ref_id)
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
user()
Definition: user.php:4
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
initTopicCreateForm($edit_draft=false)
handleFormInput($a_text, $a_stripslashes=true)
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
+ Here is the call graph for this function:

◆ cancelDraftObject()

ilObjForumGUI::cancelDraftObject ( )

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

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

1573  {
1574  $_GET['action'] = '';
1575  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
1577  $history_obj = new ilForumDraftsHistory();
1578  $history_obj->getFirstAutosaveByDraftId((int) $_GET['draft_id']);
1579  $draft = ilForumPostDraft::newInstanceByDraftId((int) $_GET['draft_id']);
1580  $draft->setPostSubject($history_obj->getPostSubject());
1581  $draft->setPostMessage($history_obj->getPostMessage());
1582 
1584  $history_obj->getPostMessage(),
1586  $history_obj->getHistoryId(),
1588  $draft->getDraftId()
1589  );
1590 
1591  $draft->updateDraft();
1592 
1593  $history_obj->deleteHistoryByDraftIds(array($draft->getDraftId()));
1594  }
1595  }
1596  $this->ctrl->clearParameters($this);
1597  $this->viewThreadObject();
1598  }
$_GET["client_id"]
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ cancelMergeThreads()

ilObjForumGUI::cancelMergeThreads ( )

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

References showThreadsObject().

4373  {
4374  $this->showThreadsObject();
4375  }
+ Here is the call graph for this function:

◆ cancelMoveThreadsObject()

ilObjForumGUI::cancelMoveThreadsObject ( )

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

References $_SESSION.

3318  {
3319  unset($_SESSION['threads2move']);
3320  $this->ctrl->redirect($this, 'showThreads');
3321  }
$_SESSION["AccountId"]

◆ cancelObject()

ilObjForumGUI::cancelObject ( )

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

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

1137  {
1138  ilUtil::sendInfo($this->lng->txt('msg_cancel'), true);
1139  ilUtil::redirect('ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=' . $_GET['ref_id']);
1140  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static redirect($a_script)
+ Here is the call graph for this function:

◆ cancelPostObject()

ilObjForumGUI::cancelPostObject ( )

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

References $_GET, $_POST, array, and ilForumPostDraft\newInstanceByDraftId().

1562  {
1563  $_GET['action'] = '';
1564  if (isset($_POST['draft_id']) && (int) $_POST['draft_id'] > 0) {
1565  $draft = ilForumPostDraft::newInstanceByDraftId((int) $_POST['draft_id']);
1566  $draft->deleteDraftsByDraftIds(array( (int) $_POST['draft_id']));
1567  }
1568 
1569  $this->viewThreadObject();
1570  }
$_GET["client_id"]
static newInstanceByDraftId($draft_id)
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ checkDraftAccess()

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

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

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

Referenced by editDraftObject().

5416  {
5417  $draft_obj = ilForumPostDraft::newInstanceByDraftId($draft_id);
5418 
5419  if (!$this->access->checkAccess('add_reply', '', (int) $_GET['ref_id']) ||
5420  $this->user->isAnonymous() ||
5421  ($draft_obj instanceof ilForumPostDraft && $this->user->getId() != $draft_obj->getPostAuthorId())) {
5422  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
5423  }
5424  return true;
5425  }
Class ilForumPostDraft.
$_GET["client_id"]
user()
Definition: user.php:4
static newInstanceByDraftId($draft_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkEnableColumnEdit()

ilObjForumGUI::checkEnableColumnEdit ( )

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

3895  {
3896  return false;
3897  }

◆ cloneWizardPageObject()

ilObjForumGUI::cloneWizardPageObject ( )

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

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

3917  {
3918  if (!$_POST['clone_source']) {
3919  ilUtil::sendInfo($this->lng->txt('select_one'));
3920  if (isset($_SESSION['wizard_search_title'])) {
3921  $this->searchCloneSourceObject();
3922  } else {
3923  $this->createObject();
3924  }
3925  return false;
3926  }
3927  $source_id = $_POST['clone_source'];
3928 
3929  $new_type = $_REQUEST['new_type'];
3930  $this->ctrl->setParameter($this, 'clone_source', (int) $_POST['clone_source']);
3931  $this->ctrl->setParameter($this, 'new_type', $new_type);
3932 
3933  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.frm_wizard_page.html', 'Modules/Forum');
3934  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this));
3935  $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_' . $new_type . '.svg'));
3936  $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_' . $new_type));
3937  $this->tpl->setVariable('TXT_DUPLICATE', $this->lng->txt('frm_wizard_page'));
3938  $this->tpl->setVariable('INFO_THREADS', $this->lng->txt('fmr_copy_threads_info'));
3939  $this->tpl->setVariable('THREADS', $this->lng->txt('forums_threads'));
3940 
3941  $forum_id = $this->ilObjDataCache->lookupObjId((int) $_POST['clone_source']);
3942  $threads = ilForum::_getThreads($forum_id, ilForum::SORT_TITLE);
3943  foreach ($threads as $thread_id => $title) {
3944  $this->tpl->setCurrentBlock('thread_row');
3945  $this->tpl->setVariable('CHECK_THREAD', ilUtil::formCheckbox(0, 'cp_options[' . $source_id . '][threads][]', $thread_id));
3946  $this->tpl->setVariable('NAME_THREAD', $title);
3947  $this->tpl->parseCurrentBlock();
3948  }
3949  $this->tpl->setVariable('SELECT_ALL', $this->lng->txt('select_all'));
3950  $this->tpl->setVariable('JS_FIELD', 'cp_options[' . $source_id . '][threads]');
3951  $this->tpl->setVariable('BTN_COPY', $this->lng->txt('obj_' . $new_type . '_duplicate'));
3952  if (isset($_SESSION['wizard_search_title'])) {
3953  $this->tpl->setVariable('BACK_CMD', 'searchCloneSource');
3954  } else {
3955  $this->tpl->setVariable('BACK_CMD', 'create');
3956  }
3957  $this->tpl->setVariable('BTN_BACK', $this->lng->txt('btn_back'));
3958  }
const SORT_TITLE
$_SESSION["AccountId"]
createObject()
create new object form
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _getThreads($a_obj_id, $a_sort_mode=self::SORT_DATE)
Get thread infos of object.
$_POST["username"]
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
+ Here is the call graph for this function:

◆ confirmDeleteThreadDraftsObject()

ilObjForumGUI::confirmDeleteThreadDraftsObject ( )

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

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

1404  {
1405  if (!isset($_POST['draft_ids']) || !is_array($_POST['draft_ids'])) {
1406  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1407  return $this->showThreadsObject();
1408  }
1409 
1410  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
1411  $c_gui = new ilConfirmationGUI();
1412 
1413  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'deleteThreadDrafts'));
1414  $c_gui->setHeaderText($this->lng->txt('sure_delete_drafts'));
1415  $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
1416  $c_gui->setConfirm($this->lng->txt('confirm'), 'deleteThreadDrafts');
1417  $instances = ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
1418  foreach ($_POST['draft_ids'] as $draft_id) {
1419  if (array_key_exists($draft_id, $instances)) {
1420  $c_gui->addItem('draft_ids[]', $draft_id, $instances[$draft_id]->getPostSubject());
1421  }
1422  }
1423 
1424  $this->confirmation_gui_html = $c_gui->getHTML();
1425 
1426  $this->hideToolbar(true);
1427 
1428  return $this->tpl->setContent($c_gui->getHTML());
1429  }
static getDraftInstancesByUserId($user_id)
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
hideToolbar($a_flag=null)
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteThreads()

ilObjForumGUI::confirmDeleteThreads ( )

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

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

Referenced by performThreadsActionObject().

1362  {
1363  if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1364  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1365  return $this->showThreadsObject();
1366  }
1367 
1368  if (!$this->is_moderator) {
1369  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1370  }
1371 
1372  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1373  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1374  }
1375 
1376  $threads = [];
1377  array_walk($_POST['thread_ids'], function ($threadId) use (&$threads) {
1378  $thread = new \ilForumTopic($threadId);
1379  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
1380 
1381  $threads[] = $thread;
1382  });
1383 
1384  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
1385  $c_gui = new ilConfirmationGUI();
1386 
1387  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteThreads'));
1388  $c_gui->setHeaderText($this->lng->txt('frm_sure_delete_threads'));
1389  $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
1390  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteThreads');
1391 
1392  foreach ($threads as $thread) {
1393  $c_gui->addItem('thread_ids[]', $thread->getId(), $thread->getSubject());
1394  }
1395 
1396  $this->confirmation_gui_html = $c_gui->getHTML();
1397 
1398  $this->hideToolbar(true);
1399 
1400  return $this->tpl->setContent($c_gui->getHTML());
1401  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
hideToolbar($a_flag=null)
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmMergeThreadsObject()

ilObjForumGUI::confirmMergeThreadsObject ( )

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

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

4280  {
4281  if (!$this->is_moderator) {
4282  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4283  }
4284 
4285  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4286  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4287  }
4288 
4289  if (!isset($_GET['merge_thread_id']) || !(int) $_GET['merge_thread_id'] || !is_array($_POST['thread_ids']) || count($_POST['thread_ids']) != 1) {
4290  ilUtil::sendFailure($this->lng->txt('select_one'));
4291  $this->mergeThreadsObject();
4292  return;
4293  }
4294 
4295  $source_thread_id = (int) $_GET['merge_thread_id'];
4296  $target_thread_id = (int) current($_POST['thread_ids']);
4297 
4298  if ($source_thread_id == $target_thread_id) {
4299  ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
4300  $this->showThreadsObject();
4301  return;
4302  }
4303 
4304  if (ilForumTopic::lookupForumIdByTopicId($source_thread_id) != ilForumTopic::lookupForumIdByTopicId($target_thread_id)) {
4305  ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
4306  $this->ctrl->clearParameters($this);
4307  $this->showThreadsObject();
4308  return;
4309  }
4310 
4311  if (ilForumTopic::_lookupDate($source_thread_id) < ilForumTopic::_lookupDate($target_thread_id)) {
4312  ilUtil::sendInfo($this->lng->txt('switch_threads_for_merge'));
4313  }
4314 
4315  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $source_thread_id));
4316  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $target_thread_id));
4317 
4318  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
4319  $c_gui = new ilConfirmationGUI();
4320 
4321  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performMergeThreads'));
4322  $c_gui->setHeaderText($this->lng->txt('frm_sure_merge_threads'));
4323  $c_gui->setCancel($this->lng->txt('cancel'), 'showThreads');
4324  $c_gui->setConfirm($this->lng->txt('confirm'), 'performMergeThreads');
4325 
4326  $c_gui->addItem('thread_ids[]', $source_thread_id, sprintf($this->lng->txt('frm_merge_src'), ilForumTopic::_lookupTitle($source_thread_id)));
4327  $c_gui->addItem('thread_ids[]', $target_thread_id, sprintf($this->lng->txt('frm_merge_target'), ilForumTopic::_lookupTitle($target_thread_id)));
4328 
4329  $this->tpl->setContent($c_gui->getHTML());
4330  return;
4331  }
static _lookupDate($thread_id)
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
static _lookupTitle($a_topic_id)
Looks up the title/subject of a topic/thread.
$_POST["username"]
static lookupForumIdByTopicId($a_topic_id)
Confirmation screen class.
+ Here is the call graph for this function:

◆ createThreadObject()

ilObjForumGUI::createThreadObject ( )

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

References initTopicCreateForm(), and setTopicCreateDefaultValues().

3603  {
3604  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3605  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3606  }
3607 
3608  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
3609  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3610  }
3611 
3612  $this->initTopicCreateForm();
3613  $this->setTopicCreateDefaultValues();
3614 
3615  $create_form = new ilTemplate('tpl.create_thread_form.html', true, true, 'Modules/Forum');
3616  $create_form->setVariable('CREATE_FORM', $this->create_topic_form_gui->getHTML());
3617  $create_form->parseCurrentBlock();
3618 
3619  $this->tpl->setContent($create_form->get());
3620  }
special template class to simplify handling of ITX/PEAR
initTopicCreateForm($edit_draft=false)
+ Here is the call graph for this function:

◆ createTopLevelPostObject()

ilObjForumGUI::createTopLevelPostObject ( )

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

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

1941  {
1942  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0 && !$this->user->isAnonymous()
1944  $draft_obj = new ilForumPostDraft($this->user->getId(), $this->objCurrentPost->getId(), (int) $_GET['draft_id']);
1945  }
1946 
1947  if ($draft_obj instanceof ilForumPostDraft && $draft_obj->getDraftId() > 0) {
1948  $this->ctrl->setParameter($this, 'action', 'editdraft');
1949  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1950  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
1951  $this->ctrl->setParameter($this, 'draft_id', $draft_obj->getDraftId());
1952  $this->ctrl->setParameter($this, 'offset', 0);
1953  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
1954  $this->ctrl->redirect($this, 'editDraft');
1955  } else {
1956  $this->viewThreadObject();
1957  }
1958  return;
1959  }
Class ilForumPostDraft.
$_GET["client_id"]
user()
Definition: user.php:4
+ 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 4886 of file class.ilObjForumGUI.php.

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

Referenced by deleteSelectedDraft(), and deleteThreadDraftsObject().

4887  {
4888  // remove usage of deleted media objects
4889  include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
4890  $oldMediaObjects = ilObjMediaObject::_getMobsOfObject('frm~d:html', $draft_id);
4891  $curMediaObjects = ilRTE::_getMediaObjects($message, 0);
4892  foreach ($oldMediaObjects as $oldMob) {
4893  $found = false;
4894  foreach ($curMediaObjects as $curMob) {
4895  if ($oldMob == $curMob) {
4896  $found = true;
4897  break;
4898  }
4899  }
4900  if (!$found) {
4901  if (ilObjMediaObject::_exists($oldMob)) {
4902  ilObjMediaObject::_removeUsage($oldMob, 'frm~d:html', $draft_id);
4903  $mob_obj = new ilObjMediaObject($oldMob);
4904  $mob_obj->delete();
4905  }
4906  }
4907  }
4908  }
static _getMediaObjects($a_text, $a_direction=0)
Returns all media objects found in the passed string.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
catch(Exception $e) $message
Class ilObjMediaObject.
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteSelectedDraft()

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

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

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

Referenced by getForumObjects().

4914  {
4915  if (
4916  !$this->access->checkAccess('add_reply', '', (int) $_GET['ref_id']) ||
4917  $this->user->isAnonymous() ||
4918  ($draft_obj instanceof ilForumPostDraft && $this->user->getId() != $draft_obj->getPostAuthorId())) {
4919  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4920  }
4921 
4922  $post_id = $this->objCurrentPost->getId();
4923  if (!($draft_obj instanceof ilForumPostDraft)) {
4924  $draft_id_to_delete = (int) $_GET['draft_id'];
4925  $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, $draft_id_to_delete);
4926 
4927  if (!$draft_obj->getDraftId() || ($draft_obj->getDraftId() != $draft_id_to_delete)) {
4928  $this->ctrl->clearParameters($this);
4929  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4930  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4931  $this->ctrl->redirect($this, 'viewThread');
4932  }
4933  }
4934 
4935  $this->deleteMobsOfDraft($draft_obj->getDraftId(), $draft_obj->getPostMessage());
4936 
4937  // delete attachments of draft
4938  $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draft_obj->getDraftId());
4939  $objFileDataForumDrafts->delete();
4940 
4942  $GLOBALS['ilAppEventHandler']->raise(
4943  'Modules/Forum',
4944  'deletedDraft',
4945  array('draftObj' => $draft_obj,
4946  'obj_id' => $this->object->getId(),
4947  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
4948  );
4949  }
4950  // delete draft
4951  $draft_obj->deleteDraft();
4952 
4953  ilUtil::sendSuccess($this->lng->txt('delete_draft_successfully'), true);
4954  $this->ctrl->clearParameters($this);
4955  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
4956  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
4957  $this->ctrl->redirect($this, 'viewThread');
4958  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilForumPostDraft.
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
This class handles all operations on files for the drafts of a forum object.
user()
Definition: user.php:4
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteThreadDraftsObject()

ilObjForumGUI::deleteThreadDraftsObject ( )

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

References $_GET, $_POST, $GLOBALS, array, ilFileDataForumDrafts\delete(), deleteMobsOfDraft(), ilForumPostDraft\getDraftInstancesByUserId(), ilForumPostDraft\isSavePostDraftAllowed(), object, ilUtil\sendInfo(), and user().

3549  {
3550  $draft_ids = array();
3551  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
3552  $draft_ids = array((int) $_GET['draft_id']);
3553  } elseif (isset($_POST['draft_ids']) && is_array($_POST['draft_ids'])) {
3554  $draft_ids = $_POST['draft_ids'];
3555  }
3556  $instances = ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
3557  $checked_draft_ids = array();
3558  foreach ($draft_ids as $draft_id) {
3559  if (array_key_exists($draft_id, $instances)) {
3560  $checked_draft_ids[] = $draft_id;
3561  $draftObj = $instances[$draft_id];
3562 
3563  $this->deleteMobsOfDraft($draftObj->getDraftId(), $draftObj->getPostMessage());
3564 
3565  // delete attachments of draft
3566  $objFileDataForumDrafts = new ilFileDataForumDrafts(0, $draftObj->getDraftId());
3567  $objFileDataForumDrafts->delete();
3568 
3570  $GLOBALS['ilAppEventHandler']->raise(
3571  'Modules/Forum',
3572  'deletedDraft',
3573  array('draftObj' => $draftObj,
3574  'obj_id' => $this->object->getId(),
3575  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
3576  );
3577  }
3578  // delete draft
3579  $draftObj->deleteDraft();
3580  }
3581  }
3582 
3583  if (count($checked_draft_ids) > 1) {
3584  ilUtil::sendInfo($this->lng->txt('delete_drafts_successfully'), true);
3585  } else {
3586  ilUtil::sendInfo($this->lng->txt('delete_draft_successfully'), true);
3587  }
3588 
3589  $this->ctrl->redirect($this, 'showThreads');
3590  }
static getDraftInstancesByUserId($user_id)
deleteMobsOfDraft($draft_id, $message)
todo: move to ilForumUtil
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
This class handles all operations on files for the drafts of a forum object.
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:

◆ deliverDraftZipFileObject()

ilObjForumGUI::deliverDraftZipFileObject ( )

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

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

4394  {
4395  $draftObj = ilForumPostDraft::newInstanceByDraftId((int) $_GET['draft_id']);
4396  if ($draftObj->getPostAuthorId() == $this->user->getId()) {
4397  $tmp_file_obj = new ilFileDataForumDrafts(0, $draftObj->getDraftId());
4398  if (!$tmp_file_obj->deliverZipFile()) {
4399  $this->ctrl->redirect($this);
4400  }
4401  }
4402  }
$_GET["client_id"]
This class handles all operations on files for the drafts of a forum object.
user()
Definition: user.php:4
static newInstanceByDraftId($draft_id)
+ Here is the call graph for this function:

◆ deliverZipFileObject()

ilObjForumGUI::deliverZipFileObject ( )

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

References ensureThreadBelongsToForum(), and object.

4408  {
4409  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4410  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4411  }
4412 
4413  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
4414 
4415  $fileData = new \ilFileDataForum($this->object->getId(), $this->objCurrentPost->getId());
4416  if (!$fileData->deliverZipFile()) {
4417  $this->ctrl->redirect($this);
4418  }
4419  }
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ disableForumNotificationObject()

ilObjForumGUI::disableForumNotificationObject ( )

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

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

3879  {
3880  $frm = $this->object->Forum;
3881  $frm->setForumId($this->object->getId());
3882  $frm->disableForumNotification($this->user->getId());
3883 
3884  if (!$this->objCurrentTopic->getId()) {
3885  $this->showThreadsObject();
3886  ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'));
3887  } else {
3888  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3889  ilUtil::sendInfo($this->lng->txt('forums_forum_notification_disabled'), true);
3890  $this->ctrl->redirect($this, 'viewThread');
3891  }
3892  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ displayConfirmPostActivation()

ilObjForumGUI::displayConfirmPostActivation ( )

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

References $display_confirm_post_activation.

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

1517  {
1519  }
+ Here is the caller graph for this function:

◆ doCaptchaCheck()

ilObjForumGUI::doCaptchaCheck ( )

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

References user().

Referenced by addThreadObject(), editDraftObject(), publishDraftObject(), publishThreadDraftObject(), saveThreadAsDraftObject(), and updateThreadDraftObject().

5477  {
5478  require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
5479  if ($this->user->isAnonymous()
5480  && !$this->user->isCaptchaVerified()
5481  && ilCaptchaUtil::isActiveForForum()) {
5482  $this->user->setCaptchaVerified(true);
5483  }
5484  }
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doHistoryCheck()

ilObjForumGUI::doHistoryCheck (   $draft_id)
Parameters
$draft_id

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

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

Referenced by editDraftObject(), and editThreadDraftObject().

5431  {
5432  require_once './Services/jQuery/classes/class.iljQueryUtil.php';
5434 
5435  $modal = '';
5437  $history_instances = ilForumDraftsHistory::getInstancesByDraftId($draft_id);
5438  if (is_array($history_instances) && sizeof($history_instances) > 0) {
5439  require_once 'Services/UIComponent/Modal/classes/class.ilModalGUI.php';
5440  $modal = ilModalGUI::getInstance();
5441  $modal->setHeading($this->lng->txt('restore_draft_from_autosave'));
5442  $modal->setId('frm_autosave_restore');
5443  $form_tpl = new ilTemplate('tpl.restore_thread_draft.html', true, true, 'Modules/Forum');
5444  include_once './Services/Accordion/classes/class.ilAccordionGUI.php';
5445 
5446  foreach ($history_instances as $key => $history_instance) {
5447  $acc_autosave = new ilAccordionGUI();
5448  $acc_autosave->setId('acc_' . $history_instance->getHistoryId());
5449 
5450  $form_tpl->setCurrentBlock('list_item');
5451  $post_message = ilRTE::_replaceMediaObjectImageSrc($history_instance->getPostMessage(), 1);
5452 
5453  $history_date = ilDatePresentation::formatDate(new ilDateTime($history_instance->getDraftDate(), IL_CAL_DATETIME));
5454  $restore_btn = ilLinkButton::getInstance();
5455  $restore_btn->addCSSClass('restore_btn');
5456  $this->ctrl->setParameter($this, 'history_id', $history_instance->getHistoryId());
5457  $restore_btn->setUrl($this->ctrl->getLinkTarget($this, 'restoreFromHistory'));
5458  $restore_btn->setCaption($this->lng->txt('restore'), false);
5459 
5460  $acc_autosave->addItem($history_date . ' - ' . $history_instance->getPostSubject(), $post_message . $restore_btn->render());
5461 
5462  $form_tpl->setVariable('ACC_AUTO_SAVE', $acc_autosave->getHtml());
5463  $form_tpl->parseCurrentBlock();
5464  }
5465 
5466  $form_tpl->setVariable('RESTORE_DATA_EXISTS', 'found_threat_history_to_restore');
5467  $modal->setBody($form_tpl->get());
5468  $modal->initJS();
5469  $this->modal_history = $modal->getHTML();
5470  } else {
5472  }
5473  }
5474  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
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 createDraftBackup($draft_id)
special template class to simplify handling of ITX/PEAR
Date and time handling
static getInstancesByDraftId($draft_id)
static getInstance()
Get instance.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
Accordion user interface class.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editDraftObject()

ilObjForumGUI::editDraftObject ( )

◆ editThreadDraftObject()

ilObjForumGUI::editThreadDraftObject (   $form = null)

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

References $_GET, $form, $modal_history, ilRTE\_replaceMediaObjectImageSrc(), array, doHistoryCheck(), initTopicCreateForm(), and object.

Referenced by updateThreadDraftObject().

4422  {
4423  $frm = $this->object->Forum;
4424  $frm->setForumId($this->object->getId());
4425  $frm->setForumRefId($this->object->getRefId());
4426 
4427  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
4428  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4429  }
4430 
4431  $thread_draft = new ilForumPostDraft();
4432  if (array_key_exists('draft_id', $_GET)) {
4433  $draft_id = (int) $_GET['draft_id'];
4434  $thread_draft = $thread_draft->newInstanceByDraftId($draft_id);
4435  }
4436 
4437  if (!isset($_GET['hist_check']) || (int) $_GET['hist_check'] != 0) {
4438  $this->doHistoryCheck($thread_draft->getDraftId());
4439  }
4440 
4441  if (!$form instanceof ilPropertyFormGUI) {
4442  $this->initTopicCreateForm(true);
4443 
4444  $this->create_topic_form_gui->setValuesByArray(
4445  array(
4446  'alias' => $thread_draft->getPostUserAlias(),
4447  'subject' => $thread_draft->getPostSubject(),
4448  'message' => ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($thread_draft->getPostMessage(), 2), 1),
4449  'notify' =>$thread_draft->getNotify() ? true : false,
4450  'userfile' => '',
4451  'del_file' => array())
4452  );
4453  $this->tpl->setContent($this->create_topic_form_gui->getHTML() . $this->modal_history);
4454  } else {
4455  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
4456  return $this->tpl->setContent($form->getHTML());
4457  }
4458  }
Class ilForumPostDraft.
This class represents a property form user interface.
$_GET["client_id"]
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...
if(isset($_POST['submit'])) $form
initTopicCreateForm($edit_draft=false)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editThreadObject()

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

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

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

Referenced by performThreadsActionObject(), and updateThreadObject().

475  {
476  if (!$this->is_moderator) {
477  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
478  }
479 
480  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
481  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
482  }
483 
484  $thread = new \ilForumTopic($a_thread_id);
485  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
486 
487  $this->tabs->activateTab('forums_threads');
488 
489  if (!($form instanceof ilPropertyFormGUI)) {
490  $form = $this->getThreadEditingForm($a_thread_id);
491  $form->setValuesByArray(array(
492  'title' => $thread->getSubject()
493  ));
494  }
495 
496  $this->tpl->setContent($form->getHTML());
497  }
This class represents a property form user interface.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
getThreadEditingForm($a_thread_id)
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableForumNotificationObject()

ilObjForumGUI::enableForumNotificationObject ( )

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

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

3863  {
3864  $frm = $this->object->Forum;
3865  $frm->setForumId($this->object->getId());
3866  $frm->enableForumNotification($this->user->getId());
3867 
3868  if (!$this->objCurrentTopic->getId()) {
3869  ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'));
3870  $this->showThreadsObject();
3871  } else {
3872  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
3873  ilUtil::sendInfo($this->lng->txt('forums_forum_notification_enabled'), true);
3874  $this->ctrl->redirect($this, 'viewThread');
3875  }
3876  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ ensureThreadBelongsToForum()

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

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

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

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

186  {
187  $forumId = \ilObjForum::lookupForumIdByObjId($objId);
188  if ((int) $thread->getForumId() !== (int) $forumId) {
189  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
190  }
191  }
static lookupForumIdByObjId($obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjForumGUI::executeCommand ( )

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

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

Referenced by performThreadsActionObject().

251  {
252  $next_class = $this->ctrl->getNextClass($this);
253  $cmd = $this->ctrl->getCmd();
254 
255  $exclude_cmds = array(
256  'viewThread', 'markPostUnread','markPostRead', 'showThreadNotification',
257  'performPostActivation',
258  'askForPostActivation', 'askForPostDeactivation',
259  'toggleThreadNotification', 'toggleThreadNotificationTab',
260  'toggleStickiness', 'cancelPost', 'savePost', 'saveTopLevelPost', 'createTopLevelPost', 'quoteTopLevelPost', 'quotePost', 'getQuotationHTMLAsynch',
261  'autosaveDraftAsync', 'autosaveThreadDraftAsync',
262  'saveAsDraft', 'editDraft', 'updateDraft', 'deliverDraftZipFile', 'deliverZipFile', 'cancelDraft',
263  'publishThreadDraft', 'deleteThreadDrafts'
264  );
265 
266  if (!in_array($cmd, $exclude_cmds)) {
267  $this->prepareOutput();
268  }
269 
270  // add entry to navigation history
271  if (!$this->getCreationMode() && !$this->ctrl->isAsynch() && $this->access->checkAccess('read', '', $_GET['ref_id'])) {
273  $_GET['ref_id'],
274  'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=showThreads&amp;ref_id=' . $_GET['ref_id'],
275  'frm'
276  );
277  }
278 
279  switch ($next_class) {
280  case 'ilforumsettingsgui':
282  $this->ctrl->forwardCommand($forum_settings_gui);
283  break;
284 
285  case 'ilrepositoryobjectsearchgui':
286  $this->addHeaderAction();
287  $this->setSideBlocks();
288  $this->tabs->activateTab("forums_threads");
289  $this->ctrl->setReturn($this, 'view');
290  include_once './Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
291  $search_gui = new ilRepositoryObjectSearchGUI(
292  $this->object->getRefId(),
293  $this,
294  'view'
295  );
296  $this->ctrl->forwardCommand($search_gui);
297  break;
298 
299  case 'ilpermissiongui':
300  require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
301  $perm_gui = new ilPermissionGUI($this);
302  $this->ctrl->forwardCommand($perm_gui);
303  break;
304 
305  case 'ilforumexportgui':
306  require_once 'Modules/Forum/classes/class.ilForumExportGUI.php';
307  $fex_gui = new ilForumExportGUI();
308  $this->ctrl->forwardCommand($fex_gui);
309  exit();
310  break;
311 
312  case 'ilforummoderatorsgui':
313  require_once 'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
314  $fm_gui = new ilForumModeratorsGUI();
315  $this->ctrl->forwardCommand($fm_gui);
316  break;
317 
318  case 'ilinfoscreengui':
319  $this->infoScreen();
320  break;
321 
322  case 'ilcolumngui':
323  $this->showThreadsObject();
324  break;
325 
326  case 'ilpublicuserprofilegui':
327  include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
328  $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
329  $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
330  $profile_gui->setAdditional($add);
331  $ret = $this->ctrl->forwardCommand($profile_gui);
332  $this->tpl->setContent($ret);
333  break;
334 
335  case 'ilobjectcopygui':
336  include_once 'Services/Object/classes/class.ilObjectCopyGUI.php';
337  $cp = new ilObjectCopyGUI($this);
338  $cp->setType('frm');
339  $this->ctrl->forwardCommand($cp);
340  break;
341 
342  case 'ilexportgui':
343  $this->tabs->activateTab('export');
344  include_once 'Services/Export/classes/class.ilExportGUI.php';
345  $exp = new ilExportGUI($this);
346  $exp->addFormat('xml');
347  $this->ctrl->forwardCommand($exp);
348  break;
349 
350  case "ilratinggui":
351  if (!$this->objProperties->isIsThreadRatingEnabled() || $this->user->isAnonymous()) {
352  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
353  }
354 
355  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
356  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
357  }
358 
359  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
360 
361  require_once 'Services/Rating/classes/class.ilRatingGUI.php';
362  $rating_gui = new ilRatingGUI();
363  $rating_gui->setObject($this->object->getId(), $this->object->getType(), $this->objCurrentTopic->getId(), 'thread');
364 
365  $this->ctrl->setParameter($this, 'thr_pk', (int) $this->objCurrentTopic->getId());
366  $this->ctrl->forwardCommand($rating_gui);
367 
368  $avg = ilRating::getOverallRatingForObject($this->object->getId(), $this->object->getType(), (int) $this->objCurrentTopic->getId(), 'thread');
369  $this->objCurrentTopic->setAverageRating($avg['avg']);
370  $this->objCurrentTopic->update();
371 
372  $this->ctrl->redirect($this, "showThreads");
373  break;
374 
375  case 'ilcommonactiondispatchergui':
376  include_once 'Services/Object/classes/class.ilCommonActionDispatcherGUI.php';
378  $this->ctrl->forwardCommand($gui);
379  break;
380 
381  default:
382  // alex, 11 Jan 2011:
383  // I inserted this workaround due to bug report 6971.
384  // In general the command handling is quite obscure here.
385  // The form action of the table should be filled
386  // with $ilCtrl->getFormAction(..) not with $ilCtrl->getLinkTarget(..)
387  // Commands should be determined with $ilCtrl->getCmd() not
388  // with accessing $_POST['selected_cmd'], since this is internal
389  // of ilTable2GUI/ilCtrl and may change.
390  if (isset($_POST['select_cmd2'])) {
391  $_POST['selected_cmd'] = $_POST["selected_cmd2"];
392  }
393 
394  if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] != null) {
395  $member_cmd = array('enableAdminForceNoti', 'disableAdminForceNoti', 'enableHideUserToggleNoti', 'disableHideUserToggleNoti');
396  in_array($_POST['selected_cmd'], $member_cmd) ? $cmd = $_POST['selected_cmd'] : $cmd = 'performThreadsAction';
397  } elseif (!$cmd && !$_POST['selected_cmd']) {
398  $cmd = 'showThreads';
399  }
400 
401  $cmd .= 'Object';
402  $this->$cmd();
403 
404  break;
405  }
406 
407  // suppress for topic level
408  if ($cmd != 'viewThreadObject' && $cmd != 'showUserObject') {
409  $this->addHeaderAction();
410  }
411  }
GUI class for the workflow of copying objects.
$_GET["client_id"]
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
Class ilForumSettingsGUI.
user()
Definition: user.php:4
Export User Interface Class.
prepareOutput($a_show_subobjects=true)
prepare output
GUI class for public user profile presentation.
addItem( $a_ref_id, $a_link, $a_type, $a_title="", $a_sub_obj_id="", $a_goto_link="")
Add an item to the stack.
Class ilRatingGUI.
Class ilForumModeratorsGUI.
Forum export to HTML and Print.
static getOverallRatingForObject($a_obj_id, $a_obj_type, $a_sub_obj_id=null, $a_sub_obj_type=null, $a_category_id=null)
Get overall rating for an object.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Navigation History of Repository Items.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
$ret
Definition: parser.php:6
getCreationMode()
get creation mode
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
addHeaderAction()
Add header action menu.
$_POST["username"]
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActivationFormHTML()

ilObjForumGUI::getActivationFormHTML ( )

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

References $_GET.

Referenced by getForumObjects().

1640  {
1641  $form_tpl = new ilTemplate('tpl.frm_activation_post_form.html', true, true, 'Modules/Forum');
1642 
1643  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1644  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1645  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
1646  $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'performPostActivation'));
1647  $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1648  $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1649  $form_tpl->setVariable('TXT_ACT', $this->lng->txt('activate_post_txt'));
1650  $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('activate_only_current'));
1651  $form_tpl->setVariable('CMD_CONFIRM', 'performPostActivation');
1652  $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1653  $form_tpl->setVariable('CMD_CANCEL', 'viewThread');
1654  $this->ctrl->clearParameters($this);
1655 
1656  return $form_tpl->get();
1657  }
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ getCensorshipFormHTML()

ilObjForumGUI::getCensorshipFormHTML ( )

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

References $_GET, $_POST, $file, ilHtmlPurifierFactory\_getInstanceByType(), ilObjAdvancedEditing\_getRichTextEditorUserState(), ilRTE\_getRTEClassname(), ilObjAdvancedEditing\_setRichTextEditorUserState(), addAutosave(), array, getForumObjects(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilForumPostDraft\isSavePostDraftAllowed(), isTopLevelReplyCommand(), isWritingWithPseudonymAllowed(), ilForumPostDraft\lookupAutosaveInterval(), ilFileWizardInputGUI\setFilenames(), ilFormPropertyGUI\setInfo(), ilTextInputGUI\setMaxLength(), ilFormPropertyGUI\setRequired(), and user().

Referenced by getForumObjects().

1660  {
1661  $frm = $this->object->Forum;
1662  $form_tpl = new ilTemplate('tpl.frm_censorship_post_form.html', true, true, 'Modules/Forum');
1663 
1664  $form_tpl->setVariable('ANCHOR', $this->objCurrentPost->getId());
1665  $form_tpl->setVariable('SPACER', '<hr noshade="noshade" width="100%" size="1" align="center" />');
1666  $this->ctrl->setParameter($this, 'action', 'ready_censor');
1667  $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
1668  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
1669  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
1670  $form_tpl->setVariable('FORM_ACTION', $this->ctrl->getLinkTarget($this, 'viewThread'));
1671  $this->ctrl->clearParameters($this);
1672  $form_tpl->setVariable('TXT_CENS_MESSAGE', $this->lng->txt('forums_the_post'));
1673  $form_tpl->setVariable('TXT_CENS_COMMENT', $this->lng->txt('forums_censor_comment') . ':');
1674  $form_tpl->setVariable('CENS_MESSAGE', $frm->prepareText($this->objCurrentPost->getCensorshipComment(), 2));
1675 
1676  if ($this->objCurrentPost->isCensored()) {
1677  $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor2_post'));
1678  $form_tpl->setVariable('YES_BUTTON', $this->lng->txt('confirm'));
1679  $form_tpl->setVariable('NO_BUTTON', $this->lng->txt('cancel'));
1680  } else {
1681  $form_tpl->setVariable('TXT_CENS', $this->lng->txt('forums_info_censor_post'));
1682  $form_tpl->setVariable('CANCEL_BUTTON', $this->lng->txt('cancel'));
1683  $form_tpl->setVariable('CONFIRM_BUTTON', $this->lng->txt('confirm'));
1684  }
1685 
1686  return $form_tpl->get();
1687  }
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContent()

ilObjForumGUI::getContent ( )

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

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

567  {
568  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
569  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
570  }
571 
572  $cmd = $this->ctrl->getCmd();
573  $frm = $this->object->Forum;
574  $frm->setForumId($this->object->getId());
575  $frm->setForumRefId($this->object->getRefId());
576  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
577 
578  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_liste.html', 'Modules/Forum');
579 
580  if ((int) strlen($this->confirmation_gui_html)) {
581  $this->tpl->setVariable('CONFIRMATION_GUI', $this->confirmation_gui_html);
582  }
583 
584  // Create topic button
585  if ($this->access->checkAccess('add_thread', '', $this->object->getRefId()) && !$this->hideToolbar()) {
586  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
587  $btn = ilLinkButton::getInstance();
588  $btn->setUrl($this->ctrl->getLinkTarget($this, 'createThread'));
589  $btn->setCaption('forums_new_thread');
590  $this->toolbar->addStickyItem($btn);
591  }
592 
593  // Mark all topics as read button
594  include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
595  if ($this->user->getId() != ANONYMOUS_USER_ID && !(int) strlen($this->confirmation_gui_html)) {
596  $this->toolbar->addButton(
597  $this->lng->txt('forums_mark_read'),
598  $this->ctrl->getLinkTarget($this, 'markAllRead'),
599  '',
601  );
602  $this->ctrl->clearParameters($this);
603  }
604 
606  include_once './Modules/Forum/classes/class.ilForumDraftsTableGUI.php';
607  $drafts_tbl = new ilForumDraftsTableGUI($this, $cmd, '');
608  $draft_instances = ilForumPostDraft::getThreadDraftData($this->user->getId(), ilObjForum::lookupForumIdByObjId($this->object->getId()));
609  if (count($draft_instances)> 0) {
610  foreach ($draft_instances as $draft) {
611  $drafts_tbl->fillRow($draft);
612  }
613  $drafts_tbl->setData($draft_instances);
614  $this->tpl->setVariable('THREADS_DRAFTS_TABLE', $drafts_tbl->getHTML());
615  }
616  }
617 
618  // Import information: Topic (variable $topicData) means frm object, not thread
619  $topicData = $frm->getOneTopic();
620  if ($topicData) {
621  // Visit-Counter
622  $frm->setDbTable('frm_data');
623  $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
624  $frm->updateVisits($topicData['top_pk']);
625 
626  include_once 'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
627  if (!in_array($cmd, array('showThreads', 'sortThreads'))) {
628  $cmd = 'showThreads';
629  }
630 
631  $tbl = new ilForumTopicTableGUI($this, $cmd, '', (int) $_GET['ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
632  $tbl->init();
633  $tbl->setMapper($frm)->fetchData();
634  $this->tpl->setVariable('THREADS_TABLE', $tbl->getHTML());
635  }
636 
637  // Permanent link
638  include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
639  $permalink = new ilPermanentLinkGUI('frm', $this->object->getRefId());
640  $this->tpl->setVariable('PRMLINK', $permalink->getHTML());
641  }
static getThreadDraftData($post_author_id, $forum_id)
Class for permanent links.
static lookupForumIdByObjId($obj_id)
$_GET["client_id"]
$tbl
Definition: example_048.php:81
Class ilForumDraftsTableGUI.
user()
Definition: user.php:4
Class ilForumTopicTableGUI.
hideToolbar($a_flag=null)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ getEditFormCustomValues()

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

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

436  {
437  $this->forum_settings_gui->getCustomValues($a_values);
438  }

◆ getForumObjects()

ilObjForumGUI::getForumObjects ( )
private

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

References $_GET, $_POST, $_SESSION, ilObjectGUI\$actions, $form, $forumObjects, $i, $mobs, $objCurrentTopic, $object, $params, $toolbar, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjectGUI\addHeaderAction(), ilNavigationHistory\addItem(), array, deleteSelectedDraft(), displayConfirmPostActivation(), ensureThreadBelongsToForum(), getActivationFormHTML(), getCensorshipFormHTML(), ilObjectGUI\getCreationMode(), ilLinkButton\getInstance(), ilSplitButtonGUI\getInstance(), ilForumPostDraft\getInstancesByUserIdAndThreadId(), getModifiedReOnSubject(), getReplyEditForm(), handleFormInput(), isHierarchicalView(), ilForumPostDraft\isSavePostDraftAllowed(), isTopLevelReplyCommand(), ilUtil\Linkbar(), ilAccessKey\MARK_ALL_READ, object, renderDraftContent(), renderPostContent(), ilUtil\sendInfo(), ilUtil\sendSuccess(), ilForumExplorerGUI\setThread(), user(), ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, and ilForumProperties\VIEW_TREE.

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

2466  {
2467  if (null === $this->forumObjects) {
2468  $forumObj = $this->object;
2469  $file_obj = new ilFileDataForum($forumObj->getId(), $this->objCurrentPost->getId());
2470  $frm = $forumObj->Forum;
2471  $frm->setForumId($forumObj->getId());
2472  $frm->setForumRefId($forumObj->getRefId());
2473 
2474  $this->forumObjects['forumObj'] = $forumObj;
2475  $this->forumObjects['frm'] = $frm;
2476  $this->forumObjects['file_obj'] = $file_obj;
2477  }
2478 
2479  return $this->forumObjects;
2480  }
This class handles all operations on files for the forum object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModifiedReOnSubject()

ilObjForumGUI::getModifiedReOnSubject (   $on_reply = false)
private

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

Referenced by getForumObjects().

3062  {
3063  $subject = $this->objCurrentPost->getSubject();
3064  $re_txt = $this->lng->txt('post_reply');
3065 
3066  $re_txt_with_num = str_replace(':', '(', $re_txt);
3067  $search_length = strlen($re_txt_with_num);
3068  $comp = substr_compare($re_txt_with_num, substr($subject, 0, $search_length), 0, $search_length);
3069 
3070  if ($comp == 0) {
3071  $modified_subject = $subject;
3072  if ($on_reply == true) {
3073  // i.e. $subject = "Re(12):"
3074  $str_pos_start = strpos($subject, '(');
3075  $str_pos_end = strpos($subject, ')');
3076 
3077  $length = ((int) $str_pos_end - (int) $str_pos_start);
3078  $str_pos_start++;
3079  $txt_number = substr($subject, $str_pos_start, $length - 1);
3080 
3081  if (is_numeric($txt_number)) {
3082  $re_count = (int) $txt_number + 1;
3083  $modified_subject = substr($subject, 0, $str_pos_start) . $re_count . substr($subject, $str_pos_end);
3084  }
3085  }
3086  } else {
3087  $re_count = substr_count($subject, $re_txt);
3088  if ($re_count >= 1 && $on_reply == true) {
3089  $subject = str_replace($re_txt, '', $subject);
3090 
3091  // i.e. $subject = "Re: Re: Re: ... " -> "Re(4):"
3092  $re_count++;
3093  $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
3094  } elseif ($re_count >= 1 && $on_reply == false) {
3095  // possibility to modify the subject only for output
3096  // i.e. $subject = "Re: Re: Re: ... " -> "Re(3):"
3097  $modified_subject = sprintf($this->lng->txt('post_reply_count'), $re_count) . ' ' . trim($subject);
3098  } elseif ($re_count == 0) {
3099  // the first reply to a thread
3100  $modified_subject = $this->lng->txt('post_reply') . ' ' . $this->objCurrentPost->getSubject();
3101  }
3102  }
3103  return $modified_subject;
3104  }
+ Here is the caller graph for this function:

◆ getReplyEditForm()

ilObjForumGUI::getReplyEditForm ( )
private
Returns
ilPropertyFormGUI

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

References $replyEditForm.

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

1929  {
1930  if (null === $this->replyEditForm) {
1931  $this->initReplyEditForm();
1932  }
1933 
1934  return $this->replyEditForm;
1935  }
+ Here is the caller graph for this function:

◆ getSubTabs()

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

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

References $is_moderator.

Referenced by showThreadsObject(), and sortThreadsObject().

559  {
560  if ($this->objProperties->getThreadSorting() == 1 && $this->is_moderator) {
561  $this->tabs->addSubTabTarget('show', $this->ctrl->getLinkTarget($this, 'showThreads'), 'showThreads', get_class($this), '', $subtab=='showThreads'? true : false);
562  $this->tabs->addSubTabTarget('sorting_header', $this->ctrl->getLinkTarget($this, 'sortThreads'), 'sortThreads', get_class($this), '', $subtab=='sortThreads'? true : false);
563  }
564  }
+ Here is the caller graph for this function:

◆ getTabs()

ilObjForumGUI::getTabs ( )
protected

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

References $_GET, array, and settings().

1153  {
1154  $this->ilHelp->setScreenIdComponent("frm");
1155 
1156  $this->ctrl->setParameter($this, 'ref_id', $this->ref_id);
1157 
1158  $active = array(
1159  '', 'showThreads', 'view', 'markAllRead',
1160  'enableForumNotification', 'disableForumNotification', 'moveThreads', 'performMoveThreads',
1161  'cancelMoveThreads', 'performThreadsAction', 'createThread', 'addThread',
1162  'showUser', 'confirmDeleteThreads',
1163  'merge','mergeThreads', 'cancelMergeThreads', 'performMergeThreads'
1164  );
1165 
1166  (in_array($this->ctrl->getCmd(), $active)) ? $force_active = true : $force_active = false;
1167  $this->tabs->addTarget('forums_threads', $this->ctrl->getLinkTarget($this, 'showThreads'), $this->ctrl->getCmd(), get_class($this), '', $force_active);
1168 
1169  // info tab
1170  if ($this->access->checkAccess('visible', '', $this->ref_id) || $this->access->checkAccess('read', '', $this->ref_id)) {
1171  $force_active = ($this->ctrl->getNextClass() == 'ilinfoscreengui' || strtolower($_GET['cmdClass']) == 'ilnotegui') ? true : false;
1172  $this->tabs->addTarget(
1173  'info_short',
1174  $this->ctrl->getLinkTargetByClass(array('ilobjforumgui', 'ilinfoscreengui'), 'showSummary'),
1175  array('showSummary', 'infoScreen'),
1176  '',
1177  '',
1178  $force_active
1179  );
1180  }
1181 
1182  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1183  $force_active = ($this->ctrl->getCmd() == 'edit') ? true : false;
1184  $this->tabs->addTarget('settings', $this->ctrl->getLinkTarget($this, 'edit'), 'edit', get_class($this), '', $force_active);
1185  }
1186 
1187  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1188  $this->tabs->addTarget('frm_moderators', $this->ctrl->getLinkTargetByClass('ilForumModeratorsGUI', 'showModerators'), 'showModerators', get_class($this));
1189  }
1190 
1191  if ($this->settings->get('enable_fora_statistics', false) &&
1192  ($this->objProperties->isStatisticEnabled() || $this->access->checkAccess('write', '', $this->ref_id))) {
1193  $force_active = ($this->ctrl->getCmd() == 'showStatistics') ? true : false;
1194  $this->tabs->addTarget('frm_statistics', $this->ctrl->getLinkTarget($this, 'showStatistics'), 'showStatistics', get_class($this), '', $force_active); //false
1195  }
1196 
1197  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1198  $this->tabs->addTarget('export', $this->ctrl->getLinkTargetByClass('ilexportgui', ''), '', 'ilexportgui');
1199  }
1200 
1201  if ($this->access->checkAccess('edit_permission', '', $this->ref_id)) {
1202  $this->tabs->addTarget('perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), 'perm'), array('perm', 'info', 'owner'), 'ilpermissiongui');
1203  }
1204  }
$_GET["client_id"]
Online help application class.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getThreadEditingForm()

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

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

References $form, and ilFormPropertyGUI\setRequired().

Referenced by editThreadObject(), and updateThreadObject().

453  {
454  $form = new ilPropertyFormGUI();
455  $this->ctrl->setParameter($this, 'thr_pk', $a_thread_id);
456  $form->setFormAction($this->ctrl->getFormAction($this, 'updateThread'));
457 
458  $ti_prop = new ilTextInputGUI($this->lng->txt('title'), 'title');
459  $ti_prop->setRequired(true);
460  $ti_prop->setMaxLength(255);
461  $ti_prop->setSize(50);
462  $form->addItem($ti_prop);
463 
464  $form->addCommandButton('updateThread', $this->lng->txt('save'));
465  $form->addCommandButton('showThreads', $this->lng->txt('cancel'));
466 
467  return $form;
468  }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleFormInput()

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

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

References ilUtil\stripSlashes().

Referenced by addThreadObject(), autosaveDraftAsyncObject(), autosaveThreadDraftAsyncObject(), editDraftObject(), getForumObjects(), publishDraftObject(), publishThreadDraftObject(), saveThreadAsDraftObject(), and updateThreadDraftObject().

3968  {
3969  $a_text = str_replace("<", "&lt;", $a_text);
3970  $a_text = str_replace(">", "&gt;", $a_text);
3971  if ($a_stripslashes) {
3972  $a_text = ilUtil::stripSlashes($a_text);
3973  }
3974 
3975  return $a_text;
3976  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideToolbar()

ilObjForumGUI::hideToolbar (   $a_flag = null)
private

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

References $hideToolbar.

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

2397  {
2398  if (null === $a_flag) {
2399  return $this->hideToolbar;
2400  }
2401 
2402  $this->hideToolbar = $a_flag;
2403  return $this;
2404  }
hideToolbar($a_flag=null)
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjForumGUI::infoScreen ( )

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

References $info, and object.

Referenced by executeCommand(), and infoScreenObject().

3999  {
4000  if (
4001  !$this->access->checkAccess('visible', '', $this->object->getRefId()) &&
4002  !$this->access->checkAccess('read', '', $this->object->getRefId())
4003  ) {
4004  $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
4005  }
4006 
4007  include_once 'Services/InfoScreen/classes/class.ilInfoScreenGUI.php';
4008  $info = new ilInfoScreenGUI($this);
4009 
4010  $info->enablePrivateNotes();
4011 
4012  // standard meta data
4013  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
4014 
4015  // forward the command
4016  $this->ctrl->forwardCommand($info);
4017  }
Class ilInfoScreenGUI.
Create new PHPExcel object
obj_idprivate
$info
Definition: index.php:5
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjForumGUI::infoScreenObject ( )

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

References infoScreen().

417  {
418  $this->ctrl->setCmd('showSummary');
419  $this->ctrl->setCmdClass('ilinfoscreengui');
420  $this->infoScreen();
421  }
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
+ Here is the call graph for this function:

◆ initEditCustomForm()

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

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

427  {
428  $this->forum_settings_gui = new ilForumSettingsGUI($this);
429  $this->forum_settings_gui->getCustomForm($a_form);
430  }
Class ilForumSettingsGUI.

◆ initForumCreateForm()

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

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

References ilRadioOption\addSubItem(), ilUtil\getImagePath(), ilTextAreaInputGUI\setCols(), ilFormPropertyGUI\setInfo(), ilTextInputGUI\setSize(), settings(), ilCheckboxInputGUI\setValue(), ilObject\TITLE_LENGTH, ilForumProperties\VIEW_DATE, ilForumProperties\VIEW_DATE_ASC, ilForumProperties\VIEW_DATE_DESC, and ilForumProperties\VIEW_TREE.

1062  {
1063  $this->create_form_gui = new ilPropertyFormGUI();
1064  $this->create_form_gui->setTableWidth('600px');
1065 
1066  $this->create_form_gui->setTitle($this->lng->txt('frm_new'));
1067  $this->create_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
1068 
1069  // form action
1070  $this->ctrl->setParameter($this, 'new_type', $object_type);
1071  $this->create_form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
1072 
1073  // title
1074  $title_gui = new ilTextInputGUI($this->lng->txt('title'), 'title');
1075  $title_gui->setSize(min(40, ilObject::TITLE_LENGTH));
1076  $title_gui->setMaxLength(ilObject::TITLE_LENGTH);
1077  $this->create_form_gui->addItem($title_gui);
1078 
1079  // description
1080  $description_gui = new ilTextAreaInputGUI($this->lng->txt('desc'), 'desc');
1081  $description_gui->setCols(40);
1082  $description_gui->setRows(2);
1083  $this->create_form_gui->addItem($description_gui);
1084 
1085  // custom properties
1086  $this->forum_settings_gui->getCustomForm($this->create_form_gui);
1087 
1088  // view sorting threads
1089  $sort_man = new ilCheckboxInputGUI($this->lng->txt('sorting_manual_sticky'), 'thread_sorting');
1090  $sort_man->setInfo($this->lng->txt('sticky_threads_always_on_top'));
1091  $sort_man->setValue(1);
1092  $this->create_form_gui->addItem($sort_man);
1093 
1094  // view
1095  $view_group_gui = new ilRadioGroupInputGUI($this->lng->txt('frm_default_view'), 'sort');
1096  $view_hir = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('answers'), ilForumProperties::VIEW_TREE);
1097  $view_group_gui->addOption($view_hir);
1098  $view_dat = new ilRadioOption($this->lng->txt('order_by') . ' ' . $this->lng->txt('date'), ilForumProperties::VIEW_DATE);
1099  $view_group_gui->addOption($view_dat);
1100  $this->create_form_gui->addItem($view_group_gui);
1101  $view_direction_group_gui = new ilRadioGroupInputGUI('', 'default_view_sort_dir');
1102  $view_desc = new ilRadioOption($this->lng->txt('frm_post_sort_desc'), ilForumProperties::VIEW_DATE_DESC);
1103  $view_direction_group_gui->addOption($view_desc);
1104  $view_asc = new ilRadioOption($this->lng->txt('frm_post_sort_asc'), ilForumProperties::VIEW_DATE_ASC);
1105  $view_direction_group_gui->addOption($view_asc);
1106  $view_dat->addSubItem($view_direction_group_gui);
1107 
1108  // anonymized or not
1109  $anonymize_gui = new ilCheckboxInputGUI($this->lng->txt('frm_anonymous_posting'), 'anonymized');
1110  $anonymize_gui->setInfo($this->lng->txt('frm_anonymous_posting_desc'));
1111  $anonymize_gui->setValue(1);
1112 
1113  if ($this->settings->get('enable_anonymous_fora', false)) {
1114  $anonymize_gui->setDisabled(true);
1115  }
1116  $this->create_form_gui->addItem($anonymize_gui);
1117 
1118  // statistics enabled or not
1119  $statistics_gui = new ilCheckboxInputGUI($this->lng->txt('frm_statistics_enabled'), 'statistics_enabled');
1120  $statistics_gui->setInfo($this->lng->txt('frm_statistics_enabled_desc'));
1121  $statistics_gui->setValue(1);
1122  if (!$this->settings->get('enable_fora_statistics', false)) {
1123  $statistics_gui->setDisabled(true);
1124  }
1125  $this->create_form_gui->addItem($statistics_gui);
1126 
1127  $cb_prop = new ilCheckboxInputGUI($this->lng->txt('activate_new_posts'), 'post_activation');
1128  $cb_prop->setValue('1');
1129  $cb_prop->setInfo($this->lng->txt('post_activation_desc'));
1130  $this->create_form_gui->addItem($cb_prop);
1131 
1132  $this->create_form_gui->addCommandButton('save', $this->lng->txt('save'));
1133  $this->create_form_gui->addCommandButton('cancel', $this->lng->txt('cancel'));
1134  }
This class represents an option in a radio group.
This class represents a property form user interface.
const TITLE_LENGTH
max length of object title
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
addSubItem($a_item)
Add Subitem.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setValue($a_value)
Set Value.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
settings()
Definition: settings.php:2
This class represents a text area property in a property form.
+ Here is the call graph for this function:

◆ initHeaderAction()

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

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

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

4052  {
4053  $lg = parent::initHeaderAction();
4054 
4055  // Workaround: Do not show "desktop actions" in thread view
4056  if ($this->objCurrentTopic->getId()) {
4057  $container_obj = null;
4058  $lg->setContainerObject($container_obj);
4059  }
4060 
4061  if ($lg instanceof ilObjForumListGUI) {
4062  if ($this->user->getId() != ANONYMOUS_USER_ID && $this->settings->get('forum_notification') != 0) {
4063  $is_user_allowed_to_deactivate_notification = $this->isUserAllowedToDeactivateNotification();
4064 
4065  $frm = $this->object->Forum;
4066  $frm->setForumId($this->object->getId());
4067  $frm->setForumRefId($this->object->getRefId());
4068  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4069  $frm_notificiation_enabled = $frm->isForumNotificationEnabled($this->user->getId());
4070 
4071  if ($this->objCurrentTopic->getId()) {
4072  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
4073  }
4074 
4075  if ($this->isParentObjectCrsOrGrp()) {
4076  // special behaviour for CRS/GRP-Forum notification!!
4077  if (
4078  $frm_notificiation_enabled &&
4079  $is_user_allowed_to_deactivate_notification
4080  ) {
4081  $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'disableForumNotification'), "forums_disable_forum_notification");
4082  } elseif (!$frm_notificiation_enabled) {
4083  $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'enableForumNotification'), "forums_enable_forum_notification");
4084  }
4085  } else {
4086  if ($frm_notificiation_enabled) {
4087  $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'disableForumNotification'), "forums_disable_forum_notification");
4088  } else {
4089  $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'enableForumNotification'), "forums_enable_forum_notification");
4090  }
4091  }
4092 
4093  $topic_notification_enabled = false;
4094  if ($this->objCurrentTopic->getId()) {
4095  $topic_notification_enabled = $this->objCurrentTopic->isNotificationEnabled($this->user->getId());
4096  if ($topic_notification_enabled) {
4097  $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_disable_notification");
4098  } else {
4099  $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_enable_notification");
4100  }
4101  }
4102  $this->ctrl->setParameter($this, 'thr_pk', '');
4103 
4104  if ($frm_notificiation_enabled || $topic_notification_enabled) {
4105  $lg->addHeaderIcon(
4106  "not_icon",
4107  ilUtil::getImagePath("notification_on.svg"),
4108  $this->lng->txt("frm_notification_activated")
4109  );
4110  } else {
4111  $lg->addHeaderIcon(
4112  "not_icon",
4113  ilUtil::getImagePath("notification_off.svg"),
4114  $this->lng->txt("frm_notification_deactivated")
4115  );
4116  }
4117  }
4118  }
4119 
4120  return $lg;
4121  }
$lg
Definition: example_018.php:62
Class ilObjForumListGUI.
user()
Definition: user.php:4
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ initSessionStorage()

ilObjForumGUI::initSessionStorage ( )
protected

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

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

Referenced by __construct().

168  {
169  $sess = ilSession::get('frm');
170  if (!is_array($sess)) {
171  $sess = array();
172  ilSession::set('frm', $sess);
173  }
174 
175  if (isset($_GET['thr_fk']) && !is_array($sess[(int) $_GET['thr_fk']])) {
176  $sess[(int) $_GET['thr_fk']] = array();
177  ilSession::set('frm', $sess);
178  }
179  }
$_GET["client_id"]
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTopicCreateForm()

ilObjForumGUI::initTopicCreateForm (   $edit_draft = false)
private

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

References $_GET, $file, ilHtmlPurifierFactory\_getInstanceByType(), addAutosave(), array, ilUtil\getImagePath(), ilForumPostDraft\isSavePostDraftAllowed(), isWritingWithPseudonymAllowed(), ilForumPostDraft\newInstanceByDraftId(), ilTextAreaInputGUI\setCols(), ilFileWizardInputGUI\setFilenames(), ilFormPropertyGUI\setInfo(), ilTextInputGUI\setMaxLength(), ilFormPropertyGUI\setRequired(), ilNonEditableValueGUI\setValue(), and user().

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

3403  {
3404  $this->create_topic_form_gui = new ilPropertyFormGUI();
3405  if ($edit_draft == true) {
3406  $this->create_topic_form_gui->setTitle($this->lng->txt('edit_thread_draft'));
3407  } else {
3408  $this->create_topic_form_gui->setTitle($this->lng->txt('forums_new_thread'));
3409  }
3410  $this->create_topic_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
3411  $this->create_topic_form_gui->setTableWidth('100%');
3412 
3413  // form action
3414  $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'addThread'));
3415 
3416  if ($this->isWritingWithPseudonymAllowed()) {
3417  $alias_gui = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias');
3418  $alias_gui->setInfo($this->lng->txt('forums_use_alias'));
3419  $alias_gui->setMaxLength(255);
3420  $alias_gui->setSize(50);
3421  $this->create_topic_form_gui->addItem($alias_gui);
3422  } else {
3423  $alias_gui = new ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias');
3424  $alias_gui->setValue($this->user->getLogin());
3425  $this->create_topic_form_gui->addItem($alias_gui);
3426  }
3427 
3428  // topic
3429  $subject_gui = new ilTextInputGUI($this->lng->txt('forums_thread'), 'subject');
3430  $subject_gui->setMaxLength(255);
3431  $subject_gui->setSize(50);
3432  $subject_gui->setRequired(true);
3433  $this->create_topic_form_gui->addItem($subject_gui);
3434 
3435  // message
3436  $post_gui = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message');
3437  $post_gui->setCols(50);
3438  $post_gui->setRows(15);
3439  $post_gui->setRequired(true);
3440  $post_gui->setUseRte(true);
3441  $post_gui->addPlugin('latex');
3442  $post_gui->addButton('latex');
3443  $post_gui->addButton('pastelatex');
3444  $post_gui->addPlugin('ilfrmquote');
3445  //$post_gui->addPlugin('code');
3446 
3447  $this->addAutosave($this->create_topic_form_gui);
3448 
3449  $post_gui->removePlugin('advlink');
3450  $post_gui->usePurifier(true);
3451  $post_gui->setRTERootBlockElement('');
3452  $post_gui->setRTESupport($this->user->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.5.11');
3453  $post_gui->disableButtons(array(
3454  'charmap',
3455  'undo',
3456  'redo',
3457  'justifyleft',
3458  'justifycenter',
3459  'justifyright',
3460  'justifyfull',
3461  'anchor',
3462  'fullscreen',
3463  'cut',
3464  'copy',
3465  'paste',
3466  'pastetext',
3467  'formatselect'
3468  ));
3469 
3470  // purifier
3471  require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
3472  $post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
3473  $this->create_topic_form_gui->addItem($post_gui);
3474 
3475  if ($this->objProperties->isFileUploadAllowed()) {
3476  $fi = new ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile');
3477  $fi->setFilenames(array(0 => ''));
3478  $this->create_topic_form_gui->addItem($fi);
3479  if ($edit_draft == true) {
3480  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
3481  $thread_draft = ilForumPostDraft::newInstanceByDraftId((int) $_GET['draft_id']);
3482 
3483  if ($thread_draft->getDraftId() > 0) {
3484  $oFDForumDrafts = new ilFileDataForumDrafts(0, $thread_draft->getDraftId());
3485  if (count($oFDForumDrafts->getFilesOfPost())) {
3486  $oExistingAttachmentsGUI = new ilCheckboxGroupInputGUI($this->lng->txt('forums_delete_file'), 'del_file');
3487  foreach ($oFDForumDrafts->getFilesOfPost() as $file) {
3488  $oAttachmentGUI = new ilCheckboxInputGUI($file['name'], 'del_file');
3489  $oAttachmentGUI->setValue($file['md5']);
3490  $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
3491  }
3492  $this->create_topic_form_gui->addItem($oExistingAttachmentsGUI);
3493  }
3494  }
3495  }
3496  }
3497  }
3498 
3499  include_once 'Services/Mail/classes/class.ilMail.php';
3500  $umail = new ilMail($this->user->getId());
3501  // catch hack attempts
3502  if ($this->rbac->system()->checkAccess('internal_mail', $umail->getMailObjectReferenceId()) &&
3503  !$this->objProperties->isAnonymized()
3504  ) {
3505  // direct notification
3506  $dir_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify');
3507  $dir_notification_gui->setInfo($this->lng->txt('forum_notify_me'));
3508  $dir_notification_gui->setValue(1);
3509  $this->create_topic_form_gui->addItem($dir_notification_gui);
3510  }
3511 
3512  require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
3513  if (
3514  $this->user->isAnonymous() &&
3515  !$this->user->isCaptchaVerified() &&
3516  ilCaptchaUtil::isActiveForForum()
3517  ) {
3518  require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
3519  $captcha = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
3520  $captcha->setRequired(true);
3521  $this->create_topic_form_gui->addItem($captcha);
3522  }
3523 
3525  if ($this->ctrl->getCmd() == 'editThreadDraft') {
3526  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
3527 
3528  $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'updateThreadDraft'));
3529  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
3530  $this->create_topic_form_gui->addCommandButton('publishThreadDraft', $this->lng->txt('publish'));
3531  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
3532  $this->create_topic_form_gui->addCommandButton('updateThreadDraft', $this->lng->txt('save_message'));
3533  } else {
3534  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
3535  $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveThreadAsDraft'));
3536  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
3537  $this->create_topic_form_gui->addCommandButton('addThread', $this->lng->txt('create'));
3538  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
3539  $this->create_topic_form_gui->addCommandButton('saveThreadAsDraft', $this->lng->txt('save_message'));
3540  }
3541  $this->create_topic_form_gui->addCommandButton('cancelDraft', $this->lng->txt('cancel'));
3542  } else {
3543  $this->create_topic_form_gui->addCommandButton('addThread', $this->lng->txt('create'));
3544  $this->create_topic_form_gui->addCommandButton('showThreads', $this->lng->txt('cancel'));
3545  }
3546  }
This class represents a property form user interface.
This class represents a captcha input in a property form.
$_GET["client_id"]
This class represents a file wizard property in a property form.
This class represents a checkbox property in a property form.
This class handles all operations on files for the drafts of a forum object.
user()
Definition: user.php:4
setInfo($a_info)
Set Information Text.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class handles base functions for mail handling.
This class represents a text property in a property form.
static newInstanceByDraftId($draft_id)
setMaxLength($a_maxlength)
Set Max Length.
This class represents a property in a property form.
Create styles array
The data for the language used.
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
This class represents a non editable value in a property form.
setFilenames($a_filenames)
Set filenames.
This class represents a text area property in a property form.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
addAutosave(ilPropertyFormGUI $form)
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHierarchicalView()

ilObjForumGUI::isHierarchicalView ( )
private
Returns
bool

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

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

Referenced by confirmDeleteThreadDraftsObject(), and getForumObjects().

229  {
230  return (
231  $_SESSION['viewmode'] == 'answers' ||
233  ) || !(
234  $_SESSION['viewmode'] == 'date' ||
236  );
237  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ isParentObjectCrsOrGrp()

ilObjForumGUI::isParentObjectCrsOrGrp ( )

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

References object.

Referenced by initHeaderAction(), and isUserAllowedToDeactivateNotification().

4149  {
4150  // check if there a parent-node is a grp or crs
4151  $grp_ref_id = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'grp');
4152  $crs_ref_id = $this->repositoryTree->checkForParentType($this->object->getRefId(), 'crs');
4153 
4154  if ($grp_ref_id == 0 && $crs_ref_id == 0) {
4155  return false;
4156  }
4157  return true;
4158  }
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ isTopLevelReplyCommand()

ilObjForumGUI::isTopLevelReplyCommand ( )
private
Returns
bool

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

References array.

Referenced by getCensorshipFormHTML(), and getForumObjects().

243  {
244  return in_array(
245  strtolower($this->ctrl->getCmd()),
246  array_map('strtolower', array('createTopLevelPost', 'quoteTopLevelPost', 'saveTopLevelPost'))
247  );
248  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ isUserAllowedToDeactivateNotification()

ilObjForumGUI::isUserAllowedToDeactivateNotification ( )

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

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

Referenced by initHeaderAction().

4124  {
4125  if ($this->objProperties->getNotificationType() == 'default') {
4126  return true;
4127  }
4128 
4129  if ($this->objProperties->isUserToggleNoti() == 0) {
4130  return true;
4131  }
4132 
4133  if ($this->isParentObjectCrsOrGrp()) {
4134  include_once 'Modules/Forum/classes/class.ilForumNotification.php';
4135 
4136  $frm_noti = new ilForumNotification((int) $_GET['ref_id']);
4137  $frm_noti->setUserId($this->user->getId());
4138 
4139  $user_toggle = (int) $frm_noti->isUserToggleNotification();
4140  if ($user_toggle == 0 && $this->objProperties->isUserToggleNoti() == 0) {
4141  return true;
4142  }
4143  }
4144 
4145  return false;
4146  }
$_GET["client_id"]
Class ilForumNotification.
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isWritingWithPseudonymAllowed()

ilObjForumGUI::isWritingWithPseudonymAllowed ( )
private

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

Referenced by addThreadObject(), getCensorshipFormHTML(), initTopicCreateForm(), and publishDraftObject().

3394  {
3395  if ($this->objProperties->isAnonymized()
3396  && (!$this->is_moderator || ($this->is_moderator && !$this->objProperties->getMarkModeratorPosts()))) {
3397  return true;
3398  }
3399  return false;
3400  }
+ Here is the caller graph for this function:

◆ markAllReadObject()

ilObjForumGUI::markAllReadObject ( )

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

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

534  {
535  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
536  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
537  }
538 
539  $this->object->markAllThreadsRead($this->user->getId());
540  ilUtil::sendInfo($this->lng->txt('forums_all_threads_marked_read'));
541  $this->showThreadsObject();
542  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ markPostReadObject()

ilObjForumGUI::markPostReadObject ( )

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

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

4034  {
4035  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4036  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4037  }
4038 
4039  if ((int) $this->objCurrentTopic->getId() > 0 && (int) $this->objCurrentPost->getId() > 0) {
4040  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
4041 
4042  $this->object->markPostRead(
4043  $this->user->getId(),
4044  (int) $this->objCurrentTopic->getId(),
4045  (int) $this->objCurrentPost->getId()
4046  );
4047  }
4048  $this->viewThreadObject();
4049  }
user()
Definition: user.php:4
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ markPostUnreadObject()

ilObjForumGUI::markPostUnreadObject ( )

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

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

4020  {
4021  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4022  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4023  }
4024 
4025  if ((int) $this->objCurrentPost->getId() > 0) {
4026  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
4027 
4028  $this->object->markPostUnread($this->user->getId(), (int) $this->objCurrentPost->getId());
4029  }
4030  $this->viewThreadObject();
4031  }
user()
Definition: user.php:4
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ mergeThreadsObject()

ilObjForumGUI::mergeThreadsObject ( )

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

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

Referenced by confirmMergeThreadsObject(), and performThreadsActionObject().

4222  {
4223  if (!$this->is_moderator) {
4224  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4225  }
4226 
4227  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4228  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4229  }
4230 
4231  $selected_thread_id = 0;
4232  if (isset($_GET['merge_thread_id']) && (int) $_GET['merge_thread_id']) {
4233  $selected_thread_id = (int) $_GET['merge_thread_id'];
4234  } elseif (isset($_POST['thread_ids']) && count((array) $_POST['thread_ids']) == 1) {
4235  $selected_thread_id = (int) current($_POST['thread_ids']);
4236  } else {
4237  ilUtil::sendInfo($this->lng->txt('select_one'));
4238  $this->showThreadsObject();
4239  return;
4240  }
4241 
4242  if ($selected_thread_id) {
4243  $frm = $this->object->Forum;
4244  $frm->setForumId($this->object->getId());
4245  $frm->setForumRefId($this->object->getRefId());
4246 
4247  $selected_thread_obj = new ilForumTopic($selected_thread_id);
4248 
4249  if (ilForum::_lookupObjIdForForumId($selected_thread_obj->getForumId()) != $frm->getForumId()) {
4250  ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
4251  $this->showThreadsObject();
4252  return;
4253  }
4254 
4255  $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4256 
4257  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_liste.html', 'Modules/Forum');
4258 
4259  $topicData = $frm->getOneTopic();
4260  if ($topicData) {
4261  include_once 'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
4262  $this->ctrl->setParameter($this, 'merge_thread_id', $selected_thread_id);
4263  $tbl = new ilForumTopicTableGUI($this, 'mergeThreads', '', (int) $_GET['ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
4264  $tbl->setSelectedThread($selected_thread_obj);
4265  $tbl->setMapper($frm)->fetchData();
4266  $tbl->init();
4267  $this->tpl->setVariable('THREADS_TABLE', $tbl->getHTML());
4268  } else {
4269  ilUtil::sendFailure($this->lng->txt('select_one'));
4270  $this->showThreadsObject();
4271  return;
4272  }
4273  }
4274  }
static _lookupObjIdForForumId($a_for_id)
$_GET["client_id"]
$tbl
Definition: example_048.php:81
Class ilForumTopicTableGUI.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveThreadsObject()

ilObjForumGUI::moveThreadsObject ( )

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

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

Referenced by performMoveThreadsObject(), and performThreadsActionObject().

3324  {
3325  if (!$this->is_moderator) {
3326  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3327  }
3328 
3329  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3330  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3331  }
3332 
3333  $threads2move = $_SESSION['threads2move'];
3334  if (!is_array($threads2move) || !count($threads2move)) {
3335  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3336  $this->ctrl->redirect($this, 'showThreads');
3337  }
3338 
3339  require_once 'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php';
3340 
3341  $threads = [];
3342  $isModerator = $this->is_moderator;
3343  array_walk($threads2move, function ($threadId) use (&$threads, $isModerator) {
3344  $thread = new \ilForumTopic($threadId, $isModerator);
3345  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3346 
3347  $threads[] = $thread;
3348  });
3349 
3350  $exp = new ilForumMoveTopicsExplorer($this, 'moveThreads');
3351  $exp->setPathOpen($this->object->getRefId());
3352  $exp->setNodeSelected(isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id'] ? (int) $_POST['frm_ref_id'] : 0);
3353  $exp->setCurrentFrmRefId($this->object->getRefId());
3354  $exp->setHighlightedNode($this->object->getRefId());
3355  if (!$exp->handleCommand()) {
3356  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_move.html', 'Modules/Forum');
3357 
3358  if (!$this->hideToolbar()) {
3359  $this->toolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this));
3360  }
3361 
3362  $tblThr = new ilTable2GUI($this);
3363  $tblThr->setId('il_frm_thread_move_table_' . $this->object->getRefId());
3364  $tblThr->setTitle($this->lng->txt('move_chosen_topics'));
3365  $tblThr->addColumn($this->lng->txt('subject'), 'top_name', '100%');
3366  $tblThr->disable('header');
3367  $tblThr->disable('footer');
3368  $tblThr->disable('linkbar');
3369  $tblThr->disable('sort');
3370  $tblThr->disable('linkbar');
3371  $tblThr->setLimit(PHP_INT_MAX);
3372  $tblThr->setRowTemplate('tpl.forums_threads_move_thr_row.html', 'Modules/Forum');
3373  $tblThr->setDefaultOrderField('is_sticky');
3374  $counter = 0;
3375  $result = array();
3376  foreach ($threads as $thread) {
3377  $result[$counter]['num'] = $counter + 1;
3378  $result[$counter]['thr_subject'] = $thread->getSubject();
3379  ++$counter;
3380  }
3381  $tblThr->setData($result);
3382  $this->tpl->setVariable('THREADS_TABLE', $tblThr->getHTML());
3383 
3384  $this->tpl->setVariable('FRM_SELECTION_TREE', $exp->getHTML());
3385  $this->tpl->setVariable('CMD_SUBMIT', 'performMoveThreads');
3386  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('move'));
3387  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'performMoveThreads'));
3388  }
3389 
3390  return true;
3391  }
$_SESSION["AccountId"]
$result
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$counter
hideToolbar($a_flag=null)
Class ilTable2GUI.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performDeleteThreadsObject()

ilObjForumGUI::performDeleteThreadsObject ( )

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

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

1310  {
1311  if (!$this->is_moderator) {
1312  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1313  }
1314 
1315  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1316  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1317  }
1318 
1319  if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
1320  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
1321  return $this->showThreadsObject();
1322  }
1323 
1324  require_once 'Modules/Forum/classes/class.ilObjForum.php';
1325  $forumObj = new ilObjForum($this->object->getRefId());
1326  $this->objProperties->setObjId($forumObj->getId());
1327 
1328  $frm = new ilForum();
1329 
1330  $success_message = "forums_thread_deleted";
1331  if (count($_POST['thread_ids']) > 1) {
1332  $success_message = "forums_threads_deleted";
1333  }
1334 
1335  $threadIds = [];
1336  if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'])) {
1337  $threadIds = $_POST['thread_ids'];
1338  }
1339 
1340  $threads = [];
1341  array_walk($threadIds, function ($threadId) use (&$threads) {
1342  $thread = new \ilForumTopic($threadId);
1343  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
1344 
1345  $threads[] = $thread;
1346  });
1347 
1348  foreach ($threads as $thread) {
1349  $frm->setForumId($forumObj->getId());
1350  $frm->setForumRefId($forumObj->getRefId());
1351 
1352  $first_node = $frm->getFirstPostNode($thread->getId());
1353  if ((int) $first_node['pos_pk']) {
1354  $frm->deletePost($first_node['pos_pk']);
1355  ilUtil::sendInfo($this->lng->txt($success_message), true);
1356  }
1357  }
1358  $this->ctrl->redirect($this, 'showThreads');
1359  }
Class Forum core functions for forum.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
Class ilObjForum.
$_POST["username"]
+ Here is the call graph for this function:

◆ performMergeThreadsObject()

ilObjForumGUI::performMergeThreadsObject ( )

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

References $_POST, ensureThreadBelongsToForum(), ilForum\mergeThreads(), object, ilUtil\sendFailure(), ilUtil\sendSuccess(), and showThreadsObject().

4337  {
4338  if (!$this->is_moderator) {
4339  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4340  }
4341 
4342  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4343  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4344  }
4345 
4346  if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids']) || count($_POST['thread_ids']) != 2) {
4347  ilUtil::sendFailure($this->lng->txt('select_one'));
4348  $this->showThreadsObject();
4349  return;
4350  }
4351 
4352  if ((int) $_POST['thread_ids'][0] == (int) $_POST['thread_ids'][1]) {
4353  ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
4354  $this->showThreadsObject();
4355  return;
4356  }
4357 
4358  try {
4359  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $_POST['thread_ids'][0]));
4360  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic((int) $_POST['thread_ids'][1]));
4361  ilForum::mergeThreads($this->object->id, (int) $_POST['thread_ids'][0], (int) $_POST['thread_ids'][1]);
4362  ilUtil::sendSuccess($this->lng->txt('merged_threads_successfully'));
4363  } catch (ilException $e) {
4364  return ilUtil::sendFailure($this->lng->txt($e->getMessage()));
4365  }
4366  $this->showThreadsObject();
4367  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static mergeThreads($obj_id, $source_id, $target_id)
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:

◆ performMoveThreadsObject()

ilObjForumGUI::performMoveThreadsObject ( )

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

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

3266  {
3267  if (!$this->is_moderator) {
3268  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3269  }
3270 
3271  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3272  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3273  }
3274 
3275  $threads2move = $_SESSION['threads2move'];
3276  if (!is_array($threads2move) || !count($threads2move)) {
3277  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3278  $this->ctrl->redirect($this, 'showThreads');
3279  }
3280 
3281  if (!$this->access->checkAccess('read', '', (int) $_POST['frm_ref_id'])) {
3282  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3283  }
3284 
3285  $threads = [];
3286  array_walk($threads2move, function ($threadId) use (&$threads) {
3287  $thread = new \ilForumTopic($threadId);
3288  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $thread);
3289 
3290  $threads[] = $threadId;
3291  });
3292 
3293  if (isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id']) {
3294  $errorMessages = $this->object->Forum->moveThreads(
3295  (array) $_SESSION['threads2move'],
3296  $this->object->getRefId(),
3297  $this->ilObjDataCache->lookupObjId($_POST['frm_ref_id'])
3298  );
3299 
3300  if (array() !== $errorMessages) {
3302  implode("<br><br>", $errorMessages),
3303  true
3304  );
3305  return $this->ctrl->redirectByClass('ilObjForumGUI', 'showThreads');
3306  }
3307 
3308  unset($_SESSION['threads2move']);
3309  ilUtil::sendInfo($this->lng->txt('threads_moved_successfully'), true);
3310  $this->ctrl->redirect($this, 'showThreads');
3311  } else {
3312  ilUtil::sendInfo($this->lng->txt('no_forum_selected'));
3313  $this->moveThreadsObject();
3314  }
3315  }
$_SESSION["AccountId"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:

◆ performPostActivationObject()

ilObjForumGUI::performPostActivationObject ( )

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

References $GLOBALS, $objCurrentPost, array, ensureThreadBelongsToForum(), object, and ilUtil\sendInfo().

1471  {
1472  if (!$this->is_moderator) {
1473  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1474  }
1475 
1476  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1477  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1478  }
1479 
1480  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentPost->getThread());
1481 
1482  $this->objCurrentPost->activatePost();
1483  $GLOBALS['ilAppEventHandler']->raise(
1484  'Modules/Forum',
1485  'activatedPost',
1486  array(
1487  'ref_id' => $this->object->getRefId(),
1488  'post' => $this->objCurrentPost
1489  )
1490  );
1491  ilUtil::sendInfo($this->lng->txt('forums_post_was_activated'), true);
1492 
1493  $this->viewThreadObject();
1494  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ performThreadsActionObject()

ilObjForumGUI::performThreadsActionObject ( )

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

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

3148  {
3149  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
3150  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3151  }
3152 
3153  unset($_SESSION['threads2move']);
3154 
3155  if (isset($_POST['thread_ids']) && is_array($_POST['thread_ids'])) {
3156  if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] == 'move') {
3157  if ($this->is_moderator) {
3158  $_SESSION['threads2move'] = $_POST['thread_ids'];
3159  $this->moveThreadsObject();
3160  }
3161  } elseif ($_POST['selected_cmd'] == 'enable_notifications' && $this->settings->get('forum_notification') != 0) {
3162  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3163  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3164  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3165  $tmp_obj->enableNotification($this->user->getId());
3166  }
3167 
3168  $this->ctrl->redirect($this, 'showThreads');
3169  } elseif ($_POST['selected_cmd'] == 'disable_notifications' && $this->settings->get('forum_notification') != 0) {
3170  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3171  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3172  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3173  $tmp_obj->disableNotification($this->user->getId());
3174  }
3175 
3176  $this->ctrl->redirect($this, 'showThreads');
3177  } elseif ($_POST['selected_cmd'] == 'close') {
3178  if ($this->is_moderator) {
3179  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3180  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3181  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3182  $tmp_obj->close();
3183  }
3184  }
3185  ilUtil::sendSuccess($this->lng->txt('selected_threads_closed'), true);
3186  $this->ctrl->redirect($this, 'showThreads');
3187  } elseif ($_POST['selected_cmd'] == 'reopen') {
3188  if ($this->is_moderator) {
3189  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3190  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3191  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3192  $tmp_obj->reopen();
3193  }
3194  }
3195 
3196  ilUtil::sendSuccess($this->lng->txt('selected_threads_reopened'), true);
3197  $this->ctrl->redirect($this, 'showThreads');
3198  } elseif ($_POST['selected_cmd'] == 'makesticky') {
3199  if ($this->is_moderator) {
3200  $message = $this->lng->txt('sel_threads_make_sticky');
3201 
3202  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3203  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3204  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3205  $makeSticky = $tmp_obj->makeSticky();
3206 
3207  if (!$makeSticky) {
3208  $message = $this->lng->txt('sel_threads_already_sticky');
3209  }
3210  }
3211  }
3212  if ($message != null) {
3213  ilUtil::sendInfo($message, true);
3214  }
3215  $this->ctrl->redirect($this, 'showThreads');
3216  } elseif ($_POST['selected_cmd'] == 'unmakesticky') {
3217  if ($this->is_moderator) {
3218  $message = $this->lng->txt('sel_threads_make_unsticky');
3219  for ($i = 0; $i < count($_POST['thread_ids']); $i++) {
3220  $tmp_obj = new ilForumTopic($_POST['thread_ids'][$i]);
3221  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $tmp_obj);
3222  $unmakeSticky = $tmp_obj->unmakeSticky();
3223  if (!$unmakeSticky) {
3224  $message = $this->lng->txt('sel_threads_already_unsticky');
3225  }
3226  }
3227  }
3228 
3229  if ($message != null) {
3230  ilUtil::sendInfo($message, true);
3231  }
3232  $this->ctrl->redirect($this, 'showThreads');
3233  } elseif ($_POST['selected_cmd'] == 'editThread') {
3234  if ($this->is_moderator) {
3235  $count = count($_POST['thread_ids']);
3236  if ($count != 1) {
3237  ilUtil::sendInfo($this->lng->txt('select_max_one_thread'), true);
3238  $this->ctrl->redirect($this, 'showThreads');
3239  } else {
3240  foreach ($_POST['thread_ids'] as $thread_id) {
3241  return $this->editThreadObject($thread_id, null);
3242  }
3243  }
3244  }
3245 
3246  $this->ctrl->redirect($this, 'showThreads');
3247  } elseif ($_POST['selected_cmd'] == 'html') {
3248  $this->ctrl->setCmd('exportHTML');
3249  $this->ctrl->setCmdClass('ilForumExportGUI');
3250  $this->executeCommand();
3251  } elseif ($_POST['selected_cmd'] == 'confirmDeleteThreads') {
3252  $this->confirmDeleteThreads();
3253  } elseif ($_POST['selected_cmd'] == 'merge') {
3254  $this->mergeThreadsObject();
3255  } else {
3256  ilUtil::sendInfo($this->lng->txt('topics_please_select_one_action'), true);
3257  $this->ctrl->redirect($this, 'showThreads');
3258  }
3259  } else {
3260  ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true);
3261  $this->ctrl->redirect($this, 'showThreads');
3262  }
3263  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_SESSION["AccountId"]
editThreadObject($a_thread_id, ilPropertyFormGUI $form=null)
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
catch(Exception $e) $message
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
settings()
Definition: settings.php:2
Create new PHPExcel object
obj_idprivate
$i
Definition: disco.tpl.php:19
$_POST["username"]
+ Here is the call graph for this function:

◆ prepareFormOutput()

ilObjForumGUI::prepareFormOutput (   $a_text)

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

References ilUtil\prepareFormOutput().

3979  {
3980  $a_text = str_replace("&lt;", "<", $a_text);
3981  $a_text = str_replace("&gt;", ">", $a_text);
3982  $a_text = ilUtil::prepareFormOutput($a_text);
3983  return $a_text;
3984  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
+ Here is the call graph for this function:

◆ publishDraftObject()

ilObjForumGUI::publishDraftObject (   $use_replyform = true)

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

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

Referenced by publishSelectedDraftObject().

1987  {
1988  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1989  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1990  }
1991 
1992  if (!$this->access->checkAccess('add_reply', '', $this->object->getRefId())) {
1993  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1994  }
1995 
1996  if (!$this->objCurrentTopic->getId()) {
1997  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_deleted'), true);
1998  $this->ctrl->redirect($this);
1999  }
2000 
2001  if ($this->objCurrentTopic->isClosed()) {
2002  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_thr_closed'), true);
2003  $this->ctrl->redirect($this);
2004  }
2005 
2006  if (!$this->objCurrentPost->getId()) {
2007  $_GET['action'] = '';
2008  \ilUtil::sendFailure($this->lng->txt('frm_action_not_possible_parent_deleted'));
2009  $this->viewThreadObject();
2010  return;
2011  }
2012 
2013  $post_id = $this->objCurrentPost->getId();
2014 
2015  $draft_obj = new ilForumPostDraft($this->user->getId(), $post_id, (int) $_GET['draft_id']);
2016 
2017  if ($use_replyform) {
2018  $oReplyEditForm = $this->getReplyEditForm();
2019  if (!$oReplyEditForm->checkInput() && !$draft_obj instanceof ilForumPostDraft) {
2020  $oReplyEditForm->setValuesByPost();
2021  return $this->viewThreadObject();
2022  }
2023  $post_subject = $oReplyEditForm->getInput('subject');
2024  $post_message = $oReplyEditForm->getInput('message');
2025  $mob_direction = 0;
2026  } else {
2027  $post_subject = $draft_obj->getPostSubject();
2028  $post_message = $draft_obj->getPostMessage();
2029  $mob_direction = 1;
2030  }
2031 
2032  if ($draft_obj->getDraftId() > 0) {
2033  // init objects
2034  $oForumObjects = $this->getForumObjects();
2035  $frm = $oForumObjects['frm'];
2036  $frm->setMDB2WhereCondition(' top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
2037 
2038  // reply: new post
2039  $status = 1;
2040  $send_activation_mail = 0;
2041 
2042  if ($this->objProperties->isPostActivationEnabled()) {
2043  if (!$this->is_moderator) {
2044  $status = 0;
2045  $send_activation_mail = 1;
2046  } elseif ($this->objCurrentPost->isAnyParentDeactivated()) {
2047  $status = 0;
2048  }
2049  }
2050 
2051  $newPost = $frm->generatePost(
2052  $draft_obj->getForumId(),
2053  $draft_obj->getThreadId(),
2054  $this->user->getId(),
2055  $draft_obj->getPostDisplayUserId(),
2056  ilRTE::_replaceMediaObjectImageSrc($post_message, $mob_direction),
2057  $draft_obj->getPostId(),
2058  (int) $draft_obj->getNotify(),
2059  $this->handleFormInput($post_subject, false),
2060  $draft_obj->getPostUserAlias(),
2061  '',
2062  $status,
2063  $send_activation_mail
2064  );
2065 
2066  $this->object->markPostRead($this->user->getId(), (int) $this->objCurrentTopic->getId(), (int) $this->objCurrentPost->getId());
2067 
2068  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
2069 
2070  foreach ($uploadedObjects as $mob) {
2071  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
2072  ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost);
2073  }
2074  ilForumUtil::saveMediaObjects($post_message, 'frm:html', $newPost, $mob_direction);
2075 
2076  if ($this->objProperties->isFileUploadAllowed()) {
2077  $file = $_FILES['userfile'];
2078  if (is_array($file) && !empty($file)) {
2079  $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost);
2080  $tmp_file_obj->storeUploadedFile($file);
2081  }
2082 
2083  //move files of draft to posts directory
2084  $oFDForum = new ilFileDataForum($this->object->getId(), $newPost);
2085  $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_obj->getDraftId());
2086 
2087  $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPost);
2088  $oFDForumDrafts->delete();
2089  }
2090 
2092  $GLOBALS['ilAppEventHandler']->raise(
2093  'Modules/Forum',
2094  'publishedDraft',
2095  array('draftObj' => $draft_obj,
2096  'obj_id' => $this->object->getId(),
2097  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
2098  );
2099  }
2100  $draft_obj->deleteDraft();
2101 
2102  $GLOBALS['ilAppEventHandler']->raise(
2103  'Modules/Forum',
2104  'createdPost',
2105  array(
2106  'ref_id' => $this->object->getRefId(),
2107  'post' => new ilForumPost($newPost),
2108  'notify_moderators' => (bool) $send_activation_mail
2109  )
2110  );
2111 
2112  $message = '';
2113  if (!$this->is_moderator && !$status) {
2114  $message .= $this->lng->txt('forums_post_needs_to_be_activated');
2115  } else {
2116  $message .= $this->lng->txt('forums_post_new_entry');
2117  }
2118 
2119  $_SESSION['frm'][(int) $_GET['thr_pk']]['openTreeNodes'][] = (int) $this->objCurrentPost->getId();
2120 
2121  $this->ctrl->clearParameters($this);
2123  $this->ctrl->setParameter($this, 'pos_pk', $newPost);
2124  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
2125 
2126  $this->ctrl->redirect($this, 'viewThread');
2127  }
2128  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilForumPostDraft.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$_SESSION["AccountId"]
$_GET["client_id"]
static saveMediaObjects($post_message, $target_type, $target_id, $direction=0)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
This class handles all operations on files for the drafts of a forum object.
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
user()
Definition: user.php:4
catch(Exception $e) $message
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
This class handles all operations on files for the forum object.
handleFormInput($a_text, $a_stripslashes=true)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
storeUploadedFile($files)
Store uploaded files in filesystem.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ publishSelectedDraftObject()

ilObjForumGUI::publishSelectedDraftObject ( )

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

References $_GET, and publishDraftObject().

1980  {
1981  if (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
1982  $this->publishDraftObject(false);
1983  }
1984  }
$_GET["client_id"]
publishDraftObject($use_replyform=true)
+ Here is the call graph for this function:

◆ publishThreadDraftObject()

ilObjForumGUI::publishThreadDraftObject (   $a_prevent_redirect = false)

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

References $_GET, $file, $GLOBALS, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilRTE\_replaceMediaObjectImageSrc(), ilObjMediaObject\_saveUsage(), array, doCaptchaCheck(), ilForumUtil\getPublicUserAlias(), handleFormInput(), initTopicCreateForm(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumPostDraft\newInstanceByDraftId(), object, ilUtil\sendSuccess(), ilFileDataForum\storeUploadedFile(), and user().

3623  {
3624  $frm = $this->object->Forum;
3625  $frm->setForumId($this->object->getId());
3626  $frm->setForumRefId($this->object->getRefId());
3627 
3628  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
3629  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
3630  }
3631 
3632  $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
3633 
3634  $topicData = $frm->getOneTopic();
3635 
3636  $this->initTopicCreateForm();
3637  if ($this->create_topic_form_gui->checkInput()) {
3638  $this->doCaptchaCheck();
3639  $user_alias = ilForumUtil::getPublicUserAlias($this->create_topic_form_gui->getInput('alias'), $this->objProperties->isAnonymized());
3640 
3641  $status = 1;
3642  if (
3643  $this->objProperties->isPostActivationEnabled() &&
3644  !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()
3645  ) {
3646  $status = 0;
3647  }
3648 
3649  if (isset($_GET['draft_id'])) {
3650  $draft_id = (int) $_GET['draft_id'];
3651  $draft_obj = ilForumPostDraft::newInstanceByDraftId((int) $draft_id);
3652  }
3653 
3654  $newThread = new ilForumTopic(0, true, true);
3655  $newThread->setForumId($topicData['top_pk']);
3656  $newThread->setThrAuthorId($draft_obj->getPostAuthorId());
3657  $newThread->setDisplayUserId($draft_obj->getPostDisplayUserId());
3658  $newThread->setSubject($this->handleFormInput($this->create_topic_form_gui->getInput('subject'), false));
3659  $newThread->setUserAlias($draft_obj->getPostUserAlias());
3660 
3661  $newPostId = $frm->generateThread(
3662  $newThread,
3663  ilRTE::_replaceMediaObjectImageSrc($this->create_topic_form_gui->getInput('message'), 0),
3664  $draft_obj->getNotify(),
3665  $draft_obj->getPostNotify(),
3666  $status
3667  );
3668 
3669  if ($this->objProperties->isFileUploadAllowed()) {
3670  $file = $_FILES['userfile'];
3671  if (is_array($file) && !empty($file)) {
3672  $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPostId);
3673  $tmp_file_obj->storeUploadedFile($file);
3674  }
3675  }
3676 
3677  // Visit-Counter
3678  $frm->setDbTable('frm_data');
3679  $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
3680  $frm->updateVisits($topicData['top_pk']);
3681 
3682  $frm->setMDB2WhereCondition(
3683  'thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ',
3684  array('integer', 'text'),
3685  array($topicData['top_pk'], $this->create_topic_form_gui->getInput('subject'))
3686  );
3687 
3688  $uploadedObjects = ilObjMediaObject::_getMobsOfObject('frm~:html', $this->user->getId());
3689 
3690  foreach ($uploadedObjects as $mob) {
3691  ilObjMediaObject::_removeUsage($mob, 'frm~:html', $this->user->getId());
3692  ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPostId);
3693  }
3694 
3695  if (ilForumPostDraft::isSavePostDraftAllowed() && $draft_obj instanceof ilForumPostDraft) {
3696  $history_obj = new ilForumDraftsHistory();
3697  $history_obj->deleteHistoryByDraftIds(array($draft_obj->getDraftId()));
3698 
3699  if ($this->objProperties->isFileUploadAllowed()) {
3700  //move files of draft to posts directory
3701  $oFDForum = new ilFileDataForum($this->object->getId(), $newPostId);
3702  $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_obj->getDraftId());
3703 
3704  $oFDForumDrafts->moveFilesOfDraft($oFDForum->getForumPath(), $newPostId);
3705  }
3706  $draft_obj->deleteDraft();
3707  }
3708 
3709  $GLOBALS['ilAppEventHandler']->raise(
3710  'Modules/Forum',
3711  'createdPost',
3712  array(
3713  'ref_id' => $this->object->getRefId(),
3714  'post' => new ilForumPost($newPostId),
3715  'notify_moderators' => !$status
3716  )
3717  );
3718 
3719  if (!$a_prevent_redirect) {
3720  ilUtil::sendSuccess($this->lng->txt('forums_thread_new_entry'), true);
3721  $this->ctrl->clearParameters($this);
3722  $this->ctrl->redirect($this);
3723  } else {
3724  return $newPostId;
3725  }
3726  } else {
3727  $this->create_topic_form_gui->setValuesByPost();
3728 
3729  if (!$this->objProperties->isAnonymized()) {
3730  $this->create_topic_form_gui->getItemByPostVar('alias')->setValue($this->user->getLogin());
3731  }
3732 
3733  return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
3734  }
3735  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilForumPostDraft.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static getPublicUserAlias($user_alias, $is_anonymized=false)
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
This class handles all operations on files for the drafts of a forum object.
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
user()
Definition: user.php:4
Class ilForumDraftHistory.
static newInstanceByDraftId($draft_id)
initTopicCreateForm($edit_draft=false)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
This class handles all operations on files for the forum object.
handleFormInput($a_text, $a_stripslashes=true)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.
storeUploadedFile($files)
Store uploaded files in filesystem.
+ Here is the call graph for this function:

◆ quotePostObject()

ilObjForumGUI::quotePostObject ( )

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

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

Referenced by quoteTopLevelPostObject().

2407  {
2408  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
2409  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
2410  }
2411 
2412  if (!is_array($_POST['del_file'])) {
2413  $_POST['del_file'] = array();
2414  }
2415 
2416  if ($this->objCurrentTopic->isClosed()) {
2417  $_GET['action'] = '';
2418  return $this->viewThreadObject();
2419  }
2420 
2421  $oReplyEditForm = $this->getReplyEditForm();
2422 
2423  // remove mandatory fields
2424  $oReplyEditForm->getItemByPostVar('subject')->setRequired(false);
2425  $oReplyEditForm->getItemByPostVar('message')->setRequired(false);
2426 
2427  $oReplyEditForm->checkInput();
2428 
2429  // add mandatory fields
2430  $oReplyEditForm->getItemByPostVar('subject')->setRequired(true);
2431  $oReplyEditForm->getItemByPostVar('message')->setRequired(true);
2432 
2433  $_GET['action'] = 'showreply';
2434 
2435  $this->viewThreadObject();
2436  }
$_GET["client_id"]
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quoteTopLevelPostObject()

ilObjForumGUI::quoteTopLevelPostObject ( )

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

References quotePostObject().

1974  {
1975  $this->quotePostObject();
1976  return;
1977  }
+ Here is the call graph for this function:

◆ removeFromDeskObject()

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

Implements ilDesktopItemHandling.

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

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

4180  {
4181  if ((int) $this->settings->get('disable_my_offers')) {
4182  $this->showThreadsObject();
4183  return;
4184  }
4185 
4186  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
4188  ilUtil::sendSuccess($this->lng->txt("removed_from_desktop"));
4189  $this->showThreadsObject();
4190  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static removeFromDesktop()
Remove item from personal desktop public.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ renderDraftContent()

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

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

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

Referenced by getForumObjects().

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

◆ renderPostContent()

ilObjForumGUI::renderPostContent ( ilForumPost  $node,
  $Start,
  $z 
)
protected
Parameters
$node
$Start
$z

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

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

Referenced by getForumObjects().

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

◆ renderSplitButton()

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

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

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

Referenced by renderDraftContent(), and renderPostContent().

5208  {
5209  $actions = array();
5210  if ($is_post) {
5211  if ($this->objCurrentPost->getId() != $node->getId()
5212  || ($_GET['action'] != 'showreply' &&
5213  $_GET['action'] != 'showedit' &&
5214  $_GET['action'] != 'censor' &&
5215  $_GET['action'] != 'delete' &&
5216  !$this->displayConfirmPostActivation())
5217  ) {
5218  if ($this->is_moderator || $node->isActivated() || $node->isOwner($this->user->getId())) {
5219  // button: reply
5220  if (!$this->objCurrentTopic->isClosed() && $node->isActivated() &&
5221  $this->access->checkAccess('add_reply', '', (int) $_GET['ref_id']) &&
5222  !$node->isCensored()
5223  ) {
5224  $this->ctrl->setParameter($this, 'action', 'showreply');
5225  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5226  $this->ctrl->setParameter($this, 'offset', $Start);
5227  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5228  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5229 
5230  if (!isset($draftsObjects[$node->getId()])) {
5231  $actions['reply_to_postings'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5232  }
5233 
5234  $this->ctrl->clearParameters($this);
5235  }
5236 
5237  // button: edit article
5238  if (!$this->objCurrentTopic->isClosed() &&
5239  ($node->isOwner($this->user->getId()) || $this->is_moderator) &&
5240  !$node->isCensored() &&
5241  $this->user->getId() != ANONYMOUS_USER_ID
5242  ) {
5243  $this->ctrl->setParameter($this, 'action', 'showedit');
5244  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5245  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5246  $this->ctrl->setParameter($this, 'offset', $Start);
5247  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5248 
5249  $actions['edit'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5250 
5251  $this->ctrl->clearParameters($this);
5252  }
5253 
5254  // button: mark read
5255  if ($this->user->getId() != ANONYMOUS_USER_ID && !$node->isPostRead()) {
5256  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5257  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5258  $this->ctrl->setParameter($this, 'offset', $Start);
5259  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5260  $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
5261 
5262  $actions['frm_mark_as_read'] = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId());
5263 
5264  $this->ctrl->clearParameters($this);
5265  }
5266 
5267  // button: mark unread
5268  if ($this->user->getId() != ANONYMOUS_USER_ID &&
5269  $node->isPostRead()
5270  ) {
5271  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5272  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5273  $this->ctrl->setParameter($this, 'offset', $Start);
5274  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5275  $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']);
5276 
5277  $actions['frm_mark_as_unread'] = $this->ctrl->getLinkTarget($this, 'markPostUnread', $node->getId());
5278 
5279  $this->ctrl->clearParameters($this);
5280  }
5281 
5282  // button: print
5283  if (!$node->isCensored()) {
5284  $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId());
5285  $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId());
5286  $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId());
5287 
5288  $actions['print'] = $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost');
5289 
5290  $this->ctrl->clearParameters($this);
5291  }
5292 
5293  # buttons for every post except the "active"
5294  if (!$this->objCurrentTopic->isClosed() &&
5295  ($this->is_moderator ||
5296  ($node->isOwner($this->user->getId()) && !$node->hasReplies())) &&
5297  $this->user->getId() != ANONYMOUS_USER_ID
5298  ) {
5299  // button: delete
5300  $this->ctrl->setParameter($this, 'action', 'delete');
5301  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5302  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5303  $this->ctrl->setParameter($this, 'offset', $Start);
5304  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5305 
5306  $actions['delete'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5307 
5308  $this->ctrl->clearParameters($this);
5309  }
5310 
5311  if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) {
5312  // button: censor
5313  $this->ctrl->setParameter($this, 'action', 'censor');
5314  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5315  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5316  $this->ctrl->setParameter($this, 'offset', $Start);
5317  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5318  if ($node->isCensored()) {
5319  $actions['frm_revoke_censorship'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5320  } else {
5321  $actions['frm_censorship'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5322  }
5323 
5324  $this->ctrl->clearParameters($this);
5325 
5326  // button: activation/deactivation
5327  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5328  $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId());
5329  $this->ctrl->setParameter($this, 'offset', $Start);
5330  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5331 
5332  if (!$node->isActivated()) {
5333  $actions['activate_post'] = $this->ctrl->getLinkTarget($this, 'askForPostActivation', $node->getId());
5334  }
5335 
5336  $this->ctrl->clearParameters($this);
5337  }
5338  }
5339  }
5340  } else {
5341  if (!isset($draft)) {
5342  $draftsObjects = ilForumPostDraft::getInstancesByUserIdAndThreadId($this->user->getId(), $this->objCurrentTopic->getId());
5343  $draft = $draftsObjects[$node->getId()];
5344  }
5345  // get actions for drafts
5346  $this->ctrl->setParameter($this, 'action', 'publishdraft');
5347  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5348  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5349  $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
5350  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5351  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5352  $actions['publish'] = $this->ctrl->getLinkTarget($this, 'publishSelectedDraft', $node->getId());
5353  $this->ctrl->clearParameters($this);
5354 
5355  $this->ctrl->setParameter($this, 'action', 'editdraft');
5356  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5357  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5358  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5359  $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
5360  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5361  $actions['edit'] = $this->ctrl->getLinkTarget($this, 'editDraft', 'draft_edit_' . $draft->getDraftId());
5362  $this->ctrl->clearParameters($this);
5363 
5364  $this->ctrl->setParameter($this, 'action', 'deletedraft');
5365  $this->ctrl->setParameter($this, 'pos_pk', $node->getId());
5366  $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
5367  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
5368  $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
5369  $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
5370  $actions['delete'] = $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId());
5371  $this->ctrl->clearParameters($this);
5372 
5373  if (isset($_GET['draft_id']) && $_GET['action'] == 'editdraft') {
5374  $actions = array();
5375  }
5376  }
5377 
5378  $this->tpl->setCurrentBlock('posts_row');
5379  if (count($actions) > 0) {
5380  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
5381  $action_button = ilSplitButtonGUI::getInstance();
5382 
5383  $i = 0;
5384  foreach ($actions as $lng_id => $url) {
5385  if ($i == 0) {
5386  $sb_item = ilLinkButton::getInstance();
5387  $sb_item->setCaption($lng_id);
5388  $sb_item->setUrl($url);
5389 
5390  $action_button->setDefaultButton($sb_item);
5391  ++$i;
5392  } else {
5393  $sb_item = ilLinkButton::getInstance();
5394  $sb_item->setCaption($lng_id);
5395  $sb_item->setUrl($url);
5396 
5397  $action_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($sb_item));
5398  }
5399  }
5400 
5401  if ($is_post) {
5402  $this->tpl->setVariable('COMMANDS', $action_button->render());
5403  } else {
5404  if ($_GET['action'] != 'deletedraft' && $_GET['action'] != 'editdraft' && !$this->objCurrentTopic->isClosed()) {
5405  $this->tpl->setVariable('COMMANDS', $action_button->render());
5406  }
5407  }
5408  }
5409  }
$_SESSION["AccountId"]
$_GET["client_id"]
isOwner($a_user_id=0)
static getInstancesByUserIdAndThreadId($user_id, $thread_id)
user()
Definition: user.php:4
Create styles array
The data for the language used.
$i
Definition: disco.tpl.php:19
$url
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ restoreFromHistoryObject()

ilObjForumGUI::restoreFromHistoryObject ( )

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

References $_GET, and ilForumPostDraft\createDraftBackup().

4461  {
4462  $history_id = ((int) $_GET['history_id']);
4463  $history = new ilForumDraftsHistory($history_id);
4464 
4465  $draft = $history->rollbackAutosave();
4466 
4467  if ($draft->getThreadId() == 0 && $draft->getPostId() == 0) {
4468  $this->ctrl->setParameter($this, 'draft_id', $history->getDraftId());
4469  $this->ctrl->redirect($this, 'editThreadDraft');
4470  }
4471 
4472  $this->ctrl->clearParameters($this);
4473  $this->ctrl->setParameter($this, 'pos_pk', $draft->getPostId());
4474  $this->ctrl->setParameter($this, 'thr_pk', $draft->getThreadId());
4475  $this->ctrl->setParameter($this, 'draft_id', $draft->getDraftId());
4476  $this->ctrl->setParameter($this, 'action', 'editdraft');
4477 
4478  // create draft backup before redirect!
4479  ilForumPostDraft::createDraftBackup((int) $draft->getDraftId());
4480 
4481  $this->ctrl->redirect($this, 'viewThread');
4482  }
$_GET["client_id"]
Class ilForumDraftHistory.
static createDraftBackup($draft_id)
+ Here is the call graph for this function:

◆ saveThreadAsDraftObject()

ilObjForumGUI::saveThreadAsDraftObject ( )

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

References $_GET, $_POST, $file, $GLOBALS, ilRTE\_replaceMediaObjectImageSrc(), array, doCaptchaCheck(), ilForumUtil\getPublicUserAlias(), handleFormInput(), initTopicCreateForm(), ilForumPostDraft\isAutoSavePostDraftAllowed(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumUtil\moveMediaObjects(), ilForumPostDraft\newInstanceByDraftId(), object, ilUtil\sendSuccess(), and user().

4485  {
4486  if (!isset($_POST['del_file']) || !is_array($_POST['del_file'])) {
4487  $_POST['del_file'] = array();
4488  }
4489  $autosave_draft_id = 0;
4490  if (ilForumPostDraft::isAutoSavePostDraftAllowed() && isset($_POST['draft_id']) && (int) $_POST['draft_id'] > 0) {
4491  $autosave_draft_id = (int) $_POST['draft_id'];
4492  } elseif (isset($_GET['draft_id']) && (int) $_GET['draft_id'] > 0) {
4493  $autosave_draft_id = (int) $_GET['draft_id'];
4494  }
4495 
4496  $frm = $this->object->Forum;
4497  $frm->setForumId($this->object->getId());
4498  $frm->setForumRefId($this->object->getRefId());
4499 
4500  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())) {
4501  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4502  }
4503 
4504  $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
4505 
4506  $topicData = $frm->getOneTopic();
4507 
4508  $this->initTopicCreateForm();
4509  if ($this->create_topic_form_gui->checkInput()) {
4510  $this->doCaptchaCheck();
4511 
4512  $user_alias = ilForumUtil::getPublicUserAlias($this->create_topic_form_gui->getInput('alias'), $this->objProperties->isAnonymized());
4513 
4514  if ($autosave_draft_id == 0) {
4515  $draftObj = new ilForumPostDraft();
4516  } else {
4517  $draftObj = ilForumPostDraft::newInstanceByDraftId($autosave_draft_id);
4518  }
4519  $draftObj->setForumId($topicData['top_pk']);
4520  $draftObj->setThreadId(0);
4521  $draftObj->setPostId(0);
4522 
4523  $draftObj->setPostSubject($this->handleFormInput($this->create_topic_form_gui->getInput('subject'), false));
4524  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($this->create_topic_form_gui->getInput('message'), 0));
4525  $draftObj->setPostUserAlias($user_alias);
4526  $draftObj->setNotify((int) $this->create_topic_form_gui->getInput('notify'));
4527  $draftObj->setPostAuthorId($this->user->getId());
4528  $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
4529 
4530  if ($autosave_draft_id == 0) {
4531  $draft_id = $draftObj->saveDraft();
4532  } else {
4533  $draftObj->updateDraft();
4534  $draft_id = $draftObj->getDraftId();
4535  }
4536 
4538  $GLOBALS['ilAppEventHandler']->raise(
4539  'Modules/Forum',
4540  'savedAsDraft',
4541  array('draftObj' => $draftObj,
4542  'obj_id' => $this->object->getId(),
4543  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
4544  );
4545  }
4546  // copy temporary media objects (frm~)
4547  ilForumUtil::moveMediaObjects($this->create_topic_form_gui->getInput('message'), 'frm~d:html', $draft_id, 'frm~d:html', $draft_id);
4548 
4549  if ($this->objProperties->isFileUploadAllowed()) {
4550  $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draft_id);
4551  $file = $_FILES['userfile'];
4552  if (is_array($file) && !empty($file)) {
4553  $oFDForumDrafts->storeUploadedFile($file);
4554  }
4555 
4556  $file2delete = $this->create_topic_form_gui->getInput('del_file');
4557  if (is_array($file2delete) && count($file2delete)) {
4558  $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
4559  }
4560  }
4561  $this->ctrl->clearParameters($this);
4562  ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4563  $this->ctrl->redirect($this, 'showThreads');
4564  } else {
4565  $_GET['action'] = substr($_GET['action'], 6);
4566  $this->create_topic_form_gui->setValuesByPost();
4567  $this->ctrl->setParameter($this, 'draft_id', $autosave_draft_id);
4568  return $this->tpl->setContent($this->create_topic_form_gui->getHTML());
4569  }
4570  $this->ctrl->clearParameters($this);
4571  $this->ctrl->redirect($this, 'showThreads');
4572  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilForumPostDraft.
static getPublicUserAlias($user_alias, $is_anonymized=false)
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
This class handles all operations on files for the drafts of a forum object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
user()
Definition: user.php:4
static newInstanceByDraftId($draft_id)
initTopicCreateForm($edit_draft=false)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
handleFormInput($a_text, $a_stripslashes=true)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
$_POST["username"]
+ Here is the call graph for this function:

◆ saveThreadSortingObject()

ilObjForumGUI::saveThreadSortingObject ( )

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

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

4193  {
4194  $_POST['thread_sorting'] ? $thread_sorting = $_POST['thread_sorting'] :$thread_sorting = array();
4195 
4196  if (!$this->is_moderator) {
4197  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4198  }
4199 
4200  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
4201  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4202  }
4203 
4204  array_walk($thread_sorting, function ($sortValue, $threadId) {
4205  $this->ensureThreadBelongsToForum((int) $this->object->getId(), new \ilForumTopic($threadId));
4206  });
4207 
4208  foreach ($thread_sorting as $thr_pk=>$sorting_value) {
4209  $sorting_value = str_replace(',', '.', $sorting_value);
4210  $sorting_value = (float) $sorting_value * 100;
4211  $this->object->setThreadSorting($thr_pk, $sorting_value);
4212  }
4213  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
4214  $this->showThreadsObject();
4215  return true;
4216  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
$_POST["username"]
+ Here is the call graph for this function:

◆ saveTopLevelPostObject()

ilObjForumGUI::saveTopLevelPostObject ( )

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

1965  {
1966  $this->savePostObject();
1967  return;
1968  }

◆ setColumnSettings()

ilObjForumGUI::setColumnSettings ( ilColumnGUI  $column_gui)

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

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

3900  {
3901  $column_gui->setBlockProperty('news', 'title', $this->lng->txt('frm_latest_postings'));
3902  $column_gui->setBlockProperty('news', 'prevent_aggregation', true);
3903  $column_gui->setRepositoryMode(true);
3904 
3905  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
3906  $news_set = new ilSetting('news');
3907  $enable_internal_rss = $news_set->get('enable_rss_for_internal');
3908  if ($enable_internal_rss) {
3909  $column_gui->setBlockProperty('news', 'settings', true);
3910  $column_gui->setBlockProperty('news', 'public_notifications_option', true);
3911  }
3912  }
3913  }
setBlockProperty($a_block_type, $a_property, $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
+ Here is the call graph for this function:

◆ setDisplayConfirmPostActivation()

ilObjForumGUI::setDisplayConfirmPostActivation (   $status = 0)

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

Referenced by askForPostActivationObject().

1512  {
1513  $this->display_confirm_post_activation = $status;
1514  }
+ Here is the caller graph for this function:

◆ setSideBlocks()

ilObjForumGUI::setSideBlocks ( )
protected

{}

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

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

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

4381  {
4382  $rgt_content = '';
4383  if (!$GLOBALS['ilCtrl']->isAsynch()) {
4384  require_once 'Services/Search/classes/class.ilRepositoryObjectSearchGUI.php';
4385  $rgt_content = ilRepositoryObjectSearchGUI::getSearchBlockHTML($this->lng->txt('frm_search'));
4386  }
4387  $this->tpl->setRightContent($rgt_content . $this->getRightColumnHTML());
4388  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getSearchBlockHTML($a_title)
Get standar search block html.
getRightColumnHTML()
Display right column.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTopicCreateDefaultValues()

ilObjForumGUI::setTopicCreateDefaultValues ( )
private

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

References array.

Referenced by createThreadObject().

3593  {
3594  $this->create_topic_form_gui->setValuesByArray(array(
3595  'subject' => '',
3596  'message' => '',
3597  'userfile' => '',
3598  'notify' => 0
3599  ));
3600  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ showStatisticsObject()

ilObjForumGUI::showStatisticsObject ( )

if globally deactivated, skip!!! intrusion detected

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

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

1207  {
1209  if (!$this->settings->get('enable_fora_statistics', false)) {
1210  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1211  }
1212 
1213  // if no read access -> intrusion detected
1214  if (!$this->access->checkAccess('read', '', (int) $_GET['ref_id'])) {
1215  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1216  }
1217 
1218  // if read access and statistics disabled -> intrusion detected
1219  if (!$this->objProperties->isStatisticEnabled()) {
1220  // if write access and statistics disabled -> ok, for forum admin
1221  if ($this->access->checkAccess('write', '', (int) $_GET['ref_id'])) {
1222  ilUtil::sendInfo($this->lng->txt('frm_statistics_disabled_for_participants'));
1223  } else {
1224  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1225  }
1226  }
1227 
1228  $this->object->Forum->setForumId($this->object->getId());
1229 
1230  require_once 'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
1231 
1232  $tbl = new ilForumStatisticsTableGUI($this, 'showStatistics');
1233  $tbl->setId('il_frm_statistic_table_' . (int) (int) $_GET['ref_id']);
1234  $tbl->setTitle($this->lng->txt('statistic'), 'icon_usr.svg', $this->lng->txt('obj_' . $this->object->getType()));
1235 
1236  $data = $this->object->Forum->getUserStatistic($this->is_moderator);
1237  $result = array();
1238  $counter = 0;
1239  foreach ($data as $row) {
1240  $result[$counter]['ranking'] = $row[0];
1241  $result[$counter]['login'] = $row[1];
1242  $result[$counter]['lastname'] = $row[2];
1243  $result[$counter]['firstname'] = $row[3];
1244 
1245  ++$counter;
1246  }
1247  $tbl->setData($result);
1248 
1249  $this->tpl->setContent($tbl->getHTML());
1250  }
Class ilForumStatisticsTableGUI.
$result
$_GET["client_id"]
$tbl
Definition: example_048.php:81
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$counter
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ showThreadsObject()

◆ showUserObject()

ilObjForumGUI::showUserObject ( )

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

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

3107  {
3108  include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
3109  $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
3110  $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
3111  $profile_gui->setAdditional($add);
3112  $profile_gui->setBackUrl(\ilUtil::stripSlashes($_GET['backurl']));
3113  $this->tpl->setContent($this->ctrl->getHTML($profile_gui));
3114  }
$_GET["client_id"]
GUI class for public user profile presentation.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ sortThreadsObject()

ilObjForumGUI::sortThreadsObject ( )

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

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

552  {
553  $this->getSubTabs('sortThreads');
554  $this->setSideBlocks();
555  $this->getCenterColumnHTML();
556  }
getSubTabs($subtab='showThreads')
getCenterColumnHTML()
Get center column.
+ Here is the call graph for this function:

◆ toggleStickinessObject()

ilObjForumGUI::toggleStickinessObject ( )

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

References $objCurrentTopic, ensureThreadBelongsToForum(), and object.

1541  {
1542  if (!$this->is_moderator) {
1543  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1544  }
1545 
1546  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1547  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1548  }
1549 
1550  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1551 
1552  if ($this->objCurrentTopic->isSticky()) {
1553  $this->objCurrentTopic->unmakeSticky();
1554  } else {
1555  $this->objCurrentTopic->makeSticky();
1556  }
1557 
1558  $this->viewThreadObject();
1559  }
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ toggleThreadNotificationObject()

ilObjForumGUI::toggleThreadNotificationObject ( )

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

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

1522  {
1523  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
1524  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
1525  }
1526 
1527  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
1528 
1529  if ($this->objCurrentTopic->isNotificationEnabled($this->user->getId())) {
1530  $this->objCurrentTopic->disableNotification($this->user->getId());
1531  \ilUtil::sendInfo($this->lng->txt('forums_notification_disabled'));
1532  } else {
1533  $this->objCurrentTopic->enableNotification($this->user->getId());
1534  \ilUtil::sendInfo($this->lng->txt('forums_notification_enabled'));
1535  }
1536 
1537  $this->viewThreadObject();
1538  }
user()
Definition: user.php:4
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ updateCustom()

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

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

444  {
445  $this->forum_settings_gui->updateCustomValues($a_form);
446  }

◆ updateThreadDraftObject()

ilObjForumGUI::updateThreadDraftObject ( )

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

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

4575  {
4576  if (!isset($_POST['del_file']) || !is_array($_POST['del_file'])) {
4577  $_POST['del_file'] = array();
4578  }
4579 
4580  $frm = $this->object->Forum;
4581  $frm->setForumId($this->object->getId());
4582  $frm->setForumRefId($this->object->getRefId());
4583 
4584  if (!$this->access->checkAccess('add_thread', '', $this->object->getRefId())
4585  || !isset($_GET['draft_id']) || (int) $_GET['draft_id'] <= 0) {
4586  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
4587  }
4588  $this->initTopicCreateForm();
4589 
4590  if ($this->create_topic_form_gui->checkInput()) {
4591  $this->doCaptchaCheck();
4592  $user_alias = ilForumUtil::getPublicUserAlias($this->create_topic_form_gui->getInput('alias'), $this->objProperties->isAnonymized());
4593 
4594  $draftObj= ilForumPostDraft::newInstanceByDraftId((int) $_GET['draft_id']);
4595 
4596  $draftObj->setPostSubject($this->handleFormInput($this->create_topic_form_gui->getInput('subject'), false));
4597  $draftObj->setPostMessage(ilRTE::_replaceMediaObjectImageSrc($this->create_topic_form_gui->getInput('message'), 0));
4598  $draftObj->setPostUserAlias($user_alias);
4599  $draftObj->setNotify((int) $this->create_topic_form_gui->getInput('notify'));
4600  $draftObj->setPostAuthorId($this->user->getId());
4601  $draftObj->setPostDisplayUserId(($this->objProperties->isAnonymized() ? 0 : $this->user->getId()));
4602 
4603  $draftObj->updateDraft();
4605  $GLOBALS['ilAppEventHandler']->raise(
4606  'Modules/Forum',
4607  'updatedDraft',
4608  array('draftObj' => $draftObj,
4609  'obj_id' => $this->object->getId(),
4610  'is_file_upload_allowed' => $this->objProperties->isFileUploadAllowed())
4611  );
4612  }
4613 
4614  // copy temporary media objects (frm~)
4615  ilForumUtil::moveMediaObjects($this->create_topic_form_gui->getInput('message'), 'frm~d:html', $draftObj->getDraftId(), 'frm~d:html', $draftObj->getDraftId());
4616 
4617  if ($this->objProperties->isFileUploadAllowed()) {
4618  $oFDForumDrafts = new ilFileDataForumDrafts($this->object->getId(), $draftObj->getDraftId());
4619  $file = $_FILES['userfile'];
4620  if (is_array($file) && !empty($file)) {
4621  $oFDForumDrafts->storeUploadedFile($file);
4622  }
4623 
4624  $file2delete = $this->create_topic_form_gui->getInput('del_file');
4625  if (is_array($file2delete) && count($file2delete)) {
4626  $oFDForumDrafts->unlinkFilesByMD5Filenames($file2delete);
4627  }
4628  }
4629 
4630  ilUtil::sendSuccess($this->lng->txt('save_draft_successfully'), true);
4631  $this->ctrl->clearParameters($this);
4632  $this->ctrl->redirect($this, 'showThreads');
4633  } else {
4634  $this->create_topic_form_gui->setValuesByPost();
4635  $this->ctrl->setParameter($this, 'hist_check', 0);
4636  $this->ctrl->setParameter($this, 'draft_id', $_GET['draft_id']);
4637  return $this->editThreadDraftObject($this->create_topic_form_gui);
4638  }
4639  // return $this->viewThreadObject();
4640  $this->ctrl->clearParameters($this);
4641  $this->ctrl->redirect($this, 'showThreads');
4642  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getPublicUserAlias($user_alias, $is_anonymized=false)
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static moveMediaObjects($post_message, $source_type, $source_id, $target_type, $target_id, $direction=0)
This class handles all operations on files for the drafts of a forum object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
user()
Definition: user.php:4
editThreadDraftObject($form=null)
static newInstanceByDraftId($draft_id)
initTopicCreateForm($edit_draft=false)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
handleFormInput($a_text, $a_stripslashes=true)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
$_POST["username"]
+ Here is the call graph for this function:

◆ updateThreadObject()

ilObjForumGUI::updateThreadObject ( )

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

References $form, $objCurrentTopic, editThreadObject(), ensureThreadBelongsToForum(), getThreadEditingForm(), object, ilUtil\sendSuccess(), and showThreadsObject().

503  {
504  if (!$this->is_moderator) {
505  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
506  }
507 
508  if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
509  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
510  }
511 
512  if (!$this->objCurrentTopic->getId()) {
513  $this->showThreadsObject();
514  return;
515  }
516 
517  $this->ensureThreadBelongsToForum((int) $this->object->getId(), $this->objCurrentTopic);
518 
519  $form = $this->getThreadEditingForm($this->objCurrentTopic->getId());
520  if (!$form->checkInput()) {
521  $form->setValuesByPost();
522  $this->editThreadObject($this->objCurrentTopic->getId(), $form);
523  return;
524  }
525 
526  $this->objCurrentTopic->setSubject($form->getInput('title'));
527  $this->objCurrentTopic->updateThreadTitle();
528 
529  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
530  $this->showThreadsObject();
531  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
editThreadObject($a_thread_id, ilPropertyFormGUI $form=null)
if(isset($_POST['submit'])) $form
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
Create new PHPExcel object
obj_idprivate
getThreadEditingForm($a_thread_id)
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjForumGUI::$access

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

◆ $confirmation_gui_html

ilObjForumGUI::$confirmation_gui_html = ''
private

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

◆ $create_form_gui

ilObjForumGUI::$create_form_gui
private

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

◆ $create_topic_form_gui

ilObjForumGUI::$create_topic_form_gui
private

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

Referenced by autosaveThreadDraftAsyncObject().

◆ $display_confirm_post_activation

ilObjForumGUI::$display_confirm_post_activation = 0
private

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

Referenced by displayConfirmPostActivation().

◆ $error

ilObjForumGUI::$error

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

◆ $forum_overview_setting

ilObjForumGUI::$forum_overview_setting = null
private

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

◆ $forum_settings_gui

ilObjForumGUI::$forum_settings_gui
private

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

Referenced by executeCommand().

◆ $forumObjects

ilObjForumGUI::$forumObjects
private

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

Referenced by getForumObjects().

◆ $hideToolbar

ilObjForumGUI::$hideToolbar = false
private

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

Referenced by hideToolbar().

◆ $ilHelp

ilObjForumGUI::$ilHelp

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

◆ $ilNavigationHistory

ilObjForumGUI::$ilNavigationHistory

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

◆ $ilObjDataCache

ilObjForumGUI::$ilObjDataCache

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

◆ $is_moderator

ilObjForumGUI::$is_moderator = false
private

◆ $locator

ilObjForumGUI::$locator

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

◆ $modal_history

ilObjForumGUI::$modal_history = ''

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

Referenced by editThreadDraftObject(), and renderDraftContent().

◆ $objCurrentPost

ilObjForumGUI::$objCurrentPost
private

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

Referenced by performPostActivationObject(), and publishDraftObject().

◆ $objCurrentTopic

◆ $object

ilObjForumGUI::$object

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

Referenced by getForumObjects(), and renderPostContent().

◆ $objProperties

ilObjForumGUI::$objProperties

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

◆ $rbac

ilObjForumGUI::$rbac

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

◆ $replyEditForm

ilObjForumGUI::$replyEditForm
private

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

Referenced by getReplyEditForm().

◆ $repositoryTree

ilObjForumGUI::$repositoryTree

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

◆ $settings

ilObjForumGUI::$settings

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

◆ $tabs

ilObjForumGUI::$tabs

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

◆ $toolbar

ilObjForumGUI::$toolbar

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

Referenced by getForumObjects().

◆ $user

ilObjForumGUI::$user

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


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