ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChatBlockedUsers Class Reference

Class ilChatUser. More...

+ Collaboration diagram for ilChatBlockedUsers:

Public Member Functions

 __construct ($a_id)
 Constructor public.
 getBlockedUsers ()
 gets blocked users
 isBlocked ($a_usr_id)
 checks if user is blocked
 block ($a_usr_id)
 blocks given user
 unblock ($a_usr_id)
 unblocks given user

Static Public Member Functions

static _isBlocked ($a_chat_id, $a_usr_id)
 checks if a given user is blocked for a given chat
static _deleteUser ($a_usr_id)
 deletes all blocking information for a given user
static _deleteChat ($a_chat_id)
 deletes all blocking information for a given chat

Data Fields

 $id
 $db
 $blocked = array()

Private Member Functions

 read ()
 initialize blocking information array

Detailed Description

Class ilChatUser.

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilChatBlockedUsers.php 20654 2009-07-20 13:14:52Z jposselt

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

Constructor & Destructor Documentation

ilChatBlockedUsers::__construct (   $a_id)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

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

References $ilDB, and read().

{
global $ilDB;
$this->db =& $ilDB;
$this->id = $a_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilChatBlockedUsers::_deleteChat (   $a_chat_id)
static

deletes all blocking information for a given chat

Parameters
integerchatid
Returns
boolean

Definition at line 170 of file class.ilChatBlockedUsers.php.

References $ilDB.

{
global $ilDB;
$statement = $ilDB->manipulateF('
DELETE FROM chat_blocked WHERE chat_id = %s',
array('integer'),
array((int) $a_chat_id));
return true;
}
static ilChatBlockedUsers::_deleteUser (   $a_usr_id)
static

deletes all blocking information for a given user

Parameters
integeruser id
Returns
boolean

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

References $ilDB.

{
global $ilDB;
$statement = $ilDB->manipulateF('
DELETE FROM chat_blocked WHERE usr_id = %s',
array('integer'),
array((int) $a_usr_id));
return true;
}
static ilChatBlockedUsers::_isBlocked (   $a_chat_id,
  $a_usr_id 
)
static

checks if a given user is blocked for a given chat

Parameters
integerchatid
integeruserid
Returns
boolean

Definition at line 132 of file class.ilChatBlockedUsers.php.

References $ilDB, and $res.

Referenced by ilObjChatGUI\fetchOnlineUsers(), ilObjChatGUI\fetchRooms(), ilChatBlock\getReadableAreas(), ilObjChatGUI\getUpdateAsyncObject(), ilMailAddressbookGUI\inviteToChat(), ilObjChatGUI\showUserFrameObject(), ilMailAddressbookGUI\submitInvitation(), and ilObjChatGUI\viewObject().

{
global $ilDB;
$res = $ilDB->queryf('
SELECT * FROM chat_blocked
WHERE chat_id = %s
AND usr_id = %s',
array('integer', 'integer'),
array($a_chat_id, $a_usr_id));
// was array($this->id, $a_usr_id));
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

ilChatBlockedUsers::block (   $a_usr_id)

blocks given user

Parameters
integeruserid
Returns
boolean true if user could be blocked, false if user was already blocked or invalid userid is not given

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

References $ilDB, and read().

{
global $ilDB;
if(in_array((int) $a_usr_id,$this->blocked) or !((int) $a_usr_id))
{
return false;
}
$statement = $this->db->manipulateF(
'INSERT INTO chat_blocked (chat_id, usr_id) VALUES (%s, %s)',
array('integer', 'integer'),
array($this->id, $a_usr_id));
$this->read();
return true;
}

+ Here is the call graph for this function:

ilChatBlockedUsers::getBlockedUsers ( )

gets blocked users

Returns
array array of blocked users or empty array

Definition at line 59 of file class.ilChatBlockedUsers.php.

Referenced by ilObjChatGUI\blockedUsersObject().

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

+ Here is the caller graph for this function:

ilChatBlockedUsers::isBlocked (   $a_usr_id)

checks if user is blocked

Parameters
integeruserid
Returns
boolean

Definition at line 69 of file class.ilChatBlockedUsers.php.

{
return in_array($a_usr_id, $this->blocked) ? true : false;
}
ilChatBlockedUsers::read ( )
private

initialize blocking information array

Returns
boolean

Definition at line 186 of file class.ilChatBlockedUsers.php.

References $ilDB, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct(), block(), and unblock().

{
global $ilDB;
$this->blocked = array();
$res = $this->db->queryf('
SELECT * FROM chat_blocked WHERE chat_id = %s',
array('integer'),
array($this->id));
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->blocked[] = $row->usr_id;
}
return true;
}

+ Here is the caller graph for this function:

ilChatBlockedUsers::unblock (   $a_usr_id)

unblocks given user

Parameters
integeruserid
Returns
boolean true if user has been unblocked, false if userid does not belong to blocked user

Definition at line 105 of file class.ilChatBlockedUsers.php.

References $ilDB, and read().

{
global $ilDB;
if(!in_array((int) $a_usr_id,$this->blocked))
{
return false;
}
$statement = $this->db->manipulateF('
DELETE FROM chat_blocked
WHERE chat_id = %s
AND usr_id = %s',
array('integer', 'integer'),
array($this->id, $a_usr_id));
$this->read();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilChatBlockedUsers::$blocked = array()

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

ilChatBlockedUsers::$db

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

ilChatBlockedUsers::$id

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


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