ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAbstractBuddySystemRelationStateButtonRenderer Class Reference

Class ilAbstractBuddySystemRelationStateButtonRenderer. More...

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

Public Member Functions

 __construct ($user_id, ilBuddySystemRelation $relation)
 
 getHtml ()
 
 getHtml ()
 

Protected Member Functions

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

Protected Attributes

 $relation
 
 $user_id
 
 $tpl
 
 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

38 {
39 global $DIC;
40
41 $this->user_id = $user_id;
42 $this->relation = $relation;
43
44 $this->tpl = new ilTemplate(
45 'tpl.buddy_system_state_' . ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName()) . '.html',
46 true,
47 true,
48 'Services/Contact/BuddySystem'
49 );
50
51 $this->lng = $DIC['lng'];
52 }
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: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilAbstractBuddySystemRelationStateButtonRenderer::getHtml ( )
Returns
string

Implements ilBuddySystemRelationStateButtonRenderer.

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

References render().

+ Here is the call graph for this function:

◆ getLanguageVariableSuffix()

ilAbstractBuddySystemRelationStateButtonRenderer::getLanguageVariableSuffix ( )
protected
Returns
string

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

58 {
59 if ($this->relation->isOwnedByRequest()) {
60 $suffix = '_a';
61 } else {
62 $suffix = '_p';
63 }
64 return $suffix;
65 }

◆ getTemplateVariablePrefix()

ilAbstractBuddySystemRelationStateButtonRenderer::getTemplateVariablePrefix ( )
protected
Returns
string

Reimplemented in ilBuddySystemSubjectDependentRelationStateButtonRenderer.

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

83 {
84 return '';
85 }

Referenced by renderStateButton(), and renderTargetState().

+ Here is the caller graph for this function:

◆ render()

ilAbstractBuddySystemRelationStateButtonRenderer::render ( )
protected

Reimplemented in ilBuddySystemSubjectDependentRelationStateButtonRenderer.

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

71 {
72 $this->renderStateButton();
73 $states = $this->relation->getCurrentPossibleTargetStates();
74 foreach ($states as $target_state) {
75 $this->renderTargetState($target_state);
76 }
77 }

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

91 {
92 $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
93
94 $this->tpl->setVariable(
95 $this->getTemplateVariablePrefix() . 'BUTTON_TXT',
96 $this->lng->txt(
97 'buddy_bs_btn_txt_' . $state_id . $this->getLanguageVariableSuffix()
98 )
99 );
100 }

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

106 {
107 $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
108 $target_state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName());
109
110 $this->tpl->setVariable(
111 $this->getTemplateVariablePrefix() . 'TARGET_STATE_' . strtoupper($target_state_id),
112 get_class($target_state)
113 );
114 $this->tpl->setVariable(
115 $this->getTemplateVariablePrefix() . 'TARGET_STATE_ACTION_' . strtoupper($target_state_id),
116 $target_state->getAction()
117 );
118 $this->tpl->setVariable(
119 $this->getTemplateVariablePrefix() . 'TARGET_STATE_TXT_' . strtoupper($target_state_id),
120 $this->lng->txt(
121 'buddy_bs_act_btn_txt_' . $state_id . '_to_' . $target_state_id
122 )
123 );
124 }

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

◆ $user_id

ilAbstractBuddySystemRelationStateButtonRenderer::$user_id
protected

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