4 require_once
"./Services/Language/classes/class.ilObjLanguage.php";
31 require_once
"./Services/Language/classes/class.ilLanguageFile.php";
64 return $this->lng->txt($this->desc);
84 return $this->cust_lang_path;
94 public function getAllValues($a_modules = array(), $a_pattern =
'')
110 return self::_getValues($this->key, $a_modules, NULL, $a_pattern,
'changed');
124 return self::_getValues($this->key, $a_modules, NULL, $a_pattern,
'unchanged');
139 $global_values = $global_file_obj->getAllValues();
142 $commented = array();
143 foreach ($local_values as
$key => $value)
145 if ($global_comments[
$key] !=
"")
147 $commented[
$key] = $value;
165 require_once
"./Services/Language/classes/class.ilLanguageFile.php";
167 if (!$import_file_obj->read())
169 $ilErr->raiseError($import_file_obj->getErrorMessage(),$ilErr->MESSAGE);
172 switch($a_mode_existing)
192 $ilDB->manipulate(
"DELETE FROM lng_modules WHERE lang_key = ".
193 $ilDB->quote($this->key,
"text"));
203 foreach ($import_file_obj->getAllValues() as
$key => $value)
205 if (!isset($to_keep[$key]))
207 $to_save[
$key] = $value;
224 $q =
"SELECT DISTINCT module FROM lng_data WHERE ".
225 " lang_key = ".$ilDB->quote($a_lang_key,
"text").
" order by module";
226 $set = $ilDB->query(
$q);
230 $modules[] = $rec[
"module"];
247 $a_modules = array(), $a_topics = array(),
248 $a_pattern =
'', $a_state =
'')
252 $q =
"SELECT * FROM lng_data WHERE".
253 " lang_key = ".$ilDB->quote($a_lang_key,
"text").
" ";
255 if (is_array($a_modules) && count($a_modules) > 0)
257 $q .=
" AND ".$ilDB->in(
"module", $a_modules,
false,
"text");
259 if (is_array($a_topics) && count($a_topics) > 0)
261 $q .=
" AND ".$ilDB->in(
"identifier", $a_topics,
false,
"text");
265 $q .=
" AND ".$ilDB->like(
"value",
"text",
"%".$a_pattern.
"%");
267 if ($a_state ==
"changed")
269 $q .=
" AND NOT local_change IS NULL ";
271 if ($a_state ==
"unchanged")
273 $q .=
" AND local_change IS NULL ";
275 $q .=
" ORDER BY module, identifier";
277 $set = $ilDB->query(
$q);
282 $values[$rec[
"module"].$lng->separator.$rec[
"identifier"]] = $rec[
"value"];
294 public static function _saveValues($a_lang_key, $a_values = array())
298 if (!is_array($a_values))
302 $save_array = array();
303 $save_date = date(
"Y-m-d H:i:s", time());
306 require_once
"./Services/Language/classes/class.ilLanguageFile.php";
308 $global_values = $global_file_obj->getAllValues();
311 foreach ($a_values as
$key => $value)
313 $keys = explode($lng->separator,
$key);
314 if (count($keys) == 2)
318 $save_array[$module][$topic] = $value;
319 $local_change = $global_values[
$key] == $value ?
323 $a_lang_key, $value, $local_change);
328 foreach ($save_array as $module => $entries)
330 $set = $ilDB->query(sprintf(
"SELECT * FROM lng_modules " .
331 "WHERE lang_key = %s AND module = %s",
332 $ilDB->quote($a_lang_key,
"text"), $ilDB->quote($module,
"text")));
333 $row = $ilDB->fetchAssoc($set);
335 $arr = unserialize(
$row[
"lang_array"]);
338 $entries = array_merge($arr, $entries);