ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $this->addColumn($this->lng->txt("last_change"));
36
37 $this->setSelectAllCheckbox("id[]");
38
39 $this->setEnableHeader(true);
40 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
41 $this->setRowTemplate("tpl.lang_list_row_extended.html", "Services/Language");
42 $this->disable("footer");
43 $this->setEnableTitle(true);
44
45 $this->addMultiCommand("confirmRefreshSelected", $lng->txt("refresh"));
46 $this->addMultiCommand("install", $lng->txt("install"));
47 $this->addMultiCommand("installLocal", $lng->txt("install_local"));
48 $this->addMultiCommand("confirmUninstall", $lng->txt("uninstall"));
49 $this->addMultiCommand("confirmUninstallChanges", $lng->txt("lang_uninstall_changes"));
50 $this->addMultiCommand("setSystemLanguage", $lng->txt("setSystemLanguage"));
51 $this->addMultiCommand("setUserLanguage", $lng->txt("setUserLanguage"));
52 $this->getItems();
53 }
54
58 function getItems()
59 {
60 $languages = $this->folder->getLanguages();
61 $data = array();
62 foreach ($languages as $k => $l)
63 {
64 $data[] = array_merge($l, array("key" => $k));
65 }
66
67 // sort alphabetically but shoe installed languages first
68 $data = ilUtil::stableSortArray($data, 'name', 'asc', false);
69 $data = ilUtil::stableSortArray($data, 'desc', 'asc', false);
70
71 $this->setData($data);
72 }
73
74
78 protected function fillRow($a_set)
79 {
80 global $lng, $rbacsystem, $ilCtrl, $ilSetting;
81
82 // set status info (in use or systemlanguage)
83 if ($a_set["status"])
84 {
85 $status = "<span class=\"small\"> (".$lng->txt($a_set["status"]).")</span>";
86 }
87
88 // set remark color
89 switch ($a_set["info"])
90 {
91 case "file_not_found":
92 $remark = "<span class=\"smallred\"> ".$lng->txt($a_set["info"])."</span>";
93 break;
94 case "new_language":
95 //$remark = "<span class=\"smallgreen\"> ".$lng->txt($a_set["info"])."</span>";
96 break;
97 default:
98 $remark = "";
99 break;
100 }
101
102 // show page translation
103 if($ilSetting->get("lang_translate_". $a_set['key'], false))
104 {
105 $remark .= $remark ? '<br />' : '';
106 $remark .= "<span class=\"smallgreen\"> ".$lng->txt('language_translation_enabled')."</span>";
107 }
108
109 if ($a_set["desc"] != "not_installed")
110 {
111 $this->tpl->setVariable("LAST_REFRESH",
112 ilDatePresentation::formatDate(new ilDateTime($a_set["last_update"],IL_CAL_DATETIME)));
113
114 $last_change = ilObjLanguage::_getLastLocalChange($a_set['key']);
115 $this->tpl->setVariable("LAST_CHANGE",
117 }
118
119 $this->tpl->setVariable("NR_OF_USERS", ilObjLanguage::countUsers($a_set["key"]));
120
121 // make language name clickable
122 if ($rbacsystem->checkAccess("write",$this->folder->getRefId()))
123 {
124 if (substr($a_set["description"],0,9) == "installed")
125 {
126 $ilCtrl->setParameterByClass("ilobjlanguageextgui", "obj_id", $a_set["obj_id"]);
127 $url = $ilCtrl->getLinkTargetByClass("ilobjlanguageextgui", "");
128 $a_set["name"] = '<a href="'.$url.'">'.$a_set["name"].'</a>';
129 }
130 }
131
132 $this->tpl->setVariable("VAL_LANGUAGE", $a_set["name"].$status);
133 $this->tpl->setVariable("VAL_STATUS", $lng->txt($a_set["desc"])."<br/>".$remark);
134 $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
135 }
136
137}
138?>
global $l
Definition: afr.php:30
An exception for terminatinating execution or to throw for unit testing.
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.
static _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)
$languages
Definition: cssgen2.php:34
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
global $ilSetting
Definition: privfeed.php:17
$url
Definition: shib_logout.php:72