54 include_once(
"./Services/Object/exceptions/class.ilObjectException.php");
69 if (!isset(self::$instances[$a_obj_id]))
74 return self::$instances[$a_obj_id];
85 $this->obj_id = $a_val;
105 $this->master_lang = $a_val;
125 $this->languages = $a_val;
146 function addLanguage($a_lang, $a_title, $a_description, $a_default, $a_force =
false)
148 if ($a_lang !=
"" && (!isset($this->languages[$a_lang]) || $a_force))
152 foreach ($this->languages as $k =>
$l)
154 $this->languages[$k][
"lang_default"] =
false;
157 $this->languages[$a_lang] =
array(
"lang_code" => $a_lang,
"lang_default" => $a_default,
158 "title" => $a_title,
"description" => $a_description);
169 foreach ($this->languages as
$l)
171 if ($l[
"lang_default"])
186 foreach ($this->languages as $k =>
$l)
188 if (
$l[
"lang_default"])
190 $this->languages[$k][
"title"] = $a_title;
202 foreach ($this->languages as
$l)
204 if ($l[
"lang_default"])
206 return $l[
"description"];
219 foreach ($this->languages as $k =>
$l)
221 if (
$l[
"lang_default"])
223 $this->languages[$k][
"description"] = $a_description;
238 unset($this->languages[$a_lang]);
250 $this->content_activated = $a_val;
268 $set = $this->db->query(
"SELECT * FROM obj_content_master_lng ".
269 " WHERE obj_id = ".$this->db->quote($this->getObjId(),
"integer")
271 if ($rec = $this->db->fetchAssoc($set))
282 $set = $this->db->query(
"SELECT * FROM object_translation ".
283 " WHERE obj_id = ".$this->db->quote($this->getObjId(),
"integer")
285 while ($rec = $this->db->fetchAssoc($set))
287 $this->
addLanguage($rec[
"lang_code"], $rec[
"title"], $rec[
"description"], $rec[
"lang_default"]);
296 $this->db->manipulate(
"DELETE FROM obj_content_master_lng ".
297 " WHERE obj_id = ".$this->db->quote($this->getObjId(),
"integer")
299 $this->db->manipulate(
"DELETE FROM object_translation ".
300 " WHERE obj_id = ".$this->db->quote($this->getObjId(),
"integer")
309 $this->db->manipulate(
"DELETE FROM obj_content_master_lng ".
310 " WHERE obj_id = ".$this->db->quote($this->getObjId(),
"integer")
323 $this->db->manipulate(
"INSERT INTO obj_content_master_lng ".
324 "(obj_id, master_lang) VALUES (".
325 $this->db->quote($this->getObjId(),
"integer").
",".
326 $this->db->quote($this->getMasterLanguage(),
"text").
333 "description" =>
"",
"lang_code" => $this->
getMasterLanguage(),
"lang_default" => 1);
335 foreach ($this->languages as
$l => $trans)
339 $this->languages[
$l][
"lang_default"] = 1;
343 $this->languages[
$l][
"lang_default"] = 0;
350 $this->db->manipulate(
$t =
"INSERT INTO object_translation ".
351 "(obj_id, title, description, lang_code, lang_default) VALUES (".
352 $this->db->quote($this->getObjId(),
"integer").
",".
353 $this->db->quote($trans[
"title"],
"text").
",".
354 $this->db->quote($trans[
"description"],
"text").
",".
355 $this->db->quote(
$l,
"text").
",".
356 $this->db->quote($trans[
"lang_default"],
"integer").
392 isset($langs[$a_lang]) &&
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
getMasterLanguage()
Get master language.
copy($a_obj_id)
Copy multilinguality settings.
getLanguages()
Get languages.
deactivateContentTranslation()
Deactivate content translation.
__construct($a_obj_id)
Constructor.
setDefaultDescription($a_description)
Set default description.
getEffectiveContentLang($a_lang, $a_parent_type)
Get effective language for given language.
setLanguages(array $a_val)
Set languages.
Base exception class for object service.
addLanguage($a_lang, $a_title, $a_description, $a_default, $a_force=false)
Add language.
getDefaultDescription()
Get default description.
setContentActivated($a_val)
Set activated for content.
setObjId($a_val)
Set object id.
getContentActivated()
Get activated for content.
setDefaultTitle($a_title)
Set default title.
getDefaultTitle()
Get default title.
removeLanguage($a_lang)
Remove language.
Create styles array
The data for the language used.
static getInstance($a_obj_id)
Get instance.
Class handles translation mode for an object.
setMasterLanguage($a_val)
Set master language.