28 return $chatSettings->
get(
'chat_enabled') && $chatSettings->
get(
'enable_osc') && $DIC->user() && !$DIC->user()->isAnonymous();
41 require_once
'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
42 require_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
46 $smileys_array = ilChatroomSmilies::_getSmilies();
47 foreach($smileys_array as $smiley_array)
51 foreach($smiley_array as $key => $value)
53 if($key ==
'smiley_keywords')
55 $new_keys = explode(
"\n", $value);
58 if($key ==
'smiley_fullpath')
64 if(!$new_keys || !$new_val)
69 foreach($new_keys as $new_key)
71 $smileys[$new_key] = $new_val;
83 $cmd = $DIC->ctrl()->getCmd();
87 case 'getUserProfileImages':
109 require_once
'Services/Authentication/classes/class.ilSession.php';
113 'loggedIn' => $DIC->user() && !$DIC->user()->isAnonymous()
122 if(!$DIC->user() || $DIC->user()->isAnonymous())
127 require_once
'Services/OnScreenChat/classes/class.ilOnScreenChatUserUserAutoComplete.php';
129 $auto->setUser($DIC->user());
131 if(($_REQUEST[
'fetchall']))
135 $auto->setMoreLinkAvailable(
true);
136 $auto->setSearchFields(
array(
'firstname',
'lastname'));
137 $auto->setResultField(
'login');
138 $auto->enableFieldSearchableCheck(
true);
139 echo $auto->getList($_REQUEST[
'term']);
149 if(!$DIC->user() || $DIC->user()->isAnonymous())
151 echo json_encode($response);
155 if(!isset(
$_GET[
'usr_ids']) || strlen(
$_GET[
'usr_ids']) == 0)
157 echo json_encode($response);
161 $DIC[
'lng']->loadLanguageModule(
'user');
163 require_once
'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
166 $user_ids = array_filter(array_map(
'intval', array_map(
'trim', explode(
',',
$_GET[
'usr_ids']))));
167 require_once
'Services/User/classes/class.ilUserUtil.php';
171 foreach($user_ids as $usr_id)
173 $public_image = isset($public_data[$usr_id]) && isset($public_data[$usr_id][
'img']) ? $public_data[$usr_id][
'img'] :
'';
176 if(isset($public_names[$usr_id]))
178 $public_name = $public_names[$usr_id];
179 if(
'unknown' == $public_name && isset($public_data[$usr_id]) && isset($public_data[$usr_id][
'login']))
181 $public_name = $public_data[$usr_id][
'login'];
185 $response[$usr_id] =
array(
186 'public_name' => $public_name,
187 'profile_image' => $public_image
191 require_once
'Services/Authentication/classes/class.ilSession.php';
194 echo json_encode($response);
205 if(!self::$frontend_initialized)
207 $clientSettings =
new ilSetting(
'chatroom');
209 if(!self::isOnScreenChatAccessible($clientSettings))
211 self::$frontend_initialized =
true;
215 require_once
'Services/JSON/classes/class.ilJsonUtil.php';
217 $settings = self::loadServerSettings();
219 $DIC->language()->loadLanguageModule(
'chatroom');
221 $renderer = $DIC->ui()->renderer();
222 $factory = $DIC->ui()->factory();
224 $chatWindowTemplate =
new ilTemplate(
'tpl.chat-window.html',
false,
false,
'Services/OnScreenChat');
225 $chatWindowTemplate->setVariable(
'SUBMIT_ACTION', $renderer ->render(
226 $factory->button()->standard($DIC->language()->txt(
'chat_osc_send'),
'onscreenchat-submit')
228 $chatWindowTemplate->setVariable(
'ADD_ACTION', $renderer ->render(
229 $factory->glyph()->add(
'addUser')
231 $chatWindowTemplate->setVariable(
'CLOSE_ACTION', $renderer ->render(
232 $factory->button()->close()
237 'chatWindowTemplate' => $chatWindowTemplate->get(),
238 'messageTemplate' => (
new ilTemplate(
'tpl.chat-message.html',
false,
false,
'Services/OnScreenChat'))->
get(),
239 'modalTemplate' => (
new ilTemplate(
'tpl.chat-add-user.html',
false,
false,
'Services/OnScreenChat'))->
get(),
240 'userId' => $DIC->user()->getId(),
241 'username' => $DIC->user()->getLogin(),
242 'userListURL' => $DIC->ctrl()->getLinkTargetByClass(
'ilonscreenchatgui',
'getUserList',
'',
true,
false),
243 'userProfileDataURL' => $DIC->ctrl()->getLinkTargetByClass(
'ilonscreenchatgui',
'getUserProfileImages',
'',
true,
false),
244 'verifyLoginURL' => $DIC->ctrl()->getLinkTargetByClass(
'ilonscreenchatgui',
'verifyLogin',
'',
true,
false),
246 'emoticons' => self::getEmoticons($settings),
247 'locale' => $DIC->language()->getLangKey()
251 'url' => $settings->generateClientUrl() .
'/' . $settings->getInstance() .
'-im',
252 'subDirectory' => $settings->getSubDirectory() .
'/socket.io',
253 'userId' => $DIC->user()->getId(),
254 'username' => $DIC->user()->getLogin()
257 $DIC->language()->toJS(
array(
258 'chat_osc_no_usr_found',
'chat_osc_emoticons',
'chat_osc_write_a_msg',
'autocomplete_more',
259 'close',
'chat_osc_invite_to_conversation',
'chat_osc_user',
'chat_osc_add_user',
'chat_osc_subs_rej_msgs',
260 'chat_osc_subs_rej_msgs_p',
'chat_osc_self_rej_msgs' 263 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
267 require_once
'Services/Link/classes/class.ilLinkifyUtil.php';
270 $DIC[
'tpl']->addJavaScript(
'./Services/jQuery/js/jquery.outside.events.min.js');
271 $DIC[
'tpl']->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
272 $DIC[
'tpl']->addJavascript(
'./Services/UIComponent/Modal/js/Modal.js');
273 $DIC[
'tpl']->addJavascript(
'./libs/composer/components/moment/min/moment-with-locales.js');
274 $DIC[
'tpl']->addJavascript(
'./Services/OnScreenChat/js/moment.js');
275 $DIC[
'tpl']->addJavascript(
'./Modules/Chatroom/chat/node_modules/socket.io/node_modules/socket.io-client/socket.io.js');
276 $DIC[
'tpl']->addJavascript(
'./Services/OnScreenChat/js/chat.js');
277 $DIC[
'tpl']->addJavascript(
'./Services/OnScreenChat/js/onscreenchat.js');
278 $DIC[
'tpl']->addOnLoadCode(
"il.Chat.setConfig(".
ilJsonUtil::encode($chatConfig).
");");
279 $DIC[
'tpl']->addOnLoadCode(
"il.OnScreenChat.setConfig(".
ilJsonUtil::encode($guiConfig).
");");
280 $DIC[
'tpl']->addOnLoadCode(
"il.OnScreenChat.init();");
282 self::$frontend_initialized =
true;
288 require_once
'./Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
289 return ilChatroomServerSettings::loadDefault();
static enableWebAccessWithoutSession($enable_web_access_without_session)
static initjQueryUI()
Init jQuery UI (see included_components.txt for included components)
Class ilOnScreenChatUserUserAutoComplete.
static initializeFrontend()
Initialize frontend and delivers required javascript files and configuration to the global template...
const PRIVACY_MODE_RESPECT_USER_SETTING
static $frontend_initialized
static getEmoticons(ilChatroomServerSettings $chatSettings)
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
static encode($mixed, $suppress_native=false)
static isOnScreenChatAccessible(ilSetting $chatSettings)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static signFile($path_to_file)
Create styles array
The data for the language used.
get($a_keyword, $a_default_value=false)
get setting
Class ilChatroomServerSettings.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
verifyLogin()
Checks if a user is logged in.
static initjQuery($a_tpl=null)
Init jQuery.
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
static loadServerSettings()
static initLinkify($a_tpl=null)
Init Linkify.