ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAbstractBuddySystemRelationStateButtonRenderer Class Reference

Class ilAbstractBuddySystemRelationStateButtonRenderer. More...

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

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 $relation
 
 $usrId
 
 $tpl
 
 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

27 {
28 global $DIC;
29
30 $this->usrId = $usrId;
31 $this->relation = $relation;
32
33 $this->tpl = new ilTemplate(
34 'tpl.buddy_system_state_' . ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName()) . '.html',
35 true,
36 true,
37 'Services/Contact/BuddySystem'
38 );
39
40 $this->lng = $DIC['lng'];
41 }
static convertUpperCamelCaseToUnderscoreCase($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: goto.php:24

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilAbstractBuddySystemRelationStateButtonRenderer::getHtml ( )
Returns
string

Implements ilBuddySystemRelationStateButtonRenderer.

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

118 : string
119 {
120 $this->render();
121
122 return $this->tpl->get();
123 }

References render().

+ Here is the call graph for this function:

◆ getLanguageVariableSuffix()

ilAbstractBuddySystemRelationStateButtonRenderer::getLanguageVariableSuffix ( )
protected
Returns
string

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

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

◆ getTemplateVariablePrefix()

ilAbstractBuddySystemRelationStateButtonRenderer::getTemplateVariablePrefix ( )
protected
Returns
string

Reimplemented in ilBuddySystemSubjectDependentRelationStateButtonRenderer.

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

71 : string
72 {
73 return '';
74 }

Referenced by renderStateButton(), and renderTargetState().

+ Here is the caller graph for this function:

◆ render()

ilAbstractBuddySystemRelationStateButtonRenderer::render ( )
protected

Reimplemented in ilBuddySystemSubjectDependentRelationStateButtonRenderer.

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

59 : void
60 {
61 $this->renderStateButton();
62 $states = $this->relation->getCurrentPossibleTargetStates();
63 foreach ($states as $target_state) {
64 $this->renderTargetState($target_state);
65 }
66 }

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

79 : void
80 {
81 $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
82
83 $this->tpl->setVariable(
84 $this->getTemplateVariablePrefix() . 'BUTTON_TXT',
85 $this->lng->txt(
86 'buddy_bs_btn_txt_' . $state_id . $this->getLanguageVariableSuffix()
87 )
88 );
89 }

References ilStr\convertUpperCamelCaseToUnderscoreCase(), and getTemplateVariablePrefix().

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
Parameters
ilBuddySystemRelationState$target_state

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

94 : void
95 {
96 $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
97 $target_state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName());
98
99 $this->tpl->setVariable(
100 $this->getTemplateVariablePrefix() . 'TARGET_STATE_' . strtoupper($target_state_id),
101 get_class($target_state)
102 );
103 $this->tpl->setVariable(
104 $this->getTemplateVariablePrefix() . 'TARGET_STATE_ACTION_' . strtoupper($target_state_id),
105 $target_state->getAction()
106 );
107 $this->tpl->setVariable(
108 $this->getTemplateVariablePrefix() . 'TARGET_STATE_TXT_' . strtoupper($target_state_id),
109 $this->lng->txt(
110 'buddy_bs_act_btn_txt_' . $state_id . '_to_' . $target_state_id
111 )
112 );
113 }

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

Referenced by render().

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

Field Documentation

◆ $lng

ilAbstractBuddySystemRelationStateButtonRenderer::$lng
protected

◆ $relation

ilAbstractBuddySystemRelationStateButtonRenderer::$relation
protected

◆ $tpl

ilAbstractBuddySystemRelationStateButtonRenderer::$tpl
protected

◆ $usrId

ilAbstractBuddySystemRelationStateButtonRenderer::$usrId
protected

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