ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilChatroomFormFactory Class Reference

Class ilChatroomFormFactory. More...

+ Collaboration diagram for ilChatroomFormFactory:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getCreationForm ()
 Instantiates and returns ilPropertyFormGUI containing ilTextInputGUI and ilTextAreaInputGUI. More...
 
 getSettingsForm ()
 
 getFileUploadForm ()
 Prepares Fileupload form and returns it. More...
 
 getPeriodForm ()
 Returns period form. More...
 
 getUserChatNameSelectionForm (array $name_options)
 Returns chatname selection form. More...
 
 getSessionForm (array $sessions)
 Returns session form with period set by given $sessions. More...
 
 getGeneralSettingsForm ()
 Returns general settings form. More...
 
 getClientSettingsForm ()
 

Static Public Member Functions

static applyValues (ilPropertyFormGUI $form, array $values)
 Applies given values to field in given form. More...
 

Protected Attributes

 $lng
 
 $user
 

Private Member Functions

 addDefaultBehaviour (ilPropertyFormGUI $form)
 Adds 'create-save' and 'cancel' button to given $form and returns it. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilChatroomFormFactory::__construct ( )

Constructor.

Definition at line 27 of file class.ilChatroomFormFactory.php.

References $DIC, and user().

28  {
29  global $DIC;
30 
31  $this->lng = $DIC->language();
32  $this->user = $DIC->user();
33  }
user()
Definition: user.php:4
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ addDefaultBehaviour()

ilChatroomFormFactory::addDefaultBehaviour ( ilPropertyFormGUI  $form)
private

Adds 'create-save' and 'cancel' button to given $form and returns it.

Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Definition at line 69 of file class.ilChatroomFormFactory.php.

References ilPropertyFormGUI\addCommandButton().

Referenced by getCreationForm().

70  {
71  $form->addCommandButton('create-save', $this->lng->txt('create'));
72  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
73 
74  return $form;
75  }
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyValues()

static ilChatroomFormFactory::applyValues ( ilPropertyFormGUI  $form,
array  $values 
)
static

Applies given values to field in given form.

Parameters
ilPropertyFormGUI$form
array$values

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

References ilPropertyFormGUI\setValuesByArray().

Referenced by ilChatroomSettingsGUI\general().

41  {
42  $form->setValuesByArray($values);
43  }
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:

◆ getClientSettingsForm()

ilChatroomFormFactory::getClientSettingsForm ( )
Returns
ilPropertyFormGUI

Definition at line 384 of file class.ilChatroomFormFactory.php.

References $auth, $name, ilFormPropertyGUI\setInfo(), and ilNumberInputGUI\setMinValue().

