102                $this->lang_key = ($a_lang_key) ? $a_lang_key : $this->lang_default;
 
  107                $txt = file($this->lang_path.
"/setup_lang_sel_multi.lang");
 
  116                                        $a = explode($this->separator,trim(
$row));
 
  117                                        $this->text[trim($a[0])] = trim($a[1]);
 
  123                $txt = file($this->lang_path.
"/setup_".$this->lang_key.
".lang");
 
  132                                        $a = explode($this->separator,trim(
$row));
 
  133                                        $this->text[trim($a[0])] = trim($a[1]);
 
  160                $translation = $this->text[$a_topic];
 
  163                $pos = strpos($translation, $this->comment_separator);
 
  168                        $translation = substr($translation,0,$pos);
 
  171                if ($translation == 
"")
 
  173                        $log->writeLanguageLog($a_topic,$this->lang_key);
 
  174                        return "-".$a_topic.
"-";
 
  191                $d = dir($this->lang_path);
 
  193                chdir ($this->lang_path);
 
  196                while ($entry = 
$d->read())
 
  198                        if (is_file($entry) && (ereg (
"(^setup_.{2}\.lang$)", $entry)))
 
  220                if (empty($a_lang_keys))
 
  222                        $a_lang_keys = array();
 
  225                if (empty($a_local_keys))
 
  227                        $a_local_keys = array();
 
  254                                if (!array_key_exists(
$lang_key,$db_langs))
 
  258                                                $itype = 
'installed_local';
 
  262                                                $itype = 
'installed';
 
  264                                        $lid = 
$ilDB->nextId(
"object_data");
 
  265                                        $query = 
"INSERT INTO object_data ".
 
  266                                                        "(obj_id,type,title,description,owner,create_date,last_update) ".
 
  269                                                        $ilDB->quote($lid, 
"integer").
",".
 
  270                                                        $ilDB->quote(
"lng", 
"text").
",".
 
  272                                                        $ilDB->quote($itype, 
"text").
",".
 
  273                                                        $ilDB->quote(
'-1',
"integer").
",".
 
  277                                        $this->db->manipulate(
$query);
 
  286                foreach ($db_langs as $key => $val)
 
  288                        if (!in_array($key,$err_lang))
 
  290                                if (in_array($key,$a_lang_keys))
 
  292                                        if (in_array($key, $a_local_keys))
 
  294                                                $ld = 
'installed_local';
 
  300                                        $query = 
"UPDATE object_data SET " .
 
  301                                                        "description = ".$ilDB->quote($ld, 
"text").
", " .
 
  302                                                        "last_update = ".$ilDB->now().
" " .
 
  303                                                        "WHERE obj_id = ".$ilDB->quote($val[
"obj_id"], 
"integer").
" " .
 
  304                                                        "AND type = ".$ilDB->quote(
"lng", 
"text");
 
  311                                        if (substr($val[
"status"], 0, 9) == 
"installed")
 
  313                                                $query = 
"UPDATE object_data SET " .
 
  314                                                                "description = ".$ilDB->quote(
"not_installed", 
"text").
", " .
 
  315                                                                "last_update = ".$ilDB->now().
" " .
 
  316                                                                "WHERE obj_id = ".$ilDB->quote($val[
"obj_id"], 
"integer").
" " .
 
  317                                                                "AND type = ".$ilDB->quote(
"lng", 
"text");
 
  324                return ($err_lang) ? $err_lang : 
true;
 
  340                $query = 
"SELECT * FROM object_data ".
 
  341                                "WHERE type = ".$ilDB->quote(
"lng", 
"text").
" ".
 
  342                                "AND ".$ilDB->like(
"description", 
"text", 
'installed%');
 
  347                        $arr[] = 
$row->title;
 
  364                $query = 
"SELECT * FROM object_data ".
 
  365                                "WHERE type = ".$ilDB->quote(
"lng", 
"text").
" ".
 
  366                                "AND description = ".$ilDB->quote(
'installed_local', 
"text");
 
  371                        $arr[] = 
$row->title;
 
  387                $query = 
"SELECT * FROM object_data ".
 
  388                                "WHERE type = ".$ilDB->quote(
"lng", 
"text");
 
  393                        $arr[
$row->title][
"obj_id"] = 
$row->obj_id;
 
  394                        $arr[
$row->title][
"status"] = 
$row->description;
 
  415                        if ($scope == 
'global')
 
  421                                $scopeExtension = 
