ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 addInputItem (string $input_item)
 
 generateDefaultForm ()
 
 generateMinimalForm ()
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 
 executeCommand ()
 
 setTableWidth (string $a_width)
 
 getTableWidth ()
 
 setMode (string $a_mode)
 
 getMode ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleIcon (string $a_titleicon)
 
 getTitleIcon ()
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setShowTopButtons (bool $a_val)
 
 getShowTopButtons ()
 
 setForceTopButtons (bool $a_val)
 
 getForceTopButtons ()
 
 addItem ($a_item)
 
 removeItemByPostVar (string $a_post_var, bool $a_remove_unused_headers=false)
 
 getItemByPostVar (string $a_post_var)
 
 setItems (array $a_items)
 
 getItems ()
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage (bool $a_val)
 
 getDisableStandardMessage ()
 
 getHideLabels ()
 
 setHideLabels (bool $a_value=true)
 
 setValuesByArray (array $a_values, bool $a_restrict_to_value_keys=false)
 
 setValuesByPost ()
 
 checkInput ()
 
 getInput (string $a_post_var, bool $ensureValidation=true)
 Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-POST variable, identified by the passed postvar. More...
 
 addCommandButton (string $a_cmd, string $a_text, string $a_id="")
 
 getCommandButtons ()
 
 clearCommandButtons ()
 
 getContent ()
 
 insertItem ( $item, bool $a_sub_item=false)
 
 addAsyncOnloadCode (string $code)
 
 getHTML ()
 
 getHTMLAsync ()
 
 getFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 
 moveFileUpload (string $a_target_directory, string $a_field, ?string $a_target_name=null, ?string $a_index=null, ?string $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

Data Fields

const ALIAS_INPUT = 'alias'
 
const SUBJECT_INPUT = 'subject'
 
const MESSAGE_INPUT = 'message'
 
const FILE_UPLOAD_INPUT = 'file_upload'
 
const ALLOW_NOTIFICATION_INPUT = 'allow_notification'
 

Private Member Functions

 addAliasInput ()
 
 addSubjectInput ()
 
 addMessageInput ()
 
 addFileUploadInput ()
 
 addAllowNotificationInput ()
 
 generateInputItems ()
 

Private Attributes

array $input_items = []
 
ilObjForumGUI $delegatingGui
 
ilForumProperties $properties
 
bool $allowPseudonyms
 
bool $allowNotification
 
bool $isDraftContext
 
int $draftId
 

Additional Inherited Members

- Protected Member Functions inherited from ilPropertyFormGUI
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 
- Protected Attributes inherited from ilPropertyFormGUI
bool $required_text = false
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
ilObjUser $user = null
 
ilSetting $settings = null
 
string $mode = "std"
 
bool $check_input_called = false
 
bool $disable_standard_message = false
 
string $top_anchor = "il_form_top"
 
string $title = ''
 
string $titleicon = ""
 
string $description = ""
 
string $tbl_width = ""
 
bool $show_top_buttons = true
 
bool $hide_labels = false
 
bool $force_top_buttons = false
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
ilGlobalTemplateInterface $global_tpl = null
 
 $onload_code = []
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $prevent_double_submission = false
 

Detailed Description

Class ilForumThreadFormGUI.

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

48  {
50 
51  $this->delegatingGui = $delegatingGui;
52  $this->properties = $properties;
53  $this->allowPseudonyms = $allowPseudonyms;
54  $this->allowNotification = $allowNotification;
55  $this->isDraftContext = $isDraftContext;
56  $this->draftId = $draftId;
57  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addAliasInput()

ilForumThreadFormGUI::addAliasInput ( )
private

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

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ilNonEditableValueGUI\setValue(), and ILIAS\Repository\user().

Referenced by generateInputItems().

59  : void
60  {
61  if ($this->allowPseudonyms) {
62  $alias = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias');
63  $alias->setInfo($this->lng->txt('forums_use_alias'));
64  $alias->setMaxLength(255);
65  $alias->setSize(50);
66  } else {
67  $alias = new ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias');
68  $alias->setValue($this->user->getLogin());
69  }
70  $this->addItem($alias);
71  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAllowNotificationInput()

ilForumThreadFormGUI::addAllowNotificationInput ( )
private

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

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setInfo().

Referenced by generateInputItems().

142  : void
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  }
This class represents a checkbox property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFileUploadInput()

ilForumThreadFormGUI::addFileUploadInput ( )
private

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

References ilPropertyFormGUI\addItem(), ilCheckboxGroupInputGUI\addOption(), ILIAS\Repository\lng(), ilForumPostDraft\newInstanceByDraftId(), and ilFileWizardInputGUI\setFilenames().

Referenced by generateInputItems().

116  : void
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 && $this->draftId > 0) {
124  $threadDraft = ilForumPostDraft::newInstanceByDraftId($this->draftId);
125  if ($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  $existingFileSelection->addOption(new ilCheckboxOption($file['name'], $file['md5']));
134  }
135  $this->addItem($existingFileSelection);
136  }
137  }
138  }
139  }
140  }
setFilenames(array $a_filenames)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a file wizard property in a property form.
This class handles all operations on files for the drafts of a forum object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static newInstanceByDraftId(int $draft_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addInputItem()

ilForumThreadFormGUI::addInputItem ( string  $input_item)

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

186  : void
187  {
188  $this->input_items[] = $input_item;
189  }

◆ addMessageInput()

ilForumThreadFormGUI::addMessageInput ( )
private

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

References $message, ilPropertyFormGUI\addItem(), ilHtmlPurifierFactory\getInstanceByType(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by generateInputItems().

82  : void
83  {
84  $message = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message');
85  $message->setCols(50);
86  $message->setRows(15);
87  $message->setRequired(true);
88  $message->setUseRte(true);
89  $message->addPlugin('latex');
90  $message->addButton('latex');
91  $message->addButton('pastelatex');
92  $message->addPlugin('ilfrmquote');
93  $message->usePurifier(true);
94  $message->setRTERootBlockElement('');
95  $message->setRTESupport($this->user->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.js', false, '5.6.0');
96  $message->disableButtons([
97  'charmap',
98  'undo',
99  'redo',
100  'alignleft',
101  'aligncenter',
102  'alignright',
103  'alignjustify',
104  'anchor',
105  'fullscreen',
106  'cut',
107  'copy',
108  'paste',
109  'pastetext',
110  'formatselect'
111  ]);
112  $message->setPurifier(ilHtmlPurifierFactory::getInstanceByType('frm_post'));
113  $this->addItem($message);
114  }
static getInstanceByType(string $type)
This class represents a text area property in a property form.
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubjectInput()

ilForumThreadFormGUI::addSubjectInput ( )
private

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

References ilPropertyFormGUI\addItem(), and ILIAS\Repository\lng().

Referenced by generateInputItems().

73  : void
74  {
75  $subject = new ilTextInputGUI($this->lng->txt('forums_thread'), 'subject');
76  $subject->setMaxLength(255);
77  $subject->setSize(50);
78  $subject->setRequired(true);
79  $this->addItem($subject);
80  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateDefaultForm()

ilForumThreadFormGUI::generateDefaultForm ( )

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

References ilPropertyFormGUI\addCommandButton(), ILIAS\Repository\ctrl(), generateInputItems(), ilForumPostDraft\isSavePostDraftAllowed(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), and ILIAS\Repository\user().

191  : void
192  {
193  $this->generateInputItems();
194 
195  if (ilForumPostDraft::isSavePostDraftAllowed() && !$this->user->isAnonymous()) {
196  $this->ctrl->setParameter($this->delegatingGui, 'draft_id', $this->draftId);
197  if (in_array($this->ctrl->getCmd(), ['publishThreadDraft', 'editThreadDraft', 'updateThreadDraft'])) {
198  $this->addCommandButton('publishThreadDraft', $this->lng->txt('publish'));
199  $this->addCommandButton('updateThreadDraft', $this->lng->txt('save_message'));
200  $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'updateThreadDraft'));
201  } else {
202  $this->addCommandButton('addThread', $this->lng->txt('create'));
203  $this->addCommandButton('saveThreadAsDraft', $this->lng->txt('save_message'));
204  $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'saveThreadAsDraft'));
205  }
206  $this->addCommandButton('cancelDraft', $this->lng->txt('cancel'));
207  } else {
208  $this->addCommandButton('addThread', $this->lng->txt('create'));
209  $this->addCommandButton('showThreads', $this->lng->txt('cancel'));
210  $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'addThread'));
211  }
212  }
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
+ Here is the call graph for this function:

