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];
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(
An exception for terminatinating execution or to throw for unit testing.
unlink(ilBuddySystemRelation $relation)
getIgnoredRelations()
Gets all ignored relations: ilBuddySystemRelationCollection.
link(ilBuddySystemRelation $relation)
setRelations(ilBuddySystemRelationCollection $relations)
static getInstanceByUserId(int $usrId)
ignore(ilBuddySystemRelation $relation)
getOwnerId()
Returns the user id of the buddy list owner.
getIgnoredRelationsForOwner()
Gets all ignored relations the buddy list owner has to interact with.
__construct(int $ownerId)
ilBuddyList constructor.
getRelationTargetUserId(ilBuddySystemRelation $relation)
getLinkedRelations()
Gets all linked/approved relations.
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)
static getInstanceByGlobalUser()
request(ilBuddySystemRelation $relation)
reset()
Remove the singleton instance from static array, used for unit tests.
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.
Class ilBuddySystemRelationStateException.
static getInstance(?ilLanguage $lng=null)
Class ilBuddySystemRelationStateTransitionException.
Class ilBuddySystemRelation.
static _lookupLogin($a_user_id)
lookup login
static _isAnonymous($usr_id)