'.' . $scope;
 
  426                if ($scope == 
"local")
 
  428                        $path = $this->cust_lang_path;
 
  435                $lang_file = 
"ilias_" . $a_lang_key . 
".lang" . $scopeExtension;
 
  438                if (!is_file($lang_file))
 
  445                if (!$content = $this->
cut_header(file($lang_file)))
 
  452                foreach ($content as $key => $val)
 
  454                        $separated = explode($this->separator, trim($val));
 
  455                        $num = count($separated);
 
  482                foreach ($content as $key => $val)
 
  484                        if (trim($val) == 
"<!-- language file start -->")
 
  486                                return array_slice($content,$key +1);
 
  505                if ($a_mode == 
'all')
 
  507                        $ilDB->manipulate(
"DELETE FROM lng_modules WHERE lang_key = ".
 
  508                                $ilDB->quote($a_lang_key, 
"text"));
 
  521                if (!$a_keep_local_change)
 
  523                        $ilDB->manipulate(
"DELETE FROM lng_data WHERE lang_key = ".
 
  524                                $ilDB->quote($a_lang_key, 
"text"));
 
  528                        $ilDB->manipulate(
"DELETE FROM lng_data WHERE lang_key = ".
 
  529                                $ilDB->quote($a_lang_key, 
"text").
 
  530                                " AND local_change IS NULL");
 
  545                if ($a_min_date == 
"")
 
  547                        $a_min_date = 
"1980-01-01 00:00:00";
 
  549                if ($a_max_date == 
"")
 
  551                        $a_max_date = 
"2200-01-01 00:00:00";
 
  554                $q = sprintf(
"SELECT * FROM lng_data WHERE lang_key = %s ".
 
  555                        "AND local_change >= %s AND local_change <= %s",
 
  556                        $ilDB->quote($a_lang_key, 
"text"), 
$ilDB->quote($a_min_date, 
"timestamp"),
 
  557                        $ilDB->quote($a_max_date, 
"timestamp"));
 
  563                        $changes[
$row[
"module"]][
$row[
"identifier"]] = 
$row[
"value"];
 
  581                $lang_array = array();
 
  585                        if ($scope == 
'global')
 
  591                                $scopeExtension = 
'.' . $scope;
 
  596                if ($scope == 
"local")
 
  598                        $path = $this->cust_lang_path;
 
  604                $lang_file = 
"ilias_" . 
$lang_key . 
".lang" . $scopeExtension;
 
  609                        $lang_array = array();
 
  610                        $lang_array[
"common"] = array();
 
  613                        if ($content = $this->
cut_header(file($lang_file)))
 
  620                                else if ($scope == 
'local')
 
  622                                        $change_date = date(
"Y-m-d H:i:s",time());
 
  623                                        $min_date = date(
"Y-m-d H:i:s", filemtime($lang_file));
 
  627                                foreach ($content as $key => $val)
 
  629                                        $separated = explode($this->separator,trim($val));
 
  632                                        $pos = strpos($separated[2], $this->comment_separator);
 
  637                                                $separated[2] = substr($separated[2] , 0 , $pos);
 
  641                                        $local_value = $local_changes[$separated[0]][$separated[1]];
 
  645                                                if ($local_value != 
"" and $local_value != $separated[2])
 
  648                                                        $lang_array[$separated[0]][$separated[1]] = $local_value;
 
  657                                                        $lang_array[$separated[0]][$separated[1]] = $separated[2];
 
  660                                        else if ($scope == 
'local')
 
  662                                                if ($local_value != 
"")
 
  665                                                        $lang_array[$separated[0]][$separated[1]] = $local_value;
 
  672                                                        $lang_array[$separated[0]][$separated[1]] = $separated[2];
 
  678                        foreach($lang_array as $module => $lang_arr)
 
  680                                if ($scope == 
"local")
 
  682                                        $q = 
"SELECT * FROM lng_modules WHERE ".
 
  683                                                " lang_key = ".$ilDB->quote($this->key, 
"text").
 
  684                                                " AND module = ".$ilDB->quote($module, 
"text");
 
  685                                        $set = 
