ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLanguageDBAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilObjLanguageDBAccess:

Public Member Functions

 __construct (ilDBInterface $ilDB, string $key, array $content, array $local_changes, string $scope="", string $separator="#:#", string $comment_separator="###")
 
 replaceLangModules (array $lang_array)
 

Protected Attributes

 $ilDB
 
 $key
 
 $content
 
 $scope
 
 $local_changes
 
 $change_date = null
 
 $separator
 
 $comment_separator
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilObjLanguageDBAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjLanguageDBAccess::__construct ( ilDBInterface  $ilDB,
string  $key,
array  $content,
array  $local_changes,
string  $scope = "",
string  $separator = "#:#",
string  $comment_separator = "###" 
)

Definition at line 30 of file class.ilObjLanguageDBAccess.php.

References $comment_separator, $content, $DIC, $ilDB, $ilErr, $key, $local_changes, $query, $scope, and $separator.

30  :#", string $comment_separator = "###")
31  {
32  $this->ilDB = $ilDB;
33  $this->key = $key;
34  $this->content = $content;
35  $this->local_changes = $local_changes;
36  $this->scope = $scope;
37  if ($scope === "local") {
38  $this->change_date = date("Y-m-d H:i:s", time());
39  }
40  $this->separator = $separator;
41  $this->comment_separator = $comment_separator;
42  }

Member Function Documentation

◆ replaceLangModules()

ilObjLanguageDBAccess::replaceLangModules ( array  $lang_array)

Definition at line 115 of file class.ilObjLanguageDBAccess.php.

References $DIC, $ilErr, $query, $result, and ilCachedLanguage\getInstance().

115  : void
116  {
117  // avoid flushing the whole cache (see mantis #28818)
118  ilCachedLanguage::getInstance($this->key)->deleteInCache();
119 
120  $query = "INSERT INTO lng_modules (module, lang_key, lang_array) VALUES ";
121  $modules_to_delete = [];
122  foreach ($lang_array as $module => $lang_arr) {
123  if ($this->scope === "local") {
124  $q = "SELECT * FROM lng_modules WHERE " .
125  " lang_key = " . $this->ilDB->quote($this->key, "text") .
126  " AND module = " . $this->ilDB->quote($module, "text");
127  $set = $this->ilDB->query($q);
128  $row = $this->ilDB->fetchAssoc($set);
129  $arr2 = isset($row["lang_array"]) ? unserialize($row["lang_array"], ["allowed_classes" => false]) : "";
130  if (is_array($arr2)) {
131  $lang_arr = array_merge($arr2, $lang_arr);
132  }
133  }
134  $query .= sprintf(
135  "(%s,%s,%s),",
136  $this->ilDB->quote($module, "text"),
137  $this->ilDB->quote($this->key, "text"),
138  $this->ilDB->quote(serialize($lang_arr), "clob")
139  );
140  $modules_to_delete[] = $module;
141  }
142 
143  $inModulesToDelete = $this->ilDB->in('module', $modules_to_delete, false, 'text');
144  $this->ilDB->manipulate(sprintf("DELETE FROM lng_modules WHERE lang_key = %s AND $inModulesToDelete",
145  $this->ilDB->quote($this->key, "text")
146  ));
147 
148  $query = rtrim($query, ",") . ";";
149  $this->ilDB->manipulate($query);
150 
151  // check if the module is correctly saved
152  // see mantis #20046 and #19140
153  $this->checkModules();
154  }
$query
+ Here is the call graph for this function:

Field Documentation

◆ $change_date

ilObjLanguageDBAccess::$change_date = null
protected

Definition at line 26 of file class.ilObjLanguageDBAccess.php.

◆ $comment_separator

ilObjLanguageDBAccess::$comment_separator
protected

Definition at line 28 of file class.ilObjLanguageDBAccess.php.

Referenced by __construct().

◆ $content

ilObjLanguageDBAccess::$content
protected

Definition at line 23 of file class.ilObjLanguageDBAccess.php.

Referenced by __construct().

◆ $ilDB

ilObjLanguageDBAccess::$ilDB
protected

Definition at line 21 of file class.ilObjLanguageDBAccess.php.

Referenced by __construct().

◆ $key

ilObjLanguageDBAccess::$key
protected

Definition at line 22 of file class.ilObjLanguageDBAccess.php.

Referenced by __construct().

◆ $local_changes

ilObjLanguageDBAccess::$local_changes
protected

Definition at line 25 of file class.ilObjLanguageDBAccess.php.

Referenced by __construct().

◆ $scope

ilObjLanguageDBAccess::$scope
protected

Definition at line 24 of file class.ilObjLanguageDBAccess.php.

Referenced by __construct().

◆ $separator

ilObjLanguageDBAccess::$separator
protected

Definition at line 27 of file class.ilObjLanguageDBAccess.php.

Referenced by __construct().


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