public function editFields()
 {
     global $ilToolbar;
     $this->ctrl->saveParameter($this, 'record_id');
     $this->initRecordObject();
     $perm = $this->getPermissions()->hasPermissions(ilAdvancedMDPermissionHelper::CONTEXT_RECORD, $this->record->getRecordId(), array(ilAdvancedMDPermissionHelper::ACTION_RECORD_CREATE_FIELD, ilAdvancedMDPermissionHelper::ACTION_RECORD_FIELD_POSITIONS));
     if ($perm[ilAdvancedMDPermissionHelper::ACTION_RECORD_CREATE_FIELD]) {
         // type selection
         include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
         $types = new ilSelectInputGUI("", "ftype");
         $options = array();
         foreach (ilAdvancedMDFieldDefinition::getValidTypes() as $type) {
             $field = ilAdvancedMDFieldDefinition::getInstance(null, $type);
             $options[$type] = $this->lng->txt($field->getTypeTitle());
         }
         $types->setOptions($options);
         $ilToolbar->addInputItem($types);
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "createField"));
         include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
         $button = ilSubmitButton::getInstance();
         $button->setCaption("add");
         $button->setCommand("createField");
         $ilToolbar->addButtonInstance($button);
     }
     // show field table
     include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
     $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->record->getRecordId());
     include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php";
     $table_gui = new ilAdvancedMDFieldTableGUI($this, "editRecord", $this->getPermissions(), $perm[ilAdvancedMDPermissionHelper::ACTION_RECORD_FIELD_POSITIONS]);
     $table_gui->setTitle($this->lng->txt("md_adv_field_table"));
     $table_gui->parseDefinitions($fields);
     if (sizeof($fields)) {
         $table_gui->addCommandButton("updateFields", $this->lng->txt("save"));
     }
     $table_gui->addCommandButton("showRecords", $this->lng->txt('cancel'));
     $table_gui->addMultiCommand("confirmDeleteFields", $this->lng->txt("delete"));
     $table_gui->setSelectAllCheckbox("field_id");
     $this->tpl->setContent($table_gui->getHTML());
 }