19 declare(strict_types=1);
37 $this->db = $db ?? $DIC->database();
48 $res = $this->db->queryF(
51 buddylist.usr_id, buddylist.buddy_usr_id, buddylist.ts, %s rel_type 53 INNER JOIN usr_data ud 54 ON ud.usr_id = buddylist.usr_id 55 INNER JOIN usr_data udbuddy 56 ON udbuddy.usr_id = buddylist.buddy_usr_id 57 WHERE buddylist.usr_id = %s 60 buddylist_requests.usr_id, buddylist_requests.buddy_usr_id, buddylist_requests.ts, (CASE WHEN ignored = 1 THEN %s ELSE %s END) rel_type 61 FROM buddylist_requests 62 INNER JOIN usr_data ud ON ud.usr_id = buddylist_requests.usr_id 63 INNER JOIN usr_data udbuddy ON udbuddy.usr_id = buddylist_requests.buddy_usr_id 64 WHERE buddylist_requests.usr_id = %s OR buddylist_requests.buddy_usr_id = %s 84 while ($row = $this->db->fetchAssoc(
$res)) {
95 if (self::TYPE_APPROVED === $row[
'rel_type']) {
99 (
int) $row[
'buddy_usr_id'],
100 (
int) $row[
'usr_id'] === $this->usrId,
105 if (self::TYPE_IGNORED === $row[
'rel_type']) {
108 (
int) $row[
'usr_id'],
109 (
int) $row[
'buddy_usr_id'],
110 (
int) $row[
'usr_id'] === $this->usrId,
117 (
int) $row[
'usr_id'],
118 (
int) $row[
'buddy_usr_id'],
119 (
int) $row[
'usr_id'] === $this->usrId,
126 $this->db->manipulateF(
127 'DELETE FROM buddylist WHERE usr_id = %s OR buddy_usr_id = %s',
128 [
'integer',
'integer'],
129 [$this->usrId, $this->usrId]
132 $this->db->manipulateF(
133 'DELETE FROM buddylist_requests WHERE usr_id = %s OR buddy_usr_id = %s',
134 [
'integer',
'integer'],
135 [$this->usrId, $this->usrId]
144 'usr_id' => [
'integer', $relation->
getUsrId()],
156 'buddy_usr_id' => [
'integer', $relation->
getUsrId()]
166 $this->db->manipulateF(
167 'DELETE FROM buddylist WHERE usr_id = %s AND buddy_usr_id = %s',
168 [
'integer',
'integer'],
172 $this->db->manipulateF(
173 'DELETE FROM buddylist WHERE buddy_usr_id = %s AND usr_id = %s',
174 [
'integer',
'integer'],
182 'buddylist_requests',
184 'usr_id' => [
'integer', $relation->
getUsrId()],
189 'ignored' => [
'integer', (
int) $ignored]
196 $this->db->manipulateF(
197 'DELETE FROM buddylist_requests WHERE usr_id = %s AND buddy_usr_id = %s',
198 [
'integer',
'integer'],
202 $this->db->manipulateF(
203 'DELETE FROM buddylist_requests WHERE buddy_usr_id = %s AND usr_id = %s',
204 [
'integer',
'integer'],
211 $ilAtomQuery = $this->db->buildAtomQuery();
212 $ilAtomQuery->addTableLock(
'buddylist_requests');
213 $ilAtomQuery->addTableLock(
'buddylist');
Class ilBuddySystemIgnoredRequestRelationState.
getAll()
Reads all items from database.
getRelationByDatabaseRecord(array $row)
removeFromRequestedBuddies(ilBuddySystemRelation $relation)
__construct(protected int $usrId, ?ilDBInterface $db=null)
Class ilBuddySystemRelationRepository.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addToRequestedBuddies(ilBuddySystemRelation $relation, bool $ignored)
Class ilBuddySystemLinkedState.
save(ilBuddySystemRelation $relation)
Class ilBuddySystemRequestedRelationState.
removeFromApprovedBuddies(ilBuddySystemRelation $relation)
addToApprovedBuddies(ilBuddySystemRelation $relation)