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)) {
76 $relation->setUserId(
$row[
'usr_id']);
77 $relation->setBuddyUserId(
$row[
'buddy_usr_id']);
78 $relation->setTimestamp(
$row[
'ts']);
79 $relation->setIsOwnedByRequest($relation->getUserId() ==
$this->usr_id);
80 $key = $this->usr_id == $relation->getUserId() ? $relation->getBuddyUserId() : $relation->getUserId();
81 $relations[
$key] = $relation;
93 if (self::TYPE_APPROVED ==
$row[
'rel_type']) {
97 if (self::TYPE_IGNORED ==
$row[
'rel_type']) {
113 "DELETE FROM buddylist WHERE usr_id = %s OR buddy_usr_id = %s",
114 array(
'integer',
'integer'),
115 array($this->usr_id, $this->usr_id)
119 "DELETE FROM buddylist_requests WHERE usr_id = %s OR buddy_usr_id = %s",
120 array(
'integer',
'integer'),
121 array($this->usr_id, $this->usr_id)
133 'usr_id' => array(
'integer', $relation->
getUserId()),
145 'buddy_usr_id' => array(
'integer', $relation->
getUserId())
158 $this->db->manipulateF(
159 "DELETE FROM buddylist WHERE usr_id = %s AND buddy_usr_id = %s",
160 array(
'integer',
'integer'),
164 $this->db->manipulateF(
165 "DELETE FROM buddylist WHERE buddy_usr_id = %s AND usr_id = %s",
166 array(
'integer',
'integer'),
178 'buddylist_requests',
180 'usr_id' => array(
'integer', $relation->
getUserId()),
185 'ignored' => array(
'integer', (
int) $ignored)
195 $this->db->manipulateF(
196 "DELETE FROM buddylist_requests WHERE usr_id = %s AND buddy_usr_id = %s",
197 array(
'integer',
'integer'),
201 $this->db->manipulateF(
202 "DELETE FROM buddylist_requests WHERE buddy_usr_id = %s AND usr_id = %s",
203 array(
'integer',
'integer'),
213 $ilAtomQuery = $this->db->buildAtomQuery();
214 $ilAtomQuery->addTableLock(
'buddylist_requests');
215 $ilAtomQuery->addTableLock(
'buddylist');
setDatabaseAdapter(ilDBInterface $db)
Class ilBuddySystemIgnoredRequestRelationState.
getAll()
Reads all items from database.
getRelationByDatabaseRecord($row)
removeFromRequestedBuddies(ilBuddySystemRelation $relation)
Class ilBuddySystemRelationRepository.
Class ilBuddySystemLinkedState.
foreach($_POST as $key=> $value) $res
save(ilBuddySystemRelation $relation)
Class ilBuddySystemRequestedRelationState.
removeFromApprovedBuddies(ilBuddySystemRelation $relation)
addToApprovedBuddies(ilBuddySystemRelation $relation)
Class ilBuddySystemRelation.
addToRequestedBuddies(ilBuddySystemRelation $relation, $ignored)