ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMultilingualismTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
19  protected $ctrl;
20 
24  protected $access;
25 
26 
30  public function __construct(
31  $a_parent_obj,
32  $a_parent_cmd,
33  $a_incl_desc = true,
34  $a_base_cmd = "HeaderTitle",
35  $a_master_lang = ""
36  ) {
37  global $DIC;
38 
39  $this->ctrl = $DIC->ctrl();
40  $this->lng = $DIC->language();
41  $this->access = $DIC->access();
42  $ilCtrl = $DIC->ctrl();
43 
44  parent::__construct($a_parent_obj, $a_parent_cmd);
45  $this->incl_desc = $a_incl_desc;
46  $this->base_cmd = $a_base_cmd;
47  $this->master_lang = $a_master_lang;
48 
49  $this->setLimit(9999);
50 
51  $this->addColumn("", "", "1");
52  $this->addColumn($this->lng->txt("language"), "", "");
53  $this->addColumn($this->lng->txt("default"), "", "");
54  $this->addColumn($this->lng->txt("title"), "", "");
55  if ($a_incl_desc) {
56  $this->addColumn($this->lng->txt("description"), "", "");
57  }
58  // $this->addColumn($this->lng->txt("actions"), "", "");
59 
60  $this->setEnableHeader(true);
61  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
62  $this->setRowTemplate("tpl.obj_translation2_row.html", "Services/Object");
63  $this->disable("footer");
64  $this->setEnableTitle(true);
65 
66  $this->nr = 0;
67  }
68 
72  public function prepareOutput()
73  {
74  $lng = $this->lng;
75 
76  $this->addMultiCommand("delete" . $this->base_cmd . "s", $lng->txt("remove"));
77  if ($this->dataExists()) {
78  $this->addCommandButton("save" . $this->base_cmd . "s", $lng->txt("save"));
79  }
80  }
81 
85  protected function fillRow($a_set)
86  {
87  $lng = $this->lng;
88 
89  $this->nr++;
90 
91 
92  if (!$a_set["default"] && $a_set["lang"] != $this->master_lang) {
93  $this->tpl->setCurrentBlock("cb");
94  $this->tpl->setVariable("CB_NR", $this->nr);
95  $this->tpl->parseCurrentBlock();
96  }
97 
98  if ($this->master_lang == "") {
99  $this->tpl->setCurrentBlock("rb");
100  $this->tpl->setVariable("RB_NR", $this->nr);
101  if ($a_set["default"]) {
102  $this->tpl->setVariable("DEF_CHECKED", "checked=\"checked\"");
103  }
104  $this->tpl->parseCurrentBlock();
105  } elseif ($a_set["lang"] == $this->master_lang) {
106  $this->tpl->setVariable("MASTER_LANG", $lng->txt("obj_master_lang"));
107  }
108 
109  if ($this->incl_desc) {
110  $this->tpl->setCurrentBlock("desc_row");
111  $this->tpl->setVariable("VAL_DESC", ilUtil::prepareFormOutput($a_set["desc"]));
112  $this->tpl->setVariable("DNR", $this->nr);
113  $this->tpl->parseCurrentBlock();
114  }
115 
116  $this->tpl->setVariable("NR", $this->nr);
117 
118  // lang selection
119  include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
120  $languages = ilMDLanguageItem::_getLanguages();
121  $this->tpl->setVariable(
122  "LANG_SELECT",
124  $a_set["lang"],
125  "lang[" . $this->nr . "]",
126  $languages,
127  false,
128  true
129  )
130  );
131 
132 
133  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
134  }
135 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
__construct( $a_parent_obj, $a_parent_cmd, $a_incl_desc=true, $a_base_cmd="HeaderTitle", $a_master_lang="")
Constructor.
TableGUI class for title/description translations.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.
setLimit($a_limit=0, $a_default_limit=0)