ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
16{
17 protected $formaction;
18 protected $multipart = false;
19 protected $keepopen = false;
20 protected $opentag = true;
21 protected $id;
22 protected $name;
23 protected $prevent_double_submission = false;
24
30 function ilFormGUI()
31 {
32 }
33
39 function setFormAction($a_formaction)
40 {
41 $this->formaction = $a_formaction;
42 }
43
49 function getFormAction()
50 {
51 return $this->formaction;
52 }
53
59 function setTarget($a_target)
60 {
61 $this->target = $a_target;
62 }
63
69 function getTarget()
70 {
71 return $this->target;
72 }
73
79 function setMultipart($a_multipart)
80 {
81 $this->multipart = $a_multipart;
82 }
83
89 function getMultipart()
90 {
91 return $this->multipart;
92 }
93
99 function setId($a_id)
100 {
101 $this->id = $a_id;
102 }
103
109 function getId()
110 {
111 return $this->id;
112 }
113
119 function setName($a_name)
120 {
121 $this->name = $a_name;
122 }
123
129 function getName()
130 {
131 return $this->name;
132 }
133
139 function setKeepOpen($a_keepopen)
140 {
141 $this->keepopen = $a_keepopen;
142 }
143
149 function getKeepOpen()
150 {
151 return $this->keepopen;
152 }
153
159 function setOpenTag($a_open)
160 {
161 $this->opentag = $a_open;
162 }
163
169 function getOpenTag()
170 {
171 return $this->opentag;
172 }
173
179 function setCloseTag($a_val)
180 {
181 $this->setKeepOpen(!$a_val);
182 }
183
189 function getCloseTag()
190 {
191 return !$this->getKeepOpen();
192 }
193
200 {
201 $this->prevent_double_submission = $a_val;
202 }
203
210 {
212 }
213
217 function getHTML()
218 {
219 $tpl = new ilTemplate("tpl.form.html", true, true, "Services/Form");
220
221 // this line also sets multipart, so it must be before the multipart check
222 $content = $this->getContent();
223 if ($this->getOpenTag())
224 {
225 $opentpl = new ilTemplate('tpl.form_open.html', true, true, "Services/Form");
226 if ($this->getTarget() != "")
227 {
228 $opentpl->setCurrentBlock("form_target");
229 $opentpl->setVariable("FORM_TARGET", $this->getTarget());
230 $opentpl->parseCurrentBlock();
231 }
232 if ($this->getName() != "")
233 {
234 $opentpl->setCurrentBlock("form_name");
235 $opentpl->setVariable("FORM_NAME", $this->getName());
236 $opentpl->parseCurrentBlock();
237 }
238 if ($this->getPreventDoubleSubmission())
239 {
240 $opentpl->setVariable("FORM_CLASS", "preventDoubleSubmission");
241 }
242
243 if ($this->getMultipart())
244 {
245 $opentpl->touchBlock("multipart");
246 /*if (function_exists("apc_fetch"))
247 //
248 // Progress bar would need additional browser window (popup)
249 // to not be stopped, when form is submitted (we can't work
250 // with an iframe or httprequest solution here)
251 //
252 {
253 $tpl->touchBlock("onsubmit");
254
255 //onsubmit="postForm('{ON_ACT}','form_{F_ID}',1); return false;"
256 $tpl->setCurrentBlock("onsubmit");
257 $tpl->setVariable("ON_ACT", $this->getFormAction());
258 $tpl->setVariable("F_ID", $this->getId());
259 $tpl->setVariable("F_ID", $this->getId());
260 $tpl->parseCurrentBlock();
261
262 $tpl->setCurrentBlock("hidden_progress");
263 $tpl->setVariable("APC_PROGRESS_ID", uniqid());
264 $tpl->setVariable("APC_FORM_ID", $this->getId());
265 $tpl->parseCurrentBlock();
266 }*/
267 }
268 $opentpl->setVariable("FORM_ACTION", $this->getFormAction());
269 if ($this->getId() != "")
270 {
271 $opentpl->setVariable("FORM_ID", $this->getId());
272 }
273 $opentpl->parseCurrentBlock();
274 $tpl->setVariable('FORM_OPEN_TAG', $opentpl->get());
275 }
276 $tpl->setVariable("FORM_CONTENT", $content);
277 if (!$this->getKeepOpen())
278 {
279 $tpl->setVariable("FORM_CLOSE_TAG", "</form>");
280 }
281 return $tpl->get();
282 }
283
287 function getContent()
288 {
289 return "";
290 }
291
292}
293?>
global $tpl
Definition: ilias.php:8
This class represents a form user interface.
setTarget($a_target)
Set Target.
getPreventDoubleSubmission()
Get prevent double submission.
setKeepOpen($a_keepopen)
Set Keep Form Tag Open.
setFormAction($a_formaction)
Set FormAction.
setId($a_id)
Set Id.
getName()
Get Name.
setName($a_name)
Set Name.
getMultipart()
Get Enctype Multipart/Formdata true/false.
setPreventDoubleSubmission($a_val)
Set prevent double submission.
getCloseTag()
Get close tag.
setOpenTag($a_open)
Enable/Disable Open Form Tag.
ilFormGUI()
Constructor.
getKeepOpen()
Get Keep Form Tag Open.
setMultipart($a_multipart)
Set Enctype Multipart/Formdata true/false.
getHTML()
Get HTML.
getTarget()
Get Target.
getOpenTag()
Get Open Form Tag Enabled.
getContent()
Get Content.
setCloseTag($a_val)
Set close tag.
getFormAction()
Get FormAction.
getId()
Get Id.
special template class to simplify handling of ITX/PEAR