ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilManualPlaceholderInputGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once 'Services/Form/classes/class.ilSubEnabledFormPropertyGUI.php';
5 
11 {
15  protected $placeholders = array();
16 
20  protected $rerenderUrl;
21 
26 
31 
35  protected $instructionText = '';
36 
40  protected $adviseText = '';
41 
45  protected $tpl;
46 
50  protected $lng;
51 
57  {
58  global $DIC;
59 
60  $this->tpl = $DIC->ui()->mainTemplate();
61  $this->lng = $DIC->language();
62 
63  parent::__construct('');
64 
65  $this->dependencyElementId = $dependencyElementId;
66 
67  $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
68  }
69 
73  public function getRerenderUrl()
74  {
75  return $this->rerenderUrl;
76  }
77 
82  {
84  }
85 
90  public function supportsRerenderSignal($elementId, $url)
91  {
92  $this->rerenderTriggerElementName = $elementId;
93  $this->rerenderUrl = $url;
94  }
95 
99  public function getAdviseText()
100  {
101  return $this->adviseText;
102  }
103 
107  public function setAdviseText($adviseText)
108  {
109  $this->adviseText = $adviseText;
110  }
111 
115  public function getInstructionText()
116  {
117  return $this->instructionText;
118  }
119 
124  {
125  $this->instructionText = $instructionText;
126  }
127 
132  public function addPlaceholder($placeholder, $title)
133  {
134  $this->placeholders[$placeholder]['placeholder'] = $placeholder;
135  $this->placeholders[$placeholder]['title'] = $title;
136  }
137 
141  public function insert($a_tpl)
142  {
143  $html = $this->render();
144 
145  $a_tpl->setCurrentBlock("prop_generic");
146  $a_tpl->setVariable("PROP_GENERIC", $html);
147  $a_tpl->parseCurrentBlock();
148  }
149 
154  public function render($ajax = false)
155  {
156  $subtpl = new ilTemplate("tpl.mail_manual_placeholders.html", true, true, "Services/Mail");
157  $subtpl->setVariable('TXT_USE_PLACEHOLDERS', $this->lng->txt('mail_nacc_use_placeholder'));
158  if ($this->getAdviseText()) {
159  $subtpl->setVariable('TXT_PLACEHOLDERS_ADVISE', $this->getAdviseText());
160  }
161 
162  if (count($this->placeholders) > 0) {
163  foreach ($this->placeholders as $placeholder) {
164  $subtpl->setCurrentBlock('man_placeholder');
165  $subtpl->setVariable('DEPENDENCY_ELM_ID', $this->dependencyElementId);
166  $subtpl->setVariable('MANUAL_PLACEHOLDER', $placeholder['placeholder']);
167  $subtpl->setVariable('TXT_MANUAL_PLACEHOLDER', $placeholder['title']);
168  $subtpl->parseCurrentBlock();
169  }
170  }
171 
172  if ($this->getRerenderTriggerElementName() && $this->getRerenderUrl()) {
173  $subtpl->setVariable('RERENDER_URL', $this->getRerenderUrl());
174  $subtpl->setVariable('RERENDER_TRIGGER_ELM_NAME', $this->getRerenderTriggerElementName());
175  }
176 
177  if ($ajax) {
178  echo $subtpl->get();
179  exit();
180  }
181 
182  return $subtpl->get();
183  }
184 
190  public function setValueByArray($a_values)
191  {
192  $this->setValue($a_values[$this->getPostVar()]);
193  }
199  public function setValue($a_value)
200  {
201  if ($this->getMulti() && is_array($a_value)) {
202  $this->setMultiValues($a_value);
203  $a_value = array_shift($a_value);
204  }
205  $this->value = $a_value;
206  }
207 
208  public function checkInput()
209  {
210  return true;
211  }
212 }
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setValueByArray($a_values)
Set value by array.
setMultiValues(array $a_values)
Set multi values.
Class ilManualPlaceholderInputGUI.
__construct($dependencyElementId)
ilManualPlaceholderInputGUI constructor.
special template class to simplify handling of ITX/PEAR
exit
Definition: backend.php:16
This class represents a property that may include a sub form.
$url
$html
Definition: example_001.php:87