ILIAS  release_8 Revision v8.24
class.ilFormGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
27 protected string $formaction = "";
28 protected bool $multipart = false;
29 protected bool $keepopen = false;
30 protected bool $opentag = true;
31 protected string $id = '';
32 protected string $name = '';
33 protected string $target = '';
34 protected bool $prevent_double_submission = false;
35
36 public function setFormAction(string $a_formaction): void
37 {
38 $this->formaction = $a_formaction;
39 }
40
41 public function getFormAction(): string
42 {
43 return $this->formaction;
44 }
45
46 public function setTarget(string $a_target): void
47 {
48 $this->target = $a_target;
49 }
50
51 public function getTarget(): string
52 {
53 return $this->target;
54 }
55
56 public function setMultipart(bool $a_multipart): void
57 {
58 $this->multipart = $a_multipart;
59 }
60
61 public function getMultipart(): bool
62 {
63 return $this->multipart;
64 }
65
66 public function setId(string $a_id): void
67 {
68 $this->id = $a_id;
69 }
70
71 public function getId(): string
72 {
73 return $this->id;
74 }
75
76 public function setName(string $a_name): void
77 {
78 $this->name = $a_name;
79 }
80
81 public function getName(): string
82 {
83 return $this->name;
84 }
85
86 public function setKeepOpen(bool $a_keepopen): void
87 {
88 $this->keepopen = $a_keepopen;
89 }
90
91 public function getKeepOpen(): bool
92 {
93 return $this->keepopen;
94 }
95
96 public function setOpenTag(bool $a_open): void
97 {
98 $this->opentag = $a_open;
99 }
100
101 public function getOpenTag(): bool
102 {
103 return $this->opentag;
104 }
105
106 public function setCloseTag(bool $a_val): void
107 {
108 $this->setKeepOpen(!$a_val);
109 }
110
111 public function getCloseTag(): bool
112 {
113 return !$this->getKeepOpen();
114 }
115
116 public function setPreventDoubleSubmission(bool $a_val): void
117 {
118 $this->prevent_double_submission = $a_val;
119 }
120
121 public function getPreventDoubleSubmission(): bool
122 {
124 }
125
126 public function getHTML(): string
127 {
128 $tpl = new ilTemplate("tpl.form.html", true, true, "Services/Form");
129
130 // this line also sets multipart, so it must be before the multipart check
131 $content = $this->getContent();
132 if ($this->getOpenTag()) {
133 $opentpl = new ilTemplate('tpl.form_open.html', true, true, "Services/Form");
134 if ($this->getTarget() != "") {
135 $opentpl->setCurrentBlock("form_target");
136 $opentpl->setVariable("FORM_TARGET", $this->getTarget());
137 $opentpl->parseCurrentBlock();
138 }
139 if ($this->getName() != "") {
140 $opentpl->setCurrentBlock("form_name");
141 $opentpl->setVariable("FORM_NAME", $this->getName());
142 $opentpl->parseCurrentBlock();
143 }
144 if ($this->getPreventDoubleSubmission()) {
145 $opentpl->setVariable("FORM_CLASS", "preventDoubleSubmission");
146 }
147
148 if ($this->getMultipart()) {
149 $opentpl->touchBlock("multipart");
150 /*if (function_exists("apc_fetch"))
151 //
152 // Progress bar would need additional browser window (popup)
153 // to not be stopped, when form is submitted (we can't work
154 // with an iframe or httprequest solution here)
155 //
156 {
157 $tpl->touchBlock("onsubmit");
158
159 //onsubmit="postForm('{ON_ACT}','form_{F_ID}',1); return false;"
160 $tpl->setCurrentBlock("onsubmit");
161 $tpl->setVariable("ON_ACT", $this->getFormAction());
162 $tpl->setVariable("F_ID", $this->getId());
163 $tpl->setVariable("F_ID", $this->getId());
164 $tpl->parseCurrentBlock();
165
166 $tpl->setCurrentBlock("hidden_progress");
167 $tpl->setVariable("APC_PROGRESS_ID", uniqid());
168 $tpl->setVariable("APC_FORM_ID", $this->getId());
169 $tpl->parseCurrentBlock();
170 }*/
171 }
172 $opentpl->setVariable("FORM_ACTION", $this->getFormAction());
173 if ($this->getId() != "") {
174 $opentpl->setVariable("FORM_ID", $this->getId());
175 }
176 $opentpl->parseCurrentBlock();
177 $tpl->setVariable('FORM_OPEN_TAG', $opentpl->get());
178 }
179 $tpl->setVariable("FORM_CONTENT", $content);
180 if (!$this->getKeepOpen()) {
181 $tpl->setVariable("FORM_CLOSE_TAG", "</form>");
182 }
183 return $tpl->get();
184 }
185
186 public function getContent(): string
187 {
188 return "";
189 }
190}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $target
getPreventDoubleSubmission()
setFormAction(string $a_formaction)
bool $prevent_double_submission
setPreventDoubleSubmission(bool $a_val)
setCloseTag(bool $a_val)
setName(string $a_name)
setTarget(string $a_target)
setOpenTag(bool $a_open)
setKeepOpen(bool $a_keepopen)
setMultipart(bool $a_multipart)
string $formaction
setId(string $a_id)
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41