ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLanguageExt Class Reference

Class ilObjLanguageExt. More...

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

Public Member Functions

 ilObjLanguageExt ($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...
 
 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='')
 Get all values from the database. More...
 
 getChangedValues ($a_modules=array(), $a_pattern='')
 Get only the changed values from the database which differ from the original language file. More...
 
 getUnchangedValues ($a_modules=array(), $a_pattern='')
 Get only the unchanged values from the database which are equal to the original language file. More...
 
 getAddedValues ($a_modules=array(), $a_pattern='')
 Get only the entries which don't exist in the global language file. More...
 
 getCommentedValues ($a_modules=array(), $a_pattern='')
 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
 ilObjLanguage ($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...
 
 flush ($a_mode='all')
 remove language data from database More...
 
 getLocalChanges ($a_min_date="", $a_max_date="")
 get locally changed language entries More...
 
 _getLastLocalChange ($a_key)
 get the date of the last local change 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...
 
 cut_header ($content)
 remove lang-file haeder information from '$content' This function seeks for a special keyword where the language information starts. 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
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 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 ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 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...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) 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...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object 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...
 
 createRoleFolder ()
 creates a local role folder More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. 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...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. 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 refreshAll ()
 Refresh all installed languages. More...
 
static _deleteLangData ($a_lang_key, $a_keep_local_change)
 Delete languge data. More...
 
static replaceLangModule ($a_key, $a_module, $a_array)
 Replace language module array. 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 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 _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id 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 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
 
 $obj_data_record
 object_data record More...
 

Detailed Description

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 468 of file class.ilObjLanguageExt.php.

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

Referenced by ilObjLanguageExtGUI\maintainObject().

469  {
470  global $ilDB, $lng;
471 
472  if (!is_array($a_values))
473  {
474  return;
475  }
476  $delete_array = array();
477 
478  // save the single translations in lng_data
479  foreach ($a_values as $key => $value)
480  {
481  $keys = explode($lng->separator, $key);
482  if (count($keys) == 2)
483  {
484  $module = $keys[0];
485  $topic = $keys[1];
486  $delete_array[$module][$topic] = $value;
487 
488  ilObjLanguage::deleteLangEntry($module, $topic, $a_lang_key);
489  }
490  }
491 
492  // save the serialized module entries in lng_modules
493  foreach ($delete_array as $module => $entries)
494  {
495  $set = $ilDB->query(sprintf("SELECT * FROM lng_modules " .
496  "WHERE lang_key = %s AND module = %s",
497  $ilDB->quote($a_lang_key, "text"), $ilDB->quote($module, "text")));
498  $row = $ilDB->fetchAssoc($set);
499 
500  $arr = unserialize($row["lang_array"]);
501  if (is_array($arr))
502  {
503  $entries = array_diff_key($arr, $entries);
504  }
505  ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
506  }
507  }
static replaceLangModule($a_key, $a_module, $a_array)
Replace language module array.
static deleteLangEntry($a_module, $a_identifier, $a_lang_key)
Delete lang entry.
+ 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 286 of file class.ilObjLanguageExt.php.

References DB_FETCHMODE_ASSOC.

Referenced by ilObjLanguageExtGUI\statisticsObject(), and ilObjLanguageExtGUI\viewObject().

