4 require_once
"./Services/Language/classes/class.ilObjLanguage.php";
22 parent::__construct($a_id, $a_call_by_reference);
31 require_once
"./Services/Language/classes/class.ilLanguageFile.php";
64 return $this->lng->txt($this->desc);
74 if (!is_dir(CLIENT_DATA_DIR.
'/lang_data'))
78 return CLIENT_DATA_DIR.
'/lang_data';
98 return $this->cust_lang_path;
108 return self::_getRemarks($this->key);
121 return self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
136 return self::_getValues($this->key, $a_modules, $a_topics, $a_pattern,
'changed');
151 return self::_getValues($this->key, $a_modules, $a_topics, $a_pattern,
'unchanged');
165 $global_values = $global_file_obj->getAllValues();
166 $local_values = self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
168 return array_diff_key($local_values, $global_values);
186 $global_comments = $global_file_obj->getAllComments();
187 $local_values = self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
189 return array_intersect_key($local_values, $global_comments);
208 $global_values = $global_file_obj->getAllValues();
209 $local_values = self::_getValues($this->key);
211 return array_merge($global_values, $local_values);
229 $global_comments = $global_file_obj->getAllComments();
232 $local_remarks = self::_getRemarks($this->key,
true);
234 return array_merge($global_comments, $local_remarks);
250 require_once
"./Services/Language/classes/class.ilLanguageFile.php";
252 if (!$import_file_obj->read())
254 $ilErr->raiseError($import_file_obj->getErrorMessage(),$ilErr->MESSAGE);
257 switch($a_mode_existing)
277 $ilDB->manipulate(
"DELETE FROM lng_modules WHERE lang_key = ".
278 $ilDB->quote($this->key,
"text"));
288 foreach ($import_file_obj->getAllValues() as
$key => $value)
290 if (!isset($to_keep[$key]))
292 $to_save[
$key] = $value;
295 self::_saveValues($this->key, $to_save, $import_file_obj->getAllComments());
309 $q =
"SELECT DISTINCT module FROM lng_data WHERE ".
310 " lang_key = ".$ilDB->quote($a_lang_key,
"text").
" order by module";
311 $set = $ilDB->query($q);
316 $modules[] = $rec[
"module"];
330 public static function _getRemarks($a_lang_key, $a_all_changed =
false)
334 $q =
"SELECT module, identifier, remarks" 336 .
" WHERE lang_key = ".$ilDB->quote($a_lang_key,
"text");
340 $q .=
" AND (remarks IS NOT NULL OR local_change IS NOT NULL)";
344 $q .=
" AND remarks IS NOT NULL";
352 $remarks[
$row[
"module"].$lng->separator.$row[
"identifier"]] =
$row[
"remarks"];
371 $a_pattern =
'', $a_state =
'')
375 $q =
"SELECT * FROM lng_data WHERE".
376 " lang_key = ".$ilDB->quote($a_lang_key,
"text").
" ";
378 if (is_array($a_modules) && count($a_modules) > 0)
380 $q .=
" AND ".$ilDB->in(
"module", $a_modules,
false,
"text");
382 if (is_array($a_topics) && count($a_topics) > 0)
384 $q .=
" AND ".$ilDB->in(
"identifier", $a_topics,
false,
"text");
388 $q .=
" AND ".$ilDB->like(
"value",
"text",
"%".$a_pattern.
"%");
390 if ($a_state ==
"changed")
392 $q .=
" AND NOT local_change IS NULL ";
394 if ($a_state ==
"unchanged")
396 $q .=
" AND local_change IS NULL ";
398 $q .=
" ORDER BY module, identifier";
400 $set = $ilDB->query($q);
405 $values[$rec[
"module"].$lng->separator.$rec[
"identifier"]] = $rec[
"value"];
425 if (!is_array($a_values))
429 $save_array =
array();
430 $save_date =
date(
"Y-m-d H:i:s",
time());
433 require_once
"./Services/Language/classes/class.ilLanguageFile.php";
435 $global_values = $global_file_obj->getAllValues();
436 $global_comments = $global_file_obj->getAllComments();
439 foreach ($a_values as
$key => $value)
441 $keys = explode($lng->separator,
$key);
442 if (count($keys) == 2)
446 $save_array[$module][$topic] = $value;
448 if ($global_values[
$key] != $value
449 or $global_comments[
$key] != $a_remarks[
$key])
451 $local_change = $save_date;
455 $local_change = null;
459 $a_lang_key, $value, $local_change, $a_remarks[$key]);
464 foreach ($save_array as $module => $entries)
466 $set = $ilDB->query(sprintf(
"SELECT * FROM lng_modules " .
467 "WHERE lang_key = %s AND module = %s",
468 $ilDB->quote($a_lang_key,
"text"), $ilDB->quote($module,
"text")));
469 $row = $ilDB->fetchAssoc($set);
471 $arr = unserialize(
$row[
"lang_array"]);
474 $entries = array_merge($arr, $entries);
476 ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
480 require_once(
'class.ilCachedLanguage.php');
496 if (!is_array($a_values))
500 $delete_array =
array();
503 foreach ($a_values as
$key => $value)
505 $keys = explode($lng->separator,
$key);
506 if (count($keys) == 2)
510 $delete_array[$module][$topic] = $value;
517 foreach ($delete_array as $module => $entries)
519 $set = $ilDB->query(sprintf(
"SELECT * FROM lng_modules " .
520 "WHERE lang_key = %s AND module = %s",
521 $ilDB->quote($a_lang_key,
"text"), $ilDB->quote($module,
"text")));
522 $row = $ilDB->fetchAssoc($set);
524 $arr = unserialize(
$row[
"lang_array"]);
527 $entries = array_diff_key($arr, $entries);
529 ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
getMergedRemarks()
Get the local remarks merged into the remarks of the global language file.
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
getMergedValues()
Get the local values merged into the values of the global language file.
getAllRemarks()
Get all remarks from the database.
static _getRemarks($a_lang_key, $a_all_changed=false)
Get all remarks of a language.
getCustLangPath()
Get the customized language files path.
getAllValues($a_modules=array(), $a_pattern='', $a_topics=array())
Get all values from the database.
static _deleteValues($a_lang_key, $a_values=array())
Delete a set of translation in the database.
getUnchangedValues($a_modules=array(), $a_pattern='', $a_topics=array())
Get only the unchanged values from the database which are equal to the original language file...
getDataPath()
Get the path for language data written by ILIAS.
isInstalled()
Check language object status, and return true if language is installed.
getChangedValues($a_modules=array(), $a_pattern='', $a_topics=array())
Get only the changed values from the database which differ from the original language file...
getGlobalLanguageFile()
Read and get the global language file as an object.
__construct($a_id=0, $a_call_by_reference=false)
Constructor.
static _deleteLangData($a_lang_key, $a_keep_local_change=false)
Delete languge data.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static deleteLangEntry($a_module, $a_identifier, $a_lang_key)
Delete lang entry.
static _getValues($a_lang_key, $a_modules=array(), $a_topics=array(), $a_pattern='', $a_state='')
Get the translations of specified topics.
Create styles array
The data for the language used.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static _saveValues($a_lang_key, $a_values=array(), $a_remarks=array())
Save a set of translation in the database.
setLocal($a_local=true)
Set the local status of the language.
getLongDescription()
Get the full language description.
getAddedValues($a_modules=array(), $a_pattern='', $a_topics=array())
Get only the entries which don't exist in the global language file.
setDescription($a_desc)
set object description
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static _getModules($a_lang_key)
Get all modules of a language.
update()
update object in db
getLangPath()
Get the language files path.
getCommentedValues($a_modules=array(), $a_pattern='', $a_topics=array())
Get all values from the database for wich the global language file has a comment. ...
static _getGlobalLanguageFile($a_lang_key)
Read and get a global language file as a singleton object.
importLanguageFile($a_file, $a_mode_existing='keepnew')
Import a language file into the ilias database.