ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBuddySystemRelation Class Reference

Class ilBuddySystemRelation. More...

+ Collaboration diagram for ilBuddySystemRelation:

Public Member Functions

 __construct (ilBuddySystemRelationState $state, int $usrId, int $buddyUsrId, bool $isOwnedByActor, int $timestamp)
 
 setState (ilBuddySystemRelationState $state, bool $rememberPriorState=true)
 
 getState ()
 
 getPriorState ()
 
 isOwnedByActor ()
 
 withIsOwnedByActor (bool $isOwnedByActor)
 
 getBuddyUsrId ()
 
 withBuddyUsrId (int $buddyUsrId)
 
 getUsrId ()
 
 withUsrId (int $usrId)
 
 getTimestamp ()
 
 withTimestamp (int $timestamp)
 
 getCurrentPossibleTargetStates ()
 
 link ()
 
 unlink ()
 
 request ()
 
 ignore ()
 
 isLinked ()
 
 isUnlinked ()
 
 isRequested ()
 
 isIgnored ()
 
 wasLinked ()
 
 wasUnlinked ()
 
 wasRequested ()
 
 wasIgnored ()
 

Protected Attributes

ilBuddySystemRelationState $state
 
int $usrId
 
int $buddyUsrId
 
bool $isOwnedByActor
 
int $timestamp
 
ilBuddySystemRelationState $priorState = null
 

Private Member Functions

 setPriorState (ilBuddySystemRelationState $prior_state)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemRelation::__construct ( ilBuddySystemRelationState  $state,
int  $usrId,
int  $buddyUsrId,
bool  $isOwnedByActor,
int  $timestamp 
)

Definition at line 34 of file class.ilBuddySystemRelation.php.

References $buddyUsrId, $isOwnedByActor, $timestamp, $usrId, isOwnedByActor(), and setState().

40  {
41  $this->usrId = $usrId;
42  $this->buddyUsrId = $buddyUsrId;
44  $this->timestamp = $timestamp;
45  $this->setState($state, false);
46  }
setState(ilBuddySystemRelationState $state, bool $rememberPriorState=true)
+ Here is the call graph for this function:

Member Function Documentation

◆ getBuddyUsrId()

◆ getCurrentPossibleTargetStates()

ilBuddySystemRelation::getCurrentPossibleTargetStates ( )

Definition at line 125 of file class.ilBuddySystemRelation.php.

References ilBuddySystemRelationStateFilterRuleFactory\getInstance().

+ Here is the call graph for this function:

◆ getPriorState()

ilBuddySystemRelation::getPriorState ( )

Definition at line 68 of file class.ilBuddySystemRelation.php.

References $priorState.

Referenced by wasIgnored(), wasLinked(), wasRequested(), and wasUnlinked().

69  {
70  return $this->priorState;
71  }
ilBuddySystemRelationState $priorState
Interface ilBuddySystemRelationState.
+ Here is the caller graph for this function:

◆ getState()

ilBuddySystemRelation::getState ( )

◆ getTimestamp()

ilBuddySystemRelation::getTimestamp ( )

◆ getUsrId()

◆ ignore()

ilBuddySystemRelation::ignore ( )
Returns
self
Exceptions
ilBuddySystemRelationStateException

Definition at line 176 of file class.ilBuddySystemRelation.php.

References getBuddyUsrId(), getState(), and getUsrId().

Referenced by ilBuddyList\ignore().