$ilDB->query($q);
 
  687                                        $arr2 = unserialize(
$row[
"lang_array"]);
 
  690                                                $lang_arr = array_merge($arr2, $lang_arr);
 
  707                $ilDB->manipulate(sprintf(
"DELETE FROM lng_modules WHERE lang_key = %s AND module = %s",
 
  708                        $ilDB->quote($a_key, 
"text"), 
$ilDB->quote($a_module, 
"text")));
 
  713                $ilDB->insert(
"lng_modules", array(
 
  714                        "lang_key" => array(
"text", $a_key),
 
  715                        "module" => array(
"text", $a_module),
 
  716                        "lang_array" => array(
"clob", serialize($a_array))
 
  724                $a_lang_key, $a_value, $a_local_change = 
null)
 
  728                $ilDB->manipulate(sprintf(
"DELETE FROM lng_data WHERE module = %s AND ".
 
  729                        "identifier = %s AND lang_key = %s",
 
  730                        $ilDB->quote($a_module, 
"text"), 
$ilDB->quote($a_identifier, 
"text"),
 
  731                        $ilDB->quote($a_lang_key, 
"text")));
 
  735                $ilDB->manipulate(sprintf(
"INSERT INTO lng_data " .
 
  736                        "(module, identifier, lang_key, value, local_change) " .
 
  737                        "VALUES (%s,%s,%s,%s,%s)",
 
  738                        $ilDB->quote($a_module, 
"text"), 
$ilDB->quote($a_identifier, 
"text"),
 
  739                        $ilDB->quote($a_lang_key, 
"text"), 
$ilDB->quote($a_value, 
"text"),
 
  740                        $ilDB->quote($a_local_change, 
"timestamp")));
 
  747                $a_lang_key, $a_value, $a_local_change = 
null)
 
  751                $ilDB->manipulate(sprintf(
"UPDATE lng_data " .
 
  752                        "SET value = %s, local_change = %s ".
 
  753                        "WHERE module = %s AND identifier = %s AND lang_key = %s ",
 
  754                        $ilDB->quote($a_value, 
"text"), 
$ilDB->quote($a_local_change, 
"timestamp"),
 
  755                        $ilDB->quote($a_module, 
"text"), 
$ilDB->quote($a_identifier, 
"text"),
 
  756                        $ilDB->quote($a_lang_key, 
"text")));
 
  766                $local_langs = array();
 
  767                if (is_dir($this->cust_lang_path))
 
  769                        $d = dir($this->cust_lang_path);
 
  771                        chdir ($this->cust_lang_path);
 
  774                        while ($entry = 
$d->read())
 
  776                                if (is_file($entry) && (ereg (
"(^ilias_.{2}\.lang.local$)", $entry)))
 
  793                $d = dir($this->lang_path);
 
  795                chdir ($this->lang_path);
 
  798                while ($entry = 
$d->read())
 
  800                        if (is_file($entry) && (ereg (
"(^ilias_.{2}\.lang$)", $entry)))
 
  821                if (empty($a_db_handler) or !is_object($a_db_handler))
 
  826                $this->db =& $a_db_handler;
 
ilLanguage($a_lang_key)
Constructor read the single-language file and put this in an array text.
getInstalledLocalLanguages()
get already installed local languages (in db)
static updateLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null)
Update lang entry.
getAvailableLanguages()
get already registered languages (in db)
getLocalChanges($a_lang_key, $a_min_date="", $a_max_date="")
get locally changed language entries
static _deleteLangData($a_lang_key, $a_keep_local_change)
Delete languge data.
txt($a_topic)
gets the text for a given topic
static replaceLangModule($a_key, $a_module, $a_array)
Replace language module array.
flushLanguage($a_lang_key, $a_mode='all')
remove language data from database
getInstalledLanguages()
get already installed languages (in db)
insertLanguage($lang_key, $scope='')
insert language data from file in database
getLanguages()
get all setup languages in the system
checkLanguage($a_lang_key, $scope='')
validate the logical structure of a lang-file
cut_header($content)
Remove *.lang header information from '$content'.
setDbHandler($a_db_handler)
set db handler object @string object db handler
getInstallableLanguages()
installLanguages($a_lang_keys, $a_local_keys)
install languages
getLocalLanguages()
Searches for the existence of *.lang.local files.
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null)
Replace lang entry.
const ILIAS_ABSOLUTE_PATH