Public Member Functions | Data Fields

ilChatRoom Class Reference

Class ilChatUser. More...

Public Member Functions

 ilChatRoom ($a_id)
 Constructor public.
 getErrorMessage ()
 setRoomId ($a_id)
 getRoomId ()
 getObjId ()
 setOwnerId ($a_id)
 getOwnerId ()
 getName ()
 setTitle ($a_title)
 getTitle ()
 getGuests ()
 setUserId ($a_id)
 getUserId ()
 invite ($a_id)
 drop ($a_id)
 visited ($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)
 _getCountActiveUsers ($chat_id, $room_id=0)
 getActiveUsers ()
 _isActive ($usr_id)
 getOnlineUsers ()
 validate ()
 deleteRooms ($a_ids)
 delete ($a_id, $a_owner=0)
 rename ()
 lookupRoomId ()
 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

Detailed Description

Class ilChatUser.

Author:
Stefan Meyer
Version:
Id:
class.ilChatRoom.php 16696 2008-05-26 15:29:27Z mjansen

Definition at line 32 of file class.ilChatRoom.php.


Member Function Documentation

ilChatRoom::__addLine ( message  ) 

Definition at line 679 of file class.ilChatRoom.php.

References $res, getObjId(), and getRoomId().

Referenced by appendMessageToDb().

        {
                global $ilDB;
                
                $query = "INSERT INTO chat_room_messages ".
                        "VALUES('0',".$ilDB->quote($this->getObjId()).",".$ilDB->quote($this->getRoomId()).",".$ilDB->quote($message).",NOW())";
                
                $res = $this->ilias->db->query($query);

                $this->chat_record = new ilChatRecording($this->getObjId());
                $this->chat_record->setRoomId($this->getRoomId());
                if ($this->chat_record->isRecording())
                {
                        $query = "INSERT INTO chat_record_data VALUES (
                                                '0', 
                                                ".$ilDB->quote($this->chat_record->getRecordId()).", 
                                                ".$ilDB->quote($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 655 of file class.ilChatRoom.php.

References $res, getObjId(), and getRoomId().

Referenced by appendMessageToDb().

        {
                global $ilDB;
                
                $query = "SELECT entry_id, MIN(commit_timestamp) as last_comm FROM chat_room_messages ".
                        "WHERE chat_id = ".$ilDB->quote($this->getObjId()). " ".
                        "AND room_id = ".$ilDB->quote($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 = ".$ilDB->quote($entry_id)."";
                        
                        $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::__getCountLines (  ) 

Definition at line 639 of file class.ilChatRoom.php.

References $res, getObjId(), and getRoomId().

Referenced by appendMessageToDb().

        {
                global $ilDB;
                
                $query = "SELECT COUNT(entry_id) as number_lines FROM chat_room_messages ".
                        "WHERE chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND room_id = ".$ilDB->quote($this->getRoomId())."";

                $res = $this->ilias->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->number_lines;
                }
                return 0;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilChatRoom::__read (  ) 

Definition at line 705 of file class.ilChatRoom.php.

References $res, getObjId(), getRoomId(), setOwnerId(), and setTitle().

Referenced by setRoomId().

        {
                global $ilDB;
                
                $this->guests = array();

                $query = "SELECT * FROM chat_rooms ".
                        "WHERE room_id = ".$ilDB->quote($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 chat_id = ".$ilDB->quote($this->getObjId())." ";
                        "AND room_id = ".$ilDB->quote($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::_getCountActiveUsers ( chat_id,
room_id = 0 
)

Definition at line 318 of file class.ilChatRoom.php.

References $res, and $room_id.

Referenced by ilObjChatListGUI::getProperties(), and ilObjChatGUI::viewObject().

        {
                global $ilDB;

                $query = "SELECT * FROM chat_user ".
                        "WHERE chat_id = ".$ilDB->quote($chat_id)." ".
                        "AND room_id = ".$ilDB->quote($room_id)." ".
                        "AND last_conn_timestamp > ".time()." - 40";
                $res = $ilDB->query($query);

                return $res->numRows();
        }

Here is the caller graph for this function:

ilChatRoom::_isActive ( usr_id  ) 

Definition at line 349 of file class.ilChatRoom.php.

References $res.

Referenced by ilUsersOnlineBlockGUI::__showActiveChatsOfUser().

        {
                global $ilDB;

                $query = "SELECT * FROM chat_user ".
                        "WHERE room_id = 0 ".
                        "AND usr_id = ".$ilDB->quote((int) $usr_id)." ".
                        "AND last_conn_timestamp > ".time()." - 40";
                
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->chat_id;
                }
                return false;
        }

Here is the caller graph for this function:

ilChatRoom::_unkick ( a_usr_id  ) 

Definition at line 733 of file class.ilChatRoom.php.

Referenced by ilStartUpGUI::showLogin().

        {
                global $ilDB;

                $ilDB->query("UPDATE chat_user SET kicked = 0 WHERE usr_id = ".$ilDB->quote($a_usr_id)."");

                return true;
        }

Here is the caller graph for this function:

ilChatRoom::add (  ) 

Definition at line 482 of file class.ilChatRoom.php.

References $res, getObjId(), getOwnerId(), and getTitle().

        {
                global $ilDB;
                
                $query = "INSERT INTO chat_rooms ".
                        "SET title = ".$ilDB->quote($this->getTitle()).", ".
                        "chat_id = ".$ilDB->quote($this->getObjId()).", ".
                        "owner = ".$ilDB->quote($this->getOwnerId())."";

                $res = $this->ilias->db->query($query);


                return ($id = $this->ilias->db->getLastInsertId()) ? $id : false;
        }

Here is the call graph for this function:

ilChatRoom::appendMessageToDb ( message  ) 

Definition at line 206 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 165 of file class.ilChatRoom.php.

References $_GET, getObjId(), getRoomId(), getUserId(), isInvited(), isOwner(), setRoomId(), and visited().

        {
                global $rbacsystem;
                
                if ($this->getObjId() ||
                        $this->getRoomId())
                {
                        if(!$this->isInvited($this->getUserId()) && 
                           !$this->isOwner() &&
                           !$rbacsystem->checkAccess('moderate', $_GET['ref_id']))
                        {
                                $this->setRoomId(0);
                                return false;
                        }
                        
                        $this->visited($this->getUserId());
                }
                return true;
        }

Here is the call graph for this function:

ilChatRoom::checkWriteAccess (  ) 

Definition at line 610 of file class.ilChatRoom.php.

References $_GET, getOwnerId(), getRoomId(), getUserId(), isInvited(), and isKicked().

        {
                global $rbacsystem;
                
                if($rbacsystem->checkAccess('moderate', $_GET['ref_id']))
                {
                        return true;
                }
                
                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 399 of file class.ilChatRoom.php.

References $data, and $res.

        {
                // DELETE ROOM
                global $ilDB;
                
                $query = "DELETE FROM chat_rooms WHERE ".
                        "room_id = ".$ilDB->quote($a_id)."";
                if ($a_owner > 0)
                {
                        " AND owner = ".$ilDB->quote($a_owner)."";
                }
                $res = $this->ilias->db->query($query);

                // DELETE INVITATIONS
                $query = "DELETE FROM chat_invitations WHERE ".
                        "room_id = ".$ilDB->quote($a_id)."";
                $res = $this->ilias->db->query($query);

                // DELETE MESSAGES
                $query = "DELETE FROM chat_room_messages WHERE ".
                        "room_id = ".$ilDB->quote($a_id)."";
                $res = $this->ilias->db->query($query);

                // DELETE USER_DATA
                $query = "DELETE FROM chat_user WHERE ".
                        "room_id = ".$ilDB->quote($a_id)."";
                if ($a_owner > 0)
                {
                        " AND owner = ".$ilDB->quote($a_owner)."";
                }
                $res = $this->ilias->db->query($query);
                        
                // AND ALL RECORDINGS
                $query = "SELECT record_id FROM chat_records WHERE 
                                        room_id = ".$ilDB->quote($a_id)."";
                $res = $this->ilias->db->query($query);
                if (DB::isError($res)) die("ilObjChat::delete(): " . $res->getMessage() . "<br>SQL-Statement: ".$query);
                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 = ".$ilDB->quote($data["record_id"])."");
                        }
                        
                }
                $query = "DELETE FROM chat_records WHERE 
                                        room_id = ".$ilDB->quote($a_id)."";
                $res = $this->ilias->db->query($query);

                return true;
        }

ilChatRoom::deleteAllMessages (  ) 

Definition at line 232 of file class.ilChatRoom.php.

References $res, getObjId(), and getRoomId().

        {
                global $ilDB;
                
                $query = "DELETE FROM chat_room_messages ".
                        "WHERE chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND room_id = ".$ilDB->quote($this->getRoomId())."";

                $res = $this->ilias->db->query($query);

                return true;
        }

Here is the call graph for this function:

ilChatRoom::deleteRooms ( a_ids  ) 

Definition at line 386 of file class.ilChatRoom.php.

        {
                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  ) 

Definition at line 141 of file class.ilChatRoom.php.

References $res, getObjId(), and getRoomId().

        {
                global $ilDB;
                
                $query = "DELETE FROM chat_invitations ".
                        "WHERE chat_id = ".$ilDB->quote( $this->getObjId() )." ".
                        "AND room_id = ".$ilDB->quote( $this->getRoomId() )." ".
                        "AND guest_id = ".$ilDB->quote( $a_id )."";

                $res = $this->ilias->db->query($query);
        }

Here is the call graph for this function:

ilChatRoom::getActiveUsers (  ) 

Definition at line 332 of file class.ilChatRoom.php.

References $res, and getObjId().

        {
                global $ilDB;
                
                $query = "SELECT * FROM chat_user ".
                        "WHERE chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND room_id = ".$ilDB->quote($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();
        }

Here is the call graph for this function:

ilChatRoom::getAllMessages (  ) 

Definition at line 216 of file class.ilChatRoom.php.

References $data, $res, getObjId(), and getRoomId().

        {
                global $ilDB;
                
                $query = "SELECT message FROM chat_room_messages ".
                        "WHERE chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND room_id = ".$ilDB->quote($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) : "";
        }

Here is the call graph for this function:

ilChatRoom::getAllRooms (  ) 

Definition at line 570 of file class.ilChatRoom.php.

References ilUtil::_getObjectsByOperations(), and ilObjChat::_getPublicChatRefId().

        {
                global $ilObjDataCache,$ilUser,$rbacsystem;

                $obj_ids = array();
                $unique_chats = array();

                $pub_chat_id = ilObjChat::_getPublicChatRefId();                
                if($rbacsystem->checkAccess('read',$pub_chat_id))
                {
                        $obj_id = $ilObjDataCache->lookupObjId($pub_chat_id);
                        if(!in_array($obj_id,$obj_ids))
                        {
                                $unique_data['child'] = $pub_chat_id;
                                $unique_data['title'] = $ilObjDataCache->lookupTitle($obj_id);
                                $unique_data['obj_id'] = $obj_id;
                                $unique_data['ref_id'] = $pub_chat_id;
                                
                                $unique_chats[] = $unique_data;
                                $obj_ids[] = $obj_id;
                        }
                }

                foreach(ilUtil::_getObjectsByOperations("chat","read",$ilUser->getId(),-1) as $chat_id)
                {
                        $obj_id = $ilObjDataCache->lookupObjId($chat_id);
                        if(!in_array($obj_id,$obj_ids))
                        {
                                $unique_data['child'] = $chat_id;
                                $unique_data['title'] = $ilObjDataCache->lookupTitle($obj_id);
                                $unique_data['obj_id'] = $obj_id;
                                $unique_data['ref_id'] = $chat_id;
                                
                                $unique_chats[] = $unique_data;
                                $obj_ids[] = $obj_id;
                        }
                }
                return $unique_chats ? $unique_chats : array();
        }

Here is the call graph for this function:

ilChatRoom::getAllRoomsOfObject (  ) 

Definition at line 552 of file class.ilChatRoom.php.

References $data, $res, and getObjId().

        {
                global $ilDB;
                
                $query = "SELECT * FROM chat_rooms ".
                        "WHERE chat_id = ".$ilDB->quote($this->getObjId())."";

                $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();
        }               

Here is the call graph for this function:

ilChatRoom::getCountActiveUser ( chat_id,
room_id 
)

Definition at line 305 of file class.ilChatRoom.php.

References $res, and $room_id.

        {
                global $ilDB;
                
                $query = "SELECT * FROM chat_user ".
                        "WHERE chat_id = ".$ilDB->quote($chat_id)." ".
                        "AND room_id = ".$ilDB->quote($room_id)." ".
                        "AND last_conn_timestamp > ".time()." - 40";
                $res = $this->ilias->db->query($query);

                return $res->numRows();
        }

ilChatRoom::getErrorMessage (  ) 

Definition at line 68 of file class.ilChatRoom.php.

        {
                return $this->error_msg;
        }

ilChatRoom::getGuests (  ) 

Definition at line 116 of file class.ilChatRoom.php.

        {
                return $this->guests ? $this->guests : array();
        }

ilChatRoom::getInternalName (  ) 

Definition at line 497 of file class.ilChatRoom.php.

References getObjId(), and getRoomId().

        {
                if(!$this->getRoomId())
                {
                        return $this->getObjId();
                }
                else
                {
                        return $this->getObjId()."_".$this->getRoomId();
                }
        }

Here is the call graph for this function:

ilChatRoom::getName (  ) 

Definition at line 97 of file class.ilChatRoom.php.

References getObjId(), and getRoomId().

        {
                if(!$this->getRoomId())
                {
                        return $this->getObjId();
                }
                else
                {
                        // GET NAME OF PRIVATE CHATROOM
                }
        }

Here is the call graph for this function:

ilChatRoom::getObjId (  ) 
ilChatRoom::getOnlineUsers (  ) 

Definition at line 366 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 92 of file class.ilChatRoom.php.

Referenced by add(), checkWriteAccess(), isInvited(), isOwner(), lookupRoomId(), and validate().

        {
                return $this->owner_id;
        }

Here is the caller graph for this function:

ilChatRoom::getRoomId (  ) 

Definition at line 80 of file class.ilChatRoom.php.

Referenced by __addLine(), __deleteFirstLine(), __getCountLines(), __read(), checkAccess(), checkWriteAccess(), deleteAllMessages(), drop(), getAllMessages(), getInternalName(), getName(), invite(), isInvited(), rename(), updateLastVisit(), and visited().

        {
                return $this->room_id;
        }

Here is the caller graph for this function:

ilChatRoom::getRooms (  ) 

Definition at line 509 of file class.ilChatRoom.php.

References $_GET, $data, $res, and getUserId().

        {
                global $ilUser, $tree, $ilDB, $rbacsystem;      

                $query = "SELECT DISTINCT(cr.room_id) as room_id,owner,title,cr.chat_id as chat_id FROM chat_rooms AS cr NATURAL LEFT JOIN chat_invitations ".
                        "WHERE (owner = ".$ilDB->quote($this->getUserId()).") ".
                        "OR (guest_id = ".$ilDB->quote($this->getUserId()).") ";
                        
                if($rbacsystem->checkAccess('moderate', $_GET['ref_id']))
                {
                        $query .= " OR (1) ";
                }

                $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]["chat_id"] = $row->chat_id;
                        $data[$row->room_id]["owner"] = $row->owner;
                        $data[$row->room_id]["title"] = $row->title;
                }
                return $data ? $data : array();
        }

Here is the call graph for this function:

ilChatRoom::getRoomsOfObject (  ) 

Definition at line 533 of file class.ilChatRoom.php.

References $data, $res, getObjId(), and getUserId().

        {
                global $ilDB;
                
                $query = "SELECT * FROM chat_rooms ".
                        "WHERE chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND owner = ".$ilDB->quote($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();
        }

Here is the call graph for this function:

ilChatRoom::getTitle (  ) 

Definition at line 112 of file class.ilChatRoom.php.

Referenced by add(), lookupRoomId(), rename(), and validate().

        {
                return $this->title;
        }

Here is the caller graph for this function:

ilChatRoom::getUserId (  ) 

Definition at line 124 of file class.ilChatRoom.php.

Referenced by checkAccess(), checkWriteAccess(), getRooms(), getRoomsOfObject(), isOwner(), and updateLastVisit().

        {
                return $this->user_id;
        }

Here is the caller graph for this function:

ilChatRoom::ilChatRoom ( a_id  ) 

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

Definition at line 53 of file class.ilChatRoom.php.

References $_SESSION, $ilias, and $lng.

        {
                global $ilias,$lng,$ilUser;

                define(MAX_LINES,1000);

                $this->ilias =& $ilias;
                $this->lng =& $lng;

                $this->obj_id = $a_id;
                $this->owner_id = $ilUser->getId();
                $this->user_id = $_SESSION["AccountId"];
        }

ilChatRoom::invite ( a_id  ) 

Definition at line 129 of file class.ilChatRoom.php.

References $res, getObjId(), and getRoomId().

        {
                global $ilDB;
                
                $query = "REPLACE INTO chat_invitations ".
                        "SET chat_id = ".$ilDB->quote( $this->getObjId() ).", ".
                        "room_id = ".$ilDB->quote( $this->getRoomId() ).", ".
                        "guest_id = ".$ilDB->quote( $a_id ).", ".
                        "invitation_time = ".time();

                $res = $this->ilias->db->query($query);
        }

Here is the call graph for this function:

ilChatRoom::isInvited ( a_id  ) 

Definition at line 185 of file class.ilChatRoom.php.

References $res, getObjId(), getOwnerId(), and getRoomId().

Referenced by checkAccess(), and checkWriteAccess().

        {
                global $ilDB;
                
                $query = "SELECT * FROM chat_invitations AS ci JOIN chat_rooms AS ca ".
                        "WHERE ci.room_id = ca.room_id ".
                        "AND ci.chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND ci.room_id = ".$ilDB->quote($this->getRoomId())." ".
                        "AND owner = ".$ilDB->quote($this->getOwnerId())." ".
                        "AND ci.guest_id = ".$ilDB->quote($a_id)."";

                $res = $this->ilias->db->query($query);
                
                return $res->numRows() ? true : false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilChatRoom::isKicked ( a_usr_id  ) 

Definition at line 291 of file class.ilChatRoom.php.

References $res, and getObjId().

Referenced by checkWriteAccess().

        {
                global $ilDB;
                
                $query = "SELECT * FROM chat_user ".
                        "WHERE kicked = 1 ".
                        "AND usr_id = ".$ilDB->quote($a_usr_id)." ".
                        "AND chat_id = ".$ilDB->quote($this->getObjId())."";

                $res = $this->ilias->db->query($query);

                return $res->numRows() ? true : false;
        }               

Here is the call graph for this function:

Here is the caller graph for this function:

ilChatRoom::isOwner (  ) 

Definition at line 200 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::lookupRoomId (  ) 

Definition at line 465 of file class.ilChatRoom.php.

References $res, getObjId(), getOwnerId(), and getTitle().

        {
                global $ilDB;
                
                $query = "SELECT * FROM chat_rooms ".
                        "WHERE title = ".$ilDB->quote($this->getTitle())." ".
                        "AND chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND owner = ".$ilDB->quote($this->getOwnerId())."";

                $res = $this->ilias->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->room_id;
                }
                return false;
        }

Here is the call graph for this function:

ilChatRoom::rename (  ) 

Definition at line 452 of file class.ilChatRoom.php.

References $res, getRoomId(), and getTitle().

        {
                global $ilDB;
                
                $query = "UPDATE chat_rooms ".
                        "SET title = ".$ilDB->quote($this->getTitle())." ".
                        "WHERE room_id = ".$ilDB->quote($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 263 of file class.ilChatRoom.php.

References getObjId().

        {
                global $ilDB;
                
                $query = "UPDATE chat_user SET kicked = '1' ".
                        "WHERE usr_id = ".$ilDB->quote($a_usr_id)." ".
                        "AND chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND room_id = '0'";

                $this->ilias->db->query($query);

                return true;
        }

Here is the call graph for this function:

ilChatRoom::setOwnerId ( a_id  ) 

Definition at line 88 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 73 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 108 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 277 of file class.ilChatRoom.php.

References getObjId().

        {
                global $ilDB;
                
                $query = "UPDATE chat_user SET kicked = '0' ".
                        "WHERE usr_id = ".$ilDB->quote($a_usr_id)." ".
                        "AND chat_id = ".$ilDB->quote($this->getObjId())." ".
                        "AND room_id = '0'";

                $this->ilias->db->query($query);

                return true;
        }

Here is the call graph for this function:

ilChatRoom::setUserId ( a_id  ) 

Definition at line 120 of file class.ilChatRoom.php.

        {
                $this->user_id = $a_id;
        }

ilChatRoom::updateLastVisit (  ) 

Definition at line 245 of file class.ilChatRoom.php.

References $res, getObjId(), getRoomId(), and getUserId().

        {
                // CHECK IF OLD DATA EXISTS
                global $ilDB;
                
                $query = "DELETE FROM chat_user ".
                        "WHERE usr_id = ".$ilDB->quote($this->getUserId())."";
                $res = $this->ilias->db->query($query);

                $query = "INSERT INTO chat_user ".
                        "SET usr_id = ".$ilDB->quote($this->getUserId()).", ".
                        "room_id = ".$ilDB->quote($this->getRoomId()).", ".
                        "chat_id = ".$ilDB->quote($this->getObjId()).", ".
                        "last_conn_timestamp = '".time()."'";
                $res = $this->ilias->db->query($query);
                return true;
        }

Here is the call graph for this function:

ilChatRoom::validate (  ) 

Definition at line 372 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::visited ( a_id  ) 

Definition at line 153 of file class.ilChatRoom.php.

References $res, getObjId(), and getRoomId().

Referenced by checkAccess().

        {
                global $ilDB;
        
                $query = "UPDATE chat_invitations SET guest_informed = 1 ".
                        "WHERE chat_id = ".$ilDB->quote( $this->getObjId() )." ".
                        "AND room_id = ".$ilDB->quote( $this->getRoomId() )." ".
                        "AND guest_id = ".$ilDB->quote( $a_id )."";

                $res = $this->ilias->db->query($query);
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilChatRoom::$error_msg

Definition at line 37 of file class.ilChatRoom.php.

ilChatRoom::$guests

Definition at line 42 of file class.ilChatRoom.php.

ilChatRoom::$ilias

Definition at line 34 of file class.ilChatRoom.php.

Referenced by ilChatRoom().

ilChatRoom::$lng

Definition at line 35 of file class.ilChatRoom.php.

Referenced by ilChatRoom().

ilChatRoom::$owner_id

Definition at line 40 of file class.ilChatRoom.php.

ilChatRoom::$ref_id

Definition at line 39 of file class.ilChatRoom.php.

ilChatRoom::$room_id

Definition at line 41 of file class.ilChatRoom.php.

Referenced by _getCountActiveUsers(), and getCountActiveUser().

ilChatRoom::$title

Definition at line 43 of file class.ilChatRoom.php.

ilChatRoom::$user_id

Definition at line 45 of file class.ilChatRoom.php.


The documentation for this class was generated from the following file: