ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 setForceTopButtons ($a_val)
 Set force top buttons. More...
 
 getForceTopButtons ()
 Get force 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 ()
 Get HTML. More...
 
 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
 
 $force_top_buttons = 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.

43 {
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 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $allowNotification, $allowPseudonyms, $delegatingGui, $draftId, $isDraftContext, $properties, ILIAS\GlobalScreen\Provider\__construct(), and initForm().

+ Here is the call graph for this function:

Member Function Documentation

◆ initForm()

ilForumThreadFormGUI::initForm ( )
protected

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

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->usePurifier(true);
96 $message->setRTERootBlockElement('');
97 $message->setRTESupport($this->user->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.js', false, '5.6.0');
98 $message->disableButtons(array(
99 'charmap',
100 'undo',
101 'redo',
102 'alignleft',
103 'aligncenter',
104 'alignright',
105 'alignjustify',
106 'anchor',
107 'fullscreen',
108 'cut',
109 'copy',
110 'paste',
111 'pastetext',
112 'formatselect'
113 ));
114 $message->setPurifier(\ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
115 $this->addItem($message);
116
117 if ($this->properties->isFileUploadAllowed()) {
118 $files = new \ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile');
119 $files->setFilenames([0 => '']);
120 $this->addItem($files);
121
122 if ($this->isDraftContext) {
123 if ($this->draftId > 0) {
124 $threadDraft = \ilForumPostDraft::newInstanceByDraftId($this->draftId);
125 if ((int) $threadDraft->getDraftId() > 0) {
126 $draftFileData = new \ilFileDataForumDrafts(0, $threadDraft->getDraftId());
127 if (count($draftFileData->getFilesOfPost()) > 0) {
128 $existingFileSelection = new \ilCheckboxGroupInputGUI(
129 $this->lng->txt('forums_delete_file'),
130 'del_file'
131 );
132 foreach ($draftFileData->getFilesOfPost() as $file) {
133 $currentAttachment = new \ilCheckboxInputGUI($file['name'], 'del_file');
134 $currentAttachment->setValue($file['md5']);
135 $existingFileSelection->addOption($currentAttachment);
136 }
137 $this->addItem($existingFileSelection);
138 }
139 }
140 }
141 }
142 }
143
144 if ($this->allowNotification) {
145 $notifyOnAnswer = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify');
146 $notifyOnAnswer->setInfo($this->lng->txt('forum_notify_me'));
147 $notifyOnAnswer->setValue(1);
148 $this->addItem($notifyOnAnswer);
149 }
150
151 if ($this->user->isAnonymous() && !$this->user->isCaptchaVerified() && \ilCaptchaUtil::isActiveForForum()) {
152 $captcha = new \ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
153 $captcha->setRequired(true);
154 $this->addItem($captcha);
155 }
156
157 if (\ilForumPostDraft::isSavePostDraftAllowed() && !$this->user->isAnonymous()) {
158 $this->ctrl->setParameter($this->delegatingGui, 'draft_id', $this->draftId);
159 if (in_array($this->ctrl->getCmd(), ['publishThreadDraft', 'editThreadDraft', 'updateThreadDraft'])) {
160 $this->addCommandButton('publishThreadDraft', $this->lng->txt('publish'));
161 $this->addCommandButton('updateThreadDraft', $this->lng->txt('save_message'));
162 $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'updateThreadDraft'));
163 } else {
164 $this->addCommandButton('addThread', $this->lng->txt('create'));
165 $this->addCommandButton('saveThreadAsDraft', $this->lng->txt('save_message'));
166 $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'saveThreadAsDraft'));
167 }
168 $this->addCommandButton('cancelDraft', $this->lng->txt('cancel'));
169 } else {
170 $this->addCommandButton('addThread', $this->lng->txt('create'));
171 $this->addCommandButton('showThreads', $this->lng->txt('cancel'));
172 $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'addThread'));
173 }
174 }
user()
Definition: user.php:4
This class represents a checkbox property in a property form.
setFormAction($a_formaction)
Set FormAction.
static newInstanceByDraftId($draft_id)
static _getInstanceByType(string $type)
Factory method for creating purifier instances.
addItem($a_item)
Add Item (Property, SectionHeader).
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
setTableWidth($a_width)
Set table width.
setTitleIcon($a_titleicon)
Set TitleIcon.
setTitle($a_title)
Set Title.
This class represents a text area property in a property form.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$message
Definition: xapiexit.php:14

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

Referenced by __construct().

+ 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: