34 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualism.php");
45 $this->title_descr_only = $a_val;
63 $next_class = $this->ctrl->getNextClass($this);
68 $cmd = $this->ctrl->getCmd(
"listTranslations");
69 if (in_array(
$cmd,
array(
"listTranslations",
"saveTranslations",
70 "addTranslation",
"deleteTranslations",
"activateContentMultilinguality",
71 "confirmRemoveLanguages",
"removeLanguages",
"confirmDeactivateContentMultiLang",
"saveLanguages",
72 "saveContentTranslationActivation",
"deactivateContentMultiLang",
"addLanguages")))
85 $this->lng->loadLanguageModule(
"translation");
90 include_once(
"./Services/Multilingualism/classes/class.ilMultilingualismTableGUI.php");
93 if ($a_get_post_values)
96 foreach(
$_POST[
"title"] as $k => $v)
98 $vals[] =
array(
"title" => $v,
99 "desc" =>
$_POST[
"desc"][$k],
100 "lang" =>
$_POST[
"lang"][$k],
101 "default" => (
$_POST[
"default"] == $k));
103 $table->setData($vals);
107 $data = $this->obj_trans->getLanguages();
108 foreach(
$data as $k => $v)
110 $data[$k][
"default"] = $v[
"lang_default"];
111 $data[$k][
"desc"] = $v[
"description"];
112 $data[$k][
"lang"] = $v[
"lang_code"];
116 $data[
"Fobject"][++$k][
"title"] =
"";
118 $table->setData(
$data);
120 $this->tpl->setContent($table->getHTML());
129 $ilToolbar->addButton($this->lng->txt(
"obj_add_languages"),
130 $this->ctrl->getLinkTarget($this,
"addLanguages"));
140 if (!isset(
$_POST[
"default"]))
148 if (array_key_exists(
"",
$_POST[
"lang"]))
156 if (count(array_unique(
$_POST[
"lang"])) < count(
$_POST[
"lang"]))
164 $this->obj_trans->setLanguages(
array());
166 foreach(
$_POST[
"title"] as $k => $v)
169 $is_default = (
$_POST[
"default"] == $k);
177 $this->obj_trans->save();
180 $this->ctrl->redirect($this,
"listTranslations");
189 foreach(
$_POST[
"title"] as $k => $v)
194 if($k !=
$_POST[
"default"])
196 unset(
$_POST[
"title"][$k]);
197 unset(
$_POST[
"desc"][$k]);
198 unset(
$_POST[
"lang"][$k]);
222 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
228 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
232 $si->setValue($ilUser->getLanguage());
239 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
250 $form->setTitle($lng->txt(
"obj_add_languages"));
251 $form->addCommandButton(
"saveLanguages", $lng->txt(
"save"));
252 $form->addCommandButton(
"listTranslations", $lng->txt(
"cancel"));
258 $form->setTitle($lng->txt(
"obj_activate_content_lang"));
262 $form->setTitle($lng->txt(
"obj_activate_multilang"));
264 $form->addCommandButton(
"saveContentTranslationActivation", $lng->txt(
"save"));
265 $form->addCommandButton(
"listTranslations", $lng->txt(
"cancel"));
267 $form->setFormAction($ilCtrl->getFormAction($this));
279 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
281 $cgui->setFormAction($ilCtrl->getFormAction($this));
284 $cgui->setHeaderText($lng->txt(
"obj_deactivate_content_transl_conf"));
288 $cgui->setHeaderText($lng->txt(
"obj_deactivate_multilang_conf"));
291 $cgui->setCancel($lng->txt(
"cancel"),
"listTranslations");
292 $cgui->setConfirm($lng->txt(
"confirm"),
"deactivateContentMultiLang");
293 $tpl->setContent($cgui->getHTML());
307 $tpl->setContent($form->getHTML());
320 if($form->checkInput())
322 $ad = $form->getInput(
"additional_langs");
336 if(!count($this->obj_trans->getLanguages()))
341 $this->obj_trans->addLanguage($l, $this->start_title, $this->start_description,$std);
345 $this->obj_trans->save();
347 $ilCtrl->redirect($this,
"listTranslations");
351 $form->setValuesByPost();
365 $lng->loadLanguageModule(
"meta");
367 if (!is_array(
$_POST[
"lang"]) || count(
$_POST[
"lang"]) == 0)
370 $ilCtrl->redirect($this,
"listTranslations");
374 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
376 $cgui->setFormAction($ilCtrl->getFormAction($this));
377 $cgui->setHeaderText($lng->txt(
"obj_conf_delete_lang"));
378 $cgui->setCancel($lng->txt(
"cancel"),
"listTranslations");
379 $cgui->setConfirm($lng->txt(
"remove"),
"removeLanguages");
381 foreach (
$_POST[
"lang"] as $i)
383 $cgui->addItem(
"lang[]", $i, $lng->txt(
"meta_l_".$i));
386 $tpl->setContent($cgui->getHTML());
397 if (is_array(
$_POST[
"lang"]))
399 $langs = $this->obj_trans->getLanguages();
400 foreach ($langs as $k =>
$l)
404 $this->obj_trans->removeLanguage();
407 $this->obj_trans->save();
410 $ilCtrl->redirect($this,
"listTranslations");
419 $this->start_title = $a_title;
420 $this->start_description = $a_description;
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
GUI class for object translation handling.
static getInstance($a_obj_id, $a_type)
Get instance.
saveTranslations()
Save translations.
saveLanguages()
Save languages.
getTitleDescrOnlyMode()
Get enable title/description only mode.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options
confirmDeactivateContentMultiLang()
Confirm page translation creation.
deleteTranslations()
Remove translation.
TableGUI class for title/description translations.
setStartValues($a_title, $a_description)
listTranslations($a_get_post_values=false, $a_add=false)
List translations.
setTitleDescrOnlyMode($a_val)
Set 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 sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
addLanguages(ilPropertyFormGUI $form=null)
Add language.
removeLanguages()
Remove languages.
confirmRemoveLanguages()
Confirm remove languages.
getMultiLangForm($a_add=false)
Get multi language form.
static getLogger($a_component_id)
Get component logger.
executeCommand()
Execute command.
__construct($a_obj_id, $a_type)
ilTranslationGUI constructor.
Confirmation screen class.