ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjLanguageExt Class Reference

Class ilObjLanguageExt. More...

+ Inheritance diagram for ilObjLanguageExt:
+ Collaboration diagram for ilObjLanguageExt:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=false)
 Constructor. More...
 
 getGlobalLanguageFile ()
 Read and get the global language file as an object. More...
 
 setLocal ($a_local=true)
 Set the local status of the language. More...
 
 getLongDescription ()
 Get the full language description. More...
 
 getDataPath ()
 Get the path for language data written by ILIAS. More...
 
 getLangPath ()
 Get the language files path. More...
 
 getCustLangPath ()
 Get the customized language files path. More...
 
 getAllRemarks ()
 Get all remarks from the database. More...
 
 getAllValues ($a_modules=array(), $a_pattern='', $a_topics=array())
 Get all values from the database. More...
 
 getChangedValues ($a_modules=array(), $a_pattern='', $a_topics=array())
 Get only the changed values from the database which differ from the original language file. More...
 
 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. More...
 
 getAddedValues ($a_modules=array(), $a_pattern='', $a_topics=array())
 Get only the entries which don't exist in the global language file. More...
 
 getCommentedValues ($a_modules=array(), $a_pattern='', $a_topics=array())
 Get all values from the database for wich the global language file has a comment. More...
 
 getMergedValues ()
 Get the local values merged into the values of the global language file. More...
 
 getMergedRemarks ()
 Get the local remarks merged into the remarks of the global language file. More...
 
 importLanguageFile ($a_file, $a_mode_existing='keepnew')
 Import a language file into the ilias database. More...
 
- Public Member Functions inherited from ilObjLanguage
 __construct ($a_id=0, $a_call_by_reference=false)
 Constructor. More...
 
 getKey ()
 get language key More...
 
 getStatus ()
 get language status More...
 
 isSystemLanguage ()
 check if language is system language More...
 
 isUserLanguage ()
 check if language is system language More...
 
 isInstalled ()
 Check language object status, and return true if language is installed. More...
 
 isLocal ()
 Check language object status, and return true if a local language file is installed. More...
 
 install ($scope='')
 install current language More...
 
 uninstall ()
 uninstall current language More...
 
 refresh ()
 refresh current language More...
 
 flush ($a_mode='all')
 remove language data from database More...
 
 getLocalChanges ($a_min_date="", $a_max_date="")
 get locally changed language entries More...
 
 insert ($scope='')
 insert language data from file into database More...
 
 resetUserLanguage ($lang_key)
 search ILIAS for users which have selected '$lang_key' as their prefered language and reset them to default language (english). More...
 
 optimizeData ()
 optimizes the db-table langdata More...
 
 check ($scope='')
 Validate the logical structure of a lang file. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _getModules ($a_lang_key)
 Get all modules of a language. More...
 
static _getRemarks ($a_lang_key, $a_all_changed=false)
 Get all remarks of a language. More...
 
static _getValues ($a_lang_key, $a_modules=array(), $a_topics=array(), $a_pattern='', $a_state='')
 Get the translations of specified topics. More...
 
static _saveValues ($a_lang_key, $a_values=array(), $a_remarks=array())
 Save a set of translation in the database. More...
 
static _deleteValues ($a_lang_key, $a_values=array())
 Delete a set of translation in the database. More...
 
- Static Public Member Functions inherited from ilObjLanguage
static getInstalledLanguages ()
 Get the language objects of the installed languages. More...
 
static refreshAll ()
 Refresh all installed languages. More...
 
static refreshPlugins ($a_lang_keys=null)
 
static _deleteLangData ($a_lang_key, $a_keep_local_change=false)
 Delete languge data. More...
 
static _getLastLocalChange ($a_key)
 get the date of the last local change More...
 
