ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilBuddySystemRelation Class Reference

Class ilBuddySystemRelation. More...

+ Collaboration diagram for ilBuddySystemRelation:

Public Member Functions

 __construct (ilBuddySystemRelationState $state)
 
 setState (ilBuddySystemRelationState $state, $remember_prior_state=true)
 
 getState ()
 
 getPriorState ()
 
 isOwnedByRequest ()
 
 setIsOwnedByRequest ($is_owned_by_request)
 
 getBuddyUserId ()
 
 setBuddyUserId ($buddy_user_id)
 
 getUserId ()
 
 setUserId ($user_id)
 
 getTimestamp ()
 
 setTimestamp ($timestamp)
 
 getCurrentPossibleTargetStates ()
 
 link ()
 
 unlink ()
 
 request ()
 
 ignore ()
 
 isLinked ()
 
 isUnlinked ()
 
 isRequested ()
 
 isIgnored ()
 
 wasLinked ()
 
 wasUnlinked ()
 
 wasRequested ()
 
 wasIgnored ()
 

Protected Attributes

 $is_owned_by_request = false
 
 $user_id
 
 $buddy_user_id
 
 $timestamp
 
 $state
 
 $prior_state
 

Private Member Functions

 setPriorState ($prior_state)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemRelation::__construct ( ilBuddySystemRelationState  $state)
Parameters
ilBuddySystemRelationState$state

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

References setState().

46  {
47  $this->setState($state, false);
48  }
setState(ilBuddySystemRelationState $state, $remember_prior_state=true)
+ Here is the call graph for this function:

Member Function Documentation

◆ getBuddyUserId()

◆ getCurrentPossibleTargetStates()

ilBuddySystemRelation::getCurrentPossibleTargetStates ( )
Returns
ilBuddySystemCollection|ilBuddySystemRelationState[]

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

References ilBuddySystemRelationStateFilterRuleFactory\getInstance().

163  {
164  require_once 'Services/Contact/BuddySystem/classes/states/class.ilBuddySystemRelationStateFilterRuleFactory.php';
165  $state_filter = ilBuddySystemRelationStateFilterRuleFactory::getInstance()->getFilterRuleByRelation($this);
166  return $state_filter->getStates();
167  }
+ Here is the call graph for this function:

◆ getPriorState()

ilBuddySystemRelation::getPriorState ( )
Returns
ilBuddySystemRelationState|null

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

References $prior_state.

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

+ Here is the caller graph for this function:

◆ getState()

◆ getTimestamp()

ilBuddySystemRelation::getTimestamp ( )
Returns
int

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

References $timestamp.

Referenced by ilBuddySystemRelationRepository\addToApprovedBuddies(), and ilBuddySystemRelationRepository\addToRequestedBuddies().

+ Here is the caller graph for this function:

◆ getUserId()

◆ ignore()

ilBuddySystemRelation::ignore ( )
Exceptions
ilBuddySystemRelationStateException
Returns
self

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

References getBuddyUserId(), getState(), and getUserId().

Referenced by ilBuddyList\ignore().

