19declare(strict_types=1);
43 'You cannot create an instance for the anonymous user (id: %s)',
48 if (isset(self::$instances[$usrId])) {
49 return self::$instances[$usrId];
52 self::$instances[$usrId] =
new self($usrId);
53 return self::$instances[$usrId];
71 $this->eventHandler = $event_handler ??
$DIC[
'ilAppEventHandler'];
82 $this->relationsRead =
false;
83 $this->relations =
null;
104 if (!$this->relationsRead) {
106 $this->relationsRead =
true;
112 if (
null === $this->relations) {
258 $this->eventHandler->raise(
259 'components/ILIAS/Contact',
286 $this->eventHandler->raise(
287 'components/ILIAS/Contact',
304 'You cannot add the anonymous user to the list (id: %s)',
312 'You cannot add a non existing user (id: %s)',
329 $this->eventHandler->raise(
330 'components/ILIAS/Contact',
367 $this->eventHandler->raise(
368 'components/ILIAS/Contact',
unlink(ilBuddySystemRelation $relation)
getIgnoredRelations()
Gets all ignored relations: ilBuddySystemRelationCollection.
link(ilBuddySystemRelation $relation)
setRelations(ilBuddySystemRelationCollection $relations)
static getInstanceByUserId(int $usrId)
ignore(ilBuddySystemRelation $relation)
ilBuddySystemRelationRepository $repository
getOwnerId()
Returns the user id of the buddy list owner.
getIgnoredRelationsForOwner()
Gets all ignored relations the buddy list owner has to interact with.
ilBuddySystemRelationCollection $relations
getRelationTargetUserId(ilBuddySystemRelation $relation)
getLinkedRelations()
Gets all linked/approved relations.
static getInstanceByGlobalUser(?ilObjUser $user=null)
ilAppEventHandler $eventHandler
getRelationUserIds()
Returns an array of all user ids the buddy list owner has a relation with.
getIgnoredRelationsByOwner()
Gets all ignored relations the buddy list owner initiated.
getRequestRelationsForOwner()
Gets all requested relations the buddy list owner has to interact with.
setRepository(ilBuddySystemRelationRepository $repository)
request(ilBuddySystemRelation $relation)
reset()
Remove the singleton instance from static array, used for unit tests.
__construct(int $ownerId, ?ilAppEventHandler $event_handler=null)
getRequestedRelations()
Gets all requested relations.
destroy()
Removes all buddy system references of the user (persistently)
getRelationByUserId(int $usrId)
getRequestRelationsByOwner()
Gets all requested relations the buddy list owner initiated.
Class ilBuddySystemException.
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list.
Class ilBuddySystemRelationRepository.
Class ilBuddySystemRelationStateAlreadyGivenException.
static getInstance(?ilLanguage $lng=null)
Class ilBuddySystemRelationStateTransitionException.
Class ilBuddySystemRelation.
static _isAnonymous(int $usr_id)
static _lookupLogin(int $a_user_id)