385  {
386  $form = new ilPropertyFormGUI();
387 
388  $enable_chat = new ilCheckboxInputGUI($this->lng->txt('chat_enabled'), 'chat_enabled');
389  $form->addItem($enable_chat);
390 
391  $enable_osc = new ilCheckboxInputGUI($this->lng->txt('chatroom_enable_osc'), 'enable_osc');
392  $enable_osc->setInfo($this->lng->txt('chatroom_enable_osc_info'));
393  $enable_chat->addSubItem($enable_osc);
394 
395  $oscBrowserNotificationStatus = new \ilCheckboxInputGUI(
396  $this->lng->txt('osc_adm_browser_noti_label'),
397  'enable_browser_notifications'
398  );
399  $oscBrowserNotificationStatus->setInfo($this->lng->txt('osc_adm_browser_noti_info'));
400  $oscBrowserNotificationStatus->setValue(1);
401  $enable_osc->addSubItem($oscBrowserNotificationStatus);
402 
403  $oscBrowserNotificationIdleTime = new \ilNumberInputGUI(
404  $this->lng->txt('osc_adm_conv_idle_state_threshold_label'),
405  'conversation_idle_state_in_minutes'
406  );
407  $oscBrowserNotificationIdleTime->allowDecimals(false);
408  $oscBrowserNotificationIdleTime->setSuffix($this->lng->txt('minutes'));
409  $oscBrowserNotificationIdleTime->setMinValue(1);
410  $oscBrowserNotificationIdleTime->setSize(5);
411  $oscBrowserNotificationIdleTime->setInfo($this->lng->txt('osc_adm_conv_idle_state_threshold_info'));
412  $enable_osc->addSubItem($oscBrowserNotificationIdleTime);
413 
414  $osd = new ilCheckboxInputGUI($this->lng->txt('enable_osd'), 'enable_osd');
415  $osd->setInfo($this->lng->txt('hint_osd'));
416  $enable_chat->addSubItem($osd);
417 
418  $interval = new ilNumberInputGUI($this->lng->txt('osd_intervall'), 'osd_intervall');
419  $interval->setMinValue(1);
420  $interval->setRequired(true);
421  $interval->setSuffix($this->lng->txt('seconds'));
422  $interval->setSize(5);
423  $interval->setInfo($this->lng->txt('hint_osd_interval'));
424  $osd->addSubItem($interval);
425 
426  $play_sound = new ilCheckboxInputGUI($this->lng->txt('play_invitation_sound'), 'play_invitation_sound');
427  $play_sound->setInfo($this->lng->txt('play_invitation_sound_info'));
428  $osd->addSubItem($play_sound);
429 
430  $enable_smilies = new ilCheckboxInputGUI($this->lng->txt('enable_smilies'), 'enable_smilies');
431  $enable_smilies->setInfo($this->lng->txt('hint_enable_smilies'));
432  $enable_chat->addSubItem($enable_smilies);
433 
434  $name = new \ilTextInputGUI($this->lng->txt('chatroom_client_name'), 'client_name');
435  $name->setInfo($this->lng->txt('chatroom_client_name_info'));
436  $name->setRequired(true);
437  $name->setMaxLength(100);
438  $enable_chat->addSubItem($name);
439 
440  require_once 'Modules/Chatroom/classes/class.ilChatroomAuthInputGUI.php';
441  $auth = new ilChatroomAuthInputGUI($this->lng->txt('chatroom_auth'), 'auth');
442  $auth->setInfo($this->lng->txt('chat_auth_token_info'));
443  $auth->setCtrlPath(array('iladministrationgui', 'ilobjchatroomgui', 'ilpropertyformgui', 'ilformpropertydispatchgui', 'ilchatroomauthinputgui'));
444  $auth->setRequired(true);
445  $enable_chat->addSubItem($auth);
446 
447  return $form;
448  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
$auth
Definition: metadata.php:59
if($format !==null) $name
Definition: metadata.php:230
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
This class represents a number property in a property form.
Class ilChatroomAuthInputGUI.
+ Here is the call graph for this function:

◆ getCreationForm()

ilChatroomFormFactory::getCreationForm ( )

Instantiates and returns ilPropertyFormGUI containing ilTextInputGUI and ilTextAreaInputGUI.

Deprecated:
replaced by default creation screens
Returns
ilPropertyFormGUI

Definition at line 51 of file class.ilChatroomFormFactory.php.

References addDefaultBehaviour().

52  {
53  $form = new ilPropertyFormGUI();
54  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
55  $title->setRequired(true);
56  $form->addItem($title);
57 
58  $description = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
59  $form->addItem($description);
60 
61  return $this->addDefaultBehaviour($form);
62  }
This class represents a property form user interface.
This class represents a text area property in a property form.
addDefaultBehaviour(ilPropertyFormGUI $form)
Adds 'create-save' and 'cancel' button to given $form and returns it.
+ Here is the call graph for this function:

◆ getFileUploadForm()

ilChatroomFormFactory::getFileUploadForm ( )

Prepares Fileupload form and returns it.

Returns
ilPropertyFormGUI

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

143  {
144  $form = new ilPropertyFormGUI();
145  $file_input = new ilFileInputGUI();
146 
147  $file_input->setPostVar('file_to_upload');
148  $file_input->setTitle($this->lng->txt('upload'));
149  $form->addItem($file_input);
150  $form->addCommandButton('UploadFile-uploadFile', $this->lng->txt('submit'));
151 
152  $form->setTarget('_blank');
153 
154  return $form;
155  }
This class represents a property form user interface.
This class represents a file property in a property form.

◆ getGeneralSettingsForm()

ilChatroomFormFactory::getGeneralSettingsForm ( )

Returns general settings form.

Returns
ilPropertyFormGUI

Definition at line 243 of file class.ilChatroomFormFactory.php.

References $http, $https, ilNumberInputGUI\allowDecimals(), ilRadioOption\setInfo(), ilNumberInputGUI\setMinValue(), and ilFormPropertyGUI\setRequired().

244  {
245  $form = new ilPropertyFormGUI();
246 
247  $address = new ilTextInputGUI($this->lng->txt('chatserver_address'), 'address');
248  $address->setRequired(true);
249  $form->addItem($address);
250 
251  $port = new ilNumberInputGUI($this->lng->txt('chatserver_port'), 'port');
252  $port->setMinValue(1);
253  $port->setMaxValue(65535);
254  $port->setRequired(true);
255  $port->setInfo($this->lng->txt('port_info'));
256  $port->setSize(6);
257  $form->addItem($port);
258 
259  $subDirectory = new ilTextInputGUI($this->lng->txt('chat_osc_no_sub_directory'), 'sub_directory');
260  $subDirectory->setRequired(false);
261  $subDirectory->setInfo($this->lng->txt('chat_osc_no_sub_directory_info'));
262  $form->addItem($subDirectory);
263 
264  $protocol = new ilRadioGroupInputGUI($this->lng->txt('protocol'), 'protocol');
265  $form->addItem($protocol);
266 
267  $http = new ilRadioOption($this->lng->txt('http'), 'http');
268  $protocol->addOption($http);
269 
270  $https = new ilRadioOption($this->lng->txt('https'), 'https');
271  $protocol->addOption($https);
272 
273  $certificate = new ilTextInputGUI($this->lng->txt('certificate'), 'cert');
274  $certificate->setInfo($this->lng->txt('chat_https_cert_info'));
275  $certificate->setRequired(true);
276  $https->addSubItem($certificate);
277 
278  $key = new ilTextInputGUI($this->lng->txt('key'), 'key');
279  $key->setInfo($this->lng->txt('chat_https_key_info'));
280  $key->setRequired(true);
281  $https->addSubItem($key);
282 
283  $dhparam = new ilTextInputGUI($this->lng->txt('dhparam'), 'dhparam');
284  $dhparam->setInfo($this->lng->txt('chat_https_dhparam_info'));
285  $dhparam->setRequired(true);
286  $https->addSubItem($dhparam);
287 
288  $chatLog = new ilTextInputGUI($this->lng->txt('chatroom_log'), 'log');
289  $chatLog->setInfo($this->lng->txt('chat_log_info'));
290  $chatLog->setRequired(false);
291  $form->addItem($chatLog);
292 
293  $chatLogLevel = new ilSelectInputGUI($this->lng->txt('chat_log_level'), 'log_level');
294  $chatLogLevel->setOptions([
295  'emerg' => 'emerg',
296  'alert' => 'alert',
297  'crit' => 'crit',
298  'error' => 'error',
299  'warning' => 'warning',
300  'notice' => 'notice',
301  'info' => 'info',
302  'debug' => 'debug',
303  'silly' => 'silly',
304  ]);
305  $form->addItem($chatLogLevel);
306 
307  $chatErrorLog = new ilTextInputGUI($this->lng->txt('error_log'), 'error_log');
308  $chatErrorLog->setInfo($this->lng->txt('chat_error_log_info'));
309  $chatErrorLog->setRequired(false);
310  $form->addItem($chatErrorLog);
311 
312  $iliasSection = new ilFormSectionHeaderGUI();
313  $iliasSection->setTitle($this->lng->txt('ilias_chatserver_connection'));
314  $form->addItem($iliasSection);
315 
316  $iliasProxy = new ilCheckboxInputGUI($this->lng->txt('proxy'), 'ilias_proxy');
317  $iliasProxy->setRequired(false);
318  $iliasProxy->setInfo($this->lng->txt('ilias_proxy_info'));
319  $form->addItem($iliasProxy);
320 
321  $chatServerILIASUrl = new ilTextInputGUI($this->lng->txt('url'), 'ilias_url');
322  $chatServerILIASUrl->setRequired(true);
323  $chatServerILIASUrl->setInfo($this->lng->txt('connection_url_info'));
324  $iliasProxy->addSubItem($chatServerILIASUrl);
325 
326  $clientSection = new ilFormSectionHeaderGUI();
327  $clientSection->setTitle($this->lng->txt('client_chatserver_connection'));
328  $form->addItem($clientSection);
329 
330  $clientProxy = new ilCheckboxInputGUI($this->lng->txt('proxy'), 'client_proxy');
331  $clientProxy->setRequired(false);
332  $clientProxy->setInfo($this->lng->txt('client_proxy_info'));
333  $form->addItem($clientProxy);
334 
335  $chatServerClientUrl = new ilTextInputGUI($this->lng->txt('url'), 'client_url');
336  $chatServerClientUrl->setRequired(true);
337  $chatServerClientUrl->setInfo($this->lng->txt('connection_url_info'));
338  $clientProxy->addSubItem($chatServerClientUrl);
339 
340  $deletion_section = new ilFormSectionHeaderGUI();
341  $deletion_section->setTitle($this->lng->txt('chat_deletion_section_head'));
342  $form->addItem($deletion_section);
343 
344  $deletion_options = new ilRadioGroupInputGUI($this->lng->txt('chat_deletion_section_head'), 'deletion_mode');
345 
346  $deletion_mode_deactivated = new ilRadioOption($this->lng->txt('chat_deletion_disabled'), 0);
347  $deletion_options->addOption($deletion_mode_deactivated);
348 
349  $chat_deletion_interval = new ilRadioOption($this->lng->txt('chat_deletion_interval'), 1);
350  $chat_deletion_interval->setInfo($this->lng->txt('chat_deletion_interval_info'));
351  $interval_unit = new ilSelectInputGUI($this->lng->txt('chat_deletion_interval_unit'), 'deletion_unit');
352  $interval_unit->setRequired(true);
353  $interval_unit->setOptions(array(
354  'days' => $this->lng->txt('days'),
355  'weeks' => $this->lng->txt('weeks'),
356  'months' => $this->lng->txt('months'),
357  'years' => $this->lng->txt('years'),
358  ));
359  $chat_deletion_interval->addSubItem($interval_unit);
360 
361  require_once 'Modules/Chatroom/classes/form/class.ilChatroomMessageDeletionThresholdInputGUI.php';
362  $interval_value = new ilChatroomMessageDeletionThresholdInputGUI($this->lng->txt('chat_deletion_interval_value'), 'deletion_value', $interval_unit);
363  $interval_value->allowDecimals(false);
364  $interval_value->setMinValue(1);
365  $interval_value->setRequired(true);
366  $chat_deletion_interval->addSubItem($interval_value);
367 
368  $runAtTime = new ilTextInputGUI($this->lng->txt('chat_deletion_interval_run_at'), 'deletion_time');
369  $runAtTime->setInfo($this->lng->txt('chat_deletion_interval_run_at_info'));
370  $runAtTime->setRequired(true);
371  $runAtTime->setValidationRegexp('/([01][0-9]|[2][0-3]):[0-5][0-9]/');
372  $chat_deletion_interval->addSubItem($runAtTime);
373 
374  $deletion_options->addOption($chat_deletion_interval);
375 
376  $form->addItem($deletion_options);
377 
378  return $form;
379  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
allowDecimals($a_value)
Toggle Decimals.
This class represents a property in a property form.
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
This class represents a number property in a property form.
$https
Definition: imgupload.php:19
$http
Definition: raiseError.php:7
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ getPeriodForm()

ilChatroomFormFactory::getPeriodForm ( )

Returns period form.

Returns
ilPropertyFormGUI

Definition at line 161 of file class.ilChatroomFormFactory.php.

References ilDateDurationInputGUI\setStartText().

162  {
163  $form = new ilPropertyFormGUI();
164  $form->setPreventDoubleSubmission(false);
165 
166  require_once 'Services/Form/classes/class.ilDateDurationInputGUI.php';
167  $duration = new ilDateDurationInputGUI($this->lng->txt('period'), 'timeperiod');
168 
169  $duration->setStartText($this->lng->txt('duration_from'));
170  $duration->setEndText($this->lng->txt('duration_to'));
171  $duration->setShowTime(true);
172  $duration->setRequired(true);
173  $form->addItem($duration);
174 
175  return $form;
176  }
This class represents a property form user interface.
input GUI for a time span (start and end date)
setStartText($a_txt)
Set text, which will be shown before the start date.
+ Here is the call graph for this function:

◆ getSessionForm()

ilChatroomFormFactory::getSessionForm ( array  $sessions)

Returns session form with period set by given $sessions.

Parameters
array$sessions
Returns
ilPropertyFormGUI

Definition at line 215 of file class.ilChatroomFormFactory.php.

References $session, ilDatePresentation\formatPeriod(), and IL_CAL_UNIX.

216  {
217  $form = new ilPropertyFormGUI();
218  $form->setPreventDoubleSubmission(false);
219  $list = new ilSelectInputGUI($this->lng->txt('session'), 'session');
220 
221  $options = array();
222 
223  foreach ($sessions as $session) {
224  $start = new ilDateTime($session['connected'], IL_CAL_UNIX);
225  $end = new ilDateTime($session['disconnected'], IL_CAL_UNIX);
226 
227  $options[$session['connected'] . ',' .
228  $session['disconnected']] = ilDatePresentation::formatPeriod($start, $end);
229  }
230 
231  $list->setOptions($options);
232  $list->setRequired(true);
233 
234  $form->addItem($list);
235 
236  return $form;
237  }
This class represents a property form user interface.
$session
const IL_CAL_UNIX
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
+ Here is the call graph for this function:

◆ getSettingsForm()

ilChatroomFormFactory::getSettingsForm ( )
Returns
ilPropertyFormGUI

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

References $section, $txt, ilFormPropertyGUI\setInfo(), ilDateDurationInputGUI\setShowTime(), and ilCheckboxInputGUI\setValue().

81  {
82  $this->lng->loadLanguageModule('rep');
83 
84  $form = new ilPropertyFormGUI();
85  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
86  $title->setRequired(true);
87  $form->addItem($title);
88 
89  $description = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
90  $form->addItem($description);
91 
92  $cb = new ilCheckboxInputGUI($this->lng->txt('allow_anonymous'), 'allow_anonymous');
93  $cb->setInfo($this->lng->txt('anonymous_hint'));
94 
95  $txt = new ilTextInputGUI($this->lng->txt('autogen_usernames'), 'autogen_usernames');
96  $txt->setRequired(true);
97  $txt->setInfo($this->lng->txt('autogen_usernames_info'));
98  $cb->addSubItem($txt);
99  $form->addItem($cb);
100 
101  $cb = new ilCheckboxInputGUI($this->lng->txt('allow_custom_usernames'), 'allow_custom_usernames');
102  $form->addItem($cb);
103 
104  $cb_history = new ilCheckboxInputGUI($this->lng->txt('enable_history'), 'enable_history');
105  $form->addItem($cb_history);
106 
107  $num_msg_history = new ilNumberInputGUI($this->lng->txt('display_past_msgs'), 'display_past_msgs');
108  $num_msg_history->setInfo($this->lng->txt('hint_display_past_msgs'));
109  $num_msg_history->setMinValue(0);
110  $num_msg_history->setMaxValue(100);
111  $form->addItem($num_msg_history);
112 
113  $cb = new ilCheckboxInputGUI($this->lng->txt('private_rooms_enabled'), 'private_rooms_enabled');
114  $cb->setInfo($this->lng->txt('private_rooms_enabled_info'));
115  $form->addItem($cb);
116 
118  $section->setTitle($this->lng->txt('rep_activation_availability'));
119  $form->addItem($section);
120 
121  $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online_status');
122  $online->setInfo($this->lng->txt('chtr_activation_online_info'));
123  $form->addItem($online);
124 
125  require_once 'Services/Form/classes/class.ilDateDurationInputGUI.php';
126  $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), 'access_period');
127  $dur->setShowTime(true);
128  $form->addItem($dur);
129 
130  $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visibility');
131  $visible->setValue(1);
132  $visible->setInfo($this->lng->txt('chtr_activation_limited_visibility_info'));
133  $dur->addSubItem($visible);
134 
135  return $form;
136  }
This class represents a property form user interface.
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:83
input GUI for a time span (start and end date)
This class represents a number property in a property form.
setValue($a_value)
Set Value.
setShowTime($a_showtime)
Set Show Time Information.
$txt
Definition: error.php:13
This class represents a text area property in a property form.
+ Here is the call graph for this function:

