ILIAS  release_7 Revision v7.30-3-g800a261c036
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
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5
15{
19 protected $ctrl;
20
24 protected $access;
25
26 protected $fallback_mode = false;
27 protected $fallback_lang = "";
28
32 public function __construct(
33 $a_parent_obj,
34 $a_parent_cmd,
35 $a_incl_desc = true,
36 $a_base_cmd = "HeaderTitle",
37 $a_master_lang = "",
38 $a_fallback_mode = false,
39 $a_fallback_lang = ""
40 ) {
41 global $DIC;
42
43 $this->ctrl = $DIC->ctrl();
44 $this->lng = $DIC->language();
45 $this->access = $DIC->access();
46 $ilCtrl = $DIC->ctrl();
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49 $this->incl_desc = $a_incl_desc;
50 $this->base_cmd = $a_base_cmd;
51 $this->master_lang = $a_master_lang;
52 $this->fallback_mode = $a_fallback_mode;
53 $this->fallback_lang = $a_fallback_lang;
54
55 $this->setLimit(9999);
56
57 $this->addColumn("", "", "1");
58 $this->addColumn($this->lng->txt("language"), "", "");
59 $this->addColumn($this->lng->txt("default"), "", "");
60 $this->addColumn($this->lng->txt("title"), "", "");
61 if ($a_incl_desc) {
62 $this->addColumn($this->lng->txt("description"), "", "");
63 }
64
65 $this->setEnableHeader(true);
66 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
67 $this->setRowTemplate("tpl.obj_translation2_row.html", "Services/Object");
68 $this->disable("footer");
69 $this->setEnableTitle(true);
70
71 $this->nr = 0;
72 }
73
77 public function prepareOutput()
78 {
80
81 $this->addMultiCommand("delete" . $this->base_cmd . "s", $lng->txt("remove"));
82 if ($this->fallback_mode) {
83 $this->addMultiCommand("setFallback", $lng->txt("obj_set_fallback_lang"));
84 }
85 if ($this->dataExists()) {
86 $this->addCommandButton("save" . $this->base_cmd . "s", $lng->txt("save"));
87 }
88 }
89
93 protected function fillRow($a_set)
94 {
96
97 $this->nr++;
98
99 if (!$a_set["default"] && $a_set["lang"] != $this->master_lang) {
100 $this->tpl->setCurrentBlock("cb");
101 $this->tpl->setVariable("CB_NR", $this->nr);
102 $this->tpl->parseCurrentBlock();
103 }
104
105 if ($this->master_lang == "") {
106 $this->tpl->setCurrentBlock("rb");
107 $this->tpl->setVariable("RB_NR", $this->nr);
108 if ($a_set["default"]) {
109 $this->tpl->setVariable("DEF_CHECKED", "checked=\"checked\"");
110 }
111 $this->tpl->parseCurrentBlock();
112 } elseif ($a_set["lang"] == $this->master_lang) {
113 $this->tpl->setVariable("MASTER_LANG", $lng->txt("obj_master_lang"));
114 }
115 if ($this->master_lang != "" && $a_set["lang"] == $this->fallback_lang) {
116 $this->tpl->setVariable("FALLBACK_LANG", $lng->txt("obj_fallback_lang"));
117 }
118
119 if ($this->incl_desc) {
120 $this->tpl->setCurrentBlock("desc_row");
121 $this->tpl->setVariable("VAL_DESC", ilUtil::prepareFormOutput($a_set["desc"]));
122 $this->tpl->setVariable("DNR", $this->nr);
123 $this->tpl->parseCurrentBlock();
124 }
125
126 $this->tpl->setVariable("NR", $this->nr);
127
128 // lang selection
129 include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
130 $languages = ilMDLanguageItem::_getLanguages();
131 $this->tpl->setVariable(
132 "LANG_SELECT",
134 $a_set["lang"],
135 "lang[" . $this->nr . "]",
136 $languages,
137 false,
138 true
139 )
140 );
141
142
143 $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
144 }
145}
An exception for terminatinating execution or to throw for unit testing.
TableGUI class for title/description translations.
__construct( $a_parent_obj, $a_parent_cmd, $a_incl_desc=true, $a_base_cmd="HeaderTitle", $a_master_lang="", $a_fallback_mode=false, $a_fallback_lang="")
Constructor.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
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.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc