ILIAS  release_8 Revision v8.23
ilAbstractBuddySystemRelationStateButtonRenderer Class Reference

Class ilAbstractBuddySystemRelationStateButtonRenderer. More...

+ Inheritance diagram for ilAbstractBuddySystemRelationStateButtonRenderer:
+ Collaboration diagram for ilAbstractBuddySystemRelationStateButtonRenderer:

Public Member Functions

 __construct (int $usrId, ilBuddySystemRelation $relation)
 
 getHtml ()
 

Protected Member Functions

 getLanguageVariableSuffix ()
 
 render ()
 
 getTemplateVariablePrefix ()
 
 renderStateButton ()
 
 renderTargetState (ilBuddySystemRelationState $target_state)
 

Protected Attributes

ilBuddySystemRelation $relation
 
int $usrId
 
ilTemplate $tpl
 
ilLanguage $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAbstractBuddySystemRelationStateButtonRenderer::__construct ( int  $usrId,
ilBuddySystemRelation  $relation 
)

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

References $DIC, $relation, $usrId, ilStr\convertUpperCamelCaseToUnderscoreCase(), and ILIAS\Repository\lng().

33  {
34  global $DIC;
35 
36  $this->usrId = $usrId;
37  $this->relation = $relation;
38 
39  $this->tpl = new ilTemplate(
40  'tpl.buddy_system_state_' . ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName()) . '.html',
41  true,
42  true,
43  'Services/Contact/BuddySystem'
44  );
45 
46  $this->lng = $DIC['lng'];
47  }
static convertUpperCamelCaseToUnderscoreCase(string $value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilAbstractBuddySystemRelationStateButtonRenderer::getHtml ( )

Implements ilBuddySystemRelationStateButtonRenderer.

Definition at line 106 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

References render().

106  : string
107  {
108  $this->render();
109 
110  return $this->tpl->get();
111  }
+ Here is the call graph for this function:

◆ getLanguageVariableSuffix()

ilAbstractBuddySystemRelationStateButtonRenderer::getLanguageVariableSuffix ( )
protected

Definition at line 49 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

49  : string
50  {
51  $suffix = '_p';
52  if ($this->relation->isOwnedByActor()) {
53  $suffix = '_a';
54  }
55 
56  return $suffix;
57  }

◆ getTemplateVariablePrefix()

ilAbstractBuddySystemRelationStateButtonRenderer::getTemplateVariablePrefix ( )
protected

Definition at line 68 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

Referenced by renderStateButton(), and renderTargetState().

68  : string
69  {
70  return '';
71  }
+ Here is the caller graph for this function:

◆ render()

ilAbstractBuddySystemRelationStateButtonRenderer::render ( )
protected

Definition at line 59 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

References renderStateButton(), and renderTargetState().

Referenced by getHtml().

59  : void
60  {
61  $this->renderStateButton();
62  $states = $this->relation->getCurrentPossibleTargetStates();
63  foreach ($states as $target_state) {
64  $this->renderTargetState($target_state);
65  }
66  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderStateButton()

ilAbstractBuddySystemRelationStateButtonRenderer::renderStateButton ( )
protected

Definition at line 73 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

References ilStr\convertUpperCamelCaseToUnderscoreCase(), getTemplateVariablePrefix(), and ILIAS\Repository\lng().

Referenced by render().

73  : void
74  {
75  $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
76 
77  $this->tpl->setVariable(
78  $this->getTemplateVariablePrefix() . 'BUTTON_TXT',
79  $this->lng->txt(
80  'buddy_bs_btn_txt_' . $state_id . $this->getLanguageVariableSuffix()
81  )
82  );
83  }
static convertUpperCamelCaseToUnderscoreCase(string $value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderTargetState()

ilAbstractBuddySystemRelationStateButtonRenderer::renderTargetState ( ilBuddySystemRelationState  $target_state)
protected

Definition at line 85 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

References ilStr\convertUpperCamelCaseToUnderscoreCase(), ilBuddySystemRelationState\getAction(), ilBuddySystemRelationState\getName(), getTemplateVariablePrefix(), and ILIAS\Repository\lng().

Referenced by render().

85  : void
86  {
87  $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
88  $target_state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName());
89 
90  $this->tpl->setVariable(
91  $this->getTemplateVariablePrefix() . 'TARGET_STATE_' . strtoupper($target_state_id),
92  get_class($target_state)
93  );
94  $this->tpl->setVariable(
95  $this->getTemplateVariablePrefix() . 'TARGET_STATE_ACTION_' . strtoupper($target_state_id),
96  $target_state->getAction()
97  );
98  $this->tpl->setVariable(
99  $this->getTemplateVariablePrefix() . 'TARGET_STATE_TXT_' . strtoupper($target_state_id),
100  $this->lng->txt(
101  'buddy_bs_act_btn_txt_' . $state_id . '_to_' . $target_state_id
102  )
103  );
104  }
static convertUpperCamelCaseToUnderscoreCase(string $value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilLanguage ilAbstractBuddySystemRelationStateButtonRenderer::$lng
protected

◆ $relation

ilBuddySystemRelation ilAbstractBuddySystemRelationStateButtonRenderer::$relation
protected

◆ $tpl

ilTemplate ilAbstractBuddySystemRelationStateButtonRenderer::$tpl
protected

◆ $usrId

int ilAbstractBuddySystemRelationStateButtonRenderer::$usrId
protected

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