◆ generateInputItems()

ilForumThreadFormGUI::generateInputItems ( )
private

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

References addAliasInput(), addAllowNotificationInput(), addFileUploadInput(), addMessageInput(), addSubjectInput(), ilUtil\getImagePath(), ILIAS\Repository\lng(), ilPropertyFormGUI\setTableWidth(), ilPropertyFormGUI\setTitle(), and ilPropertyFormGUI\setTitleIcon().

Referenced by generateDefaultForm(), and generateMinimalForm().

152  : void
153  {
154  $this->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
155  $this->setTableWidth('100%');
156  $this->setTitle($this->lng->txt('forums_new_thread'));
157  if ($this->isDraftContext) {
158  $this->setTitle($this->lng->txt('edit_thread_draft'));
159  }
160 
161  foreach ($this->input_items as $input_item) {
162  switch ($input_item) {
163  case self::ALIAS_INPUT:
164  $this->addAliasInput();
165  break;
166 
167  case self::SUBJECT_INPUT:
168  $this->addSubjectInput();
169  break;
170 
171  case self::MESSAGE_INPUT:
172  $this->addMessageInput();
173  break;
174 
175  case self::FILE_UPLOAD_INPUT:
176  $this->addFileUploadInput();
177  break;
178 
179  case self::ALLOW_NOTIFICATION_INPUT:
180  $this->addAllowNotificationInput();
181  break;
182  }
183  }
184  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setTitleIcon(string $a_titleicon)
setTableWidth(string $a_width)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateMinimalForm()

ilForumThreadFormGUI::generateMinimalForm ( )

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

References ilPropertyFormGUI\addCommandButton(), ILIAS\Repository\ctrl(), generateInputItems(), ILIAS\Repository\lng(), and ilFormGUI\setFormAction().

214  : void
215  {
216  $this->generateInputItems();
217 
218  $this->addCommandButton('addEmptyThread', $this->lng->txt('create'));
219  $this->addCommandButton('showThreads', $this->lng->txt('cancel'));
220  $this->setFormAction($this->ctrl->getFormAction($this->delegatingGui, 'addThread'));
221  }
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
+ Here is the call graph for this function:

Field Documentation

◆ $allowNotification

bool ilForumThreadFormGUI::$allowNotification
private

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

Referenced by __construct().

◆ $allowPseudonyms

bool ilForumThreadFormGUI::$allowPseudonyms
private

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

Referenced by __construct().

◆ $delegatingGui

ilObjForumGUI ilForumThreadFormGUI::$delegatingGui
private

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

Referenced by __construct().

◆ $draftId

int ilForumThreadFormGUI::$draftId
private

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

Referenced by __construct().

◆ $input_items

array ilForumThreadFormGUI::$input_items = []
private

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

◆ $isDraftContext

bool ilForumThreadFormGUI::$isDraftContext
private

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

Referenced by __construct().

◆ $properties

ilForumProperties ilForumThreadFormGUI::$properties
private

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

Referenced by __construct().

◆ ALIAS_INPUT

const ilForumThreadFormGUI::ALIAS_INPUT = 'alias'

◆ ALLOW_NOTIFICATION_INPUT

const ilForumThreadFormGUI::ALLOW_NOTIFICATION_INPUT = 'allow_notification'

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

Referenced by ilObjForumGUI\buildThreadForm().

◆ FILE_UPLOAD_INPUT

const ilForumThreadFormGUI::FILE_UPLOAD_INPUT = 'file_upload'

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

Referenced by ilObjForumGUI\buildThreadForm().

◆ MESSAGE_INPUT

const ilForumThreadFormGUI::MESSAGE_INPUT = 'message'

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

Referenced by ilObjForumGUI\buildThreadForm().

◆ SUBJECT_INPUT

const ilForumThreadFormGUI::SUBJECT_INPUT = 'subject'

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