19 declare(strict_types=1);
    47         $this->
http = $DIC->http();
    48         $this->
ctrl = $DIC->ctrl();
    49         $this->actor = $DIC->user();
    54         return $this->dic->http()->response()->withBody(Streams::ofString($body));
    62             $chatSettings->
get(
'chat_enabled', 
'0') &&
    63             $chatSettings->
get(
'enable_osc', 
'0') &&
    64             $DIC->user() && !$DIC->user()->isAnonymous()
    70         $cmd = $this->
ctrl->getCmd();
    72             case 'getUserProfileData':
    80             case 'getRenderedConversationItems':
    83                     new Conversation($this->dic->database(), $this->dic->user()),
    84                     new Subscriber($this->dic->database(), $this->dic->user())
    87                 $conversationIds = (string) ($this->dic->http()->request()->getQueryParams()[
'ids'] ?? 
'');
    88                 $noAggregates = ($this->dic->http()->request()->getQueryParams()[
'no_aggregates'] ?? 
'');
    91                     $this->dic->ui()->renderer()->renderAsync(
$provider->getAsyncItem(
    93                         $noAggregates !== 
'true'    99                 $this->dic->language()->loadLanguageModule(
'chatroom');
   100                 $txt = $this->dic->language()->txt(...);
   101                 $modal = $this->dic->ui()->factory()->modal()->roundtrip(
$txt(
'chat_osc_invite_to_conversation'), $this->dic->ui()->factory()->legacy(
$txt(
'chat_osc_search_modal_info')), [
   102                     $this->dic->ui()->factory()->input()->field()->text(
$txt(
'chat_osc_user')),
   103                 ])->withSubmitLabel(
$txt(
'confirm'));
   107             case 'confirmRemove':
   108                 $this->dic->language()->loadLanguageModule(
'chatroom');
   109                 $txt = $this->dic->language()->txt(...);
   110                 $modal = $this->dic->ui()->factory()->modal()->interruptive(
   111                     $txt(
'chat_osc_leave_grp_conv'),
   112                     $txt(
'chat_osc_sure_to_leave_grp_conv'),
   114                 )->withActionButtonLabel(
$txt(
'confirm'));
   123         if ($this->
ctrl->isAsynch()) {
   125             $this->
http->sendResponse();
   126             $this->
http->close();
   135             'loggedIn' => $this->actor->getId() && !$this->actor->isAnonymous()
   136         ], JSON_THROW_ON_ERROR));
   141         if (!$this->actor->getId() || $this->actor->isAnonymous()) {
   146         $auto->setUser($this->actor);
   148         if (isset($this->
http->request()->getQueryParams()[
'fetchall'])) {
   151         $auto->setMoreLinkAvailable(
true);
   152         $auto->setSearchFields([
'firstname', 
'lastname']);
   153         $auto->setResultField(
'login');
   154         $auto->enableFieldSearchableCheck(
true);
   156         return $this->
getResponseWithText($auto->getList($this->http->request()->getQueryParams()[
'term'] ?? 
''));
   161         if (!$this->actor->getId() || $this->actor->isAnonymous()) {
   165         $usrIds = (string) ($this->
http->request()->getQueryParams()[
'usr_ids'] ?? 
'');
   166         if ($usrIds === 
'') {
   170         $this->dic->language()->loadLanguageModule(
'user');
   171         $subscriberRepo = 
new Subscriber($this->dic->database(), $this->dic->user());
   172         $data = $subscriberRepo->getDataByUserIds(explode(
',', $usrIds));
   183         if (!self::$frontend_initialized) {
   184             $clientSettings = 
new ilSetting(
'chatroom');
   186             if (!self::isOnScreenChatAccessible($clientSettings)) {
   187                 self::$frontend_initialized = 
true;
   193             $DIC->language()->loadLanguageModule(
'chatroom');
   194             $DIC->language()->loadLanguageModule(
'user');
   197             $factory = $DIC->ui()->factory();
   199             $chatWindowTemplate = 
new ilTemplate(
'tpl.chat-window.html', 
false, 
false, 
'components/ILIAS/OnScreenChat');
   200             $chatWindowTemplate->setVariable(
'SUBMIT_ACTION', 
$renderer->render(
   201                 $factory->button()->standard($DIC->language()->txt(
'chat_osc_send'), 
'onscreenchat-submit')
   203             $chatWindowTemplate->setVariable(
'ADD_ACTION', 
$renderer->render(
   204                 $factory->symbol()->glyph()->add(
'addUser')
   206             $chatWindowTemplate->setVariable(
'MINIMIZE_ACTION', 
$renderer->render(
   207                 $factory->button()->minimize()
   211             $subscriberRepo = 
new Subscriber($DIC->database(), $DIC->user());
   214                 'chatWindowTemplate' => $chatWindowTemplate->get(),
   216                     'tpl.chat-message.html',
   219                     'components/ILIAS/OnScreenChat'   221                 'nothingFoundTemplate' => $DIC->ui()->renderer()->render($DIC->ui()->factory()->messageBox()->info($DIC->language()->txt(
'chat_osc_no_usr_found'))),
   222                 'userId' => $DIC->user()->getId(),
   223                 'username' => $DIC->user()->getLogin(),
   224                 'modalURLTemplate' => ILIAS_HTTP_PATH . 
'/' . $DIC->ctrl()->getLinkTargetByClass(
   225                     ilOnScreenChatGUI::class,
   230                 'userListURL' => ILIAS_HTTP_PATH . 
'/' . $DIC->ctrl()->getLinkTargetByClass(
   237                 'userProfileDataURL' => $DIC->ctrl()->getLinkTargetByClass(
   239                     'getUserProfileData',
   244                 'verifyLoginURL' => $DIC->ctrl()->getLinkTargetByClass(
   251                 'renderConversationItemsURL' => $DIC->ctrl()->getLinkTargetByClass(
   253                     'getRenderedConversationItems',
   259                 'locale' => $DIC->language()->getLangKey(),
   260                 'initialUserData' => $subscriberRepo->getInitialUserProfileData(),
   261                 'enabledBrowserNotifications' => (
   262                     $clientSettings->get(
'enable_browser_notifications', 
'0') &&
   263                     ilUtil::yn2tf((
string) $DIC->user()->getPref(
'chat_osc_browser_notifications'))
   265                 'broadcast_typing' => (
   266                     ilUtil::yn2tf((
string) $DIC->user()->getPref(
'chat_broadcast_typing'))
   272                 'url' => $settings->generateClientUrl() . 
'/' . $settings->getInstance() . 
'-im',
   273                 'subDirectory' => $settings->getSubDirectory() . 
'/socket.io',
   274                 'userId' => $DIC->user()->getId(),
   275                 'username' => $DIC->user()->getLogin(),
   278             $DIC->language()->toJS([
   279                 'chat_osc_no_usr_found',
   280                 'chat_osc_write_a_msg',
   283                 'chat_osc_invite_to_conversation',
   286                 'chat_osc_subs_rej_msgs',
   287                 'chat_osc_subs_rej_msgs_p',
   288                 'chat_osc_self_rej_msgs',
   289                 'chat_osc_search_modal_info',
   290                 'chat_osc_head_grp_x_persons',
   292                 'chat_osc_conversations',
   293                 'chat_osc_sure_to_leave_grp_conv',
   294                 'chat_osc_user_left_grp_conv',
   297                 'chat_osc_leave_grp_conv',
   299                 'chat_osc_nc_conv_x_p',
   300                 'chat_osc_nc_conv_x_s',
   301                 'chat_osc_nc_no_conv',
   302                 'chat_user_x_is_typing',
   303                 'chat_users_are_typing',
   315             $page->
addJavaScript(
'assets/js/moment-with-locales.min.js');
   317             $page->
addJavaScript(
'assets/js/onscreenchat-notifications.js');
   321             $page->
addOnLoadCode(
"il.Chat.setConfig(" . json_encode($chatConfig, JSON_THROW_ON_ERROR) . 
");");
   322             $page->
addOnLoadCode(
"il.OnScreenChat.setConfig(" . json_encode($guiConfig, JSON_THROW_ON_ERROR) . 
");");
   324             $page->
addOnLoadCode(
'il.OnScreenChatNotifications.init(' . json_encode([
   325                 'conversationIdleTimeThreshold' => max(
   327                     (
int) $clientSettings->get(
'conversation_idle_state_in_minutes', 
'1')
   329                 'logLevel' => $DIC[
'ilLoggerFactory']->getSettings()->getLevelByComponent(
'osch'),
   330             ], JSON_THROW_ON_ERROR) . 
');');
   332             self::$frontend_initialized = 
true;
   338         return $this->
getResponseWithText($this->dic->ui()->renderer()->renderAsync($modal->withAdditionalOnLoadCode(fn(
$id) => (
   339             'il.OnScreenChat.bus.send(' . json_encode($bus_name, JSON_THROW_ON_ERROR) . 
', ' . json_encode([(
string) $modal->getShowSignal(), (string) $modal->getCloseSignal()], JSON_THROW_ON_ERROR) . 
');' 
static enableWebAccessWithoutSession(bool $enable_web_access_without_session)
 
get(string $a_keyword, ?string $a_default_value=null)
get setting 
 
Class ilOnScreenChatUserUserAutoComplete. 
 
const PRIVACY_MODE_RESPECT_USER_SETTING
 
static initLinkify(?ilGlobalTemplateInterface $a_tpl=null)
 
static initializeFrontend(ilGlobalTemplateInterface $page)
 
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag. 
 
Interface ilCtrlBaseClassInterface describes ilCtrl base classes. 
 
readonly ILIAS HTTP Services $http
 
static http()
Fetches the global http state from ILIAS. 
 
static isOnScreenChatAccessible(ilSetting $chatSettings)
 
static bool $frontend_initialized
 
renderAsyncModal(string $bus_name, $modal)
 
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory) 
 
static initjQueryUI(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components) 
 
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header. 
 
readonly ilCtrlInterface $ctrl
 
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code. 
 
readonly ILIAS DI Container $dic
 
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template 
 
readonly ilObjUser $actor
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
Class OnScreenChatProvider. 
 
static yn2tf(string $a_yn)
 
getResponseWithText(string $body)