/** * Save title and translations */ function saveTranslations() { // default language set? if (!isset($_POST["default"])) { ilUtil::sendFailure($this->lng->txt("msg_no_default_language")); return $this->editTranslations(true); } // all languages set? if (array_key_exists("", $_POST["lang"])) { ilUtil::sendFailure($this->lng->txt("msg_no_language_selected")); return $this->editTranslations(true); } // no single language is selected more than once? if (count(array_unique($_POST["lang"])) < count($_POST["lang"])) { ilUtil::sendFailure($this->lng->txt("msg_multi_language_selected")); return $this->editTranslations(true); } // save the stuff $this->ilObjectOrgUnit->removeTranslations(); foreach ($_POST["title"] as $k => $v) { // update object data if default $is_default = $_POST["default"] == $k; if ($is_default) { $this->ilObjectOrgUnit->setTitle(ilUtil::stripSlashes($v)); $this->ilObjectOrgUnit->setDescription(ilUtil::stripSlashes($_POST["desc"][$k])); $this->ilObjectOrgUnit->update(); } $this->ilObjectOrgUnit->addTranslation(ilUtil::stripSlashes($v), ilUtil::stripSlashes($_POST["desc"][$k]), ilUtil::stripSlashes($_POST["lang"][$k]), $is_default); } ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, "editTranslations"); }