32 $this->db = $DIC[
'ilDB'];
60 $res = $this->db->queryF(
62 SELECT usr_id, buddy_usr_id, ts, %s rel_type FROM buddylist WHERE usr_id = %s 64 SELECT usr_id, buddy_usr_id, ts, (CASE WHEN ignored = 1 THEN %s ELSE %s END) rel_type FROM buddylist_requests WHERE usr_id = %s OR buddy_usr_id = %s 67 'text',
'integer',
'text',
'text',
'integer',
'integer' 70 self::TYPE_APPROVED, $this->usr_id, self::TYPE_IGNORED, self::TYPE_REQUESTED, $this->usr_id, $this->usr_id
74 while(
$row = $this->db->fetchAssoc(
$res))
77 $relation->setUserId(
$row[
'usr_id']);
78 $relation->setBuddyUserId(
$row[
'buddy_usr_id']);
79 $relation->setTimestamp(
$row[
'ts']);
80 $relation->setIsOwnedByRequest($relation->getUserId() ==
$this->usr_id);
81 $key = $this->usr_id == $relation->getUserId() ? $relation->getBuddyUserId() : $relation->getUserId();
82 $relations[$key] = $relation;
94 if(self::TYPE_APPROVED ==
$row[
'rel_type'])
101 if(self::TYPE_IGNORED ==
$row[
'rel_type'])
120 "DELETE FROM buddylist WHERE usr_id = %s OR buddy_usr_id = %s",
121 array(
'integer',
'integer'),
122 array($this->usr_id, $this->usr_id)
126 "DELETE FROM buddylist_requests WHERE usr_id = %s OR buddy_usr_id = %s",
127 array(
'integer',
'integer'),
128 array($this->usr_id, $this->usr_id)
165 $this->db->manipulateF(
166 "DELETE FROM buddylist WHERE usr_id = %s AND buddy_usr_id = %s",
167 array(
'integer',
'integer'),
171 $this->db->manipulateF(
172 "DELETE FROM buddylist WHERE buddy_usr_id = %s AND usr_id = %s",
173 array(
'integer',
'integer'),
185 'buddylist_requests',
192 'ignored' =>
array(
'integer', (
int)$ignored)
202 $this->db->manipulateF(
203 "DELETE FROM buddylist_requests WHERE usr_id = %s AND buddy_usr_id = %s",
204 array(
'integer',
'integer'),
208 $this->db->manipulateF(
209 "DELETE FROM buddylist_requests WHERE buddy_usr_id = %s AND usr_id = %s",
210 array(
'integer',
'integer'),
220 $ilAtomQuery = $this->db->buildAtomQuery();
221 $ilAtomQuery->addTableLock(
'buddylist_requests');
222 $ilAtomQuery->addTableLock(
'buddylist');
setDatabaseAdapter(ilDBInterface $db)
Class ilBuddySystemIgnoredRequestRelationState.
getAll()
Reads all items from database.
getRelationByDatabaseRecord($row)
removeFromRequestedBuddies(ilBuddySystemRelation $relation)
Class ilBuddySystemRelationRepository.
Class ilBuddySystemLinkedState.
save(ilBuddySystemRelation $relation)
Class ilBuddySystemRequestedRelationState.
removeFromApprovedBuddies(ilBuddySystemRelation $relation)
addToApprovedBuddies(ilBuddySystemRelation $relation)
Create styles array
The data for the language used.
Class ilBuddySystemRelation.
addToRequestedBuddies(ilBuddySystemRelation $relation, $ignored)