static replaceLangEntry ($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
 Replace lang entry. More...
 
static updateLangEntry ($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
 Replace lang entry. More...
 
static deleteLangEntry ($a_module, $a_identifier, $a_lang_key)
 Delete lang entry. More...
 
static cut_header ($content)
 remove lang-file haeder information from '$content' This function seeks for a special keyword where the language information starts. More...
 
static countUsers ($a_lang)
 Count number of users that use a language. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Additional Inherited Members

- Data Fields inherited from ilObjLanguage
 $separator
 
 $comment_separator
 
 $lang_default
 
 $lang_user
 
 $lang_path
 
 $key
 
 $status
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjLanguageExt::__construct (   $a_id = 0,
  $a_call_by_reference = false 
)

Constructor.

Definition at line 20 of file class.ilObjLanguageExt.php.

21  {
22  parent::__construct($a_id, $a_call_by_reference);
23  }

Member Function Documentation

◆ _deleteValues()

static ilObjLanguageExt::_deleteValues (   $a_lang_key,
  $a_values = array() 
)
static

Delete a set of translation in the database.

static

Parameters
stringlanguage key
arraymodule.separator.topic => value

Definition at line 492 of file class.ilObjLanguageExt.php.

References $ilDB, ilObjLanguage\$key, ilObject\$lng, $row, array, and ilObjLanguage\deleteLangEntry().

Referenced by ilObjLanguageExtGUI\maintainExecuteObject().

493  {
494  global $ilDB, $lng;
495 
496  if (!is_array($a_values))
497  {
498  return;
499  }
500  $delete_array = array();
501 
502  // save the single translations in lng_data
503  foreach ($a_values as $key => $value)
504  {
505  $keys = explode($lng->separator, $key);
506  if (count($keys) == 2)
507  {
508  $module = $keys[0];
509  $topic = $keys[1];
510  $delete_array[$module][$topic] = $value;
511 
512  ilObjLanguage::deleteLangEntry($module, $topic, $a_lang_key);
513  }
514  }
515 
516  // save the serialized module entries in lng_modules
517  foreach ($delete_array as $module => $entries)
518  {
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);
523 
524  $arr = unserialize($row["lang_array"]);
525  if (is_array($arr))
526  {
527  $entries = array_diff_key($arr, $entries);
528  }
529  ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
530  }
531  }
static deleteLangEntry($a_module, $a_identifier, $a_lang_key)
Delete lang entry.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getModules()

static ilObjLanguageExt::_getModules (   $a_lang_key)
static

Get all modules of a language.

static

Parameters
stringlanguage key
Returns
array list of modules

Definition at line 305 of file class.ilObjLanguageExt.php.

References $ilDB, array, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilLanguageExtTableGUI\initFilter(), and ilObjLanguageExtGUI\statisticsObject().

306  {
307  global $ilDB;
308 
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);
312 
313  $modules = array();
314  while ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
315  {
316  $modules[] = $rec["module"];
317  }
318  return $modules;
319  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getRemarks()

static ilObjLanguageExt::_getRemarks (   $a_lang_key,
  $a_all_changed = false 
)
static

Get all remarks of a language.

static

Parameters
stringlanguage key
booleaninclude empty remarks for local changes
Returns
array module.separator.topic => remarks

Definition at line 330 of file class.ilObjLanguageExt.php.

References $ilDB, ilObject\$lng, $result, $row, and array.

Referenced by ilObjLanguageExtGUI\viewObject().

331  {
332  global $ilDB, $lng;
333 
334  $q = "SELECT module, identifier, remarks"
335  . " FROM lng_data"
336  . " WHERE lang_key = ".$ilDB->quote($a_lang_key, "text");
337 
338  if ($a_all_changed)
339  {
340  $q .= " AND (remarks IS NOT NULL OR local_change IS NOT NULL)";
341  }
342  else
343  {
344  $q .= " AND remarks IS NOT NULL";
345  }
346 
347  $result = $ilDB->query($q);
348 
349  $remarks = array();
350  while ($row = $ilDB->fetchAssoc($result))
351  {
352  $remarks[$row["module"].$lng->separator.$row["identifier"]] = $row["remarks"];
353  }
354  return $remarks;
355  }
$result
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getValues()

static ilObjLanguageExt::_getValues (   $a_lang_key,
  $a_modules = array(),
  $a_topics = array(),
  $a_pattern = '',
  $a_state = '' 
)
static

Get the translations of specified topics.

static

Parameters
stringlanguage key
arraylist of modules
arraylist of topics
arraysearch pattern
stringlocal change state ('changed', 'unchanged', '')
Returns
array module.separator.topic => value

Definition at line 369 of file class.ilObjLanguageExt.php.

References $ilDB, ilObject\$lng, array, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilObjLanguageExtGUI\viewObject().

372  {
373  global $ilDB, $lng;
374 
375  $q = "SELECT * FROM lng_data WHERE".
376  " lang_key = ".$ilDB->quote($a_lang_key, "text")." ";
377 
378  if (is_array($a_modules) && count($a_modules) > 0)
379  {
380  $q .= " AND ".$ilDB->in("module", $a_modules, false, "text");
381  }
382  if (is_array($a_topics) && count($a_topics) > 0)
383  {
384  $q .= " AND ".$ilDB->in("identifier", $a_topics, false, "text");
385  }
386  if ($a_pattern)
387  {
388  $q .= " AND ".$ilDB->like("value", "text", "%".$a_pattern."%");
389  }
390  if ($a_state == "changed")
391  {
392  $q .= " AND NOT local_change IS NULL ";
393  }
394  if ($a_state == "unchanged")
395  {
396  $q .= " AND local_change IS NULL ";
397  }
398  $q .= " ORDER BY module, identifier";
399 
400  $set = $ilDB->query($q);
401 
402  $values = array();
403  while ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
404  {
405  $values[$rec["module"].$lng->separator.$rec["identifier"]] = $rec["value"];
406  }
407  return $values;
408  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _saveValues()

static ilObjLanguageExt::_saveValues (   $a_lang_key,
  $a_values = array(),
  $a_remarks = array() 
)
static

Save a set of translation in the database.

static

Parameters
stringlanguage key
arraymodule.separator.topic => value
arraymodule.separator.topic => remarks

Definition at line 421 of file class.ilObjLanguageExt.php.

References $ilDB, ilObjLanguage\$key, ilObject\$lng, $row, ilLanguageFile\_getGlobalLanguageFile(), array, date, ilCachedLanguage\getInstance(), ilObjLanguage\replaceLangEntry(), and time.

Referenced by ilObjLanguageExtGUI\saveObject().

422  {
423  global $ilDB, $lng;
424 
425  if (!is_array($a_values))
426  {
427  return;
428  }
429  $save_array = array();
430  $save_date = date("Y-m-d H:i:s", time());
431 
432  // read and get the global values
433  require_once "./Services/Language/classes/class.ilLanguageFile.php";
434  $global_file_obj = ilLanguageFile::_getGlobalLanguageFile($a_lang_key);
435  $global_values = $global_file_obj->getAllValues();
436  $global_comments = $global_file_obj->getAllComments();
437 
438  // save the single translations in lng_data
439  foreach ($a_values as $key => $value)
440  {
441  $keys = explode($lng->separator, $key);
442  if (count($keys) == 2)
443  {
444  $module = $keys[0];
445  $topic = $keys[1];
446  $save_array[$module][$topic] = $value;
447 
448  if ($global_values[$key] != $value
449  or $global_comments[$key] != $a_remarks[$key])
450  {
451  $local_change = $save_date;
452  }
453  else
454  {
455  $local_change = null;
456  }
457 
458  ilObjLanguage::replaceLangEntry($module, $topic,
459  $a_lang_key, $value, $local_change, $a_remarks[$key]);
460  }
461  }
462 
463  // save the serialized module entries in lng_modules
464  foreach ($save_array as $module => $entries)
465  {
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);
470 
471  $arr = unserialize($row["lang_array"]);
472  if (is_array($arr))
473  {
474  $entries = array_merge($arr, $entries);
475  }
476  ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
477  }
478 
479 
480  require_once('class.ilCachedLanguage.php');
481  ilCachedLanguage::getInstance($a_lang_key)->flush();
482  }
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static _getGlobalLanguageFile($a_lang_key)
Read and get a global language file as a singleton object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAddedValues()

ilObjLanguageExt::getAddedValues (   $a_modules = array(),
  $a_pattern = '',
  $a_topics = array() 
)

Get only the entries which don't exist in the global language file.

Parameters
arraylist of modules
arraysearch pattern
arraylist of topics
Returns
array module.separator.topic => value

Definition at line 162 of file class.ilObjLanguageExt.php.

References getGlobalLanguageFile().

163  {
164  $global_file_obj = $this->getGlobalLanguageFile();
165  $global_values = $global_file_obj->getAllValues();
166  $local_values = self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
167 
168  return array_diff_key($local_values, $global_values);
169  }
getGlobalLanguageFile()
Read and get the global language file as an object.
+ Here is the call graph for this function:

◆ getAllRemarks()

ilObjLanguageExt::getAllRemarks ( )

Get all remarks from the database.

Returns
array module.separator.topic => remark

Definition at line 106 of file class.ilObjLanguageExt.php.

107  {
108  return self::_getRemarks($this->key);
109  }

◆ getAllValues()

ilObjLanguageExt::getAllValues (   $a_modules = array(),
  $a_pattern = '',
  $a_topics = array() 
)

Get all values from the database.

Parameters
arraylist of modules
stringsearch pattern
arraylist of topics
Returns
array module.separator.topic => value

Definition at line 119 of file class.ilObjLanguageExt.php.

Referenced by importLanguageFile().

120  {
121  return self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
122  }
+ Here is the caller graph for this function:

◆ getChangedValues()

ilObjLanguageExt::getChangedValues (   $a_modules = array(),
  $a_pattern = '',
  $a_topics = array() 
)

Get only the changed values from the database which differ from the original language file.

Parameters
arraylist of modules
stringsearch pattern
arraylist of topics
Returns
array module.separator.topic => value

Definition at line 134 of file class.ilObjLanguageExt.php.

Referenced by importLanguageFile().

135  {
136  return self::_getValues($this->key, $a_modules, $a_topics, $a_pattern, 'changed');
137  }
+ Here is the caller graph for this function:

◆ getCommentedValues()

ilObjLanguageExt::getCommentedValues (   $a_modules = array(),
  $a_pattern = '',
  $a_topics = array() 
)

Get all values from the database for wich the global language file has a comment.

Note: This function checks the comments in the globel lang file, not the remarks in the database!

Parameters
arraylist of modules
arraysearch pattern
arraylist of topics
Returns
array module.separator.topic => value

Definition at line 183 of file class.ilObjLanguageExt.php.

References getGlobalLanguageFile().

184  {
185  $global_file_obj = $this->getGlobalLanguageFile();
186  $global_comments = $global_file_obj->getAllComments();
187  $local_values = self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
188 
189  return array_intersect_key($local_values, $global_comments);
190  }
getGlobalLanguageFile()
Read and get the global language file as an object.
+ Here is the call graph for this function:

◆ getCustLangPath()

ilObjLanguageExt::getCustLangPath ( )

Get the customized language files path.

Returns
string path of customized language files folder

Definition at line 96 of file class.ilObjLanguageExt.php.

97  {
98  return $this->cust_lang_path;
99  }

◆ getDataPath()

ilObjLanguageExt::getDataPath ( )

Get the path for language data written by ILIAS.

Returns
string

Definition at line 72 of file class.ilObjLanguageExt.php.

References ilUtil\makeDir().

73  {
74  if (!is_dir(CLIENT_DATA_DIR.'/lang_data'))
75  {
76  ilUtil::makeDir(CLIENT_DATA_DIR.'/lang_data');
77  }
78  return CLIENT_DATA_DIR.'/lang_data';
79  }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ getGlobalLanguageFile()

ilObjLanguageExt::getGlobalLanguageFile ( )

Read and get the global language file as an object.

Returns
object global language file

Definition at line 29 of file class.ilObjLanguageExt.php.

References ilLanguageFile\_getGlobalLanguageFile().

Referenced by getAddedValues(), getCommentedValues(), getMergedRemarks(), and getMergedValues().

30  {
31  require_once "./Services/Language/classes/class.ilLanguageFile.php";
32  return ilLanguageFile::_getGlobalLanguageFile($this->key);
33  }
static _getGlobalLanguageFile($a_lang_key)
Read and get a global language file as a singleton object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLangPath()

ilObjLanguageExt::getLangPath ( )

Get the language files path.

Returns
string path of language files folder

Definition at line 86 of file class.ilObjLanguageExt.php.

References ilObjLanguage\$lang_path.

87  {
88  return $this->lang_path;
89  }

◆ getLongDescription()

ilObjLanguageExt::getLongDescription ( )

Get the full language description.

Returns
string description

Definition at line 62 of file class.ilObjLanguageExt.php.

63  {
64  return $this->lng->txt($this->desc);
65  }

◆ getMergedRemarks()

ilObjLanguageExt::getMergedRemarks ( )

Get the local remarks merged into the remarks of the global language file.

The returned array contains:

  1. all remarks that exist globally, with their local values, ordered like in the global language file
  2. all additional local remarks, ordered by module and identifier
Returns
array module.separator.topic => value

Definition at line 225 of file class.ilObjLanguageExt.php.

References getGlobalLanguageFile().

226  {
227 
228  $global_file_obj = $this->getGlobalLanguageFile();
229  $global_comments = $global_file_obj->getAllComments();
230 
231  // get remarks including empty remarks for local changes
232  $local_remarks = self::_getRemarks($this->key, true);
233 
234  return array_merge($global_comments, $local_remarks);
235  }
getGlobalLanguageFile()
Read and get the global language file as an object.
+ Here is the call graph for this function:

◆ getMergedValues()

ilObjLanguageExt::getMergedValues ( )

Get the local values merged into the values of the global language file.

The returned array contains:

  1. all entries that exist globally, with their local values, ordered like in the global language file
  2. all additional local entries, ordered by module and identifier
Returns
array module.separator.topic => value

Definition at line 204 of file class.ilObjLanguageExt.php.

References getGlobalLanguageFile().

205  {
206 
207  $global_file_obj = $this->getGlobalLanguageFile();
208  $global_values = $global_file_obj->getAllValues();
209  $local_values = self::_getValues($this->key);
210 
211  return array_merge($global_values, $local_values);
212  }
getGlobalLanguageFile()
Read and get the global language file as an object.
+ Here is the call graph for this function:

◆ getUnchangedValues()

ilObjLanguageExt::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.

Parameters
arraylist of modules
arraysearch pattern
arraylist of topics
Returns
array module.separator.topic => value

Definition at line 149 of file class.ilObjLanguageExt.php.

150  {
151  return self::_getValues($this->key, $a_modules, $a_topics, $a_pattern, 'unchanged');
152  }

◆ importLanguageFile()

ilObjLanguageExt::importLanguageFile (   $a_file,
  $a_mode_existing = 'keepnew' 
)

Import a language file into the ilias database.

Parameters
stringhandling of existing values ('keepall','keepnew','replace','delete')

Definition at line 245 of file class.ilObjLanguageExt.php.

References $ilDB, $ilErr, ilObjLanguage\$key, ilObjLanguage\_deleteLangData(), array, getAllValues(), and getChangedValues().

246  {
247  global $ilDB, $ilErr;
248 
249  // read the new language file
250  require_once "./Services/Language/classes/class.ilLanguageFile.php";
251  $import_file_obj = new ilLanguageFile($a_file);
252  if (!$import_file_obj->read())
253  {
254  $ilErr->raiseError($import_file_obj->getErrorMessage(),$ilErr->MESSAGE);
255  }
256 
257  switch($a_mode_existing)
258  {
259  // keep all existing entries
260  case 'keepall':
261  $to_keep = $this->getAllValues();
262  break;
263 
264  // keep existing online changes
265  case 'keepnew':
266  $to_keep = $this->getChangedValues();
267  break;
268 
269  // replace all existing definitions
270  case 'replace':
271  $to_keep = array();
272  break;
273 
274  // delete all existing entries
275  case 'delete':
276  ilObjLanguage::_deleteLangData($this->key, false);
277  $ilDB->manipulate("DELETE FROM lng_modules WHERE lang_key = ".
278  $ilDB->quote($this->key, "text"));
279  $to_keep = array();
280  break;
281 
282  default:
283  return;
284  }
285 
286  // process the values of the import file
287  $to_save = array();
288  foreach ($import_file_obj->getAllValues() as $key => $value)
289  {
290  if (!isset($to_keep[$key]))
291  {
292  $to_save[$key] = $value;
293  }
294  }
295  self::_saveValues($this->key, $to_save, $import_file_obj->getAllComments());
296  }
global $ilErr
Definition: raiseError.php:16
getAllValues($a_modules=array(), $a_pattern='', $a_topics=array())
Get all values from the database.
getChangedValues($a_modules=array(), $a_pattern='', $a_topics=array())
Get only the changed values from the database which differ from the original language file...
static _deleteLangData($a_lang_key, $a_keep_local_change=false)
Delete languge data.
Create styles array
The data for the language used.
Class ilLanguageFile.
global $ilDB
+ Here is the call graph for this function:

◆ setLocal()

ilObjLanguageExt::setLocal (   $a_local = true)

Set the local status of the language.

Parameters
booleanlocal status (true/false)

Definition at line 40 of file class.ilObjLanguageExt.php.

References ilObjLanguage\isInstalled(), ilObject\setDescription(), and ilObject\update().

41  {
42  if ($this->isInstalled())
43  {
44  if ($a_local == true)
45  {
46  $this->setDescription("installed_local");
47  }
48  else
49  {
50  $this->setDescription("installed");
51  }
52  $this->update();
53  }
54  }
isInstalled()
Check language object status, and return true if language is installed.
setDescription($a_desc)
set object description
update()
update object in db
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: