ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilBuddySystemRelationStateFactory Class Reference

Class ilBuddySystemRelationStateFactory. More...

+ Collaboration diagram for ilBuddySystemRelationStateFactory:

Public Member Functions

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

Static Public Member Functions

static getInstance (?ilLanguage $lng=null)
 

Static Protected Attributes

static self $instance = null
 
static array $validStates = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemRelationStateFactory::__construct ( protected ilLanguage  $lng)

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

32  {
33  }

Member Function Documentation

◆ getInitialState()

ilBuddySystemRelationStateFactory::getInitialState ( )
Exceptions
ilBuddySystemException

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

References getValidStates().

71  {
72  foreach ($this->getValidStates() as $state) {
73  if ($state->isInitial()) {
74  return $state;
75  }
76  }
77 
78  throw new ilBuddySystemException('Could not find an initial state class');
79  }
Class ilBuddySystemException.
Interface ilBuddySystemRelationState.
+ Here is the call graph for this function:

◆ getInstance()

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

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

References $DIC, $lng, and null.

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

35  : self
36  {
37  global $DIC;
38 
39  if (null === self::$instance) {
40  $lng ??= $DIC['lng'];
41 
42  self::$instance = new self($lng);
43  }
44 
45  return self::$instance;
46  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ getStateButtonRendererByOwnerAndRelation()

ilBuddySystemRelationStateFactory::getStateButtonRendererByOwnerAndRelation ( int  $ownerId,
ilBuddySystemRelation  $relation 
)

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

References ilBuddySystemRelation\getState().

93  $stateClass = $relation->getState()::class;
94  $class = $stateClass . 'ButtonRenderer';
95 
96  return new $class($ownerId, $relation);
97  }
+ Here is the call graph for this function:

◆ getTableFilterStateMapper()

ilBuddySystemRelationStateFactory::getTableFilterStateMapper ( ilBuddySystemRelationState  $state)

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

References ILIAS\Repository\lng().

82  {
83  $stateClass = $state::class;
84  $class = $stateClass . 'TableFilterMapper';
85 
86  return new $class($this->lng, $state);
87  }
+ Here is the call graph for this function:

◆ getValidStates()

ilBuddySystemRelationStateFactory::getValidStates ( )

Get all valid states.

Returns
ilBuddySystemRelationState[]

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

Referenced by getInitialState().

57  : array
58  {
59  return self::$validStates ?? (self::$validStates = [
64  ]);
65  }
Class ilBuddySystemUnlinkedRelationState.
+ Here is the caller graph for this function:

◆ reset()

ilBuddySystemRelationStateFactory::reset ( )

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

References null.

48  : void
49  {
50  self::$instance = null;
51  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Field Documentation

◆ $instance

self ilBuddySystemRelationStateFactory::$instance = null
staticprotected

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

◆ $validStates

array ilBuddySystemRelationStateFactory::$validStates = null
staticprotected

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


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