176  : self
177  {
178  if ($this->getUsrId() === $this->getBuddyUsrId()) {
179  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
180  }
181 
182  $this->getState()->ignore($this);
183  return $this;
184  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isIgnored()

ilBuddySystemRelation::isIgnored ( )

Definition at line 201 of file class.ilBuddySystemRelation.php.

References getState().

Referenced by ilBuddyList\getIgnoredRelations(), ilBuddyList\ignore(), and ilBuddySystemRelationRepository\save().

201  : bool
202  {
203  return $this->getState() instanceof ilBuddySystemIgnoredRequestRelationState;
204  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLinked()

ilBuddySystemRelation::isLinked ( )

Definition at line 186 of file class.ilBuddySystemRelation.php.

References getState().

Referenced by ilBuddyList\getLinkedRelations(), ilBuddyList\ignore(), ilBuddyList\link(), and ilBuddySystemRelationRepository\save().

186  : bool
187  {
188  return $this->getState() instanceof ilBuddySystemLinkedRelationState;
189  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOwnedByActor()

ilBuddySystemRelation::isOwnedByActor ( )

◆ isRequested()

ilBuddySystemRelation::isRequested ( )

Definition at line 196 of file class.ilBuddySystemRelation.php.

References getState().

Referenced by ilBuddyList\getRequestedRelations(), ilBuddyList\request(), and ilBuddySystemRelationRepository\save().

196  : bool
197  {
198  return $this->getState() instanceof ilBuddySystemRequestedRelationState;
199  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUnlinked()

ilBuddySystemRelation::isUnlinked ( )

Definition at line 191 of file class.ilBuddySystemRelation.php.

References getState().

Referenced by ilBuddySystemGUI\requestCommand(), and ilBuddyList\unlink().

191  : bool
192  {
193  return $this->getState() instanceof ilBuddySystemUnlinkedRelationState;
194  }
Class ilBuddySystemUnlinkedRelationState.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ link()

ilBuddySystemRelation::link ( )
Returns
self
Exceptions
ilBuddySystemRelationStateException

Definition at line 134 of file class.ilBuddySystemRelation.php.

References getBuddyUsrId(), getState(), and getUsrId().

Referenced by ilBuddyList\link().

134  : self
135  {
136  if ($this->getUsrId() === $this->getBuddyUsrId()) {
137  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
138  }
139 
140  $this->getState()->link($this);
141  return $this;
142  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request()

ilBuddySystemRelation::request ( )
Returns
self
Exceptions
ilBuddySystemRelationStateException

Definition at line 162 of file class.ilBuddySystemRelation.php.

References getBuddyUsrId(), getState(), and getUsrId().

Referenced by ilBuddyList\request().

162  : self
163  {
164  if ($this->getUsrId() === $this->getBuddyUsrId()) {
165  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
166  }
167 
168  $this->getState()->request($this);
169  return $this;
170  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPriorState()

ilBuddySystemRelation::setPriorState ( ilBuddySystemRelationState  $prior_state)
private

Definition at line 48 of file class.ilBuddySystemRelation.php.

Referenced by setState().

48  : void
49  {
50  $this->priorState = $prior_state;
51  }
+ Here is the caller graph for this function:

◆ setState()

ilBuddySystemRelation::setState ( ilBuddySystemRelationState  $state,
bool  $rememberPriorState = true 
)

Definition at line 53 of file class.ilBuddySystemRelation.php.

References $state, getState(), and setPriorState().

Referenced by __construct(), ilBuddySystemRequestedRelationState\ignore(), ilBuddySystemIgnoredRequestRelationState\link(), ilBuddySystemRequestedRelationState\link(), ilBuddySystemUnlinkedRelationState\request(), ilBuddySystemLinkedRelationState\unlink(), ilBuddySystemIgnoredRequestRelationState\unlink(), and ilBuddySystemRequestedRelationState\unlink().

53  : self
54  {
55  if ($rememberPriorState) {
56  $this->setPriorState($this->getState());
57  }
58 
59  $this->state = $state;
60  return $this;
61  }
ilBuddySystemRelationState $state
setPriorState(ilBuddySystemRelationState $prior_state)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unlink()

ilBuddySystemRelation::unlink ( )
Returns
self
Exceptions
ilBuddySystemRelationStateException

Definition at line 148 of file class.ilBuddySystemRelation.php.

References getBuddyUsrId(), getState(), and getUsrId().

Referenced by ilBuddyList\unlink().

148  : self
149  {
150  if ($this->getUsrId() === $this->getBuddyUsrId()) {
151  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
152  }
153 
154  $this->getState()->unlink($this);
155  return $this;
156  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasIgnored()

ilBuddySystemRelation::wasIgnored ( )

Definition at line 221 of file class.ilBuddySystemRelation.php.

References getPriorState().

Referenced by ilBuddySystemRelationRepository\save().

221  : bool
222  {
223  return $this->getPriorState() instanceof ilBuddySystemIgnoredRequestRelationState;
224  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasLinked()

ilBuddySystemRelation::wasLinked ( )

Definition at line 206 of file class.ilBuddySystemRelation.php.

References getPriorState().

Referenced by ilBuddySystemRelationRepository\save().

206  : bool
207  {
208  return $this->getPriorState() instanceof ilBuddySystemLinkedRelationState;
209  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasRequested()

ilBuddySystemRelation::wasRequested ( )

Definition at line 216 of file class.ilBuddySystemRelation.php.

References getPriorState().

Referenced by ilBuddySystemRelationRepository\save().

216  : bool
217  {
218  return $this->getPriorState() instanceof ilBuddySystemRequestedRelationState;
219  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasUnlinked()

ilBuddySystemRelation::wasUnlinked ( )

Definition at line 211 of file class.ilBuddySystemRelation.php.

References getPriorState().

211  : bool
212  {
213  return $this->getPriorState() instanceof ilBuddySystemUnlinkedRelationState;
214  }
Class ilBuddySystemUnlinkedRelationState.
+ Here is the call graph for this function:

◆ withBuddyUsrId()

ilBuddySystemRelation::withBuddyUsrId ( int  $buddyUsrId)

Definition at line 91 of file class.ilBuddySystemRelation.php.

References $buddyUsrId.

91  : self
92  {
93  $clone = clone $this;
94  $clone->buddyUsrId = $buddyUsrId;
95 
96  return $clone;
97  }

◆ withIsOwnedByActor()

ilBuddySystemRelation::withIsOwnedByActor ( bool  $isOwnedByActor)

Definition at line 78 of file class.ilBuddySystemRelation.php.

References $isOwnedByActor.

78  : self
79  {
80  $clone = clone $this;
81  $clone->isOwnedByActor = $isOwnedByActor;
82 
83  return $clone;
84  }

◆ withTimestamp()

ilBuddySystemRelation::withTimestamp ( int  $timestamp)

Definition at line 117 of file class.ilBuddySystemRelation.php.

References $timestamp.

117  : self
118  {
119  $clone = clone $this;
120  $clone->timestamp = $timestamp;
121 
122  return $clone;
123  }

◆ withUsrId()

ilBuddySystemRelation::withUsrId ( int  $usrId)

Definition at line 104 of file class.ilBuddySystemRelation.php.

References $usrId.

104  : self
105  {
106  $clone = clone $this;
107  $clone->usrId = $usrId;
108 
109  return $clone;
110  }

Field Documentation

◆ $buddyUsrId

int ilBuddySystemRelation::$buddyUsrId
protected

Definition at line 29 of file class.ilBuddySystemRelation.php.

Referenced by __construct(), getBuddyUsrId(), and withBuddyUsrId().

◆ $isOwnedByActor

bool ilBuddySystemRelation::$isOwnedByActor
protected

Definition at line 30 of file class.ilBuddySystemRelation.php.

Referenced by __construct(), isOwnedByActor(), and withIsOwnedByActor().

◆ $priorState

ilBuddySystemRelationState ilBuddySystemRelation::$priorState = null
protected

Definition at line 32 of file class.ilBuddySystemRelation.php.

Referenced by getPriorState().

◆ $state

ilBuddySystemRelationState ilBuddySystemRelation::$state
protected

Definition at line 27 of file class.ilBuddySystemRelation.php.

Referenced by getState(), and setState().

◆ $timestamp

int ilBuddySystemRelation::$timestamp
protected

Definition at line 31 of file class.ilBuddySystemRelation.php.

Referenced by __construct(), getTimestamp(), and withTimestamp().

◆ $usrId

int ilBuddySystemRelation::$usrId
protected

Definition at line 28 of file class.ilBuddySystemRelation.php.

Referenced by __construct(), getUsrId(), and withUsrId().


The documentation for this class was generated from the following file: