ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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{
17 protected $folder;
21 public function __construct($a_parent_obj, $a_parent_cmd, $a_folder)
22 {
23 global $DIC;
24 $ilAccess = $DIC->access();
25
26 $this->folder = $a_folder;
27
28 parent::__construct($a_parent_obj, $a_parent_cmd);
29 $this->setLimit(9999);
30
31 if ($ilAccess->checkAccess('write', '', $this->folder->getRefId())) {
32 $this->addColumn("", "", "1", 1);
33 }
34 $this->addColumn($this->lng->txt("language"));
35 $this->addColumn($this->lng->txt("status"));
36 $this->addColumn($this->lng->txt("users"));
37 $this->addColumn($this->lng->txt("last_refresh"));
38 $this->addColumn($this->lng->txt("last_change"));
39
40 $this->setEnableHeader(true);
41 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
42 $this->setRowTemplate("tpl.lang_list_row_extended.html", "Services/Language");
43 $this->disable("footer");
44 $this->setEnableTitle(true);
45
46 if ($ilAccess->checkAccess('write', '', $this->folder->getRefId())) {
47 $this->setSelectAllCheckbox("id[]");
48 $this->addMultiCommand("confirmRefreshSelected", $this->lng->txt("refresh"));
49 $this->addMultiCommand("install", $this->lng->txt("install"));
50 $this->addMultiCommand("installLocal", $this->lng->txt("install_local"));
51 $this->addMultiCommand("confirmUninstall", $this->lng->txt("uninstall"));
52 $this->addMultiCommand("confirmUninstallChanges", $this->lng->txt("lang_uninstall_changes"));
53 $this->addMultiCommand("setSystemLanguage", $this->lng->txt("setSystemLanguage"));
54 $this->addMultiCommand("setUserLanguage", $this->lng->txt("setUserLanguage"));
55 }
56
57 $this->getItems();
58 }
59
63 public function getItems()
64 {
65 $languages = $this->folder->getLanguages();
66 $data = array();
67 foreach ($languages as $k => $l) {
68 $data[] = array_merge($l, array("key" => $k));
69 }
70
71 // sort alphabetically but shoe installed languages first
72 $data = ilUtil::stableSortArray($data, 'name', 'asc', false);
73 $data = ilUtil::stableSortArray($data, 'desc', 'asc', false);
74
75 $this->setData($data);
76 }
77
78
82 protected function fillRow($a_set)
83 {
84 global $DIC;
85 $ilSetting = $DIC->settings();
86 $ilAccess = $DIC->access();
87
88 // set status info (in use or systemlanguage)
89 if ($a_set["status"]) {
90 $status = "<span class=\"small\"> (" . $this->lng->txt($a_set["status"]) . ")</span>";
91 }
92
93 // set remark color
94 switch ($a_set["info"]) {
95 case "file_not_found":
96 $remark = "<span class=\"smallred\"> " . $this->lng->txt($a_set["info"]) . "</span>";
97 break;
98 case "new_language":
99 //$remark = "<span class=\"smallgreen\"> ".$lng->txt($a_set["info"])."</span>";
100 break;
101 default:
102 $remark = "";
103 break;
104 }
105
106 // show page translation
107 if ($ilSetting->get("lang_translate_" . $a_set['key'], false)) {
108 $remark .= $remark ? '<br />' : '';
109 $remark .= "<span class=\"smallgreen\"> " . $this->lng->txt('language_translation_enabled') . "</span>";
110 }
111
112 if ($a_set["desc"] != "not_installed") {
113 $this->tpl->setVariable(
114 "LAST_REFRESH",
116 );
117
118 $last_change = ilObjLanguage::_getLastLocalChange($a_set['key']);
119 $this->tpl->setVariable(
120 "LAST_CHANGE",
122 );
123 }
124
125 $this->tpl->setVariable("NR_OF_USERS", ilObjLanguage::countUsers($a_set["key"]));
126
127 // make language name clickable
128 if ($ilAccess->checkAccess("write", "", $this->folder->getRefId())) {
129 if (substr($a_set["description"], 0, 9) == "installed") {
130 $this->ctrl->setParameterByClass("ilobjlanguageextgui", "obj_id", $a_set["obj_id"]);
131 $url = $this->ctrl->getLinkTargetByClass("ilobjlanguageextgui", "");
132 $a_set["name"] = '<a href="' . $url . '">' . $a_set["name"] . '</a>';
133 }
134 }
135
136 $this->tpl->setVariable("VAL_LANGUAGE", $a_set["name"] . $status);
137 $this->tpl->setVariable("VAL_STATUS", $this->lng->txt($a_set["desc"]) . "<br/>" . $remark);
138
139 if ($ilAccess->checkAccess('write', '', $this->folder->getRefId())) {
140 $this->tpl->setVariable("OBJ_ID", $a_set["obj_id"]);
141 }
142 }
143}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
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.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
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.
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.
disable($a_module_name)
diesables particular modules of table
static stableSortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
$url
$DIC
Definition: xapitoken.php:46