102 $this->lang_key = ($a_lang_key) ? $a_lang_key : $this->lang_default;
103 $this->lang_path = ILIAS_ABSOLUTE_PATH .
"/lang";
104 $this->cust_lang_path = ILIAS_ABSOLUTE_PATH .
"/Customizing/global/lang";
107 $txt =
file($this->lang_path .
"/setup_lang_sel_multi.lang");
110 if (is_array(
$txt)) {
112 if ($row[0] !=
"#") {
113 $a = explode($this->separator, trim($row));
114 $this->text[trim($a[0])] = trim($a[1]);
120 $txt =
file($this->lang_path .
"/setup_" . $this->lang_key .
".lang");
123 if (is_array(
$txt)) {
125 if ($row[0] !=
"#") {
126 $a = explode($this->separator, trim($row));
127 $this->text[trim($a[0])] = trim($a[1]);
145 public function txt($a_topic)
149 if (empty($a_topic)) {
153 $translation = $this->text[$a_topic];
156 $pos = strpos($translation, $this->comment_separator);
158 if ($pos !==
false) {
160 $translation = substr($translation, 0, $pos);
163 if ($translation ==
"") {
164 $log->writeLanguageLog($a_topic, $this->lang_key);
165 return "-" . $a_topic .
"-";
180 $d = dir($this->lang_path);
182 chdir($this->lang_path);
185 while ($entry =
$d->read()) {
186 if (is_file($entry) && (preg_match(
'/(^setup_.{2}\.lang$)/', $entry))) {
207 if (empty($a_lang_keys)) {
208 $a_lang_keys =
array();
211 if (empty($a_local_keys)) {
212 $a_local_keys =
array();
224 if (in_array($lang_key, $a_local_keys)) {
233 if (!array_key_exists($lang_key, $db_langs)) {
234 if (in_array($lang_key, $a_local_keys)) {
235 $itype =
'installed_local';
237 $itype =
'installed';
239 $lid = $ilDB->nextId(
"object_data");
240 $query =
"INSERT INTO object_data " .
241 "(obj_id,type,title,description,owner,create_date,last_update) " .
244 $ilDB->quote($lid,
"integer") .
"," .
245 $ilDB->quote(
"lng",
"text") .
"," .
246 $ilDB->quote($lang_key,
"text") .
"," .
247 $ilDB->quote($itype,
"text") .
"," .
248 $ilDB->quote(
'-1',
"integer") .
"," .
252 $this->db->manipulate(
$query);
259 foreach ($db_langs as
$key => $val) {
260 if (!in_array(
$key, $err_lang)) {
261 if (in_array(
$key, $a_lang_keys)) {
262 if (in_array(
$key, $a_local_keys)) {
263 $ld =
'installed_local';
267 $query =
"UPDATE object_data SET " .
268 "description = " . $ilDB->quote($ld,
"text") .
", " .
269 "last_update = " . $ilDB->now() .
" " .
270 "WHERE obj_id = " . $ilDB->quote($val[
"obj_id"],
"integer") .
" " .
271 "AND type = " . $ilDB->quote(
"lng",
"text");
272 $ilDB->manipulate(
$query);
276 if (substr($val[
"status"], 0, 9) ==
"installed") {
277 $query =
"UPDATE object_data SET " .
278 "description = " . $ilDB->quote(
"not_installed",
"text") .
", " .
279 "last_update = " . $ilDB->now() .
" " .
280 "WHERE obj_id = " . $ilDB->quote($val[
"obj_id"],
"integer") .
" " .
281 "AND type = " . $ilDB->quote(
"lng",
"text");
282 $ilDB->manipulate(
$query);
288 return ($err_lang) ? $err_lang :
true;
304 $query =
"SELECT * FROM object_data " .
305 "WHERE type = " . $ilDB->quote(
"lng",
"text") .
" " .
306 "AND " . $ilDB->like(
"description",
"text",
'installed%');
309 while (
$row = $ilDB->fetchObject(
$r)) {
310 $arr[] =
$row->title;
327 $query =
"SELECT * FROM object_data " .
328 "WHERE type = " . $ilDB->quote(
"lng",
"text") .
" " .
329 "AND description = " . $ilDB->quote(
'installed_local',
"text");
332 while (
$row = $ilDB->fetchObject(
$r)) {
333 $arr[] =
$row->title;
349 $query =
"SELECT * FROM object_data " .
350 "WHERE type = " . $ilDB->quote(
"lng",
"text");
353 while (
$row = $ilDB->fetchObject(
$r)) {
354 $arr[
$row->title][
"obj_id"] =
$row->obj_id;
355 $arr[
$row->title][
"status"] =
$row->description;
374 if (!empty($scope)) {
375 if ($scope ==
'global') {
378 $scopeExtension =
'.' . $scope;
383 if ($scope ==
"local") {
384 $path = $this->cust_lang_path;
391 $lang_file =
"ilias_" . $a_lang_key .
".lang" . $scopeExtension;
394 if (!is_file($lang_file)) {
406 foreach ($content as
$key => $val) {
407 $separated = explode($this->separator, trim($val));
408 $num = count($separated);
434 foreach ($content as
$key => $val) {
435 if (trim($val) ==
"<!-- language file start -->") {
436 return array_slice($content,
$key +1);
455 if ($a_mode ==
'all') {
456 $ilDB->manipulate(
"DELETE FROM lng_modules WHERE lang_key = " .
457 $ilDB->quote($a_lang_key,
"text"));
470 if (!$a_keep_local_change) {
471 $ilDB->manipulate(
"DELETE FROM lng_data WHERE lang_key = " .
472 $ilDB->quote($a_lang_key,
"text"));
474 $ilDB->manipulate(
"DELETE FROM lng_data WHERE lang_key = " .
475 $ilDB->quote($a_lang_key,
"text") .
476 " AND local_change IS NULL");
491 if ($a_min_date ==
"") {
492 $a_min_date =
"1980-01-01 00:00:00";
494 if ($a_max_date ==
"") {
495 $a_max_date =
"2200-01-01 00:00:00";
499 "SELECT * FROM lng_data WHERE lang_key = %s " .
500 "AND local_change >= %s AND local_change <= %s",
501 $ilDB->quote($a_lang_key,
"text"),
502 $ilDB->quote($a_min_date,
"timestamp"),
503 $ilDB->quote($a_max_date,
"timestamp")
509 $changes[
$row[
"module"]][
$row[
"identifier"]] = $row[
"value"];
527 $lang_array =
array();
529 if (!empty($scope)) {
530 if ($scope ==
'global') {
533 $scopeExtension =
'.' . $scope;
538 if ($scope ==
"local") {
539 $path = $this->cust_lang_path;
545 $lang_file =
"ilias_" .
$lang_key .
".lang" . $scopeExtension;
549 $lang_array =
array();
550 $lang_array[
"common"] =
array();
557 } elseif ($scope ==
'local') {
558 $change_date =
date(
"Y-m-d H:i:s",
time());
559 $min_date =
date(
"Y-m-d H:i:s", filemtime($lang_file));
563 foreach ($content as
$key => $val) {
564 $separated = explode($this->separator, trim($val));
567 $pos = strpos($separated[2], $this->comment_separator);
569 if ($pos !==
false) {
571 $separated[2] = substr($separated[2], 0, $pos);
575 $local_value = $local_changes[$separated[0]][$separated[1]];
578 if ($local_value !=
"" and $local_value != $separated[2]) {
580 $lang_array[$separated[0]][$separated[1]] = $local_value;
591 $lang_array[$separated[0]][$separated[1]] = $separated[2];
593 } elseif ($scope ==
'local') {
594 if ($local_value !=
"") {
596 $lang_array[$separated[0]][$separated[1]] = $local_value;
606 $lang_array[$separated[0]][$separated[1]] = $separated[2];
612 foreach ($lang_array as
$module => $lang_arr) {
613 if ($scope ==
"local") {
614 $q =
"SELECT * FROM lng_modules WHERE " .
615 " lang_key = " .
$ilDB->quote($this->key,
"text") .
617 $set =
$ilDB->query($q);
619 $arr2 = unserialize(
$row[
"lang_array"]);
620 if (is_array($arr2)) {
621 $lang_arr = array_merge($arr2, $lang_arr);
638 $ilDB->manipulate(sprintf(
639 "DELETE FROM lng_modules WHERE lang_key = %s AND module = %s",
640 $ilDB->quote($a_key,
"text"),
641 $ilDB->quote($a_module,
"text")
647 $ilDB->insert(
"lng_modules",
array(
648 "lang_key" =>
array(
"text", $a_key),
649 "module" =>
array(
"text", $a_module),
650 "lang_array" =>
array(
"clob", serialize($a_array))
662 $a_local_change = null
666 $ilDB->manipulate(sprintf(
667 "DELETE FROM lng_data WHERE module = %s AND " .
668 "identifier = %s AND lang_key = %s",
669 $ilDB->quote($a_module,
"text"),
670 $ilDB->quote($a_identifier,
"text"),
671 $ilDB->quote($a_lang_key,
"text")
676 $ilDB->manipulate(sprintf(
677 "INSERT INTO lng_data " .
678 "(module, identifier, lang_key, value, local_change) " .
679 "VALUES (%s,%s,%s,%s,%s)",
680 $ilDB->quote($a_module,
"text"),
681 $ilDB->quote($a_identifier,
"text"),
682 $ilDB->quote($a_lang_key,
"text"),
683 $ilDB->quote($a_value,
"text"),
684 $ilDB->quote($a_local_change,
"timestamp")
696 $a_local_change = null
700 $ilDB->manipulate(sprintf(
702 "SET value = %s, local_change = %s " .
703 "WHERE module = %s AND identifier = %s AND lang_key = %s ",
704 $ilDB->quote($a_value,
"text"),
705 $ilDB->quote($a_local_change,
"timestamp"),
706 $ilDB->quote($a_module,
"text"),
707 $ilDB->quote($a_identifier,
"text"),
708 $ilDB->quote($a_lang_key,
"text")
719 $local_langs =
array();
720 if (is_dir($this->cust_lang_path)) {
721 $d = dir($this->cust_lang_path);
723 chdir($this->cust_lang_path);
726 while ($entry =
$d->read()) {
727 if (is_file($entry) && (preg_match(
"~(^ilias_.{2}\.lang.local$)~", $entry))) {
743 $d = dir($this->lang_path);
745 chdir($this->lang_path);
748 while ($entry =
$d->read()) {
749 if (is_file($entry) && (preg_match(
"~(^ilias_.{2}\.lang$)~", $entry))) {
769 if (empty($a_db_handler) or !is_object($a_db_handler)) {
773 $this->db =&$a_db_handler;
static replaceLangModule($a_key, $a_module, $a_array)
Replace language module array.
getAvailableLanguages()
get already registered languages (in db)
txt($a_topic)
gets the text for a given topic
getInstallableLanguages()
static _deleteLangData($a_lang_key, $a_keep_local_change)
Delete languge data.
installLanguages($a_lang_keys, $a_local_keys)
install languages
checkLanguage($a_lang_key, $scope='')
validate the logical structure of a lang-file
getInstalledLocalLanguages()
get already installed local languages (in db)
if($modEnd===false) $module
cut_header($content)
Remove *.lang header information from '$content'.
getLocalChanges($a_lang_key, $a_min_date="", $a_max_date="")
get locally changed language entries
static replaceLangEntry( $a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null)
Replace lang entry.
flushLanguage($a_lang_key, $a_mode='all')
remove language data from database
getLanguages()
get all setup languages in the system
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
__construct($a_lang_key)
Constructor read the single-language file and put this in an array text.
Reload workbook from saved file
setDbHandler($a_db_handler)
set db handler object object db handler
getInstalledLanguages()
get already installed languages (in db)
getLocalLanguages()
Searches for the existence of *.lang.local files.
Create styles array
The data for the language used.
insertLanguage($lang_key, $scope='')
insert language data from file in database
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static updateLangEntry( $a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null)
Update lang entry.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d