ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4include_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->setSelectAllCheckbox("id[]");
40
41 $this->setEnableHeader(true);
42 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
43 if ($ilSetting->get("lang_ext_maintenance"))
44 {
45 $this->setRowTemplate("tpl.lang_list_row_extended.html", "Services/Language");
46 }
47 else
48 {
49 $this->setRowTemplate("tpl.lang_list_row.html", "Services/Language");
50 }
51 $this->disable("footer");
52 $this->setEnableTitle(true);
53
54 if ($ilSetting->get("lang_ext_maintenance") == "1")
55 {
56 $this->addMultiCommand("confirmRefreshSelected", $lng->txt("refresh"));
57 }
58 else
59 {
60 $this->addMultiCommand("RefreshSelected", $lng->txt("refresh"));
61 }
62 $this->addMultiCommand("install", $lng->txt("install"));
63 $this->addMultiCommand("installLocal", $lng->txt("install_local"));
64 $this->addMultiCommand("uninstall", $lng->txt("uninstall"));
65 $this->addMultiCommand("setSystemLanguage", $lng->txt("setSystemLanguage"));
66 $this->addMultiCommand("setUserLanguage", $lng->txt("setUserLanguage"));
67 $this->getItems();
68 }
69
73 function getItems()
74 {
75 $languages = $this->folder->getLanguages();
76 $data = array();
77 foreach ($languages as $k => $l)
78 {
79 $data[] = array_merge($l, array("key" => $k));
80 }
81
82 // sort alphabetically but shoe installed languages first
83 $data = ilUtil::stableSortArray($data, 'name', 'asc', false);
84 $data = ilUtil::stableSortArray($data, 'desc', 'asc', false);
85
86 $this->setData($data);
87 }
88
89
93 protected function fillRow($a_set)
94 {
95 global $lng, $rbacsystem, $ilCtrl, $ilSetting;
96
97 // set status info (in use or systemlanguage)
98 if ($a_set["status"])
99 {
100 $status = "<span class=\"small\"> (".$lng->txt($a_set["status"]).")</span>";
101 }
102
103 // set remark color
104 switch ($a_set["info"])
105 {
106 case "file_not_found":
107 $remark = "<span class=\"smallred\"> ".$lng->txt($a_set["info"])."</span>";
108 break;
109 case "new_language":
110 //$remark = "<span class=\"smallgreen\"> ".$lng->txt($a_set["info"])."</span>";
111 break;
112 default:
113 $remark = "";
114 break;
115 }
116
117 // show page translation
118 if($ilSetting->get("lang_ext_maintenance")
119 and $ilSetting->get("lang_translate_". $a_set['key'], false))
120 {
121 $remark .= $remark ? '<br />' : '';
122 $remark .= "<span class=\"smallgreen\"> ".$lng->txt('language_translation_enabled')."</span>";
123 }
124
125 // make language name clickable
126 if ($rbacsystem->checkAccess("write", $this->folder->getRefId()))
127 {
128 if ($ilSetting->get("lang_ext_maintenance") == "1")
129 {
130 if (substr($lang_data["description"],0,9) == "installed")
131 {
132 $ilCtrl->setParameterByClass("ilobjlanguageextgui","obj_id",$a_set["obj_id"]);
133 $url = $ilCtrl->getLinkTargetByClass("ilobjlanguageextgui","");
134 $a_set["name"] = '<a href="'.$url.'">'.$a_set["name"].'</a>';
135 }
136 }
137 }
138
139 if ($a_set["desc"] != "not_installed")
140 {
141 $this->tpl->setVariable("LAST_REFRESH",
142 ilDatePresentation::formatDate(new ilDateTime($a_set["last_update"],IL_CAL_DATETIME)));
143
144 if ($ilSetting->get("lang_ext_maintenance"))
145 {
146 $last_change = ilObjLanguage::_getLastLocalChange($a_set['key']);
147 $this->tpl->setVariable("LAST_CHANGE",
149 }
150 }
151
152 $this->tpl->setVariable("NR_OF_USERS", ilObjLanguage::countUsers($a_set["key"]));
153
154 // make language name clickable
155 if ($rbacsystem->checkAccess("write",$this->folder->getRefId()))
156 {
157 if ($ilSetting->get("lang_ext_maintenance") == "1")
158 {
159 if (substr($a_set["description"],0,9) == "installed")
160 {
161 $ilCtrl->setParameterByClass("ilobjlanguageextgui", "obj_id", $a_set["obj_id"]);
162 $url = $ilCtrl->getLinkTargetByClass("ilobjlanguageextgui", "");
163 $a_set["name"] = '<a href="'.$url.'">'.$a_set["name"].'</a>';
164 }
165 }
166 }
167
168 $this->tpl->setVariable("VAL_LANGUAGE", $a_set["name"].$status);
169 $this->tpl->setVariable("VAL_STATUS", $lng->txt($a_set["desc"])."<br/>".$remark);
170 $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
171 }
172
173}
174?>
global $l
Definition: afr.php:30
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
fillRow($a_set)
Fill table row.
__construct($a_parent_obj, $a_parent_cmd, $a_folder)
Constructor.
getItems()
Get language data.
static countUsers($a_lang)
Count number of users that use a language.
_getLastLocalChange($a_key)
get the date of the last local change
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
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.
setData($a_data)
set table data @access public
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
static stableSortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false)
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilSetting
Definition: privfeed.php:40
$url
Definition: shib_logout.php:72