4require_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)) {
 
  203                        FROM chatroom_users WHERE ' . 
$DIC->database()->in(
'user_id', $usrIds, 
false, 
'integer');
 
  205        if (
null !== $roomId) {
 
  206            $query .= 
' AND room_id = ' . 
$DIC->database()->quote($roomId, 
'integer');
 
An exception for terminatinating execution or to throw for unit testing.
static getUserInformation(array $usrIds, int $roomId=null)
__construct(ilObjUser $user, ilChatroom $chatroom)
Constructor Requires ilObjUser and sets $this->user and $this->room using given $user and $chatroom.
getChatNameSuggestions()
Returns an array of chat-name suggestions.
buildFullname()
Returns users first & lastname.
getUserId()
Returns Ilias User ID.
buildAnonymousName()
Returns an anonymous username containing a random number.
buildUniqueUsername($username)
buildShortname()
Returns first letter of users firstname, followed by dot lastname.
setUsername($username)
Sets and stores given username in SESSION.
buildLogin()
Returns user login.
getUsername()
Returns username from Object or SESSION.
foreach($_POST as $key=> $value) $res