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)
148 if ($a_lang !=
"" && !isset($this->languages[$a_lang]))
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(
"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]) &&