ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBuddySystemRelationStateFactory Class Reference

Class ilBuddySystemRelationStateFactory. More...

+ Collaboration diagram for ilBuddySystemRelationStateFactory:

Public Member Functions

 __construct (ilLanguage $lng)
 
 getValidStates ()
 Get all valid states. More...
 
 getInitialState ()
 
 getTableFilterStateMapper (ilBuddySystemRelationState $state)
 
 getStateButtonRendererByOwnerAndRelation (int $ownerId, ilBuddySystemRelation $relation)
 

Static Public Member Functions

static getInstance (?ilLanguage $lng=null)
 

Protected Attributes

 $lng
 

Static Protected Attributes

static $instance
 
static $validStates
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemRelationStateFactory::__construct ( ilLanguage  $lng)

Definition at line 19 of file class.ilBuddySystemRelationStateFactory.php.

References $lng.

Member Function Documentation

◆ getInitialState()

ilBuddySystemRelationStateFactory::getInitialState ( )
Returns
ilBuddySystemRelationState
Exceptions
ilBuddySystemException

Definition at line 59 of file class.ilBuddySystemRelationStateFactory.php.

References getValidStates().

60  {
61  foreach ($this->getValidStates() as $state) {
62  if ($state->isInitial()) {
63  return $state;
64  }
65  }
66 
67  throw new ilBuddySystemException("Could not find an initial state class");
68  }
Class ilBuddySystemException.
Interface ilBuddySystemRelationState.
+ Here is the call graph for this function:

◆ getInstance()

static ilBuddySystemRelationStateFactory::getInstance ( ?ilLanguage  $lng = null)
static

Definition at line 24 of file class.ilBuddySystemRelationStateFactory.php.

References $DIC, and $lng.

Referenced by ilBuddySystemGUI\__construct(), ilBuddySystemLinkButton\getHtml(), ilBuddyList\getRelationByUserId(), ilBuddySystemRelationsTableGUI\initFilter(), and ilBuddySystemRelationsTableGUI\populate().

24  : self
25  {
26  global $DIC;
27 
28  if (null === self::$instance) {
29  $lng = $lng ?? $DIC['lng'];
30 
31  self::$instance = new self($lng);
32  }
33 
34  return self::$instance;
35  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ getStateButtonRendererByOwnerAndRelation()

ilBuddySystemRelationStateFactory::getStateButtonRendererByOwnerAndRelation ( int  $ownerId,
ilBuddySystemRelation  $relation 
)
Parameters
int$ownerId
ilBuddySystemRelation$relation
Returns
ilBuddySystemRelationStateButtonRenderer

Definition at line 83 of file class.ilBuddySystemRelationStateFactory.php.

References ilBuddySystemRelation\getState().

87  $stateClass = get_class($relation->getState());
88  $class = $stateClass . 'ButtonRenderer';
89 
90  return new $class($ownerId, $relation);
91  }
Interface ilBuddySystemRelationStateButtonRenderer.
+ Here is the call graph for this function:

◆ getTableFilterStateMapper()

ilBuddySystemRelationStateFactory::getTableFilterStateMapper ( ilBuddySystemRelationState  $state)

Definition at line 70 of file class.ilBuddySystemRelationStateFactory.php.

71  {
72  $stateClass = get_class($state);
73  $class = $stateClass . 'TableFilterMapper';
74 
75  return new $class($this->lng, $state);
76  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getValidStates()

ilBuddySystemRelationStateFactory::getValidStates ( )

Get all valid states.

Returns
ilBuddySystemRelationState[]

Definition at line 41 of file class.ilBuddySystemRelationStateFactory.php.

Referenced by getInitialState().

41  : array
42  {
43  if (null !== self::$validStates) {
44  return self::$validStates;
45  }
46 
47  return (self::$validStates = [
52  ]);
53  }
Class ilBuddySystemUnlinkedRelationState.
Class ilBuddySystemRequestedRelationState.
+ Here is the caller graph for this function:

Field Documentation

◆ $instance

ilBuddySystemRelationStateFactory::$instance
staticprotected

Definition at line 11 of file class.ilBuddySystemRelationStateFactory.php.

◆ $lng

ilBuddySystemRelationStateFactory::$lng
protected

Definition at line 17 of file class.ilBuddySystemRelationStateFactory.php.

Referenced by __construct(), and getInstance().

◆ $validStates

ilBuddySystemRelationStateFactory::$validStates
staticprotected

Definition at line 14 of file class.ilBuddySystemRelationStateFactory.php.


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