1 <?php declare(strict_types=1);
37 "You cannot create an instance for the anonymous user (id: %s)",
42 if (isset(self::$instances[$usrId])) {
43 return self::$instances[$usrId];
46 self::$instances[$usrId] =
new self($usrId);
47 return self::$instances[$usrId];
58 return self::getInstanceByUserId((
int) $DIC->user()->getId());
72 $this->eventHandler = $DIC[
'ilAppEventHandler'];
80 $this->relationsRead =
false;
81 $this->relations = null;
114 if (!$this->relationsRead) {
116 $this->relationsRead =
true;
125 if (null === $this->relations) {
263 $relation->setIsOwnedByActor(
true);
265 $relation->setBuddyUsrId($usrId);
266 $relation->setTimestamp(time());
331 "You cannot add the anonymous user to the list (id: %s)",
338 "You cannot add a non existing user (id: %s)",
355 $this->eventHandler->raise(
static _lookupLogin($a_user_id)
lookup login
static getInstance(?ilLanguage $lng=null)
getRequestRelationsByOwner()
Gets all requested relations the buddy list owner initiated.
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.
Class ilBuddySystemRelationStateException.
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($usr_id)
Class ilBuddySystemRelation.
__construct(int $ownerId)
ilBuddyList constructor.
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.