216  {
217  if ($this->getUserId() == $this->getBuddyUserId()) {
218  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
219  }
220 
221  $this->getState()->ignore($this);
222  return $this;
223  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isIgnored()

ilBuddySystemRelation::isIgnored ( )
Returns
bool

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

References getState().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLinked()

ilBuddySystemRelation::isLinked ( )
Returns
bool

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

References getState().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOwnedByRequest()

ilBuddySystemRelation::isOwnedByRequest ( )
Returns
bool

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

References $is_owned_by_request.

◆ isRequested()

ilBuddySystemRelation::isRequested ( )
Returns
bool

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

References getState().

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

245  {
246  return $this->getState() instanceof ilBuddySystemRequestedRelationState;
247  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUnlinked()

ilBuddySystemRelation::isUnlinked ( )
Returns
bool

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

References getState().

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

237  {
238  return $this->getState() instanceof ilBuddySystemUnlinkedRelationState;
239  }
Class ilBuddySystemUnlinkedRelationState.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ link()

ilBuddySystemRelation::link ( )
Exceptions
ilBuddySystemRelationStateException
Returns
self

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

References getBuddyUserId(), getState(), and getUserId().

Referenced by ilBuddyList\link().

174  {
175  if ($this->getUserId() == $this->getBuddyUserId()) {
176  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
177  }
178 
179  $this->getState()->link($this);
180  return $this;
181  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request()

ilBuddySystemRelation::request ( )
Exceptions
ilBuddySystemRelationStateException
Returns
self

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

References getBuddyUserId(), getState(), and getUserId().

Referenced by ilBuddyList\request().

202  {
203  if ($this->getUserId() == $this->getBuddyUserId()) {
204  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
205  }
206 
207  $this->getState()->request($this);
208  return $this;
209  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBuddyUserId()

ilBuddySystemRelation::setBuddyUserId (   $buddy_user_id)
Parameters
int$buddy_user_id
Returns
self

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

References $buddy_user_id.

118  {
119  $this->buddy_user_id = $buddy_user_id;
120  return $this;
121  }

◆ setIsOwnedByRequest()

ilBuddySystemRelation::setIsOwnedByRequest (   $is_owned_by_request)
Parameters
bool$is_owned_by_request

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

References $is_owned_by_request.

101  {
102  $this->is_owned_by_request = $is_owned_by_request;
103  }

◆ setPriorState()

ilBuddySystemRelation::setPriorState (   $prior_state)
private
Parameters
ilBuddySystemRelationState$prior_state

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

References $prior_state.

Referenced by setState().

85  {
86  $this->prior_state = $prior_state;
87  }
+ Here is the caller graph for this function:

◆ setState()

ilBuddySystemRelation::setState ( ilBuddySystemRelationState  $state,
  $remember_prior_state = true 
)
Parameters
ilBuddySystemRelationState$state
$remember_prior_stateboolean
Returns
self

Definition at line 55 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().

56  {
57  if ($remember_prior_state) {
58  $this->setPriorState($this->getState());
59  }
60 
61  $this->state = $state;
62  return $this;
63  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTimestamp()

ilBuddySystemRelation::setTimestamp (   $timestamp)
Parameters
int$timestamp
Returns
self

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

References $timestamp.

154  {
155  $this->timestamp = $timestamp;
156  return $this;
157  }

◆ setUserId()

ilBuddySystemRelation::setUserId (   $user_id)
Parameters
int$user_id
Returns
self

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

References $user_id.

136  {
137  $this->user_id = $user_id;
138  return $this;
139  }

◆ unlink()

ilBuddySystemRelation::unlink ( )
Exceptions
ilBuddySystemRelationStateException
Returns
self

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

References getBuddyUserId(), getState(), and getUserId().

Referenced by ilBuddyList\unlink().

188  {
189  if ($this->getUserId() == $this->getBuddyUserId()) {
190  throw new ilBuddySystemRelationStateException("Can't change a state when the requester equals the requestee.");
191  }
192 
193  $this->getState()->unlink($this);
194  return $this;
195  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasIgnored()

ilBuddySystemRelation::wasIgnored ( )
Returns
bool

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

References getPriorState().

Referenced by ilBuddySystemRelationRepository\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasLinked()

ilBuddySystemRelation::wasLinked ( )
Returns
bool

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

References getPriorState().

Referenced by ilBuddySystemRelationRepository\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasRequested()

ilBuddySystemRelation::wasRequested ( )
Returns
bool

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

References getPriorState().

Referenced by ilBuddySystemRelationRepository\save().

277  {
278  return $this->getPriorState() instanceof ilBuddySystemRequestedRelationState;
279  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wasUnlinked()

ilBuddySystemRelation::wasUnlinked ( )
Returns
bool

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

References getPriorState().

269  {
270  return $this->getPriorState() instanceof ilBuddySystemUnlinkedRelationState;
271  }
Class ilBuddySystemUnlinkedRelationState.
+ Here is the call graph for this function:

Field Documentation

◆ $buddy_user_id

ilBuddySystemRelation::$buddy_user_id
protected

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

Referenced by getBuddyUserId(), and setBuddyUserId().

◆ $is_owned_by_request

ilBuddySystemRelation::$is_owned_by_request = false
protected

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

Referenced by isOwnedByRequest(), and setIsOwnedByRequest().

◆ $prior_state

ilBuddySystemRelation::$prior_state
protected

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

Referenced by getPriorState(), and setPriorState().

◆ $state

ilBuddySystemRelation::$state
protected

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

Referenced by getState(), and setState().

◆ $timestamp

ilBuddySystemRelation::$timestamp
protected

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

Referenced by getTimestamp(), and setTimestamp().

◆ $user_id

ilBuddySystemRelation::$user_id
protected

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

Referenced by getUserId(), and setUserId().


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