287  {
288  global $ilDB;
289 
290  $q = "SELECT DISTINCT module FROM lng_data WHERE ".
291  " lang_key = ".$ilDB->quote($a_lang_key, "text")." order by module";
292  $set = $ilDB->query($q);
293 
294  while ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
295  {
296  $modules[] = $rec["module"];
297  }
298  return $modules;
299  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
+ 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 310 of file class.ilObjLanguageExt.php.

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

Referenced by ilObjLanguageExtGUI\viewObject().

311  {
312  global $ilDB, $lng;
313 
314  $q = "SELECT module, identifier, remarks"
315  . " FROM lng_data"
316  . " WHERE lang_key = ".$ilDB->quote($a_lang_key, "text");
317 
318  if ($a_all_changed)
319  {
320  $q .= " AND (remarks IS NOT NULL OR local_change IS NOT NULL)";
321  }
322  else
323  {
324  $q .= " AND remarks IS NOT NULL";
325  }
326 
327  $result = $ilDB->query($q);
328 
329  $remarks = array();
330  while ($row = $ilDB->fetchAssoc($result))
331  {
332  $remarks[$row["module"].$lng->separator.$row["identifier"]] = $row["remarks"];
333  }
334  return $remarks;
335  }
$result
+ 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 349 of file class.ilObjLanguageExt.php.

References ilObject\$lng, and DB_FETCHMODE_ASSOC.

Referenced by ilObjLanguageExtGUI\viewObject().

352  {
353  global $ilDB, $lng;
354 
355  $q = "SELECT * FROM lng_data WHERE".
356  " lang_key = ".$ilDB->quote($a_lang_key, "text")." ";
357 
358  if (is_array($a_modules) && count($a_modules) > 0)
359  {
360  $q .= " AND ".$ilDB->in("module", $a_modules, false, "text");
361  }
362  if (is_array($a_topics) && count($a_topics) > 0)
363  {
364  $q .= " AND ".$ilDB->in("identifier", $a_topics, false, "text");
365  }
366  if ($a_pattern)
367  {
368  $q .= " AND ".$ilDB->like("value", "text", "%".$a_pattern."%");
369  }
370  if ($a_state == "changed")
371  {
372  $q .= " AND NOT local_change IS NULL ";
373  }
374  if ($a_state == "unchanged")
375  {
376  $q .= " AND local_change IS NULL ";
377  }
378  $q .= " ORDER BY module, identifier";
379 
380  $set = $ilDB->query($q);
381 
382  $values = array();
383  while ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
384  {
385  $values[$rec["module"].$lng->separator.$rec["identifier"]] = $rec["value"];
386  }
387  return $values;
388  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
+ 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 401 of file class.ilObjLanguageExt.php.

References ilObjLanguage\$key, ilObject\$lng, $row, ilLanguageFile\_getGlobalLanguageFile(), ilObjLanguage\replaceLangEntry(), and ilObjLanguage\replaceLangModule().

Referenced by ilObjLanguageExtGUI\saveObject().

402  {
403  global $ilDB, $lng;
404 
405  if (!is_array($a_values))
406  {
407  return;
408  }
409  $save_array = array();
410  $save_date = date("Y-m-d H:i:s", time());
411 
412  // read and get the global values
413  require_once "./Services/Language/classes/class.ilLanguageFile.php";
414  $global_file_obj = ilLanguageFile::_getGlobalLanguageFile($a_lang_key);
415  $global_values = $global_file_obj->getAllValues();
416  $global_comments = $global_file_obj->getAllComments();
417 
418  // save the single translations in lng_data
419  foreach ($a_values as $key => $value)
420  {
421  $keys = explode($lng->separator, $key);
422  if (count($keys) == 2)
423  {
424  $module = $keys[0];
425  $topic = $keys[1];
426  $save_array[$module][$topic] = $value;
427 
428  if ($global_values[$key] != $value
429  or $global_comments[$key] != $a_remarks[$key])
430  {
431  $local_change = $save_date;
432  }
433  else
434  {
435  $local_change = null;
436  }
437 
438  ilObjLanguage::replaceLangEntry($module, $topic,
439  $a_lang_key, $value, $local_change, $a_remarks[$key]);
440  }
441  }
442 
443  // save the serialized module entries in lng_modules
444  foreach ($save_array as $module => $entries)
445  {
446  $set = $ilDB->query(sprintf("SELECT * FROM lng_modules " .
447  "WHERE lang_key = %s AND module = %s",
448  $ilDB->quote($a_lang_key, "text"), $ilDB->quote($module, "text")));
449  $row = $ilDB->fetchAssoc($set);
450 
451  $arr = unserialize($row["lang_array"]);
452  if (is_array($arr))
453  {
454  $entries = array_merge($arr, $entries);
455  }
456  ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
457  }
458  }
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
static replaceLangModule($a_key, $a_module, $a_array)
Replace language module array.
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 = '' 
)

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

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

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

References getGlobalLanguageFile().

145  {
146  $global_file_obj = $this->getGlobalLanguageFile();
147  $global_values = $global_file_obj->getAllValues();
148  $local_values = self::_getValues($this->key, $a_modules, NULL, $a_pattern);
149 
150  return array_diff_key($local_values, $global_values);
151  }
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 92 of file class.ilObjLanguageExt.php.

93  {
94  return self::_getRemarks($this->key);
95  }

◆ getAllValues()

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

Get all values from the database.

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

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

Referenced by importLanguageFile().

105  {
106  return self::_getValues($this->key, $a_modules, NULL, $a_pattern);
107  }
+ Here is the caller graph for this function:

◆ getChangedValues()

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

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

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

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

Referenced by importLanguageFile().

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

◆ getCommentedValues()

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

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
Returns
array module.separator.topic => value

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

References getGlobalLanguageFile().

165  {
166  $global_file_obj = $this->getGlobalLanguageFile();
167  $global_comments = $global_file_obj->getAllComments();
168  $local_values = self::_getValues($this->key, $a_modules, NULL, $a_pattern);
169 
170  return array_intersect_key($local_values, $global_comments);
171  }
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 82 of file class.ilObjLanguageExt.php.

83  {
84  return $this->cust_lang_path;
85  }

◆ 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 72 of file class.ilObjLanguageExt.php.

References ilObjLanguage\$lang_path.

73  {
74  return $this->lang_path;
75  }

◆ 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 206 of file class.ilObjLanguageExt.php.

References getGlobalLanguageFile().

207  {
208 
209  $global_file_obj = $this->getGlobalLanguageFile();
210  $global_comments = $global_file_obj->getAllComments();
211 
212  // get remarks including empty remarks for local changes
213  $local_remarks = self::_getRemarks($this->key, true);
214 
215  return array_merge($global_comments, $local_remarks);
216  }
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 185 of file class.ilObjLanguageExt.php.

References getGlobalLanguageFile().

186  {
187 
188  $global_file_obj = $this->getGlobalLanguageFile();
189  $global_values = $global_file_obj->getAllValues();
190  $local_values = self::_getValues($this->key);
191 
192  return array_merge($global_values, $local_values);
193  }
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 = '' 
)

