4 require_once
'Services/User/classes/class.ilObjUser.php';
39 $this->room = $chatroom;
50 $user_id = $this->
user->getId();
52 if ($this->
user->isAnonymous()) {
53 if (isset(
$_SESSION[
'chat'][$this->room->getRoomId()][
'user_id'])) {
54 return $_SESSION[
'chat'][$this->room->getRoomId()][
'user_id'];
56 $user_id = mt_rand(-99999, -20);
57 $_SESSION[
'chat'][$this->room->getRoomId()][
'user_id'] = $user_id;
72 if ($this->username) {
74 } elseif (
$_SESSION[
'chat'][$this->room->getRoomId()][
'username']) {
75 return $_SESSION[
'chat'][$this->room->getRoomId()][
'username'];
77 return $this->
user->getLogin();
87 $this->username = htmlspecialchars(
$username);
99 if ($this->
user->isAnonymous()) {
116 $anonymous_name = str_replace(
119 $this->room->getSetting(
'autogen_usernames')
122 return $anonymous_name;
131 $tmp = $this->
user->getPref(
'public_profile');
132 $this->
user->setPref(
'public_profile',
'y');
133 $pn = $this->
user->getPublicName();
134 $this->
user->setPref(
'public_profile', $tmp);
144 $firstname = $this->
user->getFirstname();
146 return $firstname{0} .
'. ' . $this->
user->getLastname();
155 return $this->
user->getLogin();
167 $usernames =
array();
170 $rset = $DIC->database()->query(
171 'SELECT * FROM chatroom_users WHERE ' 172 . $DIC->database()->like(
'userdata',
'text',
'%"login":"' .
$username .
'%')
173 .
' AND room_id = ' . $DIC->database()->quote($this->room->getRoomId(),
'integer')
176 while ((
$row = $DIC->database()->fetchAssoc($rset))) {
177 $json = json_decode(
$row[
'userdata'],
true);
178 $usernames[] = $json[
'login'];
182 if (in_array($uniqueName, $usernames)) {
buildAnonymousName()
Returns an anonymous username containing a random number.
getUserId()
Returns Ilias User ID.
setUsername($username)
Sets and stores given username in SESSION.
buildFullname()
Returns users first & lastname.
buildUniqueUsername($username)
buildShortname()
Returns first letter of users firstname, followed by dot lastname.
Create styles array
The data for the language used.
getChatNameSuggestions()
Returns an array of chat-name suggestions.
getUsername()
Returns username from Object or SESSION.
__construct(ilObjUser $user, ilChatroom $chatroom)
Constructor Requires ilObjUser and sets $this->user and $this->room using given $user and $chatroom...
buildLogin()
Returns user login.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options