ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilFormGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
15 class ilFormGUI
16 {
17  protected $formaction;
18  protected $multipart = false;
19  protected $keepopen = false;
20  protected $opentag = true;
21  protected $id;
22  protected $name;
23 
29  function ilFormGUI()
30  {
31  }
32 
38  function setFormAction($a_formaction)
39  {
40  $this->formaction = $a_formaction;
41  }
42 
48  function getFormAction()
49  {
50  return $this->formaction;
51  }
52 
58  function setTarget($a_target)
59  {
60  $this->target = $a_target;
61  }
62 
68  function getTarget()
69  {
70  return $this->target;
71  }
72 
78  function setMultipart($a_multipart)
79  {
80  $this->multipart = $a_multipart;
81  }
82 
88  function getMultipart()
89  {
90  return $this->multipart;
91  }
92 
98  function setId($a_id)
99  {
100  $this->id = $a_id;
101  }
102 
108  function getId()
109  {
110  return $this->id;
111  }
112 
118  function setName($a_name)
119  {
120  $this->name = $a_name;
121  }
122 
128  function getName()
129  {
130  return $this->name;
131  }
132 
138  function setKeepOpen($a_keepopen)
139  {
140  $this->keepopen = $a_keepopen;
141  }
142 
148  function getKeepOpen()
149  {
150  return $this->keepopen;
151  }
152 
158  function setOpenTag($a_open)
159  {
160  $this->opentag = $a_open;
161  }
162 
168  function getOpenTag()
169  {
170  return $this->opentag;
171  }
172 
178  function setCloseTag($a_val)
179  {
180  $this->setKeepOpen(!$a_val);
181  }
182 
188  function getCloseTag()
189  {
190  return !$this->getKeepOpen();
191  }
192 
196  function getHTML()
197  {
198  $tpl = new ilTemplate("tpl.form.html", true, true, "Services/Form");
199 
200  // this line also sets multipart, so it must be before the multipart check
201  $content = $this->getContent();
202  if ($this->getOpenTag())
203  {
204  $opentpl = new ilTemplate('tpl.form_open.html', true, true, "Services/Form");
205  if ($this->getTarget() != "")
206  {
207  $opentpl->setCurrentBlock("form_target");
208  $opentpl->setVariable("FORM_TARGET", $this->getTarget());
209  $opentpl->parseCurrentBlock();
210  }
211  if ($this->getName() != "")
212  {
213  $opentpl->setCurrentBlock("form_name");
214  $opentpl->setVariable("FORM_NAME", $this->getName());
215  $opentpl->parseCurrentBlock();
216  }
217  if ($this->getMultipart())
218  {
219  $opentpl->touchBlock("multipart");
220  /*if (function_exists("apc_fetch"))
221  //
222  // Progress bar would need additional browser window (popup)
223  // to not be stopped, when form is submitted (we can't work
224  // with an iframe or httprequest solution here)
225  //
226  {
227  $tpl->touchBlock("onsubmit");
228 
229  //onsubmit="postForm('{ON_ACT}','form_{F_ID}',1); return false;"
230  $tpl->setCurrentBlock("onsubmit");
231  $tpl->setVariable("ON_ACT", $this->getFormAction());
232  $tpl->setVariable("F_ID", $this->getId());
233  $tpl->setVariable("F_ID", $this->getId());
234  $tpl->parseCurrentBlock();
235 
236  $tpl->setCurrentBlock("hidden_progress");
237  $tpl->setVariable("APC_PROGRESS_ID", uniqid());
238  $tpl->setVariable("APC_FORM_ID", $this->getId());
239  $tpl->parseCurrentBlock();
240  }*/
241  }
242  $opentpl->setVariable("FORM_ACTION", $this->getFormAction());
243  if ($this->getId() != "")
244  {
245  $opentpl->setVariable("FORM_ID", $this->getId());
246  }
247  $opentpl->parseCurrentBlock();
248  $tpl->setVariable('FORM_OPEN_TAG', $opentpl->get());
249  }
250  $tpl->setVariable("FORM_CONTENT", $content);
251  if (!$this->getKeepOpen())
252  {
253  $tpl->setVariable("FORM_CLOSE_TAG", "</form>");
254  }
255  return $tpl->get();
256  }
257 
261  function getContent()
262  {
263  return "";
264  }
265 
266 }
267 ?>