ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 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.

30 {
31 global $DIC;
32
33 $this->tpl = new ilTemplate(
34 'tpl.buddy_system_state_' . ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName()) . '.html',
35 true,
36 true,
37 'components/ILIAS/Contact/BuddySystem'
38 );
39
40 $this->tpl->setVariable('MENU_ID', uniqid('buddy-system-menu', true));
41
42 $this->lng = $lng ?? $DIC['lng'];
43 }
static convertUpperCamelCaseToUnderscoreCase(string $value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilAbstractBuddySystemRelationStateButtonRenderer::getHtml ( )

Implements ilBuddySystemRelationStateButtonRenderer.

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

102 : string
103 {
104 $this->render();
105
106 return $this->tpl->get();
107 }

References render().

+ Here is the call graph for this function:

◆ getLanguageVariableSuffix()

ilAbstractBuddySystemRelationStateButtonRenderer::getLanguageVariableSuffix ( )
protected

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

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

◆ getTemplateVariablePrefix()

ilAbstractBuddySystemRelationStateButtonRenderer::getTemplateVariablePrefix ( )
protected

Reimplemented in ilBuddySystemSubjectDependentRelationStateButtonRenderer.

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

64 : string
65 {
66 return '';
67 }

Referenced by renderStateButton(), and renderTargetState().

+ Here is the caller graph for this function:

◆ render()

ilAbstractBuddySystemRelationStateButtonRenderer::render ( )
protected

Reimplemented in ilBuddySystemSubjectDependentRelationStateButtonRenderer.

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

55 : void
56 {
57 $this->renderStateButton();
58 $states = $this->relation->getCurrentPossibleTargetStates();
59 foreach ($states as $target_state) {
60 $this->renderTargetState($target_state);
61 }
62 }

References renderStateButton(), and renderTargetState().

Referenced by getHtml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderStateButton()

ilAbstractBuddySystemRelationStateButtonRenderer::renderStateButton ( )
protected

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

69 : void
70 {
71 $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
72
73 $this->tpl->setVariable(
74 $this->getTemplateVariablePrefix() . 'BUTTON_TXT',
75 $this->lng->txt(
76 'buddy_bs_btn_txt_' . $state_id . $this->getLanguageVariableSuffix()
77 )
78 );
79 }

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

Referenced by render().

+ 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 81 of file class.ilAbstractBuddySystemRelationStateButtonRenderer.php.

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

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

Referenced by render().

+ 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: