ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjectTranslation2TableGUI.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 {
16 
20  function __construct($a_parent_obj, $a_parent_cmd, $a_incl_desc = true, $a_base_cmd = "HeaderTitle",
21  $a_master_lang = "")
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng;
24 
25  parent::__construct($a_parent_obj, $a_parent_cmd);
26  $this->incl_desc = $a_incl_desc;
27  $this->base_cmd = $a_base_cmd;
28  $this->master_lang = $a_master_lang;
29 
30  $this->setLimit(9999);
31 
32  $this->addColumn("", "", "1");
33  $this->addColumn($this->lng->txt("language"), "", "");
34  $this->addColumn($this->lng->txt("default"), "", "");
35  $this->addColumn($this->lng->txt("title"), "", "");
36  if ($a_incl_desc)
37  {
38  $this->addColumn($this->lng->txt("description"), "", "");
39  }
40 // $this->addColumn($this->lng->txt("actions"), "", "");
41 
42  $this->setEnableHeader(true);
43  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
44  $this->setRowTemplate("tpl.obj_translation2_row.html", "Services/Object");
45  $this->disable("footer");
46  $this->setEnableTitle(true);
47 
48  $this->nr = 0;
49  }
50 
54  function prepareOutput()
55  {
56  global $lng;
57 
58  $this->addMultiCommand("delete".$this->base_cmd."s", $lng->txt("remove"));
59  if ($this->dataExists())
60  {
61  $this->addCommandButton("save".$this->base_cmd."s", $lng->txt("save"));
62  }
63  }
64 
68  protected function fillRow($a_set)
69  {
70  global $lng;
71 
72  $this->nr++;
73 
74 
75  if (!$a_set["default"] && $a_set["lang"] != $this->master_lang)
76  {
77  $this->tpl->setCurrentBlock("cb");
78  $this->tpl->setVariable("CB_NR", $this->nr);
79  $this->tpl->parseCurrentBlock();
80  }
81 
82  if ($this->master_lang == "")
83  {
84  $this->tpl->setCurrentBlock("rb");
85  $this->tpl->setVariable("RB_NR", $this->nr);
86  if ($a_set["default"])
87  {
88  $this->tpl->setVariable("DEF_CHECKED", "checked=\"checked\"");
89  }
90  $this->tpl->parseCurrentBlock();
91  }
92  else if ($a_set["lang"] == $this->master_lang)
93  {
94  $this->tpl->setVariable("MASTER_LANG", $lng->txt("obj_master_lang"));
95  }
96 
97  if ($this->incl_desc)
98  {
99  $this->tpl->setCurrentBlock("desc_row");
100  $this->tpl->setVariable("VAL_DESC", ilUtil::prepareFormOutput($a_set["desc"]));
101  $this->tpl->setVariable("DNR", $this->nr);
102  $this->tpl->parseCurrentBlock();
103  }
104 
105  $this->tpl->setVariable("NR", $this->nr);
106 
107  // lang selection
108  include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
109  $languages = ilMDLanguageItem::_getLanguages();
110  $this->tpl->setVariable("LANG_SELECT",
111  ilUtil::formSelect($a_set["lang"], "lang[".$this->nr."]", $languages,
112  false, true));
113 
114 
115  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
116  }
117 
118 }
119 ?>