ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 setFormAction($a_formaction)
31 {
32 $this->formaction = $a_formaction;
33 }
34
40 function getFormAction()
41 {
42 return $this->formaction;
43 }
44
50 function setTarget($a_target)
51 {
52 $this->target = $a_target;
53 }
54
60 function getTarget()
61 {
62 return $this->target;
63 }
64
70 function setMultipart($a_multipart)
71 {
72 $this->multipart = $a_multipart;
73 }
74
80 function getMultipart()
81 {
82 return $this->multipart;
83 }
84
90 function setId($a_id)
91 {
92 $this->id = $a_id;
93 }
94
100 function getId()
101 {
102 return $this->id;
103 }
104
110 function setName($a_name)
111 {
112 $this->name = $a_name;
113 }
114
120 function getName()
121 {
122 return $this->name;
123 }
124
130 function setKeepOpen($a_keepopen)
131 {
132 $this->keepopen = $a_keepopen;
133 }
134
140 function getKeepOpen()
141 {
142 return $this->keepopen;
143 }
144
150 function setOpenTag($a_open)
151 {
152 $this->opentag = $a_open;
153 }
154
160 function getOpenTag()
161 {
162 return $this->opentag;
163 }
164
170 function setCloseTag($a_val)
171 {
172 $this->setKeepOpen(!$a_val);
173 }
174
180 function getCloseTag()
181 {
182 return !$this->getKeepOpen();
183 }
184
191 {
192 $this->prevent_double_submission = $a_val;
193 }
194
201 {
203 }
204
208 function getHTML()
209 {
210 $tpl = new ilTemplate("tpl.form.html", true, true, "Services/Form");
211
212 // this line also sets multipart, so it must be before the multipart check
213 $content = $this->getContent();
214 if ($this->getOpenTag())
215 {
216 $opentpl = new ilTemplate('tpl.form_open.html', true, true, "Services/Form");
217 if ($this->getTarget() != "")
218 {
219 $opentpl->setCurrentBlock("form_target");
220 $opentpl->setVariable("FORM_TARGET", $this->getTarget());
221 $opentpl->parseCurrentBlock();
222 }
223 if ($this->getName() != "")
224 {
225 $opentpl->setCurrentBlock("form_name");
226 $opentpl->setVariable("FORM_NAME", $this->getName());
227 $opentpl->parseCurrentBlock();
228 }
229 if ($this->getPreventDoubleSubmission())
230 {
231 $opentpl->setVariable("FORM_CLASS", "preventDoubleSubmission");
232 }
233
234 if ($this->getMultipart())
235 {
236 $opentpl->touchBlock("multipart");
237 /*if (function_exists("apc_fetch"))
238 //
239 // Progress bar would need additional browser window (popup)
240 // to not be stopped, when form is submitted (we can't work
241 // with an iframe or httprequest solution here)
242 //
243 {
244 $tpl->touchBlock("onsubmit");
245
246 //onsubmit="postForm('{ON_ACT}','form_{F_ID}',1); return false;"
247 $tpl->setCurrentBlock("onsubmit");
248 $tpl->setVariable("ON_ACT", $this->getFormAction());
249 $tpl->setVariable("F_ID", $this->getId());
250 $tpl->setVariable("F_ID", $this->getId());
251 $tpl->parseCurrentBlock();
252
253 $tpl->setCurrentBlock("hidden_progress");
254 $tpl->setVariable("APC_PROGRESS_ID", uniqid());
255 $tpl->setVariable("APC_FORM_ID", $this->getId());
256 $tpl->parseCurrentBlock();
257 }*/
258 }
259 $opentpl->setVariable("FORM_ACTION", $this->getFormAction());
260 if ($this->getId() != "")
261 {
262 $opentpl->setVariable("FORM_ID", $this->getId());
263 }
264 $opentpl->parseCurrentBlock();
265 $tpl->setVariable('FORM_OPEN_TAG', $opentpl->get());
266 }
267 $tpl->setVariable("FORM_CONTENT", $content);
268 if (!$this->getKeepOpen())
269 {
270 $tpl->setVariable("FORM_CLOSE_TAG", "</form>");
271 }
272 return $tpl->get();
273 }
274
278 function getContent()
279 {
280 return "";
281 }
282
283}
284?>
global $tpl
Definition: ilias.php:8
An exception for terminatinating execution or to throw for unit testing.
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.
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