27 $this->obj_gui = $a_obj_gui;
28 $this->obj = $a_obj_gui->object;
30 include_once(
"./Services/Object/classes/class.ilObjectTranslation.php");
41 $this->title_descr_only = $a_val;
59 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd(
"listTranslations");
65 if (in_array(
$cmd, array(
"listTranslations",
"saveTranslations",
66 "addTranslation",
"deleteTranslations",
"activateContentMultilinguality",
67 "confirmRemoveLanguages",
"removeLanguages",
"confirmDeactivateContentMultiLang",
"saveLanguages",
68 "saveContentTranslationActivation",
"deactivateContentMultiLang",
"addLanguages")))
88 $ilToolbar->addButton($this->lng->txt(
"obj_add_languages"),
89 $this->ctrl->getLinkTarget($this,
"addLanguages"));
94 if (!$this->obj_trans->getContentActivated())
97 $ilToolbar->addButton($this->lng->txt(
"obj_activate_content_lang"),
98 $this->ctrl->getLinkTarget($this,
"activateContentMultilinguality"));
102 $ilToolbar->addButton($this->lng->txt(
"obj_deactivate_content_lang"),
103 $this->ctrl->getLinkTarget($this,
"confirmDeactivateContentMultiLang"));
109 if ($this->obj_trans->getContentActivated())
111 $ilToolbar->addButton($this->lng->txt(
"obj_deactivate_multilang"),
112 $this->ctrl->getLinkTarget($this,
"confirmDeactivateContentMultiLang"));
116 $ilToolbar->addButton($this->lng->txt(
"obj_activate_multilang"),
117 $this->ctrl->getLinkTarget($this,
"activateContentMultilinguality"));
122 include_once(
"./Services/Object/classes/class.ilObjectTranslation2TableGUI.php");
124 "Translation", $this->obj_trans->getMasterLanguage());
125 if ($a_get_post_values)
128 foreach(
$_POST[
"title"] as $k => $v)
130 $vals[] = array(
"title" => $v,
131 "desc" =>
$_POST[
"desc"][$k],
132 "lang" =>
$_POST[
"lang"][$k],
133 "default" => (
$_POST[
"default"] == $k));
135 $table->setData($vals);
139 $data = $this->obj_trans->getLanguages();
140 foreach($data as $k => $v)
142 $data[$k][
"default"] = $v[
"lang_default"];
143 $data[$k][
"desc"] = $v[
"description"];
144 $data[$k][
"lang"] = $v[
"lang_code"];
150 $table->setData($data);
152 $this->tpl->setContent($table->getHTML());
162 if (!isset(
$_POST[
"default"]) && $this->obj_trans->getMasterLanguage() ==
"")
170 if (array_key_exists(
"",
$_POST[
"lang"]))
178 if (count(array_unique(
$_POST[
"lang"])) < count(
$_POST[
"lang"]))
186 $this->obj_trans->setLanguages(array());
188 foreach(
$_POST[
"title"] as $k => $v)
191 $is_default = (
$_POST[
"default"] == $k);
194 if ($this->obj_trans->getMasterLanguage() !=
"")
196 $is_default = ($this->obj_trans->getMasterLanguage() ==
$_POST[
"lang"][$k]);
202 $this->obj->update();
211 $this->obj_trans->save();
214 $this->ctrl->redirect($this,
"listTranslations");
223 foreach(
$_POST[
"title"] as $k => $v)
228 if($k !=
$_POST[
"default"])
230 unset(
$_POST[
"title"][$k]);
231 unset(
$_POST[
"desc"][$k]);
232 unset(
$_POST[
"lang"][$k]);
259 $tpl->setContent($form->getHTML());
269 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
275 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
279 $si->setValue($ilUser->getLanguage());
286 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
297 $form->setTitle($lng->txt(
"obj_add_languages"));
298 $form->addCommandButton(
"saveLanguages", $lng->txt(
"save"));
299 $form->addCommandButton(
"listTranslations", $lng->txt(
"cancel"));
305 $form->setTitle($lng->txt(
"obj_activate_content_lang"));
309 $form->setTitle($lng->txt(
"obj_activate_multilang"));
311 $form->addCommandButton(
"saveContentTranslationActivation", $lng->txt(
"save"));
312 $form->addCommandButton(
"listTranslations", $lng->txt(
"cancel"));
314 $form->setFormAction($ilCtrl->getFormAction($this));
329 if ($form->checkInput())
331 $ml = $form->getInput(
"master_lang");
332 $this->obj_trans->setMasterLanguage($ml);
333 $this->obj_trans->save();
336 $ilCtrl->redirect($this,
"listTranslations");
372 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
374 $cgui->setFormAction($ilCtrl->getFormAction($this));
377 $cgui->setHeaderText($lng->txt(
"obj_deactivate_content_transl_conf"));
381 $cgui->setHeaderText($lng->txt(
"obj_deactivate_multilang_conf"));
384 $cgui->setCancel($lng->txt(
"cancel"),
"listTranslations");
385 $cgui->setConfirm($lng->txt(
"confirm"),
"deactivateContentMultiLang");
386 $tpl->setContent($cgui->getHTML());
396 $this->obj_trans->deactivateContentTranslation();
407 $ilCtrl->redirect($this,
"listTranslations");
418 $tpl->setContent($form->getHTML());
429 if ($form->checkInput())
431 $ad = $form->getInput(
"additional_langs");
434 $ml = $this->obj_trans->getMasterLanguage();
437 if ($l != $ml && $l !=
"")
439 $this->obj_trans->addLanguage($l,
false,
"",
"");
444 $this->obj_trans->save();
446 $ilCtrl->redirect($this,
"listTranslations");
456 $lng->loadLanguageModule(
"meta");
458 if (!is_array(
$_POST[
"lang"]) || count(
$_POST[
"lang"]) == 0)
461 $ilCtrl->redirect($this,
"listTranslations");
465 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
467 $cgui->setFormAction($ilCtrl->getFormAction($this));
468 $cgui->setHeaderText($lng->txt(
"obj_conf_delete_lang"));
469 $cgui->setCancel($lng->txt(
"cancel"),
"listTranslations");
470 $cgui->setConfirm($lng->txt(
"remove"),
"removeLanguages");
472 foreach (
$_POST[
"lang"] as $i)
474 $cgui->addItem(
"lang[]", $i, $lng->txt(
"meta_l_".$i));
477 $tpl->setContent($cgui->getHTML());
488 if (is_array(
$_POST[
"lang"]))
490 $langs = $this->obj_trans->getLanguages();
491 foreach ($langs as $k => $l)
493 if (in_array($l,
$_POST[
"lang"]))
495 $this->obj_trans->removeLanguage();
498 $this->obj_trans->save();
501 $ilCtrl->redirect($this,
"listTranslations");