◆ getUserChatNameSelectionForm()

ilChatroomFormFactory::getUserChatNameSelectionForm ( array  $name_options)

Returns chatname selection form.

Parameters
array$name_options
Returns
ilPropertyFormGUI

Definition at line 183 of file class.ilChatroomFormFactory.php.

References $txt, and user().

184  {
185  $form = new ilPropertyFormGUI();
186 
187  $radio = new ilRadioGroupInputGUI($this->lng->txt('select_custom_username'), 'custom_username_radio');
188 
189  foreach ($name_options as $key => $option) {
190  $opt = new ilRadioOption($option, $key);
191  $radio->addOption($opt);
192  }
193 
194  $custom_opt = new ilRadioOption($this->lng->txt('custom_username'), 'custom_username');
195  $radio->addOption($custom_opt);
196 
197  $txt = new ilTextInputGUI($this->lng->txt('custom_username'), 'custom_username_text');
198  $custom_opt->addSubItem($txt);
199  $form->addItem($radio);
200 
201  if ($this->user->isAnonymous()) {
202  $radio->setValue('anonymousName');
203  } else {
204  $radio->setValue('fullname');
205  }
206 
207  return $form;
208  }
This class represents an option in a radio group.
This class represents a property form user interface.
user()
Definition: user.php:4
This class represents a property in a property form.
$txt
Definition: error.php:13
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilChatroomFormFactory::$lng
protected

Definition at line 17 of file class.ilChatroomFormFactory.php.

◆ $user

ilChatroomFormFactory::$user
protected

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


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