1 <?php declare(strict_types=1);
28 $this->db = $DIC[
'ilDB'];
40 $res = $this->db->queryF(
43 buddylist.usr_id, buddylist.buddy_usr_id, buddylist.ts, %s rel_type 45 INNER JOIN usr_data ud 46 ON ud.usr_id = buddylist.usr_id 47 WHERE buddylist.usr_id = %s 50 buddylist_requests.usr_id, buddylist_requests.buddy_usr_id, buddylist_requests.ts, (CASE WHEN ignored = 1 THEN %s ELSE %s END) rel_type 51 FROM buddylist_requests 52 INNER JOIN usr_data ud ON ud.usr_id = buddylist_requests.usr_id 53 INNER JOIN usr_data udbuddy ON udbuddy.usr_id = buddylist_requests.buddy_usr_id 54 WHERE buddylist_requests.usr_id = %s OR buddylist_requests.buddy_usr_id = %s 74 while ($row = $this->db->fetchAssoc(
$res)) {
76 $relation->setUsrId((
int) $row[
'usr_id']);
77 $relation->setBuddyUsrId((
int) $row[
'buddy_usr_id']);
78 $relation->setTimestamp((
int) $row[
'ts']);
79 $relation->setIsOwnedByActor($relation->getUsrId() ===
$this->usrId);
80 $key = $this->usrId === $relation->getUsrId() ? $relation->getBuddyUsrId() : $relation->getUsrId();
81 $relations[$key] = $relation;
93 if (self::TYPE_APPROVED === $row[
'rel_type']) {
95 } elseif (self::TYPE_IGNORED === $row[
'rel_type']) {
108 "DELETE FROM buddylist WHERE usr_id = %s OR buddy_usr_id = %s",
109 [
'integer',
'integer'],
110 [$this->usrId, $this->usrId]
114 "DELETE FROM buddylist_requests WHERE usr_id = %s OR buddy_usr_id = %s",
115 [
'integer',
'integer'],
116 [$this->usrId, $this->usrId]
128 'usr_id' => [
'integer', $relation->
getUsrId()],
140 'buddy_usr_id' => [
'integer', $relation->
getUsrId()]
153 $this->db->manipulateF(
154 "DELETE FROM buddylist WHERE usr_id = %s AND buddy_usr_id = %s",
155 [
'integer',
'integer'],
159 $this->db->manipulateF(
160 "DELETE FROM buddylist WHERE buddy_usr_id = %s AND usr_id = %s",
161 [
'integer',
'integer'],
173 'buddylist_requests',
175 'usr_id' => [
'integer', $relation->
getUsrId()],
180 'ignored' => [
'integer', (int) $ignored]
190 $this->db->manipulateF(
191 "DELETE FROM buddylist_requests WHERE usr_id = %s AND buddy_usr_id = %s",
192 [
'integer',
'integer'],
196 $this->db->manipulateF(
197 "DELETE FROM buddylist_requests WHERE buddy_usr_id = %s AND usr_id = %s",
198 [
'integer',
'integer'],
208 $ilAtomQuery = $this->db->buildAtomQuery();
209 $ilAtomQuery->addTableLock(
'buddylist_requests');
210 $ilAtomQuery->addTableLock(
'buddylist');
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)
__construct(int $usrId)
ilBuddySystemRelationRepository constructor.