19 declare(strict_types=1);
45 'You cannot create an instance for the anonymous user (id: %s)',
50 if (isset(self::$instances[$usrId])) {
51 return self::$instances[$usrId];
54 self::$instances[$usrId] =
new self($usrId);
55 return self::$instances[$usrId];
66 return self::getInstanceByUserId($DIC->user()->getId());
76 $this->eventHandler = $DIC[
'ilAppEventHandler'];
84 $this->relationsRead =
false;
85 $this->relations = null;
106 if (!$this->relationsRead) {
108 $this->relationsRead =
true;
114 if (null === $this->relations) {
270 $this->eventHandler->raise(
274 'relation' => $relation
300 $this->eventHandler->raise(
304 'relation' => $relation
320 'You cannot add the anonymous user to the list (id: %s)',
328 'You cannot add a non existing user (id: %s)',
345 $this->eventHandler->raise(
350 'relation' => $relation
385 $this->eventHandler->raise(
389 'relation' => $relation
static getInstance(?ilLanguage $lng=null)
getRequestRelationsByOwner()
Gets all requested relations the buddy list owner initiated.
ilBuddySystemRelationCollection $relations
static getInstanceByGlobalUser()
setRepository(ilBuddySystemRelationRepository $repository)
getIgnoredRelationsByOwner()
Gets all ignored relations the buddy list owner initiated.
request(ilBuddySystemRelation $relation)
getIgnoredRelationsForOwner()
Gets all ignored relations the buddy list owner has to interact with.
ignore(ilBuddySystemRelation $relation)
Class ilBuddySystemException.
getIgnoredRelations()
Gets all ignored relations: ilBuddySystemRelationCollection.
getRelationUserIds()
Returns an array of all user ids the buddy list owner has a relation with.
ilBuddySystemRelationRepository $repository
Class ilBuddySystemRelationStateTransitionException.
Class ilBuddySystemRelationRepository.
unlink(ilBuddySystemRelation $relation)
static getInstanceByUserId(int $usrId)
reset()
Remove the singleton instance from static array, used for unit tests.
getRequestedRelations()
Gets all requested relations.
link(ilBuddySystemRelation $relation)
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
getRequestRelationsForOwner()
Gets all requested relations the buddy list owner has to interact with.
getRelationTargetUserId(ilBuddySystemRelation $relation)
getLinkedRelations()
Gets all linked/approved relations.
Class ilBuddySystemRelationStateAlreadyGivenException.
static _isAnonymous(int $usr_id)
ilAppEventHandler $eventHandler
__construct(int $ownerId)
setRelations(ilBuddySystemRelationCollection $relations)
destroy()
Removes all buddy system references of the user (persistently)
getRelationByUserId(int $usrId)
getOwnerId()
Returns the user id of the buddy list owner.
static _lookupLogin(int $a_user_id)