ILIAS  Release_4_4_x_branch Revision 61816
 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->setDefaultOrderField("name");
40  $this->setSelectAllCheckbox("id[]");
41 
42  $this->setEnableHeader(true);
43  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
44  if ($ilSetting->get("lang_ext_maintenance"))
45  {
46  $this->setRowTemplate("tpl.lang_list_row_extended.html", "Services/Language");
47  }
48  else
49  {
50  $this->setRowTemplate("tpl.lang_list_row.html", "Services/Language");
51  }
52  $this->disable("footer");
53  $this->setEnableTitle(true);
54 
55  $this->addMultiCommand("install", $lng->txt("install"));
56  $this->addMultiCommand("installLocal", $lng->txt("install_local"));
57  $this->addMultiCommand("uninstall", $lng->txt("uninstall"));
58  if ($ilSetting->get("lang_ext_maintenance") == "1")
59  {
60  $this->addMultiCommand("confirmRefreshSelected", $lng->txt("refresh"));
61  }
62  else
63  {
64  $this->addMultiCommand("RefreshSelected", $lng->txt("refresh"));
65  }
66  $this->addMultiCommand("setSystemLanguage", $lng->txt("setSystemLanguage"));
67  $this->addMultiCommand("setUserLanguage", $lng->txt("setUserLanguage"));
68  $this->getItems();
69  }
70 
74  function getItems()
75  {
76  $languages = $this->folder->getLanguages();
77  $data = array();
78  foreach ($languages as $k => $l)
79  {
80  $data[] = array_merge($l, array("key" => $k));
81  }
82 
83  $this->setData($data);
84  }
85 
86 
90  protected function fillRow($a_set)
91  {
92  global $lng, $rbacsystem, $ilCtrl, $ilSetting;
93 
94  // set status info (in use or systemlanguage)
95  if ($a_set["status"])
96  {
97  $status = "<span class=\"small\"> (".$lng->txt($a_set["status"]).")</span>";
98  }
99 
100  // set remark color
101  switch ($a_set["info"])
102  {
103  case "file_not_found":
104  $remark = "<span class=\"smallred\"> ".$lng->txt($a_set["info"])."</span>";
105  break;
106  case "new_language":
107  //$remark = "<span class=\"smallgreen\"> ".$lng->txt($a_set["info"])."</span>";
108  break;
109  default:
110  $remark = "";
111  break;
112  }
113 
114  // show page translation
115  if($ilSetting->get("lang_ext_maintenance")
116  and $ilSetting->get("lang_translate_". $a_set['key'], false))
117  {
118  $remark .= $remark ? '<br />' : '';
119  $remark .= "<span class=\"smallgreen\"> ".$lng->txt('language_translation_enabled')."</span>";
120  }
121 
122  // make language name clickable
123  if ($rbacsystem->checkAccess("write", $this->folder->getRefId()))
124  {
125  if ($ilSetting->get("lang_ext_maintenance") == "1")
126  {
127  if (substr($lang_data["description"],0,9) == "installed")
128  {
129  $ilCtrl->setParameterByClass("ilobjlanguageextgui","obj_id",$a_set["obj_id"]);
130  $url = $ilCtrl->getLinkTargetByClass("ilobjlanguageextgui","");
131  $a_set["name"] = '<a href="'.$url.'">'.$a_set["name"].'</a>';
132  }
133  }
134  }
135 
136  if ($a_set["desc"] != "not_installed")
137  {
138  $this->tpl->setVariable("LAST_REFRESH",
139  ilDatePresentation::formatDate(new ilDateTime($a_set["last_update"],IL_CAL_DATETIME)));
140 
141  if ($ilSetting->get("lang_ext_maintenance"))
142  {
143  $last_change = ilObjLanguage::_getLastLocalChange($a_set['key']);
144  $this->tpl->setVariable("LAST_CHANGE",
146  }
147  }
148 
149  $this->tpl->setVariable("NR_OF_USERS", ilObjLanguage::countUsers($a_set["key"]));
150 
151  // make language name clickable
152  if ($rbacsystem->checkAccess("write",$this->folder->getRefId()))
153  {
154  if ($ilSetting->get("lang_ext_maintenance") == "1")
155  {
156  if (substr($a_set["description"],0,9) == "installed")
157  {
158  $ilCtrl->setParameterByClass("ilobjlanguageextgui", "obj_id", $a_set["obj_id"]);
159  $url = $ilCtrl->getLinkTargetByClass("ilobjlanguageextgui", "");
160  $a_set["name"] = '<a href="'.$url.'">'.$a_set["name"].'</a>';
161  }
162  }
163  }
164 
165  $this->tpl->setVariable("VAL_LANGUAGE", $a_set["name"].$status);
166  $this->tpl->setVariable("VAL_STATUS", $lng->txt($a_set["desc"])."<br/>".$remark);
167  $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
168  }
169 
170 }
171 ?>