Get only the unchanged values from the database which are equal to the original language file.

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

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

133  {
134  return self::_getValues($this->key, $a_modules, NULL, $a_pattern, 'unchanged');
135  }

◆ ilObjLanguageExt()

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

Constructor.

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

References ilObjLanguage\ilObjLanguage().

21  {
22  $this->ilObjLanguage($a_id, $a_call_by_reference);
23  }
ilObjLanguage($a_id=0, $a_call_by_reference=false)
Constructor.
+ Here is the call graph for this function:

◆ 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 226 of file class.ilObjLanguageExt.php.

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

227  {
228  global $ilDB, $ilErr;
229 
230  // read the new language file
231  require_once "./Services/Language/classes/class.ilLanguageFile.php";
232  $import_file_obj = new ilLanguageFile($a_file);
233  if (!$import_file_obj->read())
234  {
235  $ilErr->raiseError($import_file_obj->getErrorMessage(),$ilErr->MESSAGE);
236  }
237 
238  switch($a_mode_existing)
239  {
240  // keep all existing entries
241  case 'keepall':
242  $to_keep = $this->getAllValues();
243  break;
244 
245  // keep existing online changes
246  case 'keepnew':
247  $to_keep = $this->getChangedValues();
248  break;
249 
250  // replace all existing definitions
251  case 'replace':
252  $to_keep = array();
253  break;
254 
255  // delete all existing entries
256  case 'delete':
257  ilObjLanguage::_deleteLangData($this->key, false);
258  $ilDB->manipulate("DELETE FROM lng_modules WHERE lang_key = ".
259  $ilDB->quote($this->key, "text"));
260  $to_keep = array();
261  break;
262 
263  default:
264  return;
265  }
266 
267  // process the values of the import file
268  $to_save = array();
269  foreach ($import_file_obj->getAllValues() as $key => $value)
270  {
271  if (!isset($to_keep[$key]))
272  {
273  $to_save[$key] = $value;
274  }
275  }
276  self::_saveValues($this->key, $to_save, $import_file_obj->getAllComments());
277  }
getChangedValues($a_modules=array(), $a_pattern='')
Get only the changed values from the database which differ from the original language file...
getAllValues($a_modules=array(), $a_pattern='')
Get all values from the database.
Class ilLanguageFile.
static _deleteLangData($a_lang_key, $a_keep_local_change)
Delete languge data.
+ 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: