ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilAbstractBuddySystemRelationStateButtonRenderer Class Reference
+ 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 26 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

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

27  {
28  global $DIC;
29 
30  $this->tpl = new ilTemplate(
31  'tpl.buddy_system_state_' . ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName()) . '.html',
32  true,
33  true,
34  'components/ILIAS/Contact/BuddySystem'
35  );
36 
37  $this->tpl->setVariable('MENU_ID', uniqid('buddy-system-menu', true));
38 
39  $this->lng = $lng ?? $DIC['lng'];
40  }
static convertUpperCamelCaseToUnderscoreCase(string $value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
global $DIC
Definition: shib_login.php:25
+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilAbstractBuddySystemRelationStateButtonRenderer::getHtml ( )

Implements ilBuddySystemRelationStateButtonRenderer.

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

References render().

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

◆ getLanguageVariableSuffix()

ilAbstractBuddySystemRelationStateButtonRenderer::getLanguageVariableSuffix ( )
protected

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

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

◆ getTemplateVariablePrefix()

ilAbstractBuddySystemRelationStateButtonRenderer::getTemplateVariablePrefix ( )
protected

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

Referenced by renderStateButton(), and renderTargetState().

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

◆ render()

ilAbstractBuddySystemRelationStateButtonRenderer::render ( )
protected

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

References renderStateButton(), and renderTargetState().

Referenced by getHtml().

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

◆ renderStateButton()

ilAbstractBuddySystemRelationStateButtonRenderer::renderStateButton ( )
protected

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

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

Referenced by render().

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

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

Referenced by render().

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