ILIAS  eassessment Revision 61809
 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 
27  function ilFormGUI()
28  {
29  }
30 
36  function setFormAction($a_formaction)
37  {
38  $this->formaction = $a_formaction;
39  }
40 
46  function getFormAction()
47  {
48  return $this->formaction;
49  }
50 
56  function setTarget($a_target)
57  {
58  $this->target = $a_target;
59  }
60 
66  function getTarget()
67  {
68  return $this->target;
69  }
70 
76  function setMultipart($a_multipart)
77  {
78  $this->multipart = $a_multipart;
79  }
80 
86  function getMultipart()
87  {
88  return $this->multipart;
89  }
90 
96  function setId($a_id)
97  {
98  $this->id = $a_id;
99  }
100 
106  function getId()
107  {
108  return $this->id;
109  }
110 
116  function setKeepOpen($a_keepopen)
117  {
118  $this->keepopen = $a_keepopen;
119  }
120 
126  function getKeepOpen()
127  {
128  return $this->keepopen;
129  }
130 
136  function setOpenTag($a_open)
137  {
138  $this->opentag = $a_open;
139  }
140 
146  function getOpenTag()
147  {
148  return $this->opentag;
149  }
150 
156  function setCloseTag($a_val)
157  {
158  $this->setKeepOpen(!$a_val);
159  }
160 
166  function getCloseTag()
167  {
168  return !$this->getKeepOpen();
169  }
170 
174  function getHTML()
175  {
176  $tpl = new ilTemplate("tpl.form.html", true, true, "Services/Form");
177 
178  // this line also sets multipart, so it must be before the multipart check
179  $content = $this->getContent();
180  if ($this->getOpenTag())
181  {
182  $opentpl = new ilTemplate('tpl.form_open.html', true, true, "Services/Form");
183  if ($this->getTarget() != "")
184  {
185  $opentpl->setCurrentBlock("form_target");
186  $opentpl->setVariable("FORM_TARGET", $this->getTarget());
187  $opentpl->parseCurrentBlock();
188  }
189  if ($this->getMultipart())
190  {
191  $opentpl->touchBlock("multipart");
192  /*if (function_exists("apc_fetch"))
193  //
194  // Progress bar would need additional browser window (popup)
195  // to not be stopped, when form is submitted (we can't work
196  // with an iframe or httprequest solution here)
197  //
198  {
199  $tpl->touchBlock("onsubmit");
200 
201  //onsubmit="postForm('{ON_ACT}','form_{F_ID}',1); return false;"
202  $tpl->setCurrentBlock("onsubmit");
203  $tpl->setVariable("ON_ACT", $this->getFormAction());
204  $tpl->setVariable("F_ID", $this->getId());
205  $tpl->setVariable("F_ID", $this->getId());
206  $tpl->parseCurrentBlock();
207 
208  $tpl->setCurrentBlock("hidden_progress");
209  $tpl->setVariable("APC_PROGRESS_ID", uniqid());
210  $tpl->setVariable("APC_FORM_ID", $this->getId());
211  $tpl->parseCurrentBlock();
212  }*/
213  }
214  $opentpl->setVariable("FORM_ACTION", $this->getFormAction());
215  if ($this->getId() != "")
216  {
217  $opentpl->setVariable("FORM_ID", $this->getId());
218  }
219  $opentpl->parseCurrentBlock();
220  $tpl->setVariable('FORM_OPEN_TAG', $opentpl->get());
221  }
222  $tpl->setVariable("FORM_CONTENT", $content);
223  if (!$this->getKeepOpen())
224  {
225  $tpl->setVariable("FORM_CLOSE_TAG", "</form>");
226  }
227  return $tpl->get();
228  }
229 
233  function getContent()
234  {
235  return "";
236  }
237 
238 }
239 ?>