ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjLanguageExt Class Reference

Class ilObjLanguageExt. More...

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

Public Member Functions

 getGlobalLanguageFile ()
 Read and get the global language file as an object. More...
 
 setLocal (bool $a_local=true)
 Set the local status of the language. More...
 
 getLongDescription ()
 Get the full language description. More...
 
 getDataPath ()
 Return 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 (array $a_modules=array(), string $a_pattern="", array $a_topics=array())
 Get all values from the database. More...
 
 getChangedValues (array $a_modules=array(), string $a_pattern="", array $a_topics=array())
 Get only the changed values from the database which differ from the original language file. More...
 
 getUnchangedValues (array $a_modules=array(), string $a_pattern="", array $a_topics=array())
 Get only the unchanged values from the database which are equal to the original language file. More...
 
 getAddedValues (array $a_modules=array(), string $a_pattern='', array $a_topics=array())
 Get only the entries which don't exist in the global language file. More...
 
 getCommentedValues (array $a_modules=array(), string $a_pattern="", array $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...
 
- Public Member Functions inherited from ilObjLanguage
 __construct (int $a_id=0, bool $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 (string $scope="")
 install current language More...
 
 uninstall ()
 uninstall current language More...
 
 refresh ()
 refresh current language More...
 
 flush (string $a_mode="all")
 remove language data from database $a_mode "all" or "keep_local" More...
 
 getLocalChanges (string $a_min_date="", string $a_max_date="")
 get locally changed language entries $a_min_date minimum change date "yyyy-mm-dd hh:mm:ss" $a_max_date maximum change date "yyyy-mm-dd hh:mm:ss" Return array [module][identifier] => value More...
 
 insert (string $scope="")
 insert language data from file into database More...
 
 resetUserLanguage (string $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 (string $scope="")
 Validate the logical structure of a lang file. More...
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _getModules (string $a_lang_key)
 Get all modules of a language. More...
 
static _getRemarks (string $a_lang_key, bool $a_all_changed=false)
 Get all remarks of a language. More...
 
static _getValues (string $a_lang_key, array $a_modules=array(), array $a_topics=array(), string $a_pattern='', string $a_state='')
 Get the translations of specified topics. More...
 
static _saveValues (string $a_lang_key, array $a_values=array(), array $a_remarks=array())
 Save a set of translation in the database. More...
 
static _deleteValues (string $a_lang_key, array $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 (array $a_lang_keys=null)
 Refresh languages of activated plugins $a_lang_keys keys of languages to be refreshed (not yet supported, all available will be refreshed) More...
 
static _deleteLangData (string $a_lang_key, bool $a_keep_local_change=false)
 Delete languge data $a_lang_key lang key. More...
 
static _getLastLocalChange (string $a_key)
 get the date of the last local change $a_key language key Return change_date "yyyy-mm-dd hh:mm:ss" More...
 
static _getLocalChangesByModule (string $a_key, string $a_module)
 Get the local changes of a language module $a_key Language key $a_module Module key Return array identifier => value. More...
 
static replaceLangEntry (string $a_module, string $a_identifier, string $a_lang_key, string $a_value, string $a_local_change=null, string $a_remarks=null)
 Replace lang entry. More...
 
static updateLangEntry (string $a_module, string $a_identifier, string $a_lang_key, string $a_value, string $a_local_change=null, string $a_remarks=null)
 Replace lang entry. More...
 
static deleteLangEntry (string $a_module, string $a_identifier, string $a_lang_key)
 Delete lang entry. More...
 
static cut_header (array $content)
 remove lang-file haeder information from '$content' This function seeks for a special keyword where the language information starts. More...
 
static countUsers (string $a_lang)
 Count number of users that use a language. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Additional Inherited Members

- Data Fields inherited from ilObjLanguage
string $separator
 separator of module, comment separator, identifier & values in language files More...
 
string $comment_separator
 
string $lang_default
 
string $lang_user
 
string $lang_path
 
string $key
 
string $status
 
string $cust_lang_path
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Detailed Description

Member Function Documentation

◆ _deleteValues()

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

Delete a set of translation in the database.

$a_lang_key language key $a_values module.separator.topic => value

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

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

Referenced by ilObjLanguageExtGUI\maintainExecuteObject().

485  : void
486  {
487  global $DIC;
488  $ilDB = $DIC->database();
489  $lng = $DIC->language();
490 
491  if (!is_array($a_values)) {
492  return;
493  }
494  $delete_array = array();
495 
496  // save the single translations in lng_data
497  foreach ($a_values as $key => $value) {
498  $keys = explode($lng->separator, $key);
499  if (count($keys) === 2) {
500  $module = $keys[0];
501  $topic = $keys[1];
502  $delete_array[$module][$topic] = $value;
503 
504  ilObjLanguage::deleteLangEntry($module, $topic, $a_lang_key);
505  }
506  }
507 
508  // save the serialized module entries in lng_modules
509  foreach ($delete_array as $module => $entries) {
510  $set = $ilDB->query(sprintf(
511  "SELECT * FROM lng_modules " .
512  "WHERE lang_key = %s AND module = %s",
513  $ilDB->quote($a_lang_key, "text"),
514  $ilDB->quote($module, "text")
515  ));
516  $row = $ilDB->fetchAssoc($set);
517 
518  $arr = unserialize($row["lang_array"], ["allowed_classes" => false]);
519  if (is_array($arr)) {
520  $entries = array_diff_key($arr, $entries);
521  }
522  ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
523  }
524  }
global $DIC
Definition: feed.php:28
ilLanguage $lng
static deleteLangEntry(string $a_module, string $a_identifier, string $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 ( string  $a_lang_key)
static

Get all modules of a language.

$a_lang_key language key Return list of modules

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

References $DIC, $ilDB, $q, and ilDBConstants\FETCHMODE_ASSOC.

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

298  : array
299  {
300  global $DIC;
301  $ilDB = $DIC->database();
302 
303  $q = "SELECT DISTINCT module FROM lng_data WHERE " .
304  " lang_key = " . $ilDB->quote($a_lang_key, "text") . " order by module";
305  $set = $ilDB->query($q);
306 
307  $modules = array();
308  while ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
309  $modules[] = $rec["module"];
310  }
311  return $modules;
312  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _getRemarks()

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

Get all remarks of a language.

$a_lang_key language key $a_all_changed include empty remarks for local changes Return array module.separator.topic => remarks

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

References $DIC, $ilDB, ilObject\$lng, and $q.

Referenced by ilObjLanguageExtGUI\viewObject().

322  : array
323  {
324  global $DIC;
325  $ilDB = $DIC->database();
326  $lng = $DIC->language();
327 
328  $q = "SELECT module, identifier, remarks"
329  . " FROM lng_data"
330  . " WHERE lang_key = " . $ilDB->quote($a_lang_key, "text");
331 
332  if ($a_all_changed) {
333  $q .= " AND (remarks IS NOT NULL OR local_change IS NOT NULL)";
334  } else {
335  $q .= " AND remarks IS NOT NULL";
336  }
337 
338  $result = $ilDB->query($q);
339 
340  $remarks = array();
341  while ($row = $ilDB->fetchAssoc($result)) {
342  $remarks[$row["module"] . $lng->separator . $row["identifier"]] = $row["remarks"];
343  }
344  return $remarks;
345  }
global $DIC
Definition: feed.php:28
ilLanguage $lng
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _getValues()

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

Get the translations of specified topics.

$a_lang_key language key $a_modules list of modules $a_topics list of topics $a_pattern search pattern $a_state local change state ('changed', 'unchanged', '') Return array module.separator.topic => value

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

References $DIC, $ilDB, ilObject\$lng, $q, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilObjLanguageExtGUI\viewObject().

364  : array {
365  global $DIC;
366  $ilDB = $DIC->database();
367  $lng = $DIC->language();
368 
369  $q = "SELECT * FROM lng_data WHERE" .
370  " lang_key = " . $ilDB->quote($a_lang_key, "text") . " ";
371 
372  if (is_array($a_modules) && count($a_modules) > 0) {
373  $q .= " AND " . $ilDB->in("module", $a_modules, false, "text");
374  }
375  if (is_array($a_topics) && count($a_topics) > 0) {
376  $q .= " AND " . $ilDB->in("identifier", $a_topics, false, "text");
377  }
378  if ($a_pattern) {
379  $q .= " AND " . $ilDB->like("value", "text", "%" . $a_pattern . "%");
380  }
381  if ($a_state === "changed") {
382  $q .= " AND NOT local_change IS NULL ";
383  }
384  if ($a_state === "unchanged") {
385  $q .= " AND local_change IS NULL ";
386  }
387  $q .= " ORDER BY module, identifier";
388 
389  $set = $ilDB->query($q);
390 
391  $values = array();
392  while ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
393  $values[$rec["module"] . $lng->separator . $rec["identifier"]] = $rec["value"];
394  }
395  return $values;
396  }
global $DIC
Definition: feed.php:28
ilLanguage $lng
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _saveValues()

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

Save a set of translation in the database.

$a_lang_key language key $a_values module.separator.topic => value $a_remarks module.separator.topic => remarks

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

References $DIC, $ilDB, ilObjLanguage\$key, ilObject\$lng, ilLanguageFile\_getGlobalLanguageFile(), ilCachedLanguage\getInstance(), and ilObjLanguage\replaceLangEntry().

Referenced by ilObjLanguageExtGUI\saveObject().

405  : void
406  {
407  global $DIC;
408  $ilDB = $DIC->database();
409  $lng = $DIC->language();
410 
411  if (!is_array($a_values)) {
412  return;
413  }
414  $save_array = [];
415  $save_date = (new DateTimeImmutable('now', new DateTimeZone('UTC')))
416  ->format('Y-m-d H:i:s');
417 
418  // read and get the global values
419  require_once "./Services/Language/classes/class.ilLanguageFile.php";
420  $global_file_obj = ilLanguageFile::_getGlobalLanguageFile($a_lang_key);
421  $file_values = $global_file_obj->getAllValues();
422  $file_comments = $global_file_obj->getAllComments();
423  $db_values = self::_getValues($a_lang_key);
424  $db_comments = self::_getRemarks($a_lang_key);
425  $global_values = array_merge($db_values, $file_values);
426  $global_comments = array_merge($db_comments, $file_comments);
427 
428  // save the single translations in lng_data
429  foreach ($a_values as $key => $value) {
430  $keys = explode($lng->separator, $key);
431 
432  if (count($keys) !== 2) {
433  continue;
434  }
435 
436  list($module, $topic) = $keys;
437  $save_array[$module][$topic] = $value;
438 
439  $are_comments_set = array_key_exists($key, $global_comments) && array_key_exists($key, $a_remarks);
440  $are_changes_made = (isset($global_values[$key]) ? $global_values[$key] != $value : true) || (isset($db_values[$key]) ? $db_values[$key] != $value : true);
441  if ($are_changes_made || ($are_comments_set ? $global_comments[$key] != $a_remarks[$key] : $are_comments_set)) {
442  $local_change = (isset($db_values[$key]) ? $db_values[$key] == $value : true) || (isset($global_values[$key]) ? $global_values[$key] != $value : true) ? $save_date : null;
444  $module,
445  $topic,
446  $a_lang_key,
447  $value,
448  $local_change,
449  $a_remarks[$key] ?? null
450  );
451  }
452  }
453 
454  // save the serialized module entries in lng_modules
455  foreach ($save_array as $module => $entries) {
456  $set = $ilDB->query(sprintf(
457  "SELECT * FROM lng_modules " .
458  "WHERE lang_key = %s AND module = %s",
459  $ilDB->quote($a_lang_key, "text"),
460  $ilDB->quote($module, "text")
461  ));
462  $row = $ilDB->fetchAssoc($set);
463  if (!$row) {
464  $DIC->logger()->root()->warning("Language module '{$module}' not found for language {$a_lang_key}.");
465  continue;
466  }
467 
468  $arr = unserialize($row["lang_array"], ["allowed_classes" => false]);
469  if (is_array($arr)) {
470  $entries = array_merge($arr, $entries);
471  }
472  ilObjLanguage::replaceLangModule($a_lang_key, $module, $entries);
473  }
474 
475  require_once("class.ilCachedLanguage.php");
476  ilCachedLanguage::getInstance($a_lang_key)->flush();
477  }
global $DIC
Definition: feed.php:28
ilLanguage $lng
static replaceLangEntry(string $a_module, string $a_identifier, string $a_lang_key, string $a_value, string $a_local_change=null, string $a_remarks=null)
Replace lang entry.
static _getGlobalLanguageFile(string $a_lang_key)
Read and get a global language file as a singleton object $a_lang_key language key.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAddedValues()

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

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

$a_modules list of modules $a_pattern search pattern $a_topics list of topics Return array module.separator.topic => value

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

References getGlobalLanguageFile().

161  : array
162  {
163  $global_file_obj = $this->getGlobalLanguageFile();
164  $global_values = $global_file_obj->getAllValues();
165  $local_values = self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
166 
167  return array_diff_key($local_values, $global_values);
168  }
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.

Return array module.separator.topic => remark

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

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

◆ getAllValues()

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

Get all values from the database.

$a_modules list of modules $a_pattern search pattern $a_topics list of topics Return array module.separator.topic => value

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

Referenced by getMergedRemarks().

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

◆ getChangedValues()

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

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

$a_modules list of modules $a_pattern search pattern $a_topics list of topics Return array module.separator.topic => value

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

Referenced by getMergedRemarks().

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

◆ getCommentedValues()

ilObjLanguageExt::getCommentedValues ( array  $a_modules = array(),
string  $a_pattern = "",
array  $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!

$a_modules list of modules $a_pattern search pattern $a_topics list of topics Return array module.separator.topic => value

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

References getGlobalLanguageFile().

182  : array
183  {
184  $global_file_obj = $this->getGlobalLanguageFile();
185  $global_comments = $global_file_obj->getAllComments();
186  $local_values = self::_getValues($this->key, $a_modules, $a_topics, $a_pattern);
187 
188  return array_intersect_key($local_values, $global_comments);
189  }
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.

Return path of customized language files folder

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

References ilObjLanguage\$cust_lang_path.

98  : string
99  {
100  return $this->cust_lang_path;
101  }

◆ getDataPath()

ilObjLanguageExt::getDataPath ( )

Return the path for language data written by ILIAS.

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

References CLIENT_DATA_DIR, and ilFileUtils\makeDir().

75  : string
76  {
77  if (!is_dir(CLIENT_DATA_DIR . "/lang_data")) {
78  ilFileUtils::makeDir(CLIENT_DATA_DIR . "/lang_data");
79  }
80  return CLIENT_DATA_DIR . "/lang_data";
81  }
const CLIENT_DATA_DIR
Definition: constants.php:46
static makeDir(string $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 37 of file class.ilObjLanguageExt.php.

References ilLanguageFile\_getGlobalLanguageFile().

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

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

◆ getLangPath()

ilObjLanguageExt::getLangPath ( )

Get the language files path.

Return path of language files folder

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

References ilObjLanguage\$lang_path.

88  : string
89  {
90  return $this->lang_path;
91  }

◆ getLongDescription()

ilObjLanguageExt::getLongDescription ( )

Get the full language description.

Return description

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

References ILIAS\Repository\lng().

66  : string
67  {
68  return $this->lng->txt($this->desc);
69  }
+ Here is the call graph for this function:

◆ 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

Return array module.separator.topic => value

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

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

223  : array
224  {
225  $global_file_obj = $this->getGlobalLanguageFile();
226  $global_comments = $global_file_obj->getAllComments();
227 
228  // get remarks including empty remarks for local changes
229  $local_remarks = self::_getRemarks($this->key, true);
230 
231  return array_merge($global_comments, $local_remarks);
232  }
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

Return array module.separator.topic => value

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

References getGlobalLanguageFile().

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

◆ getUnchangedValues()

ilObjLanguageExt::getUnchangedValues ( array  $a_modules = array(),
string  $a_pattern = "",
array  $a_topics = array() 
)

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

Return array module.separator.topic => value

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

148  : array
149  {
150  return self::_getValues($this->key, $a_modules, $a_topics, $a_pattern, "unchanged");
151  }

◆ setLocal()

ilObjLanguageExt::setLocal ( bool  $a_local = true)

Set the local status of the language.

$a_local local status (true/false)

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

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

48  : void
49  {
50  if ($this->isInstalled()) {
51  if ($a_local) {
52  $this->setDescription("installed_local");
53  } else {
54  $this->setDescription("installed");
55  }
56  $this->update();
57  }
58  }
isInstalled()
Check language object status, and return true if language is installed.
setDescription(string $description)
+ Here is the call graph for this function:

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