protected function initAddNewEntryForm($a_id = null)
 {
     global $ilCtrl;
     if (!$a_id) {
         $a_id = $_POST["id"];
     }
     if (!$a_id || !in_array($a_id, ilObjLanguageAccess::_getSavedTopics())) {
         $ilCtrl->redirect($this, "view");
     }
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "saveNewEntry"));
     $form->setTitle($this->lng->txt("adm_missing_entry_add"));
     $mods = ilObjLanguageAccess::_getSavedModules();
     $options = array_combine($mods, $mods);
     $mod = new ilSelectInputGUI(ucfirst($this->lng->txt("module")), "mod");
     $mod->setOptions(array("" => $this->lng->txt("please_select")) + $options);
     $mod->setRequired(true);
     $form->addItem($mod);
     $id = new ilTextInputGUI(ucfirst($this->lng->txt("identifier")), "id");
     $id->setValue($a_id);
     $id->setDisabled(true);
     $form->addItem($id);
     foreach ($this->lng->getInstalledLanguages() as $lang_key) {
         $trans = new ilTextInputGUI($this->lng->txt("meta_l_" . $lang_key), "trans_" . $lang_key);
         if (in_array($lang_key, array("de", "en"))) {
             $trans->setRequired(true);
         }
         $form->addItem($trans);
     }
     $form->addCommandButton("saveNewEntry", $this->lng->txt("save"));
     $form->addCommandButton("view", $this->lng->txt("cancel"));
     return $form;
 }
 /**
  * Show the edit screen
  */
 function viewObject()
 {
     global $tpl;
     // get the view table
     $table_gui = $this->getViewTable();
     // get the remarks in database
     $comments = $this->object->getAllRemarks();
     // set the language to compare with
     // get the default values if the compare language is the same
     $compare = $table_gui->getFilterItemByPostVar('compare')->getValue();
     if ($compare == $this->object->key) {
         $compare_object = $this->object->getGlobalLanguageFile();
         $compare_content = $compare_object->getAllValues();
         $compare_comments = $compare_object->getAllComments();
     }
     // page translation mode:
     // - the table is filtered by a list of modules and topics
     if (ilObjLanguageAccess::_isPageTranslation()) {
         // get the selection of modules and topics from request or session
         $modules = ilObjLanguageAccess::_getSavedModules();
         $topics = ilObjLanguageAccess::_getSavedTopics();
         // first call for translation
         if ($_GET['reset_offset']) {
             $table_gui->resetOffset();
         }
         if (!isset($compare_content)) {
             $compare_content = ilObjLanguageExt::_getValues($compare, $modules, $topics);
             $compare_comments = ilObjLanguageExt::_getRemarks($compare);
         }
         $translations = ilObjLanguageExt::_getValues($this->object->key, $modules, $topics);
     } else {
         $filter_mode = $table_gui->getFilterItemByPostVar('mode')->getValue();
         $filter_pattern = $table_gui->getFilterItemByPostVar('pattern')->getValue();
         $filter_module = $table_gui->getFilterItemByPostVar('module')->getValue();
         $filter_module = $filter_module == 'all' ? '' : $filter_module;
         $filter_modules = $filter_module ? array($filter_module) : array();
         if (!isset($compare_content)) {
             $compare_content = ilObjLanguageExt::_getValues($compare, $filter_modules);
             $compare_comments = ilObjLanguageExt::_getRemarks($compare);
         }
         switch ($filter_mode) {
             case "changed":
                 $translations = $this->object->getChangedValues($filter_modules, $filter_pattern);
                 break;
             case "added":
                 //langmode only
                 $translations = $this->object->getAddedValues($filter_modules, $filter_pattern);
                 break;
             case "unchanged":
                 $translations = $this->object->getUnchangedValues($filter_modules, $filter_pattern);
                 break;
             case "commented":
                 $translations = $this->object->getCommentedValues($filter_modules, $filter_pattern);
                 break;
             case "dbremarks":
                 $translations = $this->object->getAllValues($filter_modules, $filter_pattern);
                 $translations = array_intersect_key($translations, $remarks);
                 break;
             case "equal":
                 $translations = $this->object->getAllValues($filter_modules, $filter_pattern);
                 $translations = array_intersect_assoc($translations, $compare_content);
                 break;
             case "different":
                 $translations = $this->object->getAllValues($filter_modules, $filter_pattern);
                 $translations = array_diff_assoc($translations, $compare_content);
                 break;
             case "conflicts":
                 $former_file = $this->object->getCustLangPath() . '/ilias_' . $this->object->key . '.lang';
                 if (!is_readable($former_file)) {
                     ilUtil::sendFailure(sprintf($this->lng->txt("language_former_file_missing"), $former_file) . '<br />' . $this->lng->txt("language_former_file_description"), false);
                     $translations = array();
                     break;
                 }
                 $global_file_obj = $this->object->getGlobalLanguageFile();
                 $former_file_obj = new ilLanguageFile($former_file);
                 $former_file_obj->read();
                 $global_changes = array_diff_assoc($global_file_obj->getAllValues(), $former_file_obj->getAllValues());
                 if (!count($global_changes)) {
                     ilUtil::sendInfo(sprintf($this->lng->txt("language_former_file_equal"), $former_file) . '<br />' . $this->lng->txt("language_former_file_description"), false);
                     $translations = array();
                     break;
                 }
                 $translations = $this->object->getChangedValues($filter_modules, $filter_pattern);
                 $translations = array_intersect_key($translations, $global_changes);
                 break;
             case "all":
             default:
                 $translations = $this->object->getAllValues($filter_modules, $filter_pattern);
         }
     }
     // prepare the the data for the table
     $data = array();
     foreach ($translations as $name => $translation) {
         $keys = explode($this->lng->separator, $name);
         $row = array();
         $row["module"] = $keys[0];
         $row["topic"] = $keys[1];
         $row["name"] = $name;
         $row["translation"] = $translation;
         $row["comment"] = $comments[$name];
         $row["default"] = $compare_content[$name];
         $row["default_comment"] = $compare_comments[$name];
         $data[] = $row;
     }
     // render and show the table
     $table_gui->setData($data);
     $tpl->setContent($table_gui->getHTML());
 }