19declare(strict_types=1);
21use Psr\Http\Message\RequestInterface;
59 string $a_postvar =
""
63 if (isset(
$DIC[
"http"])) {
64 $this->
http = $DIC->http();
67 if (isset(
$DIC[
"refinery"])) {
71 $this->
ctrl = $DIC->ctrl();
72 $this->
lng = $DIC->language();
76 if (isset(
$DIC[
"http"])) {
77 $this->request =
$DIC->http()->request();
79 if (isset(
$DIC[
"tpl"])) {
80 $this->global_tpl =
$DIC[
'tpl'];
89 $cmd = $this->
ctrl->getCmd();
96 return $DIC->repository()->internal()->gui()->symbol();
99 protected function setType(
string $a_type): void
101 $this->type = $a_type;
111 $this->title = $a_title;
121 $this->postvar = $a_postvar;
132 $id = str_replace(
"]",
"__",
$id);
138 $this->
info = $a_info;
148 $this->alert = $a_alert;
158 $this->required = $a_required;
186 $this->parentform = $a_parentform;
197 $this->parent_gui = $a_val;
218 $this->hidden_title = $a_val;
239 return serialize($this->
getValue());
244 $data = unserialize($a_data);
247 $this->setValue(
$data);
259 $this->parent_table = $a_val;
276 throw new Exception(
"Parent form/table not set for " . get_class($this) .
" to use serialize feature.");
292 if (!is_object($parent)) {
295 return "form_" . $parent->getId() .
"_" . $this->
getFieldId();
331 bool $a_sortable =
false,
332 bool $a_addremove =
true
336 "%s not supported for form property type %s",
342 $this->multi = $a_multi;
343 $this->multi_sortable = $a_sortable;
344 $this->multi_addremove = $a_addremove;
354 $this->multi_values = array_unique($a_values);
359 return $this->multi_values;
367 $id = $this->getFieldId();
369 $tpl =
new ilTemplate(
"tpl.multi_icons.html",
true,
true,
"components/ILIAS/Form");
372 if ($this->multi_addremove) {
373 $tpl->setCurrentBlock(
"addremove");
374 $tpl->setVariable(
"ID",
$id);
375 $tpl->setVariable(
"TXT_ADD",
$lng->txt(
"add"));
376 $tpl->setVariable(
"TXT_REMOVE",
$lng->txt(
"remove"));
377 $tpl->setVariable(
"SRC_ADD", $this->
symbol()->glyph(
"add")->render());
378 $tpl->setVariable(
"SRC_REMOVE", $this->
symbol()->glyph(
"remove")->render());
379 $tpl->parseCurrentBlock();
382 if ($this->multi_sortable) {
383 $tpl->setCurrentBlock(
"sortable");
384 $tpl->setVariable(
"ID",
$id);
385 $tpl->setVariable(
"TXT_DOWN",
$lng->txt(
"down"));
386 $tpl->setVariable(
"TXT_UP",
$lng->txt(
"up"));
387 $tpl->setVariable(
"SRC_UP", $this->
symbol()->glyph(
"up")->render());
388 $tpl->setVariable(
"SRC_DOWN", $this->
symbol()->glyph(
"down")->render());
389 $tpl->parseCurrentBlock();
409 return str_replace(
"\x0B",
"", $a_text);
418 if ($str != $a_str) {
429 return $this->getFieldId();
437 return $this->getFieldId();
446 $t = $this->
refinery->kindlyTo()->int();
447 return (
int) ($this->getRequestParam($key, $t) ?? 0);
453 if (!$this->isRequestParamArray($key)) {
456 $t = $this->
refinery->custom()->transformation(
462 return [$k, (
int) $v];
472 return (array) ($this->getRequestParam($key, $t) ?? []);
476 protected function str($key): string
481 $t = $this->
refinery->kindlyTo()->string();
482 return $this->stripSlashesAddSpaceFallback(
483 (
string) ($this->getRequestParam($key, $t) ??
"")
488 protected function raw($key)
490 $t = $this->
refinery->custom()->transformation(
function ($v) {
493 return $this->getRequestParam($key, $t);
499 if (!$this->isRequestParamArray($key)) {
502 $t = $this->
refinery->custom()->transformation(
511 return [$k, $this->stripSlashesAddSpaceFallback((
string) $v)];
521 return (array) ($this->getRequestParam($key, $t) ?? []);
527 if (!$this->isRequestParamArray($key)) {
530 $t = $this->
refinery->custom()->transformation(
536 return [$k, (array) $v];
546 return (array) ($this->getRequestParam($key, $t) ?? []);
551 $no_transform = $this->
refinery->identity();
552 $w = $this->
http->wrapper();
553 if ($w->post()->has($key)) {
554 return is_array($w->post()->retrieve($key, $no_transform));
556 if ($w->query()->has($key)) {
557 return is_array($w->query()->retrieve($key, $no_transform));
569 $this->set_params[$key] = $val;
577 if (isset($this->set_params[$key])) {
578 return $this->set_params[$key];
580 $w = $this->
http->wrapper();
581 if ($w->post()->has($key)) {
582 return $w->post()->retrieve($key, $t);
584 if ($w->query()->has($key)) {
585 return $w->query()->retrieve($key, $t);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ilCtrl provides processing control methods.
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface for multi values support.
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))