19 declare(strict_types=1);
34 protected \ILIAS\HTTP\Services
$http;
42 $this->
lng = $DIC->language();
43 $this->
user = $DIC->user();
44 $this->
http = $DIC->http();
45 $this->ui_factory = $DIC->ui()->factory();
56 static fn($value) => is_int($value) ? (
string) $value : $value,
71 $title->setRequired(
true);
72 $form->addItem($title);
75 $form->addItem($description);
93 return $this->
refinery->custom()->transformation(
static fn(array $values): array => array_merge(...$values));
98 $sanitize =
static function (array
$data) use (&$sanitize): array {
100 if (is_array($value)) {
102 } elseif (is_string($value)) {
110 return $this->
refinery->custom()->transformation($sanitize);
116 ?array $values = null
118 $this->
lng->loadLanguageModule(
'obj');
119 $this->
lng->loadLanguageModule(
'rep');
121 $field_factory = $this->ui_factory->input()->field();
123 $title_and_description = $gui->
getObject()->getObjectProperties()->getPropertyTitleAndDescription();
124 $general_settings_fields = [
125 self::PROP_TITLE_AND_DESC => $title_and_description->toForm(
132 $online_status = $gui->
getObject()->getObjectProperties()->getPropertyIsOnline();
133 $availability_fields = [
134 self::PROP_ONLINE_STATUS => $online_status->toForm(
138 )->withByline($this->
lng->txt(
'chtr_activation_online_info')),
141 $tile_image = $gui->
getObject()->getObjectProperties()->getPropertyTileImage();
142 $presentation_fields = [
143 self::PROP_TILE_IMAGE => $tile_image->toForm(
148 self::PROP_DISPLAY_PAST_MSG => $field_factory->numeric(
149 $this->
lng->txt(
'display_past_msgs'),
150 $this->
lng->txt(
'hint_display_past_msgs')
153 )->withAdditionalTransformation(
154 $this->
refinery->logical()->parallel([
155 $this->
refinery->int()->isGreaterThanOrEqual(0),
156 $this->
refinery->int()->isLessThanOrEqual(100)
159 $values[
'display_past_msgs'] ?? 0
161 self::PROP_ENABLE_HISTORY => $field_factory->checkbox(
162 $this->
lng->txt(
'chat_enable_history'),
163 $this->
lng->txt(
'chat_enable_history_info')
164 )->
withValue((
bool) ($values[
'enable_history'] ??
false)),
168 self::PROP_ALLOW_ANONYMOUS => $field_factory->checkbox(
169 $this->
lng->txt(
'allow_anonymous'),
170 $this->
lng->txt(
'anonymous_hint')
171 )->
withValue((
bool) ($values[
'allow_anonymous'] ??
false)),
172 self::PROP_ALLOW_CUSTOM_NAMES => $field_factory->optionalGroup(
174 self::PROP_AUTOGEN_USERNAMES => $field_factory->text(
175 $this->lng->txt(
'autogen_usernames'),
176 $this->
lng->txt(
'autogen_usernames_info')
177 )->withRequired(
true),
179 $this->
lng->txt(
'allow_custom_usernames')
181 ($values[
'allow_custom_usernames'] ??
false) ? [self::PROP_AUTOGEN_USERNAMES => $values[
'autogen_usernames'] ??
''] : null
186 $field_factory->section(
187 $general_settings_fields,
188 $this->
lng->txt(
'settings_title'),
191 $field_factory->section(
192 $availability_fields,
193 $this->lng->txt(
'rep_activation_availability'),
196 $field_factory->section(
197 $presentation_fields,
198 $this->lng->txt(
'settings_presentation_header'),
201 $field_factory->section(
203 $this->lng->txt(
'chat_settings_functions_header'),
208 return $this->ui_factory->input()
222 $form->setPreventDoubleSubmission(
false);
226 $duration->setStartText($this->
lng->txt(
'duration_from'));
245 foreach ($name_options as
$key => $option) {
247 $radio->addOption($opt);
250 $custom_opt =
new ilRadioOption($this->
lng->txt(
'custom_username'),
'custom_username');
251 $radio->addOption($custom_opt);
254 $custom_opt->addSubItem(
$txt);
255 $form->addItem($radio);
257 if ($this->
user->isAnonymous()) {
258 $radio->setValue(
'anonymousName');
260 $radio->setValue(
'fullname');
272 $form->setPreventDoubleSubmission(
false);
277 foreach ($sessions as $session) {
281 $options[$session[
'connected'] .
',' .
285 $list->setOptions($options);
286 $list->setRequired(
true);
288 $form->addItem($list);
298 $form->addItem($enable_chat);
301 $enable_osc->setInfo($this->
lng->txt(
'chatroom_enable_osc_info'));
302 $enable_chat->addSubItem($enable_osc);
305 $this->
lng->txt(
'osc_adm_browser_noti_label'),
306 'enable_browser_notifications' 308 $oscBrowserNotificationStatus->setInfo($this->
lng->txt(
'osc_adm_browser_noti_info'));
309 $oscBrowserNotificationStatus->setValue(
'1');
310 $enable_osc->addSubItem($oscBrowserNotificationStatus);
313 $this->
lng->txt(
'osc_adm_conv_idle_state_threshold_label'),
314 'conversation_idle_state_in_minutes' 316 $oscBrowserNotificationIdleTime->allowDecimals(
false);
317 $oscBrowserNotificationIdleTime->setSuffix($this->
lng->txt(
'minutes'));
318 $oscBrowserNotificationIdleTime->setMinValue(1);
319 $oscBrowserNotificationIdleTime->setSize(5);
320 $oscBrowserNotificationIdleTime->setInfo($this->
lng->txt(
'osc_adm_conv_idle_state_threshold_info'));
321 $enable_osc->addSubItem($oscBrowserNotificationIdleTime);
323 $name =
new ilTextInputGUI($this->
lng->txt(
'chatroom_client_name'),
'client_name');
324 $name->setInfo($this->
lng->txt(
'chatroom_client_name_info'));
325 $name->setRequired(
true);
326 $name->setMaxLength(100);
327 $enable_chat->addSubItem($name);
330 $this->
lng->txt(
'chatroom_auth'),
334 $auth->
setInfo($this->
lng->txt(
'chat_auth_token_info'));
337 ilAdministrationGUI::class,
338 ilObjChatroomGUI::class,
339 ilPropertyFormGUI::class,
340 ilFormPropertyDispatchGUI::class,
341 ilChatroomAuthInputGUI::class,
344 $auth->setRequired(
true);
345 $enable_chat->addSubItem($auth);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Returns a form action link for the given information.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
This class represents a text area property in a property form.