ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
17  protected $url;
21  public function __construct($url)
22  {
23  global $tpl;
24 
25  parent::__construct('');
26  $this->url = $url;
27  $tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
28  }
29 
34  public function addPlaceholder($placeholder, $title)
35  {
36  $this->placeholders[$placeholder]['placeholder'] = $placeholder;
37  $this->placeholders[$placeholder]['title'] = $title;
38  }
39 
43  public function insert($a_tpl)
44  {
45  $html = $this->render();
46 
47  $a_tpl->setCurrentBlock("prop_generic");
48  $a_tpl->setVariable("PROP_GENERIC", $html);
49  $a_tpl->parseCurrentBlock();
50  }
51 
56  public function render($ajax = false)
57  {
58  global $lng;
59 
60  $subtpl = new ilTemplate("tpl.mail_manual_placeholders.html", true, true, "Services/Mail");
61  $subtpl->setVariable('TXT_USE_PLACEHOLDERS', $lng->txt('mail_nacc_use_placeholder'));
62  $subtpl->setVariable('TXT_PLACEHOLDERS_ADVISE', sprintf($lng->txt('placeholders_advise'), '<br />'));
63  if(count($this->placeholders) > 0)
64  {
65  foreach($this->placeholders as $placeholder)
66  {
67  $subtpl->setCurrentBlock('man_placeholder');
68  $subtpl->setVariable('MANUAL_PLACEHOLDER', $placeholder['placeholder']);
69  $subtpl->setVariable('TXT_MANUAL_PLACEHOLDER', $placeholder['title']);
70  $subtpl->parseCurrentBlock();
71  }
72  }
73  if($ajax)
74  {
75  echo $subtpl->get();
76  exit();
77  }
78  else
79  {
80  $subtpl->setVariable('URL', $this->url);
81  return $subtpl->get();
82  }
83 
84  }
85 
91  function setValueByArray($a_values)
92  {
93  $this->setValue($a_values[$this->getPostVar()]);
94  }
100  function setValue($a_value)
101  {
102  if($this->getMulti() && is_array($a_value))
103  {
104  $this->setMultiValues($a_value);
105  $a_value = array_shift($a_value);
106  }
107  $this->value = $a_value;
108  }
109 
110  function checkInput()
111  {
112  return true;
113  }
114 
115 }
116 
getPostVar()
Get Post Variable.
setValueByArray($a_values)
Set value by array.
setMultiValues(array $a_values)
Set multi values.
global $tpl
Definition: ilias.php:8
Class ilManualPlaceholderInputGUI.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
This class represents a property that may include a sub form.
global $lng
Definition: privfeed.php:17
$html
Definition: example_001.php:87