ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilForumThreadFormGUI Class Reference

Class ilForumThreadFormGUI. More...

+ Inheritance diagram for ilForumThreadFormGUI:
+ Collaboration diagram for ilForumThreadFormGUI:

Public Member Functions

 __construct (\ilObjForumGUI $delegatingGui, \ilForumProperties $properties, bool $allowPseudonyms, bool $allowNotification, bool $isDraftContext, int $draftId)
 ilForumThreadFormGUI constructor. More...
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 setTableWidth ($a_width)
 Set table width. More...
 
 getTableWidth ()
 get table width More...
 
 setMode ($a_mode)
 Set Mode ('std', 'subform'). More...
 
 getMode ()
 Get Mode ('std', 'subform'). More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setTitleIcon ($a_titleicon)
 Set TitleIcon. More...
 
 getTitleIcon ()
 Get TitleIcon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setShowTopButtons ($a_val)
 Get show top buttons. More...
 
 getShowTopButtons ()
 Set show top buttons. More...
 
 addItem ($a_item)
 Add Item (Property, SectionHeader). More...
 
 removeItemByPostVar ($a_post_var, $a_remove_unused_headers=false)
 Remove Item. More...
 
 getItemByPostVar ($a_post_var)
 Get Item by POST variable. More...
 
 setItems ($a_items)
 Set Items. More...
 
 getItems ()
 Get Items. More...
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage ($a_val)
 Set disable standard message. More...
 
 getDisableStandardMessage ()
 Get disable standard message. More...
 
 getHideLabels ()
 Get a value indicating whether the labels should be hidden or not. More...
 
 setHideLabels ($a_value=true)
 Set a value indicating whether the labels should be hidden or not. More...
 
 setValuesByArray ($a_values, $a_restrict_to_value_keys=false)
 Set form values from an array. More...
 
 setValuesByPost ()
 Set form values from POST values. More...
 
 checkInput ()
 Check Post Input. More...
 
 getInput ($a_post_var, $ensureValidation=true)
 Returns the value of a HTTP-POST variable, identified by the passed id. More...
 
 addCustomProperty ( $a_title, $a_html, $a_info="", $a_alert="", $a_required=false)
 Add a custom property. More...
 
 addCommandButton ($a_cmd, $a_text, $a_id="")
 Add Command button. More...
 
 getCommandButtons ()
 Return all Command buttons. More...
 
 clearCommandButtons ()
 Remove all command buttons. More...
 
 getContent ()
 Get Content. More...
 
 insertItem ($item, $a_sub_item=false)
 
 getHTML ()
 
 getFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Was any file uploaded? More...
 
 moveFileUpload ($a_target_directory, $a_field, $a_target_name=null, $a_index=null, $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction ($a_formaction)
 Set FormAction. More...
 
 getFormAction ()
 Get FormAction. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false. More...
 
 getMultipart ()
 Get Enctype Multipart/Formdata true/false. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setName ($a_name)
 Set Name. More...
 
 getName ()
 Get Name. More...
 
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open. More...
 
 getKeepOpen ()
 Get Keep Form Tag Open. More...
 
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag. More...
 
 getOpenTag ()
 Get Open Form Tag Enabled. More...
 
 setCloseTag ($a_val)
 Set close tag. More...
 
 getCloseTag ()
 Get close tag. More...
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 getHTML ()
 Get HTML. More...
 
 getContent ()
 Get Content. More...
 

Protected Member Functions

 initForm ()
 
- Protected Member Functions inherited from ilPropertyFormGUI
 hideRequired ($a_type)
 
 rebuildUploadedFiles ()
 try to rebuild files More...
 

Protected Attributes

 $delegatingGui
 
 $properties
 
 $allowPseudonyms = false
 
 $allowNotification = false
 
 $isDraftContext = false
 
 $draftId = 0
 
- Protected Attributes inherited from ilPropertyFormGUI
 $lng
 
 $ctrl
 
 $tpl
 
 $user
 
 $settings
 
 $mode = "std"
 
 $check_input_called = false
 
 $disable_standard_message = false
 
 $top_anchor = "il_form_top"
 
 $titleicon = false
 
 $description = ""
 
 $tbl_width = false
 
 $show_top_buttons = true
 
 $hide_labels = false
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

Detailed Description

Class ilForumThreadFormGUI.

Definition at line 7 of file class.ilForumThreadFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilForumThreadFormGUI::__construct ( \ilObjForumGUI  $delegatingGui,
\ilForumProperties  $properties,
bool  $allowPseudonyms,
bool  $allowNotification,
bool  $isDraftContext,
int  $draftId 
)

ilForumThreadFormGUI constructor.

Parameters
\ilObjForumGUI$delegatingGui
\ilForumProperties$properties
bool$allowPseudonyms
bool$allowNotification
bool$isDraftContext
int$draftId

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

References $allowNotification, $allowPseudonyms, $delegatingGui, $draftId, $isDraftContext, $properties, and initForm().

43  {
44  parent::__construct();
45 
46  $this->delegatingGui = $delegatingGui;
47  $this->properties = $properties;
48  $this->allowPseudonyms = $allowPseudonyms;
49  $this->allowNotification = $allowNotification;
50  $this->isDraftContext = $isDraftContext;
51  $this->draftId = $draftId;
52 
53  $this->initForm();
54  }
+ Here is the call graph for this function:

Member Function Documentation

◆ initForm()

ilForumThreadFormGUI::initForm ( )
protected

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

References $files, $message, ilHtmlPurifierFactory\_getInstanceByType(), ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilUtil\getImagePath(), ilForumPostDraft\isSavePostDraftAllowed(), ilForumPostDraft\newInstanceByDraftId(), ilFormGUI\setFormAction(), ilFormPropertyGUI\setInfo(), ilPropertyFormGUI\setTableWidth(), ilPropertyFormGUI\setTitle(), ilPropertyFormGUI\setTitleIcon(), and user().

Referenced by __construct().

60  {
61  $this->setTitleIcon(\ilUtil::getImagePath('icon_frm.svg'));
62  $this->setTableWidth('100%');
63  $this->setTitle($this->lng->txt('forums_new_thread'));
64  if ($this->isDraftContext) {
65  $this->setTitle($this->lng->txt('edit_thread_draft'));
66  }
67 
68  if ($this->allowPseudonyms) {
69  $alias = new \ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias');
70  $alias->setInfo($this->lng->txt('forums_use_alias'));
71  $alias->setMaxLength(255);
72  $alias->setSize(50);
73  } else {
74  $alias = new \ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias');
75  $alias->setValue($this->user->getLogin());
76  }
77  $this->addItem($alias);
78 
79  $subject = new \ilTextInputGUI($this->lng->txt('forums_thread'), 'subject');
80  $subject->setMaxLength(255);
81  $subject->setSize(50);
82  $subject->setRequired(true);
83  $this->addItem($subject);
84 
85  $message = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message');
86  $message->setCols(50);
87  $message->setRows(15);
88  $message->setRequired(true);
89  $message->setUseRte(true);
90  $message->addPlugin('latex');
91  $message->addButton('latex');
92  $message->addButton('pastelatex');
93  $message->addPlugin('ilfrmquote');
94 
95  $message->removePlugin('advlink');
96  $message->usePurifier(true);
97  $message->setRTERootBlockElement('');
98  $message->setRTESupport($this->user->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.5.11');
99  $message->disableButtons(array(
100  'charmap',
101  'undo',
102  'redo',
103  'justifyleft',
104  'justifycenter',
105  'justifyright',
106  'justifyfull',
107  'anchor',
108  'fullscreen',
109  'cut',
110  'copy',
111  'paste',
112  'pastetext',
113  'formatselect'
114  ));
115  $message->setPurifier(\ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
116  $this->addItem($message);
117 
118  if ($this->properties->isFileUploadAllowed()) {
119  $files = new \ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile');
120  $files->setFilenames([0 => '']);
121  $this->addItem($files);
122 
123  if ($this->isDraftContext) {
124  if ($this->draftId > 0) {
125  $threadDraft = \ilForumPostDraft::newInstanceByDraftId($this->draftId);
126  if ((int) $threadDraft->getDraftId() > 0) {
127  $draftFileData = new \ilFileDataForumDrafts(0, $threadDraft->getDraftId());
128  if (count($draftFileData->getFilesOfPost()) > 0) {
129  $existingFileSelection = new \ilCheckboxGroupInputGUI(
130  $this->lng->txt('forums_delete_file'),
131  'del_file'
132  );
133  foreach ($draftFileData->getFilesOfPost() as $file) {
134  $currentAttachment = new \ilCheckboxInputGUI($file['name'], 'del_file');
135  $currentAttachment->setValue($file['md5']);
136  $existingFileSelection->addOption($currentAttachment);
137  }
138  $this->addItem($existingFileSelection);
139  }
140  }
141  }
142  }
143  }
144 
145  if ($this->allowNotification) {
146  $notifyOnAnswer = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify');
147  $notifyOnAnswer->setInfo($this->lng->txt('forum_notify_me'));
148  $notifyOnAnswer->setValue(1);
149  $this->addItem($notifyOnAnswer);
150  }
151 
152  if ($this->user->isAnonymous() && !$this->user->isCaptchaVerified() && \ilCaptchaUtil::isActiveForForum()) {
153  $captcha = new \ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
154  $captcha->setRequired(true);
155  $this->addItem($captcha);
156  }
157 
159  $this->ctrl->setParameter($this->delegatingGui, 'draft_id', $this->draftId);
160  if (in_array($this->ctrl->getCmd(), ['publishThreadDraft', 'editThreadDraft', 'updateThreadDraft'])) {
161  $this->addCommandButton('publishThreadDraft', $this->lng->txt('publish'));
162  $this->addCommandButton('updateThreadDraft', $this->lng->txt('save_message'));
163  $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'updateThreadDraft'));
164  } else {
165  $this->addCommandButton('addThread', $this->lng->txt('create'));
166  $this->addCommandButton('saveThreadAsDraft', $this->lng->txt('save_message'));
167  $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'saveThreadAsDraft'));
168  }
169  $this->addCommandButton('cancelDraft', $this->lng->txt('cancel'));
170  } else {
171  $this->addCommandButton('addThread', $this->lng->txt('create'));
172  $this->addCommandButton('showThreads', $this->lng->txt('cancel'));
173  $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'addThread'));
174  }
175  }
setTitleIcon($a_titleicon)
Set TitleIcon.
$files
Definition: metarefresh.php:49
This class represents a checkbox property in a property form.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
user()
Definition: user.php:4
setInfo($a_info)
Set Information Text.
catch(Exception $e) $message
setTitle($a_title)
Set Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
static newInstanceByDraftId($draft_id)
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
This class represents a text area property in a property form.
setTableWidth($a_width)
Set table width.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $allowNotification

ilForumThreadFormGUI::$allowNotification = false
protected

Definition at line 19 of file class.ilForumThreadFormGUI.php.

Referenced by __construct().

◆ $allowPseudonyms

ilForumThreadFormGUI::$allowPseudonyms = false
protected

Definition at line 16 of file class.ilForumThreadFormGUI.php.

Referenced by __construct().

◆ $delegatingGui

ilForumThreadFormGUI::$delegatingGui
protected

Definition at line 10 of file class.ilForumThreadFormGUI.php.

Referenced by __construct().

◆ $draftId

ilForumThreadFormGUI::$draftId = 0
protected

Definition at line 25 of file class.ilForumThreadFormGUI.php.

Referenced by __construct().

◆ $isDraftContext

ilForumThreadFormGUI::$isDraftContext = false
protected

Definition at line 22 of file class.ilForumThreadFormGUI.php.

Referenced by __construct().

◆ $properties

ilForumThreadFormGUI::$properties
protected

Definition at line 13 of file class.ilForumThreadFormGUI.php.

Referenced by __construct().


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