49 $this->toolbar = $DIC->toolbar();
50 $this->
user = $DIC->user();
51 $lng = $DIC->language();
58 $this->obj_gui = $a_obj_gui;
59 $this->obj = $a_obj_gui->object;
61 include_once(
"./Services/Object/classes/class.ilObjectTranslation.php");
72 $this->title_descr_only = $a_val;
90 $next_class = $this->ctrl->getNextClass($this);
92 switch ($next_class) {
94 $cmd = $this->ctrl->getCmd(
"listTranslations");
95 if (in_array($cmd,
array(
"listTranslations",
"saveTranslations",
96 "addTranslation",
"deleteTranslations",
"activateContentMultilinguality",
97 "confirmRemoveLanguages",
"removeLanguages",
"confirmDeactivateContentMultiLang",
"saveLanguages",
98 "saveContentTranslationActivation",
"deactivateContentMultiLang",
"addLanguages"))) {
116 $ilToolbar->addButton(
117 $this->lng->txt(
"obj_add_languages"),
118 $this->ctrl->getLinkTarget($this,
"addLanguages")
123 if (!$this->obj_trans->getContentActivated()) {
125 $ilToolbar->addButton(
126 $this->lng->txt(
"obj_activate_content_lang"),
127 $this->ctrl->getLinkTarget($this,
"activateContentMultilinguality")
130 $ilToolbar->addButton(
131 $this->lng->txt(
"obj_deactivate_content_lang"),
132 $this->ctrl->getLinkTarget($this,
"confirmDeactivateContentMultiLang")
136 if ($this->obj_trans->getContentActivated()) {
137 $ilToolbar->addButton(
138 $this->lng->txt(
"obj_deactivate_multilang"),
139 $this->ctrl->getLinkTarget($this,
"confirmDeactivateContentMultiLang")
142 $ilToolbar->addButton(
143 $this->lng->txt(
"obj_activate_multilang"),
144 $this->ctrl->getLinkTarget($this,
"activateContentMultilinguality")
150 include_once(
"./Services/Object/classes/class.ilObjectTranslation2TableGUI.php");
156 $this->obj_trans->getMasterLanguage()
158 if ($a_get_post_values) {
160 foreach (
$_POST[
"title"] as $k => $v) {
161 $vals[] =
array(
"title" => $v,
162 "desc" =>
$_POST[
"desc"][$k],
163 "lang" =>
$_POST[
"lang"][$k],
164 "default" => (
$_POST[
"default"] == $k));
168 $data = $this->obj_trans->getLanguages();
169 foreach (
$data as $k => $v) {
170 $data[$k][
"default"] = $v[
"lang_default"];
171 $data[$k][
"desc"] = $v[
"description"];
172 $data[$k][
"lang"] = $v[
"lang_code"];
180 $this->tpl->setContent(
$table->getHTML());
189 if (!isset(
$_POST[
"default"]) && $this->obj_trans->getMasterLanguage() ==
"") {
196 if (array_key_exists(
"",
$_POST[
"lang"])) {
203 if (count(array_unique(
$_POST[
"lang"])) < count(
$_POST[
"lang"])) {
210 $this->obj_trans->setLanguages(
array());
212 foreach (
$_POST[
"title"] as $k => $v) {
214 $is_default = (
$_POST[
"default"] == $k);
217 if ($this->obj_trans->getMasterLanguage() !=
"") {
218 $is_default = ($this->obj_trans->getMasterLanguage() ==
$_POST[
"lang"][$k]);
223 $this->obj->update();
226 $this->obj_trans->addLanguage(
233 $this->obj_trans->save();
236 $this->ctrl->redirect($this,
"listTranslations");
244 foreach (
$_POST[
"title"] as $k => $v) {
245 if (
$_POST[
"check"][$k]) {
247 if ($k !=
$_POST[
"default"]) {
248 unset(
$_POST[
"title"][$k]);
249 unset(
$_POST[
"desc"][$k]);
250 unset(
$_POST[
"lang"][$k]);
276 $tpl->setContent($form->getHTML());
289 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
294 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
304 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
314 $form->setTitle(
$lng->txt(
"obj_add_languages"));
315 $form->addCommandButton(
"saveLanguages",
$lng->txt(
"save"));
316 $form->addCommandButton(
"listTranslations",
$lng->txt(
"cancel"));
319 $form->setTitle(
$lng->txt(
"obj_activate_content_lang"));
321 $form->setTitle(
$lng->txt(
"obj_activate_multilang"));
323 $form->addCommandButton(
"saveContentTranslationActivation",
$lng->txt(
"save"));
324 $form->addCommandButton(
"listTranslations",
$lng->txt(
"cancel"));
341 if (
$form->checkInput()) {
342 $ml =
$form->getInput(
"master_lang");
343 $this->obj_trans->setMasterLanguage($ml);
344 $this->obj_trans->addLanguage(
346 $this->obj->getTitle(),
347 $this->obj->getDescription(),
350 $this->obj_trans->setDefaultTitle($this->obj->getTitle());
351 $this->obj_trans->setDefaultDescription($this->obj->getDescription());
352 $this->obj_trans->save();
355 $ilCtrl->redirect($this,
"listTranslations");
393 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
395 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
397 $cgui->setHeaderText(
$lng->txt(
"obj_deactivate_content_transl_conf"));
399 $cgui->setHeaderText(
$lng->txt(
"obj_deactivate_multilang_conf"));
402 $cgui->setCancel(
$lng->txt(
"cancel"),
"listTranslations");
403 $cgui->setConfirm(
$lng->txt(
"confirm"),
"deactivateContentMultiLang");
404 $tpl->setContent($cgui->getHTML());
416 $this->obj_trans->setMasterLanguage(
"");
417 $this->obj_trans->setLanguages(
array());
418 $this->obj_trans->save();
420 $this->obj_trans->deactivateContentTranslation();
428 $ilCtrl->redirect($this,
"listTranslations");
452 if (
$form->checkInput()) {
453 $ad =
$form->getInput(
"additional_langs");
455 $ml = $this->obj_trans->getMasterLanguage();
456 foreach ($ad as
$l) {
457 if ($l != $ml && $l !=
"") {
458 $this->obj_trans->addLanguage($l,
false,
"",
"");
462 $this->obj_trans->save();
464 $ilCtrl->redirect($this,
"listTranslations");
468 $form->setValuesByPost();
481 $lng->loadLanguageModule(
"meta");
483 if (!is_array(
$_POST[
"lang"]) || count(
$_POST[
"lang"]) == 0) {
485 $ilCtrl->redirect($this,
"listTranslations");
487 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
489 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
490 $cgui->setHeaderText(
$lng->txt(
"obj_conf_delete_lang"));
491 $cgui->setCancel(
$lng->txt(
"cancel"),
"listTranslations");
492 $cgui->setConfirm(
$lng->txt(
"remove"),
"removeLanguages");
495 $cgui->addItem(
"lang[]", $i,
$lng->txt(
"meta_l_" . $i));
498 $tpl->setContent($cgui->getHTML());
510 if (is_array(
$_POST[
"lang"])) {
511 $langs = $this->obj_trans->getLanguages();
512 foreach ($langs as $k =>
$l) {
514 $this->obj_trans->removeLanguage();
517 $this->obj_trans->save();
520 $ilCtrl->redirect($this,
"listTranslations");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
__construct($a_obj_gui)
Constructor.
TableGUI class for title/description translations.
confirmDeactivateContentMultiLang()
Get multi lang info.
activateContentMultilinguality()
Activate multi language (-> master language selection)
listTranslations($a_get_post_values=false, $a_add=false)
List translations.
executeCommand()
Execute command.
removeLanguages()
Remove languages.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
deleteTranslations()
Remove translation.
if(isset($_POST['submit'])) $form
getMultiLangForm($a_add=false)
Get multi language form.
getTitleDescrOnlyMode()
Get enable title/description only mode.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
deactivateContentMultiLang()
Deactivate multilanguage.
saveLanguages()
Save languages.
static getInstance($a_obj_id)
Get instance.
if(empty($password)) $table
saveTranslations()
Save translations.
confirmRemoveLanguages()
Confirm remove languages.
addLanguages()
Add language.
saveContentTranslationActivation()
Save content translation activation.
GUI class for object translation handling.
setTitleDescrOnlyMode($a_val)
Set enable title/description only mode.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Confirmation screen class.