ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLanguageTableGUI.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_folder)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng, $ilSetting;
23 
24  $this->folder = $a_folder;
25 
26  parent::__construct($a_parent_obj, $a_parent_cmd);
27 // $this->setTitle($lng->txt(""));
28  $this->setLimit(9999);
29 
30  $this->addColumn("", "", "1", 1);
31  $this->addColumn($this->lng->txt("language"));
32  $this->addColumn($this->lng->txt("status"));
33  $this->addColumn($this->lng->txt("users"));
34  $this->addColumn($this->lng->txt("last_refresh"));
35  if ($ilSetting->get("lang_ext_maintenance"))
36  {
37  $this->addColumn($this->lng->txt("last_change"));
38  }
39  $this->addColumn($this->lng->txt("usr_agreement"));
40  $this->setDefaultOrderField("name");
41  $this->setSelectAllCheckbox("id[]");
42 
43  $this->setEnableHeader(true);
44  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
45  if ($ilSetting->get("lang_ext_maintenance"))
46  {
47  $this->setRowTemplate("tpl.lang_list_row_extended.html", "Services/Language");
48  }
49  else
50  {
51  $this->setRowTemplate("tpl.lang_list_row.html", "Services/Language");
52  }
53  $this->disable("footer");
54  $this->setEnableTitle(true);
55 
56  $this->addMultiCommand("install", $lng->txt("install"));
57  $this->addMultiCommand("installLocal", $lng->txt("install_local"));
58  $this->addMultiCommand("uninstall", $lng->txt("uninstall"));
59  if ($ilSetting->get("lang_ext_maintenance") == "1")
60  {
61  $this->addMultiCommand("confirmRefreshSelected", $lng->txt("refresh"));
62  }
63  else
64  {
65  $this->addMultiCommand("RefreshSelected", $lng->txt("refresh"));
66  }
67  $this->addMultiCommand("setSystemLanguage", $lng->txt("setSystemLanguage"));
68  $this->addMultiCommand("setUserLanguage", $lng->txt("setUserLanguage"));
69  $this->getItems();
70  }
71 
75  function getItems()
76  {
77  $languages = $this->folder->getLanguages();
78  $data = array();
79  foreach ($languages as $k => $l)
80  {
81  $data[] = array_merge($l, array("key" => $k));
82  }
83 
84  $this->setData($data);
85  }
86 
87 
91  protected function fillRow($a_set)
92  {
93  global $lng, $rbacsystem, $ilCtrl, $ilSetting;
94 
95  // set status info (in use or systemlanguage)
96  if ($a_set["status"])
97  {
98  $status = "<span class=\"small\"> (".$lng->txt($a_set["status"]).")</span>";
99  }
100 
101  // set remark color
102  switch ($a_set["info"])
103  {
104  case "file_not_found":
105  $remark = "<span class=\"smallred\"> ".$lng->txt($a_set["info"])."</span>";
106  break;
107  case "new_language":
108  //$remark = "<span class=\"smallgreen\"> ".$lng->txt($a_set["info"])."</span>";
109  break;
110  default:
111  $remark = "";
112  break;
113  }
114 
115  // show page translation
116  if($ilSetting->get("lang_ext_maintenance")
117  and $ilSetting->get("lang_translate_". $a_set['key'], false))
118  {
119  $remark .= $remark ? '<br />' : '';
120  $remark .= "<span class=\"smallgreen\"> ".$lng->txt('language_translation_enabled')."</span>";
121  }
122 
123  if (file_exists("./Customizing/clients/".CLIENT_ID."/agreement/".
124  "agreement_".$a_set["key"].".html"))
125  {
126  $agreement_exists_str = $lng->txt("available")." (".$lng->txt("client").")";
127  }
128  else if (file_exists("./Customizing/global/agreement/".
129  "agreement_".$a_set["key"].".html"))
130  {
131  $agreement_exists_str = $lng->txt("available");
132  }
133  else
134  {
135  if ($a_set["status"] == "system_language")
136  {
137  $agreement_exists_str = "<b>".$lng->txt("missing")."</b>";
138  }
139  else
140  {
141  $agreement_exists_str = $lng->txt("missing");
142  }
143  }
144 
145  // make language name clickable
146  if ($rbacsystem->checkAccess("write", $this->folder->getRefId()))
147  {
148  if ($ilSetting->get("lang_ext_maintenance") == "1")
149  {
150  if (substr($lang_data["description"],0,9) == "installed")
151  {
152  $ilCtrl->setParameterByClass("ilobjlanguageextgui","obj_id",$a_set["obj_id"]);
153  $url = $ilCtrl->getLinkTargetByClass("ilobjlanguageextgui","");
154  $a_set["name"] = '<a href="'.$url.'">'.$a_set["name"].'</a>';
155  }
156  }
157  }
158 
159  if ($a_set["desc"] != "not_installed")
160  {
161  $this->tpl->setVariable("LAST_REFRESH",
162  ilDatePresentation::formatDate(new ilDateTime($a_set["last_update"],IL_CAL_DATETIME)));
163 
164  if ($ilSetting->get("lang_ext_maintenance"))
165  {
166  $last_change = ilObjLanguage::_getLastLocalChange($a_set['key']);
167  $this->tpl->setVariable("LAST_CHANGE",
169  }
170  }
171 
172  $this->tpl->setVariable("NR_OF_USERS", ilObjLanguage::countUsers($a_set["key"]));
173 
174  // make language name clickable
175  if ($rbacsystem->checkAccess("write",$this->folder->getRefId()))
176  {
177  if ($ilSetting->get("lang_ext_maintenance") == "1")
178  {
179  if (substr($a_set["description"],0,9) == "installed")
180  {
181  $ilCtrl->setParameterByClass("ilobjlanguageextgui", "obj_id", $a_set["obj_id"]);
182  $url = $ilCtrl->getLinkTargetByClass("ilobjlanguageextgui", "");
183  $a_set["name"] = '<a href="'.$url.'">'.$a_set["name"].'</a>';
184  }
185  }
186  }
187 
188  $this->tpl->setVariable("VAL_LANGUAGE", $a_set["name"].$status);
189  $this->tpl->setVariable("VAL_STATUS", $lng->txt($a_set["desc"])."<br/>".$remark);
190  $this->tpl->setVariable("VAL_USER_AGREEMENT", $agreement_exists_str);
191  $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
192  }
193 
194 }
195 ?>