ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilBuddySystemRelationStateFactory Class Reference

Class ilBuddySystemRelationStateFactory. More...

+ Collaboration diagram for ilBuddySystemRelationStateFactory:

Public Member Functions

 getInitialState ()
 
 getRendererByOwnerAndRelation ($owner_id, ilBuddySystemRelation $relation)
 

Static Public Member Functions

static getInstance ()
 

Protected Member Functions

 __construct ()
 

Static Protected Attributes

static $instance
 
static $valid_states
 
static $state_option_array
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBuddySystemRelationStateFactory::__construct ( )
protected

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

31  {
32  }

Member Function Documentation

◆ getInitialState()

ilBuddySystemRelationStateFactory::getInitialState ( )
Returns
ilBuddySystemRelationState
Exceptions
ilBuddySystemException

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

References $lng, and $options.

90  {
91  foreach($this->getValidStates() as $state)
92  {
93  if($state->isInitial())
94  {
95  return $state;
96  }
97  }
98 
99  throw new ilBuddySystemException("Could not find an initial state class");
100  }

◆ getInstance()

static ilBuddySystemRelationStateFactory::getInstance ( )
static
Returns
self

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

References $file.

Referenced by ilBuddySystemLinkButton\getBuddyList(), ilBuddyList\getRelationByUserId(), and ilBuddySystemRelationsTableGUI\initFilter().

38  {
39  if(null === self::$instance)
40  {
41  self::$instance = new self;
42  }
43 
44  return self::$instance;
45  }
+ Here is the caller graph for this function:

◆ getRendererByOwnerAndRelation()

ilBuddySystemRelationStateFactory::getRendererByOwnerAndRelation (   $owner_id,
ilBuddySystemRelation  $relation 
)
Parameters
int$owner_id
ilBuddySystemRelation$relation
Returns
ilBuddySystemRelationStateButtonRenderer
Exceptions
ilBuddySystemException

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

References ilBuddySystemRelation\getState().

138  {
139  $state_class = get_class($relation->getState());
140  $renderer_class = $state_class . 'ButtonRenderer';
141  $renderer_path = "Services/Contact/BuddySystem/classes/states/renderer/class.{$renderer_class}.php";
142 
143  if(!file_exists($renderer_path))
144  {
145  throw new ilBuddySystemException(sprintf("Could not find a renderer file for state: %s", $state_class));
146  }
147 
148  require_once $renderer_path;
149  if(!class_exists($renderer_class))
150  {
151  throw new ilBuddySystemException(sprintf("Could not find a renderer class for state: %s in file: %s", $state_class, $renderer_path));
152  }
153 
154  return new $renderer_class($owner_id, $relation);
155  }
+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilBuddySystemRelationStateFactory::$instance
staticprotected

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

◆ $state_option_array

ilBuddySystemRelationStateFactory::$state_option_array
staticprotected

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

◆ $valid_states

ilBuddySystemRelationStateFactory::$valid_states
staticprotected

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


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