ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
All Data Structures Namespaces Files Functions Variables Typedefs Modules Pages
ilAbstractBuddySystemRelationStateButtonRenderer Class Reference

Class ilAbstractBuddySystemRelationStateButtonRenderer. More...

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

Public Member Functions

 __construct ($user_id, ilBuddySystemRelation $relation)
 
 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.

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

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
+ Here is the call graph for this function:

Member Function Documentation

◆ getHtml()

ilAbstractBuddySystemRelationStateButtonRenderer::getHtml ( )
Returns
string

Implements ilBuddySystemRelationStateButtonRenderer.

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

References render().

134  {
135  $this->render();
136  return $this->tpl->get();
137  }
+ 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  {
61  $suffix = '_a';
62  }
63  else
64  {
65  $suffix = '_p';
66  }
67  return $suffix;
68  }

◆ getTemplateVariablePrefix()

ilAbstractBuddySystemRelationStateButtonRenderer::getTemplateVariablePrefix ( )
protected
Returns
string

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

Referenced by renderStateButton(), and renderTargetState().

87  {
88  return '';
89  }
+ Here is the caller graph for this function:

◆ render()

ilAbstractBuddySystemRelationStateButtonRenderer::render ( )
protected

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

References renderStateButton(), and renderTargetState().

Referenced by getHtml().

74  {
75  $this->renderStateButton();
76  $states = $this->relation->getCurrentPossibleTargetStates();
77  foreach($states as $target_state)
78  {
79  $this->renderTargetState($target_state);
80  }
81  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderStateButton()

ilAbstractBuddySystemRelationStateButtonRenderer::renderStateButton ( )
protected

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

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

Referenced by render().

95  {
96  $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
97 
98  $this->tpl->setVariable(
99  $this->getTemplateVariablePrefix() . 'BUTTON_TXT',
100  $this->lng->txt(
101  'buddy_bs_btn_txt_' . $state_id . $this->getLanguageVariableSuffix()
102  )
103  );
104  }
static convertUpperCamelCaseToUnderscoreCase($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
Parameters
ilBuddySystemRelationState$target_state

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

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

Referenced by render().

110  {
111  $state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($this->relation->getState()->getName());
112  $target_state_id = ilStr::convertUpperCamelCaseToUnderscoreCase($target_state->getName());
113 
114  $this->tpl->setVariable(
115  $this->getTemplateVariablePrefix() . 'TARGET_STATE_' . strtoupper($target_state_id),
116  get_class($target_state)
117  );
118  $this->tpl->setVariable(
119  $this->getTemplateVariablePrefix() . 'TARGET_STATE_ACTION_' . strtoupper($target_state_id),
120  $target_state->getAction()
121  );
122  $this->tpl->setVariable(
123  $this->getTemplateVariablePrefix() . 'TARGET_STATE_TXT_' . strtoupper($target_state_id),
124  $this->lng->txt(
125  'buddy_bs_act_btn_txt_' . $state_id . '_to_' . $target_state_id
126  )
127  );
128  }
static convertUpperCamelCaseToUnderscoreCase($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

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: