Public Member Functions | |
| ilChatRoom ($a_id) | |
| Constructor public. | |
| getErrorMessage () | |
| setRoomId ($a_id) | |
| getRoomId () | |
| getRefId () | |
| setOwnerId ($a_id) | |
| getOwnerId () | |
| getName () | |
| setTitle ($a_title) | |
| getTitle () | |
| getGuests () | |
| setUserId ($a_id) | |
| getUserId () | |
| invite ($a_id) | |
| drop ($a_id) | |
| checkAccess () | |
| isInvited ($a_id) | |
| isOwner () | |
| appendMessageToDb ($message) | |
| getAllMessages () | |
| deleteAllMessages () | |
| updateLastVisit () | |
| setKicked ($a_usr_id) | |
| setUnkicked ($a_usr_id) | |
| isKicked ($a_usr_id) | |
| getCountActiveUser ($chat_id, $room_id) | |
| getActiveUsers () | |
| getOnlineUsers () | |
| validate () | |
| deleteRooms ($a_ids) | |
| delete ($a_id, $a_owner=0) | |
| rename () | |
| add () | |
| getInternalName () | |
| getRooms () | |
| getRoomsOfObject () | |
| getAllRoomsOfObject () | |
| getAllRooms () | |
| checkWriteAccess () | |
| __getCountLines () | |
| __deleteFirstLine () | |
| __addLine ($message) | |
| __read () | |
| _unkick ($a_usr_id) | |
Data Fields | |
| $ilias | |
| $lng | |
| $error_msg | |
| $ref_id | |
| $owner_id | |
| $room_id | |
| $guests | |
| $title | |
| $user_id | |
Definition at line 33 of file class.ilChatRoom.php.
| ilChatRoom::__addLine | ( | $ | message | ) |
Definition at line 530 of file class.ilChatRoom.php.
References $query, $res, getRefId(), and getRoomId().
Referenced by appendMessageToDb().
{
$query = "INSERT INTO chat_room_messages ".
"VALUES('0','".$this->getRefId()."','".$this->getRoomId()."','".addslashes($message)."',now())";
$res = $this->ilias->db->query($query);
$this->chat_record = new ilChatRecording($this->getRefId());
$this->chat_record->setRoomId($this->getRoomId());
if ($this->chat_record->isRecording())
{
$query = "INSERT INTO chat_record_data VALUES (
'0',
'" . $this->chat_record->getRecordId() . "',
'" . addslashes($message) . "',
'" . time() . "')";
$res = $this->ilias->db->query($query);
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilChatRoom::__deleteFirstLine | ( | ) |
Definition at line 509 of file class.ilChatRoom.php.
References $query, $res, and $row.
Referenced by appendMessageToDb().
{
$query = "SELECT entry_id, MIN(commit_timestamp) as last_comm FROM chat_room_messages ".
"WHERE chat_id = '".$this->getRefId()."' ".
"AND room_id = '".$this->getRoomId()."' ".
"GROUP BY null";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$entry_id = $row->entry_id;
}
if($entry_id)
{
$query = "DELETE FROM chat_room_messages ".
"WHERE entry_id = '".$entry_id."'";
$res = $this->ilias->db->query($query);
}
return true;
}
Here is the caller graph for this function:| ilChatRoom::__getCountLines | ( | ) |
Definition at line 496 of file class.ilChatRoom.php.
References $query, $res, and $row.
Referenced by appendMessageToDb().
{
$query = "SELECT COUNT(entry_id) as number_lines FROM chat_room_messages ".
"WHERE chat_id = '".$this->getRefId()."' ".
"AND room_id = '".$this->getRoomId()."'";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->number_lines;
}
return 0;
}
Here is the caller graph for this function:| ilChatRoom::__read | ( | ) |
Definition at line 554 of file class.ilChatRoom.php.
References $query, $res, $row, setOwnerId(), and setTitle().
Referenced by setRoomId().
{
$this->guests = array();
$query = "SELECT * FROM chat_rooms ".
"WHERE room_id = '".$this->getRoomId()."'";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setTitle($row->title);
$this->setOwnerId($row->owner);
}
$query = "SELECT * FROM chat_invitations ".
"WHERE room_id = '".$this->getRoomId()."'";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->guests[] = $row->guest_id;
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilChatRoom::_unkick | ( | $ | a_usr_id | ) |
Definition at line 579 of file class.ilChatRoom.php.
{
global $ilDB;
$ilDB->query("UPDATE chat_user SET kicked = 0 WHERE usr_id = '".$a_usr_id."'");
return true;
}
| ilChatRoom::add | ( | ) |
Definition at line 386 of file class.ilChatRoom.php.
References $query, $res, and getTitle().
{
$query = "INSERT INTO chat_rooms ".
"SET title = '".ilUtil::prepareDBString($this->getTitle())."', ".
"chat_id = '".$this->getRefId()."', ".
"owner = '".$this->getOwnerId()."'";
$res = $this->ilias->db->query($query);
return true;
}
Here is the call graph for this function:| ilChatRoom::appendMessageToDb | ( | $ | message | ) |
Definition at line 178 of file class.ilChatRoom.php.
References __addLine(), __deleteFirstLine(), and __getCountLines().
{
if($this->__getCountLines() >= MAX_LINES)
{
$this->__deleteFirstLine();
}
$this->__addLine($message);
return true;
}
Here is the call graph for this function:| ilChatRoom::checkAccess | ( | ) |
Definition at line 147 of file class.ilChatRoom.php.
References getRoomId(), getUserId(), isInvited(), isOwner(), and setRoomId().
{
if($this->getRoomId())
{
if(!$this->isInvited($this->getUserId()) and !$this->isOwner())
{
$this->setRoomId(0);
return false;
}
}
return true;
}
Here is the call graph for this function:| ilChatRoom::checkWriteAccess | ( | ) |
Definition at line 474 of file class.ilChatRoom.php.
References getOwnerId(), getRoomId(), getUserId(), isInvited(), and isKicked().
{
if($this->isKicked($this->getUserId()))
{
return false;
}
if(!$this->getRoomId())
{
return true;
}
if($this->getUserId() == $this->getOwnerId())
{
return true;
}
if($this->isInvited($this->getUserId()))
{
return true;
}
return false;
}
Here is the call graph for this function:| ilChatRoom::delete | ( | $ | a_id, | |
| $ | a_owner = 0 | |||
| ) |
Definition at line 324 of file class.ilChatRoom.php.
References $data, $num, $query, and $res.
{
// DELETE ROOM
$query = "DELETE FROM chat_rooms WHERE ".
"room_id = '".$a_id."'";
if ($a_owner > 0)
{
" AND owner = '".$a_owner."'";
}
$res = $this->ilias->db->query($query);
// DELETE INVITATIONS
$query = "DELETE FROM chat_invitations WHERE ".
"room_id = '".$a_id."'";
$res = $this->ilias->db->query($query);
// DELETE MESSAGES
$query = "DELETE FROM chat_room_messages WHERE ".
"room_id = '".$a_id."'";
$res = $this->ilias->db->query($query);
// DELETE USER_DATA
$query = "DELETE FROM chat_user WHERE ".
"room_id = '".$a_id."'";
if ($a_owner > 0)
{
" AND owner = '".$a_owner."'";
}
$res = $this->ilias->db->query($query);
// AND ALL RECORDINGS
$query = "SELECT record_id FROM chat_records WHERE
room_id = '".$a_id."'";
$res = $this->ilias->db->query($query);
if (DB::isError($res)) die("ilObjChat::delete(): " . $res->getMessage() . "<br>SQL-Statement: ".$q);
if (($num = $res->numRows()) > 0)
{
for ($i = 0; $i < $num; $i++)
{
$data = $res->fetchRow(DB_FETCHMODE_ASSOC);
$this->ilias->db->query("DELETE FROM chat_record_data WHERE record_id = '" . $data["record_id"] . "'");
}
}
$query = "DELETE FROM chat_records WHERE
room_id = '".$a_id."'";
$res = $this->ilias->db->query($query);
return true;
}
| ilChatRoom::deleteAllMessages | ( | ) |
| ilChatRoom::deleteRooms | ( | $ | a_ids | ) |
Definition at line 311 of file class.ilChatRoom.php.
References $id.
{
if(!is_array($a_ids))
{
$this->ilias->raiseError("ARRAY REQUIRED",$this->ilias->error_obj->FATAL);
}
foreach($a_ids as $id)
{
$this->delete($id);
}
return true;
}
| ilChatRoom::drop | ( | $ | a_id | ) |
| ilChatRoom::getActiveUsers | ( | ) |
Definition at line 277 of file class.ilChatRoom.php.
References $query, $res, and $row.
{
$query = "SELECT * FROM chat_user ".
"WHERE chat_id = '".$this->ref_id."' ".
"AND room_id = '".$this->room_id."' ".
"AND last_conn_timestamp > ".time()." - 40";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$usr_ids[] = $row->usr_id;
}
return $usr_ids ? $usr_ids : array();
}
| ilChatRoom::getAllMessages | ( | ) |
Definition at line 188 of file class.ilChatRoom.php.
References $data, $query, $res, and $row.
{
$query = "SELECT message FROM chat_room_messages ".
"WHERE chat_id = '".$this->getRefId()."' ".
"AND room_id = '".$this->getRoomId()."' ".
"ORDER BY commit_timestamp ";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$data[] = $row->message;
}
return is_array($data) ? implode("<br />",$data) : "";
}
| ilChatRoom::getAllRooms | ( | ) |
Definition at line 469 of file class.ilChatRoom.php.
References ilUtil::getObjectsByOperations().
{
return ilUtil::getObjectsByOperations("chat","read");
}
Here is the call graph for this function:| ilChatRoom::getAllRoomsOfObject | ( | ) |
Definition at line 451 of file class.ilChatRoom.php.
References $data, $query, $res, and $row.
{
$query = "SELECT * FROM chat_rooms ".
"WHERE chat_id = '".$this->getRefId()."'";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$data[$row->room_id]["room_id"] = $row->room_id;
$data[$row->room_id]["owner"] = $row->owner;
$data[$row->room_id]["title"] = $row->title;
$data[$row->room_id]["owner"] = $row->owner;
}
return $data ? $data : array();
}
| ilChatRoom::getCountActiveUser | ( | $ | chat_id, | |
| $ | room_id | |||
| ) |
| ilChatRoom::getErrorMessage | ( | ) |
Definition at line 69 of file class.ilChatRoom.php.
{
return $this->error_msg;
}
| ilChatRoom::getGuests | ( | ) |
Definition at line 117 of file class.ilChatRoom.php.
{
return $this->guests ? $this->guests : array();
}
| ilChatRoom::getInternalName | ( | ) |
Definition at line 398 of file class.ilChatRoom.php.
References getRefId(), and getRoomId().
{
if(!$this->getRoomId())
{
return $this->getRefId();
}
else
{
return $this->getRefId()."_".$this->getRoomId();
}
}
Here is the call graph for this function:| ilChatRoom::getName | ( | ) |
Definition at line 98 of file class.ilChatRoom.php.
References getRefId(), and getRoomId().
Here is the call graph for this function:| ilChatRoom::getOnlineUsers | ( | ) |
Definition at line 291 of file class.ilChatRoom.php.
References ilUtil::getUsersOnline().
{
// TODO: CHECK INVITABLE AND ALLOW MESSAGES
return ilUtil::getUsersOnline();
}
Here is the call graph for this function:| ilChatRoom::getOwnerId | ( | ) |
Definition at line 93 of file class.ilChatRoom.php.
Referenced by checkWriteAccess(), isOwner(), and validate().
{
return $this->owner_id;
}
Here is the caller graph for this function:| ilChatRoom::getRefId | ( | ) |
Definition at line 85 of file class.ilChatRoom.php.
Referenced by __addLine(), getInternalName(), and getName().
{
return $this->ref_id;
}
Here is the caller graph for this function:| ilChatRoom::getRoomId | ( | ) |
Definition at line 81 of file class.ilChatRoom.php.
Referenced by __addLine(), checkAccess(), checkWriteAccess(), getInternalName(), and getName().
{
return $this->room_id;
}
Here is the caller graph for this function:| ilChatRoom::getRooms | ( | ) |
Definition at line 409 of file class.ilChatRoom.php.
References $data, $query, $res, $row, and $tree.
{
global $tree;
$query = "SELECT DISTINCT(cr.room_id) as room_id,owner,title,chat_id FROM chat_rooms AS cr NATURAL LEFT JOIN chat_invitations ".
"WHERE (owner = '".$this->getUserId()."') ".
"OR (guest_id = '".$this->getUserId()."')";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if(!$tree->isInTree($row->chat_id))
{
continue;
}
$data[$row->room_id]["room_id"] = $row->room_id;
$data[$row->room_id]["chat_id"] = $row->chat_id;
$data[$row->room_id]["owner"] = $row->owner;
$data[$row->room_id]["title"] = $row->title;
}
return $data ? $data : array();
}
| ilChatRoom::getRoomsOfObject | ( | ) |
Definition at line 435 of file class.ilChatRoom.php.
References $data, $query, $res, and $row.
{
$query = "SELECT * FROM chat_rooms ".
"WHERE chat_id = '".$this->getRefId()."' ".
"AND owner = '".$this->getUserId()."'";
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$data[$row->room_id]["room_id"] = $row->room_id;
$data[$row->room_id]["owner"] = $row->owner;
$data[$row->room_id]["title"] = $row->title;
$data[$row->room_id]["owner"] = $row->owner;
}
return $data ? $data : array();
}
| ilChatRoom::getTitle | ( | ) |
Definition at line 113 of file class.ilChatRoom.php.
Referenced by add(), rename(), and validate().
{
return $this->title;
}
Here is the caller graph for this function:| ilChatRoom::getUserId | ( | ) |
Definition at line 125 of file class.ilChatRoom.php.
Referenced by checkAccess(), checkWriteAccess(), and isOwner().
{
return $this->user_id;
}
Here is the caller graph for this function:| ilChatRoom::ilChatRoom | ( | $ | a_id | ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 54 of file class.ilChatRoom.php.
| ilChatRoom::invite | ( | $ | a_id | ) |
| ilChatRoom::isInvited | ( | $ | a_id | ) |
Definition at line 160 of file class.ilChatRoom.php.
Referenced by checkAccess(), and checkWriteAccess().
{
$query = "SELECT * FROM chat_invitations AS ci JOIN chat_rooms AS ca ".
"WHERE ci.room_id = ca.room_id ".
"AND ci.room_id = '".$this->getRoomId()."' ".
"AND owner = '".$this->getOwnerId()."' ".
"AND ci.guest_id = '".$a_id."'";
$res = $this->ilias->db->query($query);
return $res->numRows() ? true : false;
}
Here is the caller graph for this function:| ilChatRoom::isKicked | ( | $ | a_usr_id | ) |
Definition at line 253 of file class.ilChatRoom.php.
Referenced by checkWriteAccess().
{
$query = "SELECT * FROM chat_user ".
"WHERE kicked = 1 ".
"AND usr_id = '".$a_usr_id."' ".
"AND chat_id = '".$this->getRefId()."'";
$res = $this->ilias->db->query($query);
return $res->numRows() ? true : false;
}
Here is the caller graph for this function:| ilChatRoom::isOwner | ( | ) |
Definition at line 172 of file class.ilChatRoom.php.
References getOwnerId(), and getUserId().
Referenced by checkAccess().
{
return $this->getOwnerId() == $this->getUserId();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilChatRoom::rename | ( | ) |
Definition at line 375 of file class.ilChatRoom.php.
References $query, $res, and getTitle().
{
$query = "UPDATE chat_rooms ".
"SET title = '".ilUtil::prepareDBString($this->getTitle())."' ".
"WHERE room_id = '".$this->getRoomId()."'";
$res = $this->ilias->db->query($query);
return true;
}
Here is the call graph for this function:| ilChatRoom::setKicked | ( | $ | a_usr_id | ) |
Definition at line 229 of file class.ilChatRoom.php.
References $query.
| ilChatRoom::setOwnerId | ( | $ | a_id | ) |
Definition at line 89 of file class.ilChatRoom.php.
Referenced by __read().
{
$this->owner_id = $a_id;
}
Here is the caller graph for this function:| ilChatRoom::setRoomId | ( | $ | a_id | ) |
Definition at line 74 of file class.ilChatRoom.php.
References __read().
Referenced by checkAccess().
{
$this->room_id = $a_id;
// READ DATA OF ROOM
$this->__read();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilChatRoom::setTitle | ( | $ | a_title | ) |
Definition at line 109 of file class.ilChatRoom.php.
Referenced by __read().
{
$this->title = $a_title;
}
Here is the caller graph for this function:| ilChatRoom::setUnkicked | ( | $ | a_usr_id | ) |
Definition at line 241 of file class.ilChatRoom.php.
References $query.
| ilChatRoom::setUserId | ( | $ | a_id | ) |
Definition at line 121 of file class.ilChatRoom.php.
{
$this->user_id = $a_id;
}
| ilChatRoom::updateLastVisit | ( | ) |
Definition at line 213 of file class.ilChatRoom.php.
{
// CHECK IF OLD DATA EXISTS
$query = "DELETE FROM chat_user ".
"WHERE usr_id = '".$this->getUserId()."'";
$res = $this->ilias->db->query($query);
$query = "INSERT INTO chat_user ".
"SET usr_id = '".$this->getUserId()."', ".
"room_id = '".$this->getRoomId()."', ".
"chat_id = '".$this->getRefId()."', ".
"last_conn_timestamp = '".time()."'";
$res = $this->ilias->db->query($query);
return true;
}
| ilChatRoom::validate | ( | ) |
Definition at line 297 of file class.ilChatRoom.php.
References getOwnerId(), and getTitle().
{
$this->error_msg = "";
if(!$this->getTitle())
{
$this->error_msg .= $this->lng->txt("chat_title_missing");
}
if(!$this->getOwnerId())
{
$this->ilias->raiseError("MISSING OWNER ID",$this->ilias->error_obj->FATAL);
}
return $this->error_msg ? false : true;
}
Here is the call graph for this function:| ilChatRoom::$error_msg |
Definition at line 38 of file class.ilChatRoom.php.
| ilChatRoom::$guests |
Definition at line 43 of file class.ilChatRoom.php.
| ilChatRoom::$ilias |
Definition at line 35 of file class.ilChatRoom.php.
Referenced by ilChatRoom().
| ilChatRoom::$lng |
Definition at line 36 of file class.ilChatRoom.php.
Referenced by ilChatRoom().
| ilChatRoom::$owner_id |
Definition at line 41 of file class.ilChatRoom.php.
| ilChatRoom::$ref_id |
Definition at line 40 of file class.ilChatRoom.php.
| ilChatRoom::$room_id |
Definition at line 42 of file class.ilChatRoom.php.
| ilChatRoom::$title |
Definition at line 44 of file class.ilChatRoom.php.
| ilChatRoom::$user_id |
Definition at line 46 of file class.ilChatRoom.php.
1.7.1