4 require_once
'Services/Contact/BuddySystem/classes/states/class.ilAbstractBuddySystemRelationState.php';
39 $this->lng = $DIC[
'lng'];
47 if (null === self::$instance) {
48 self::$instance =
new self;
51 return self::$instance;
58 public function getValidStates()
60 if (null !== self::$valid_states) {
61 return self::$valid_states;
66 foreach ($iter as $file) {
74 require_once $file->getFilename();
75 $class = str_replace(array(
'class.',
'.php'),
'', $file->getBasename());
78 !$reflection->isAbstract() &&
79 $reflection->isSubclassOf(
'ilBuddySystemRelationState')
81 $states[] =
new $class();
85 return (self::$valid_states = $states);
94 foreach ($this->getValidStates() as
$state) {
95 if ($state->isInitial()) {
109 if (null !== self::$state_option_array[$with_initial_state]) {
110 return self::$state_option_array[$with_initial_state];
115 foreach ($this->getValidStates() as
$state) {
116 if ($with_initial_state || !$state->isInitial()) {
117 $options[get_class($state)] = $this->lng->txt(
'buddy_bs_state_' . strtolower($state->getName()));
121 return (self::$state_option_array[$with_initial_state] =
$options);
132 $state_class = get_class($relation->
getState());
133 $renderer_class = $state_class .
'ButtonRenderer';
134 $renderer_path =
"Services/Contact/BuddySystem/classes/states/renderer/class.{$renderer_class}.php";
136 if (!file_exists($renderer_path)) {
140 require_once $renderer_path;
141 if (!class_exists($renderer_class)) {
142 throw new ilBuddySystemException(sprintf(
"Could not find a renderer class for state: %s in file: %s", $state_class, $renderer_path));
145 return new $renderer_class($owner_id, $relation);
Class ilBuddySystemRelationStateFactory.
static $state_option_array
getStatesAsOptionArray($with_initial_state=false)
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
getRendererByOwnerAndRelation($owner_id, ilBuddySystemRelation $relation)
Class ilBuddySystemRelation.