ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilAbstractBuddySystemRelationStateButtonRenderer Class Reference

Class ilAbstractBuddySystemRelationStateButtonRenderer. More...

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

Public Member Functions

 __construct (protected int $usrId, protected ilBuddySystemRelation $relation, ilLanguage $lng=null)
 
 getHtml ()
 

Protected Member Functions

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

Protected Attributes

ilTemplate $tpl
 
ilLanguage $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAbstractBuddySystemRelationStateButtonRenderer::__construct ( protected int  $usrId,
protected ilBuddySystemRelation  $relation,
ilLanguage  $lng = null 
)

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

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

31  {
32  global $DIC;
33 
34  $this->tpl = new ilTemplate(
35  'tpl.buddy_system_state_' . ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName()) . '.html',
36  true,
37  true,
38  'Services/Contact/BuddySystem'
39  );
40 
41  $this->lng = $lng ?? $DIC['lng'];
42  }
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 101 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

References render().

101  : string
102  {
103  $this->render();
104 
105  return $this->tpl->get();
106  }
+ Here is the call graph for this function:

◆ getLanguageVariableSuffix()

ilAbstractBuddySystemRelationStateButtonRenderer::getLanguageVariableSuffix ( )
protected

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

44  : string
45  {
46  $suffix = '_p';
47  if ($this->relation->isOwnedByActor()) {
48  $suffix = '_a';
49  }
50 
51  return $suffix;
52  }

◆ getTemplateVariablePrefix()

ilAbstractBuddySystemRelationStateButtonRenderer::getTemplateVariablePrefix ( )
protected

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

Referenced by renderStateButton(), and renderTargetState().

63  : string
64  {
65  return '';
66  }
+ Here is the caller graph for this function:

◆ render()

ilAbstractBuddySystemRelationStateButtonRenderer::render ( )
protected

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

References renderStateButton(), and renderTargetState().

Referenced by getHtml().

54  : void
55  {
56  $this->renderStateButton();
57  $states = $this->relation->getCurrentPossibleTargetStates();
58  foreach ($states as $target_state) {
59  $this->renderTargetState($target_state);
60  }
61  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderStateButton()

ilAbstractBuddySystemRelationStateButtonRenderer::renderStateButton ( )
protected

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

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

Referenced by render().

68  : void
69  {
70  $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
71 
72  $this->tpl->setVariable(
73  $this->getTemplateVariablePrefix() . 'BUTTON_TXT',
74  $this->lng->txt(
75  'buddy_bs_btn_txt_' . $state_id . $this->getLanguageVariableSuffix()
76  )
77  );
78  }
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 80 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

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

Referenced by render().

80  : void
81  {
82  $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
83  $target_state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName());
84 
85  $this->tpl->setVariable(
86  $this->getTemplateVariablePrefix() . 'TARGET_STATE_' . strtoupper($target_state_id),
87  $target_state::class
88  );
89  $this->tpl->setVariable(
90  $this->getTemplateVariablePrefix() . 'TARGET_STATE_ACTION_' . strtoupper($target_state_id),
91  $target_state->getAction()
92  );
93  $this->tpl->setVariable(
94  $this->getTemplateVariablePrefix() . 'TARGET_STATE_TXT_' . strtoupper($target_state_id),
95  $this->lng->txt(
96  'buddy_bs_act_btn_txt_' . $state_id . '_to_' . $target_state_id
97  )
98  );
99  }
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

◆ $tpl

ilTemplate ilAbstractBuddySystemRelationStateButtonRenderer::$tpl
protected

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