29 'object_id' =>
'integer',
30 'allow_anonymous' =>
'boolean',
31 'allow_custom_usernames' =>
'boolean',
32 'enable_history' =>
'boolean',
33 'restrict_history' =>
'boolean',
34 'autogen_usernames' =>
'string',
35 'room_type' =>
'string',
36 'allow_private_rooms' =>
'integer',
37 'display_past_msgs' =>
'integer',
38 'private_rooms_enabled' =>
'boolean' 52 global $rbacsystem,
$lng;
54 if(!is_array($permissions))
56 $permissions =
array($permissions);
59 foreach($permissions as $permission)
61 if(!$rbacsystem->checkAccess($permission,
$ref_id))
86 global $rbacsystem,
$lng;
88 if(!is_array($permissions))
90 $permissions =
array($permissions);
93 foreach($permissions as $permission)
95 if(!$rbacsystem->checkAccessOfUser($usr_id, $permission,
$ref_id))
113 $query =
'SELECT * FROM ' . self::$settingsTable .
' WHERE object_id = %s';
114 $types =
array(
'integer');
115 $values =
array($object_id);
116 $rset = $ilDB->queryF(
$query, $types, $values);
118 if(
$row = $ilDB->fetchAssoc($rset))
121 $room->initialize(
$row);
133 $this->roomId = $rowdata[
'room_id'];
135 foreach($this->availableSettings as $setting => $type)
137 if(isset($rowdata[$setting]))
139 settype($rowdata[$setting], $this->availableSettings[$setting]);
140 $this->
setSetting($setting, $rowdata[$setting]);
161 public static function byRoomId($room_id, $initObject =
false)
165 $query =
'SELECT * FROM ' . self::$settingsTable .
' WHERE room_id = %s';
167 $types =
array(
'integer');
168 $values =
array($room_id);
170 $rset = $ilDB->queryF(
$query, $types, $values);
172 if(
$row = $ilDB->fetchAssoc($rset))
175 $room->initialize(
$row);
194 $ilDB->manipulate(
'DELETE FROM ' . self::$userTable);
195 $ilDB->manipulate(
'UPDATE ' . self::$privateRoomsTable .
' SET closed = ' . $ilDB->quote(
time(),
'integer') .
' WHERE closed = 0 OR closed IS NULL');
196 $ilDB->manipulate(
'UPDATE ' . self::$privateSessionsTable .
' SET disconnected = ' . $ilDB->quote(
time(),
'integer') .
' WHERE disconnected = 0');
207 SELECT private_rooms.proom_id id, MIN(disconnected) min_disconnected, MAX(disconnected) max_disconnected 208 FROM ' . self::$privateSessionsTable .
' private_sessions 209 INNER JOIN ' . self::$privateRoomsTable .
' private_rooms 210 ON private_sessions.proom_id = private_rooms.proom_id 212 GROUP BY private_rooms.proom_id 213 HAVING MIN(disconnected) > 0 AND MAX(disconnected) < %s';
214 $rset = $ilDB->queryF(
222 while(
$row = $ilDB->fetchAssoc($rset))
224 $rooms[
$row[
'id']] = $row[
'id'];
227 $query =
'SELECT DISTINCT proom_id, room_id, object_id FROM ' . self::$privateRoomsTable
228 .
' INNER JOIN ' . self::$settingsTable .
' ON parent_id = room_id ' 229 .
' WHERE ' . $ilDB->in(
'proom_id', $rooms,
false,
'integer');
231 $rset = $ilDB->query(
$query);
233 while(
$row = $ilDB->fetchAssoc($rset))
236 'proom_id' =>
$row[
'proom_id'],
237 'room_id' =>
$row[
'room_id'],
238 'object_id' =>
$row[
'object_id']
245 public static function getUntrashedChatReferences($filter =
array())
255 SELECT od.obj_id, od.title, ore.ref_id, od.type, odp.title parent_title 257 INNER JOIN object_reference ore ON ore.obj_id = od.obj_id 258 INNER JOIN tree t ON t.child = ore.ref_id 259 INNER JOIN tree p ON p.child = t.parent 260 INNER JOIN object_reference orep ON orep.ref_id = p.child 261 INNER JOIN object_data odp ON odp.obj_id = orep.obj_id 262 INNER JOIN object_reference pre ON pre.ref_id = t.parent 263 INNER JOIN object_data pod ON pod.obj_id = pre.obj_id 266 if(isset($filter[
'last_activity']))
268 $threshold = $ilDB->quote($filter[
'last_activity'],
'integer');
270 INNER JOIN chatroom_settings ON chatroom_settings.object_id = od.obj_id 271 INNER JOIN chatroom_history ON chatroom_history.room_id = chatroom_settings.room_id AND chatroom_history.timestamp > $threshold 276 WHERE od.type = %s AND t.tree > 0 AND ore.deleted IS NULL 277 GROUP BY od.obj_id, od.title, ore.ref_id, od.type, odp.title 283 while(
$row = $ilDB->fetchAssoc(
$res))
298 return $this->
object->getDescription();
328 $localSettings =
array();
330 foreach($this->availableSettings as $setting => $type)
332 if(isset($settings[$setting]))
334 if($type ==
'boolean')
336 $settings[$setting] = (boolean)$settings[$setting];
342 if(!$localSettings[
'room_type'][1])
344 $localSettings[
'room_type'][1] =
'repository';
350 self::$settingsTable,
352 array(
'room_id' =>
array(
'integer', $this->roomId))
357 $this->roomId = $ilDB->nextId(self::$settingsTable);
359 $localSettings[
'room_id'] =
array(
360 $this->availableSettings[
'room_id'], $this->roomId
363 $ilDB->insert(self::$settingsTable, $localSettings);
392 if(is_array($message))
394 $subRoom = (int)$message[
'sub'];
396 else if(is_object($message))
398 $subRoom = (int)$message->sub;
401 $id = $ilDB->nextId(self::$historyTable);
405 'hist_id' =>
array(
'integer', $id),
406 'room_id' =>
array(
'integer', $this->roomId),
407 'sub_room' =>
array(
'integer', $subRoom),
408 'message' =>
array(
'text', json_encode($message)),
436 $query =
'SELECT user_id FROM ' . self::$userTable .
' WHERE room_id = %s AND user_id = %s';
437 $types =
array(
'integer',
'integer');
440 if(!$ilDB->fetchAssoc($ilDB->queryF($query, $types, $values)))
447 'room_id' =>
array(
'integer', $this->roomId),
451 'userdata' =>
array(
'text', json_encode($userdata)),
473 $query =
'SELECT userdata FROM ' . self::$userTable .
' WHERE room_id = %s';
474 $types =
array(
'integer');
475 $values =
array($this->roomId);
476 $rset = $ilDB->queryF(
$query, $types, $values);
479 while(
$row = $ilDB->fetchAssoc($rset))
481 $users[] = json_decode(
$row[
'userdata']);
508 $query =
'SELECT * FROM ' . self::$userTable .
' WHERE room_id = %s AND ' .
509 $ilDB->in(
'user_id', $userIds,
false,
'integer');
511 $types =
array(
'integer');
512 $values =
array($this->roomId);
513 $rset = $ilDB->queryF(
$query, $types, $values);
515 if(
$row = $ilDB->fetchAssoc($rset))
517 $query =
'SELECT proom_id FROM ' . self::$privateRoomsTable .
' WHERE parent_id = %s';
518 $rset_prooms = $ilDB->queryF(
$query,
array(
'integer'),
array($this->roomId));
522 while($row_prooms = $ilDB->fetchAssoc($rset_prooms))
524 $prooms[] = $row_prooms[
'proom_id'];
527 if(
true || $this->
getSetting(
'enable_history'))
529 $query =
'UPDATE ' . self::$privateSessionsTable .
' SET disconnected = %s WHERE ' . $ilDB->in(
'user_id', $userIds,
false,
'integer') .
' AND ' . $ilDB->in(
'proom_id', $prooms,
false,
'integer');
534 $query =
'DELETE FROM ' . self::$privateSessionsTable .
' WHERE ' . $ilDB->in(
'user_id', $userIds,
false,
'integer') .
' AND ' . $ilDB->in(
'proom_id', $prooms,
false,
'integer');
535 $ilDB->manipulate(
$query);
538 $query =
'DELETE FROM ' . self::$userTable .
' WHERE room_id = %s AND ' .
539 $ilDB->in(
'user_id', $userIds,
false,
'integer');
541 $types =
array(
'integer');
542 $values =
array($this->roomId);
543 $ilDB->manipulateF(
$query, $types, $values);
549 $id = $ilDB->nextId(self::$sessionTable);
553 'sess_id' =>
array(
'integer', $id),
554 'room_id' =>
array(
'integer', $this->roomId),
555 'user_id' =>
array(
'integer',
$row[
'user_id']),
556 'userdata' =>
array(
'text',
$row[
'userdata']),
557 'connected' =>
array(
'integer',
$row[
'connected']),
558 'disconnected' =>
array(
'integer',
time())
563 while(
$row = $ilDB->fetchAssoc($rset));
588 $query =
'SELECT count(user_id) as cnt FROM ' . self::$userTable .
589 ' WHERE room_id = %s AND user_id = %s';
591 $types =
array(
'integer',
'integer');
592 $values =
array($this->roomId, $chat_userid);
593 $rset = $ilDB->queryF(
$query, $types, $values);
595 if($rset && (
$row = $ilDB->fetchAssoc($rset)) &&
$row[
'cnt'] == 1)
606 $query =
'SELECT count(user_id) cnt FROM ' . self::$privateRoomsAccessTable .
607 ' WHERE proom_id = %s AND user_id = %s';
609 $types =
array(
'integer',
'integer');
610 $values =
array($proom_id, $chat_userid);
611 $rset = $ilDB->queryF(
$query, $types, $values);
613 if($rset && (
$row = $ilDB->fetchAssoc($rset)) &&
$row[
'cnt'] == 1)
616 $query =
'SELECT count(*) cnt FROM ' . self::$privateRoomsTable .
617 ' WHERE proom_id = %s AND owner = %s';
619 $types =
array(
'integer',
'integer');
620 $values =
array($proom_id, $chat_userid);
621 $rset = $ilDB->queryF(
$query, $types, $values);
623 if($rset && (
$row = $ilDB->fetchAssoc($rset)) &&
$row[
'cnt'] == 1)
647 'INNER JOIN ' . self::$privateSessionsTable .
' pSessionTable ' .
648 'ON pSessionTable.user_id = ' . $ilDB->quote($restricted_session_userid,
'integer') .
' ' .
649 'AND pSessionTable.proom_id = historyTable.sub_room ' .
650 'AND timestamp >= pSessionTable.connected ' .
651 'AND timestamp <= pSessionTable.disconnected ';
655 'SELECT historyTable.* ' .
656 'FROM ' . self::$historyTable .
' historyTable ' . $join .
' ' .
657 'WHERE historyTable.room_id = ' . $this->
getRoomId();
659 $query .=
' AND historyTable.sub_room = ' . $ilDB->quote($proom_id,
'integer');
665 $filter[] =
'timestamp >= ' . $ilDB->quote($from->getUnixTime(),
'integer');
670 $filter[] =
'timestamp <= ' . $ilDB->quote($to->getUnixTime(),
'integer');
674 $query .=
' AND ' . join(
' AND ', $filter);
675 $query .=
' ORDER BY timestamp ASC';
677 $rset = $ilDB->query(
$query);
680 while(
$row = $ilDB->fetchAssoc($rset))
682 $message = json_decode(
$row[
'message']);
683 if ($message === null) {
684 $message = json_decode(
'{}');
687 $row[
'message'] = $message;
688 $row[
'message']->timestamp =
$row[
'timestamp'];
689 if(
$row[
'message']->target !== null && !
$row[
'message']->target->public && !in_array($ilUser->getId(), explode(
',',
$row[
'recipients'])))
712 $query =
'SELECT proom_id, title FROM ' . self::$privateRoomsTable .
' WHERE proom_id IN ( 713 SELECT proom_id FROM ' . self::$privateSessionsTable .
' WHERE connected >= %s AND disconnected <= %s AND user_id = %s 715 ) AND parent_id = %s';
717 $rset = $ilDB->queryF(
$query,
array(
'integer',
'integer',
'integer',
'integer'),
array($from->getUnixTime(), $to->getUnixTime(), $user_id, $room_id));
719 while(
$row = $ilDB->fetchAssoc($rset))
737 $upload_id = $ilDB->nextId(self::$uploadTable);
742 'upload_id' =>
array(
'integer', $upload_id),
743 'room_id' =>
array(
'integer', $this->roomId),
744 'user_id' =>
array(
'integer', $user_id),
746 'filetype' =>
array(
'text', $type),
765 'room_id' =>
array(
'integer', $this->roomId),
766 'user_id' =>
array(
'integer', $user_id)
786 if(!is_array($user_id))
788 $user_id =
array($user_id);
791 $query =
'DELETE FROM ' . self::$banTable .
' WHERE room_id = %s AND ' . $ilDB->in(
'user_id', $user_id,
false,
'integer');
793 $types =
array(
'integer');
796 return $ilDB->manipulateF(
$query, $types, $values);
810 $query =
'SELECT COUNT(user_id) cnt FROM ' . self::$banTable .
' WHERE user_id = %s AND room_id = %s';
812 $types =
array(
'integer',
'integer');
815 $rset = $ilDB->queryF(
$query, $types, $values);
817 if($rset && (
$row = $ilDB->fetchAssoc($rset)) &&
$row[
'cnt'])
835 $query =
'SELECT chb.* FROM ' . self::$banTable .
' chb INNER JOIN usr_data ud ON chb.user_id = ud.usr_id WHERE chb.room_id = %s ';
836 $types =
array(
'integer');
838 $rset = $ilDB->queryF(
$query, $types, $values);
843 while(
$row = $ilDB->fetchAssoc($rset))
845 if(
$row[
'user_id'] > 0)
849 'user_id' => $user->getId(),
850 'firstname' => $user->getFirstname(),
851 'lastname' => $user->getLastname(),
852 'login' => $user->getLogin(),
853 'remark' =>
$row[
'remark']
880 $query =
'SELECT * FROM ' . self::$sessionTable .
' WHERE user_id = ' .
881 $ilDB->quote($user->
getUserId(),
'integer') .
882 ' ORDER BY connected DESC';
885 $rset = $ilDB->query(
$query);
887 if(
$row = $ilDB->fetchAssoc($rset))
905 $query =
'SELECT * FROM ' . self::$sessionTable
906 .
' WHERE room_id = ' .
907 $ilDB->quote($this->
getRoomId(),
'integer') .
908 ' ORDER BY connected DESC';
910 $rset = $ilDB->query(
$query);
914 while(
$row = $ilDB->fetchAssoc($rset))
926 $nextId = $ilDB->nextId(self::$privateRoomsTable);
928 self::$privateRoomsTable,
930 'proom_id' =>
array(
'integer', $nextId),
931 'parent_id' =>
array(
'integer', $this->roomId),
947 'UPDATE ' . self::$privateRoomsTable .
' SET closed = %s WHERE proom_id = %s',
948 array(
'integer',
'integer'),
957 $query =
'SELECT proom_id FROM ' . self::$privateRoomsTable .
' WHERE proom_id = %s AND owner = %s';
958 $types =
array(
'integer',
'integer');
959 $values =
array($proom_id, $user_id);
961 $rset = $ilDB->queryF(
$query, $types, $values);
963 if($rset && $ilDB->fetchAssoc($rset))
978 public function sendInvitationNotification($gui, $sender, $recipient_id, $subScope = 0, $invitationLink =
'')
985 if($gui && !$invitationLink)
987 $invitationLink = $this->
getChatURL($gui, $subScope);
990 if($recipient_id > 0 && !in_array(ANONYMOUS_USER_ID,
array($recipient_id)))
992 if(is_numeric($sender) && $sender > 0)
994 $sender_id = $sender;
999 $public_name = $usr->getPublicName();
1003 if($sender->getUserId() > 0)
1005 $sender_id = $sender->getUserId();
1009 $sender_id = ANONYMOUS_USER_ID;
1011 $public_name = $sender->getUsername();
1015 throw new InvalidArgumentException(
'$sender must be an instance of ilChatroomUser or an id of an ilObjUser instance');
1018 $lng->loadLanguageModule(
'mail');
1021 $bodyParams =
array(
1022 'link' => $invitationLink,
1023 'inviter_name' => $public_name,
1025 'salutation' => $lng->txt(
'mail_salutation_' . $recipient->getGender()) .
' ' . $recipient->getFullname()
1030 $bodyParams[
'room_name'] .=
' - ' . self::lookupPrivateRoomTitle($subScope);
1033 require_once
'Services/Notifications/classes/class.ilNotificationConfig.php';
1035 $notification->setTitleVar(
'chat_invitation', $bodyParams,
'chatroom');
1036 $notification->setShortDescriptionVar(
'chat_invitation_short', $bodyParams,
'chatroom');
1037 $notification->setLongDescriptionVar(
'chat_invitation_long', $bodyParams,
'chatroom');
1038 $notification->setAutoDisable(
false);
1039 $notification->setLink($invitationLink);
1040 $notification->setIconPath(
'templates/default/images/icon_chtr.svg');
1044 $notification->setHandlerParam(
'mail.sender', $sender_id);
1046 $notification->notifyByUsers(
array($recipient_id));
1057 include_once
'Services/Link/classes/class.ilLink.php';
1083 return $this->
object->getTitle();
1090 $query =
'SELECT title FROM ' . self::$privateRoomsTable .
' WHERE proom_id = %s';
1091 $types =
array(
'integer');
1092 $values =
array($proom_id);
1094 $rset = $ilDB->queryF(
$query, $types, $values);
1096 if(
$row = $ilDB->fetchAssoc($rset))
1098 return $row[
'title'];
1108 $this->inviteUserToPrivateRoom($user_id, $proom_id);
1115 public function inviteUserToPrivateRoom($user_id, $proom_id)
1122 $query =
'DELETE FROM ' . self::$privateRoomsAccessTable .
' WHERE user_id = %s AND proom_id = %s';
1123 $types =
array(
'integer',
'integer');
1124 $values =
array($user_id, $proom_id);
1126 $ilDB->manipulateF(
$query, $types, $values);
1128 $ilDB->insert(self::$privateRoomsAccessTable,
array(
1129 'user_id' =>
array(
'integer', $user_id),
1130 'proom_id' =>
array(
'integer', $proom_id)
1139 SELECT roomtable.title, roomtable.proom_id, accesstable.user_id id, roomtable.owner rowner 1140 FROM ' . self::$privateRoomsTable .
' roomtable 1141 LEFT JOIN ' . self::$privateRoomsAccessTable .
' accesstable 1142 ON roomtable.proom_id = accesstable.proom_id 1143 AND accesstable.user_id = %s 1144 WHERE parent_id = %s 1145 AND (closed = 0 OR closed IS NULL) 1146 AND (accesstable.user_id IS NOT NULL OR roomtable.owner = %s)';
1147 $types =
array(
'integer',
'integer',
'integer');
1148 $values =
array($userid, $this->roomId, $userid);
1149 $rset = $ilDB->queryF(
$query, $types, $values);
1152 while(
$row = $ilDB->fetchAssoc($rset))
1167 SELECT chatroom_users.user_id FROM ' . self::$privateSessionsTable .
' 1168 INNER JOIN chatroom_users ON chatroom_users.user_id = ' . self::$privateSessionsTable .
'.user_id WHERE proom_id = %s AND disconnected = 0 1170 $types =
array(
'integer');
1171 $values =
array($private_room_id);
1172 $rset = $ilDB->queryF(
$query, $types, $values);
1176 while(
$row = $ilDB->fetchAssoc($rset))
1178 $users[
$row[
'user_id']] = $row[
'user_id'];
1181 return array_values($users);
1190 $id = $ilDB->nextId(self::$privateSessionsTable);
1192 self::$privateSessionsTable,
1194 'psess_id' =>
array(
'integer', $id),
1195 'proom_id' =>
array(
'integer', $room_id),
1196 'user_id' =>
array(
'integer', $user_id),
1197 'connected' =>
array(
'integer',
time()),
1198 'disconnected' =>
array(
'integer', 0),
1208 $query =
'SELECT proom_id id FROM ' . self::$privateSessionsTable .
' WHERE user_id = %s AND proom_id = %s AND disconnected = 0';
1209 $types =
array(
'integer',
'integer');
1210 $values =
array($user_id, $room_id);
1211 $rset = $ilDB->queryF(
$query, $types, $values);
1212 if($ilDB->fetchAssoc($rset))
1227 self::$privateSessionsTable,
1229 'disconnected' =>
array(
'integer',
time())
1232 'proom_id' =>
array(
'integer', $room_id),
1233 'user_id' =>
array(
'integer', $user_id)
1242 $query =
'SELECT count(user_id) as cnt FROM ' . self::$userTable .
1243 ' WHERE room_id = %s';
1245 $types =
array(
'integer');
1246 $values =
array($this->roomId);
1247 $rset = $ilDB->queryF(
$query, $types, $values);
1249 if($rset && (
$row = $ilDB->fetchAssoc($rset)) &&
$row[
'cnt'] == 1)
1259 $query =
'SELECT title FROM ' . self::$privateRoomsTable .
' WHERE parent_id = %s and closed = 0';
1264 while(
$row = $ilDB->fetchAssoc($rset))
1266 $titles[] =
$row[
'title'];
1273 if(!in_array(
$title . $suffix, $titles))
1281 $suffix =
' (' . $i .
')';
1295 public function getAllRooms($user_id)
1303 SELECT room_id, od.title 1306 INNER JOIN " . self::$settingsTable .
" 1307 ON object_id = od.obj_id 1309 INNER JOIN " . self::$privateRoomsTable .
" prt 1312 WHERE od.type = 'chtr' 1315 $types =
array(
'integer');
1316 $values =
array($user_id);
1318 $res = $ilDB->queryF(
$query, $types, $values);
1322 while(
$row = $ilDB->fetchAssoc(
$res))
1324 $room_id =
$row[
'room_id'];
1325 $rooms[$room_id] =
$row[
'title'];
1336 SELECT proom_id, parent_id 1337 FROM chatroom_prooms 1338 WHERE parent_id = %s 1343 $types =
array(
'integer',
'integer');
1344 $values =
array($parent_room, $user_id);
1346 $res = $ilDB->queryF(
$query, $types, $values);
1348 $priv_rooms =
array();
1350 while(
$row = $ilDB->fetchAssoc(
$res))
1352 $proom_id =
$row[
'proom_id'];
1353 $priv_rooms[$proom_id] =
$row[
'parent_id'];
1371 FROM object_reference objr 1373 INNER JOIN chatroom_settings cs 1374 ON cs.object_id = objr.obj_id 1376 INNER JOIN object_data od 1377 ON od.obj_id = cs.object_id 1379 WHERE cs.room_id = %s 1382 $types =
array(
'integer');
1383 $values =
array($room_id);
1385 $res = $ilDB->queryF(
$query, $types, $values);
1389 return $row[
'ref_id'];
1404 $ilDB->setLimit($number);
1405 $rset = $ilDB->query(
1407 FROM ' . self::$historyTable .
' 1408 WHERE room_id = ' . $ilDB->quote($this->roomId,
'integer') .
' 1411 (' . $ilDB->like(
'message',
'text',
'%"type":"message"%') .
' AND NOT ' . $ilDB->like(
'message',
'text',
'%"public":0%') .
') 1412 OR ' . $ilDB->like(
'message',
'text',
'%"target":{%"id":"' . $chatuser->getUserId() .
'"%') .
' 1413 OR ' . $ilDB->like(
'message',
'text',
'%"from":{"id":' . $chatuser->getUserId() .
'%') .
' 1415 ORDER BY timestamp DESC' 1421 while((
$row = $ilDB->fetchAssoc($rset)) && $result_count < $number)
1423 $tmp = json_decode(
$row[
'message']);
1424 if($chatuser !== null && $tmp->target != null && $tmp->target->public == 0)
1426 if($chatuser->getUserId() == $tmp->target->id || $chatuser->getUserId() == $tmp->from->id)
1439 $rset = $ilDB->query(
1441 FROM ' . self::$historyTable .
' 1442 WHERE room_id = ' . $ilDB->quote($this->roomId,
'integer') .
' 1444 AND ' . $ilDB->like(
'message',
'text',
'%"type":"notice"%') .
' 1445 AND timestamp <= ' . $ilDB->quote(
$results[0]->timestamp,
'integer') .
' AND timestamp >= ' . $ilDB->quote(
$results[$result_count - 1]->timestamp,
'integer') .
' 1447 ORDER BY timestamp DESC' 1450 while((
$row = $ilDB->fetchAssoc($rset)))
1452 $tmp = json_decode(
$row[
'message']);
1458 $a_timestamp = strlen($a->timestamp) == 13 ? substr($a->timestamp, 0, -3) : $a->timestamp;
1459 $b_timestamp = strlen($b->timestamp) == 13 ? substr($b->timestamp, 0, -3) : $b->timestamp;
1461 return $b_timestamp - $a_timestamp;
1472 'DELETE FROM ' . self::$historyTable .
' WHERE room_id = %s AND sub_room = %s',
1473 array(
'integer',
'integer'),
1474 array($this->roomId, (
int)$sub_room)
1480 'DELETE FROM ' . self::$privateSessionsTable .
' WHERE proom_id = %s AND disconnected < %s',
1481 array(
'integer',
'integer'),
1488 'DELETE FROM ' . self::$sessionTable .
' WHERE room_id = %s AND disconnected < %s',
1489 array(
'integer',
'integer'),
setSetting($name, $value)
Sets given name and value as setting into $this->settings array.
static $privateRoomsTable
getUserId()
Returns Ilias User ID.
getActivePrivateRooms($userid)
getUniquePrivateRoomTitle($title)
getPrivateSubRooms($parent_room, $user_id)
banUser($user_id, $comment='')
Inserts user into banTable, using given $user_id ilDBInterface $ilDB.
getRoomId()
Returns roomID from $this->roomId.
getHistory(ilDateTime $from=null, ilDateTime $to=null, $restricted_session_userid=null, $proom_id=0)
Returns array containing history data selected from historyTable by given ilDateTime, $restricted_session_userid and matching roomId.
isUserBanned($user_id)
Returns true if there's an entry in banTable matching roomId and given $user_id ilDBInterface $ilDB...
static _getStaticLink($a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
getLastMessages($number, $chatuser=null)
getSettings()
Returns $this->settings array.
getLastSession(ilChatroomUser $user)
Returns last session from user.
getRefIdByRoomId($room_id)
Returns ref_id of given room_id ilDBInterface $ilDB.
getSetting($name)
Returns setting from $this->settings array by given name.
isSubscribed($chat_userid)
Returns true if entry exists in userTable matching given $chat_userid and $this->roomId.
static byRoomId($room_id, $initObject=false)
Returns ilChatroom by given $room_id ilDBInterface $ilDB.
getPrivateRoomSessions(ilDateTime $from=null, ilDateTime $to=null, $user_id=0, $room_id=0)
disconnectUsers(array $userIds)
Disconnects users by deleting userdata from userTable using given userId array.
static _lookupId($a_user_str)
Lookup id by login.
unsubscribeUserFromPrivateRoom($room_id, $user_id)
ilDBInterface $ilDB
userIsInPrivateRoom($room_id, $user_id)
getChatURL($gui, $scope_id=0)
ilCtrl $ilCtrl
Describes a notification and provides methods for publishing this notification.
listUsersInPrivateRoom($private_room_id)
save()
Saves settings using $this->settings.
isOwnerOfPrivateRoom($user_id, $proom_id)
static $privateSessionsTable
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
getBannedUsers()
Returns an multidimensional array containing userdata from users having an entry in banTable with mat...
addPrivateRoom($title, ilChatroomUser $owner, $settings)
getSessions(ilChatroomUser $user)
Returns all session from user Returns all from sessionTable where user_id matches userId from given $...
static findDeletablePrivateRooms()
addHistoryEntry($message, $recipient=null, $publicMessage=true)
Inserts entry into historyTable.
static lookupPrivateRoomTitle($proom_id)
getConnectedUsers()
Returns an array of connected users.
subscribeUserToPrivateRoom($room_id, $user_id)
saveFileUploadToDb($user_id, $filename, $type)
Saves information about file uploads in DB.
unbanUser($user_id)
Deletes entry from banTable matching roomId and given $user_id and returns true if sucessful...
disconnectUser($user_id)
Creates userId array by given $user object and calls disconnectUsers method.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static disconnectAllUsersFromAllRooms()
Deletes all entrys from userTable.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getLastMessagesForChatViewer($number, $chatuser=null)
static $privateRoomsAccessTable
inviteUserToPrivateRoomByLogin($login, $proom_id)
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
getUsername()
Returns username from Object or SESSION.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
initialize(array $rowdata)
Sets $this->roomId by given array $rowdata and calls setSetting method foreach available setting in $...
static checkPermissionsOfUser($usr_id, $permissions, $ref_id)
Checks user permissions in question for a given user id in relation to a given ref_id.
saveSettings(array $settings)
Saves settings into settingsTable using given settings array.
isAllowedToEnterPrivateRoom($chat_userid, $proom_id)