ILIAS  release_8 Revision v8.24
class.ilMultilingualismTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected int $nr;
27 protected string $master_lang;
28 protected string $base_cmd;
29 protected bool $incl_desc;
31
32 public function __construct(
33 object $a_parent_obj,
34 string $a_parent_cmd,
35 bool $a_incl_desc = true,
36 string $a_base_cmd = "HeaderTitle",
37 string $a_master_lang = ""
38 ) {
39 global $DIC;
40
41 $this->ctrl = $DIC->ctrl();
42 $this->lng = $DIC->language();
43 $this->access = $DIC->access();
44 $ilCtrl = $DIC->ctrl();
45
46 parent::__construct($a_parent_obj, $a_parent_cmd);
47 $this->incl_desc = $a_incl_desc;
48 $this->base_cmd = $a_base_cmd;
49 $this->master_lang = $a_master_lang;
50
51 $this->setLimit(9999);
52
53 $this->addColumn("", "", "1");
54 $this->addColumn($this->lng->txt("language"), "", "");
55 $this->addColumn($this->lng->txt("default"), "", "");
56 $this->addColumn($this->lng->txt("title"), "", "");
57 if ($a_incl_desc) {
58 $this->addColumn($this->lng->txt("description"), "", "");
59 }
60 // $this->addColumn($this->lng->txt("actions"), "", "");
61
62 $this->setEnableHeader(true);
63 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
64 $this->setRowTemplate("tpl.obj_translation2_row.html", "Services/Object");
65 $this->disable("footer");
66 $this->setEnableTitle(true);
67
68 $this->nr = 0;
69 }
70
71 protected function prepareOutput(): void
72 {
74
75 $this->addMultiCommand("delete" . $this->base_cmd . "s", $lng->txt("remove"));
76 if ($this->dataExists()) {
77 $this->addCommandButton("save" . $this->base_cmd . "s", $lng->txt("save"));
78 }
79 }
80
81 protected function fillRow(array $a_set): void
82 {
84
85 $this->nr++;
86
87
88 if (!$a_set["default"] && $a_set["lang"] != $this->master_lang) {
89 $this->tpl->setCurrentBlock("cb");
90 $this->tpl->setVariable("CB_NR", $this->nr);
91 $this->tpl->parseCurrentBlock();
92 }
93
94 if ($this->master_lang === "") {
95 $this->tpl->setCurrentBlock("rb");
96 $this->tpl->setVariable("RB_NR", $this->nr);
97 if ($a_set["default"]) {
98 $this->tpl->setVariable("DEF_CHECKED", "checked=\"checked\"");
99 }
100 $this->tpl->parseCurrentBlock();
101 } elseif ($a_set["lang"] == $this->master_lang) {
102 $this->tpl->setVariable("MASTER_LANG", $lng->txt("obj_master_lang"));
103 }
104
105 if ($this->incl_desc) {
106 $this->tpl->setCurrentBlock("desc_row");
107 $this->tpl->setVariable("VAL_DESC", ilLegacyFormElementsUtil::prepareFormOutput($a_set["desc"]));
108 $this->tpl->setVariable("DNR", $this->nr);
109 $this->tpl->parseCurrentBlock();
110 }
111
112 $this->tpl->setVariable("NR", $this->nr);
113
114 // lang selection
115 $languages = ilMDLanguageItem::_getLanguages();
116 $this->tpl->setVariable(
117 "LANG_SELECT",
119 $a_set["lang"],
120 "lang[" . $this->nr . "]",
121 $languages,
122 false,
123 true
124 )
125 );
126
127
128 $this->tpl->setVariable("VAL_TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
129 }
130}
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
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...
fillRow(array $a_set)
Standard Version of Fill Row.
prepareOutput()
Anything that must be done before HTML is generated.
__construct(object $a_parent_obj, string $a_parent_cmd, bool $a_incl_desc=true, string $a_base_cmd="HeaderTitle", string $a_master_lang="")
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.
ilLanguage $lng
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