ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilBuddySystemRelationStateFactory.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 /* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
11  protected static $instance;
12 
14  protected static $validStates;
15 
17  protected $lng;
18 
19  public function __construct(ilLanguage $lng)
20  {
21  $this->lng = $lng;
22  }
23 
24  public static function getInstance(?ilLanguage $lng = null) : 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  }
36 
41  public function getValidStates() : array
42  {
43  if (null !== self::$validStates) {
44  return self::$validStates;
45  }
46 
47  return (self::$validStates = [
52  ]);
53  }
54 
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  }
69 
71  {
72  $stateClass = get_class($state);
73  $class = $stateClass . 'TableFilterMapper';
74 
75  return new $class($this->lng, $state);
76  }
77 
84  int $ownerId,
85  ilBuddySystemRelation $relation
87  $stateClass = get_class($relation->getState());
88  $class = $stateClass . 'ButtonRenderer';
89 
90  return new $class($ownerId, $relation);
91  }
92 }
Class ilBuddySystemRelationStateFactory.
Class ilBuddySystemUnlinkedRelationState.
Class ilBuddySystemException.
getStateButtonRendererByOwnerAndRelation(int $ownerId, ilBuddySystemRelation $relation)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilBuddySystemRelationStateButtonRenderer.
getTableFilterStateMapper(ilBuddySystemRelationState $state)
Class ilBuddySystemRequestedRelationState.
Class ilBuddySystemRelation.
$DIC
Definition: xapitoken.php:46
language handling
Interface ilBuddySystemRelationState.