ILIAS  release_8 Revision v8.24
class.ilObjectTranslationTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
27{
29
30 protected bool $incl_desc;
31 protected string $base_cmd;
32 protected int $nr;
33
34 public function __construct(
35 ?object $parent_obj,
36 string $parent_cmd,
37 bool $incl_desc = true,
38 string $base_cmd = "HeaderTitle"
39 ) {
40 global $DIC;
41 $this->access = $DIC->access();
42
44 $this->incl_desc = $incl_desc;
45 $this->base_cmd = $base_cmd;
46
47 $this->setLimit(9999);
48
49 $this->addColumn("", "", "1");
50 $this->addColumn($this->lng->txt("language"));
51 $this->addColumn($this->lng->txt("default"));
52 $this->addColumn($this->lng->txt("title"));
53 if ($incl_desc) {
54 $this->addColumn($this->lng->txt("description"));
55 }
56
57 $this->setEnableHeader(true);
58 $this->setFormAction($this->ctrl->getFormAction($parent_obj));
59 $this->setRowTemplate("tpl.obj_translation_row.html", "Services/Object");
60 $this->disable("footer");
61 $this->setEnableTitle(true);
62
63 $this->nr = 0;
64 }
65
66 protected function prepareOutput(): void
67 {
68 $this->addMultiCommand("delete" . $this->base_cmd . "s", $this->lng->txt("remove"));
69 if ($this->dataExists()) {
70 $this->addCommandButton("save" . $this->base_cmd . "s", $this->lng->txt("save"));
71 }
72 $this->addCommandButton("add" . $this->base_cmd, $this->lng->txt("add"));
73 }
74
75 protected function fillRow(array $set): void
76 {
77 $this->nr++;
78
79 if ($this->incl_desc) {
80 $this->tpl->setCurrentBlock("desc_row");
81 $this->tpl->setVariable("VAL_DESC", ilLegacyFormElementsUtil::prepareFormOutput($set["desc"]));
82 $this->tpl->setVariable("DNR", $this->nr);
83 $this->tpl->parseCurrentBlock();
84 }
85
86 $this->tpl->setVariable("NR", $this->nr);
87
88 // lang selection
90 $this->tpl->setVariable(
91 "LANG_SELECT",
93 $set["lang"],
94 "lang[" . $this->nr . "]",
95 $languages,
96 false,
97 true
98 )
99 );
100
101 if ($set["default"]) {
102 $this->tpl->setVariable("DEF_CHECKED", "checked=\"checked\"");
103 }
104
105 $this->tpl->setVariable("VAL_TITLE", ilLegacyFormElementsUtil::prepareFormOutput($set["title"]));
106 }
107}
static prepareFormOutput($a_str, bool $a_strip=false)
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareOutput()
Anything that must be done before HTML is generated.
__construct(?object $parent_obj, string $parent_cmd, bool $incl_desc=true, string $base_cmd="HeaderTitle")
fillRow(array $set)
Standard Version of Fill Row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setEnableTitle(bool $a_enabletitle)
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
disable(string $a_module_name)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc