ILIAS  release_8 Revision v8.24
ilBuddySystemRelationStateFactory Class Reference

Class ilBuddySystemRelationStateFactory. More...

+ Collaboration diagram for ilBuddySystemRelationStateFactory:

Public Member Functions

 __construct (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)
 

Protected Attributes

ilLanguage $lng
 

Static Protected Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemRelationStateFactory::__construct ( ilLanguage  $lng)

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

References $lng, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getInitialState()

ilBuddySystemRelationStateFactory::getInitialState ( )
Returns
ilBuddySystemRelationState
Exceptions
ilBuddySystemException

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

76 {
77 foreach ($this->getValidStates() as $state) {
78 if ($state->isInitial()) {
79 return $state;
80 }
81 }
82
83 throw new ilBuddySystemException('Could not find an initial state class');
84 }
Class ilBuddySystemException.
Interface ilBuddySystemRelationState.

References getValidStates().

+ Here is the call graph for this function:

◆ getInstance()

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

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

39 : self
40 {
41 global $DIC;
42
43 if (null === self::$instance) {
44 $lng = $lng ?? $DIC['lng'];
45
46 self::$instance = new self($lng);
47 }
48
49 return self::$instance;
50 }
global $DIC
Definition: feed.php:28

References $DIC, $instance, and $lng.

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

+ Here is the caller graph for this function:

◆ getStateButtonRendererByOwnerAndRelation()

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

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

98 $stateClass = get_class($relation->getState());
99 $class = $stateClass . 'ButtonRenderer';
100
101 return new $class($ownerId, $relation);
102 }

◆ getTableFilterStateMapper()

ilBuddySystemRelationStateFactory::getTableFilterStateMapper ( ilBuddySystemRelationState  $state)

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

87 {
88 $stateClass = get_class($state);
89 $class = $stateClass . 'TableFilterMapper';
90
91 return new $class($this->lng, $state);
92 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getValidStates()

ilBuddySystemRelationStateFactory::getValidStates ( )

Get all valid states.

Returns
ilBuddySystemRelationState[]

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

61 : array
62 {
63 return self::$validStates ?? (self::$validStates = [
68 ]);
69 }

Referenced by getInitialState().

+ Here is the caller graph for this function:

◆ reset()

ilBuddySystemRelationStateFactory::reset ( )

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

52 : void
53 {
54 self::$instance = null;
55 }

Field Documentation

◆ $instance

self ilBuddySystemRelationStateFactory::$instance = null
staticprotected

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

Referenced by getInstance().

◆ $lng

ilLanguage ilBuddySystemRelationStateFactory::$lng
protected

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

Referenced by __construct(), and getInstance().

◆ $stateOptions

array ilBuddySystemRelationStateFactory::$stateOptions = null
staticprotected

Definition at line 31 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: