/**
  * Set sub tabs
  *
  * @access protected
  */
 protected function setSubTabs()
 {
     $this->tabs_gui->clearSubTabs();
     $this->tabs_gui->addSubTabTarget("md_adv_record_list", $this->ctrl->getLinkTarget($this, "showRecords"), '', '', '', true);
     if (ilAdvancedMDRecord::_getAllRecordsByObjectType()) {
         $this->tabs_gui->addSubTabTarget("md_adv_presentation", $this->ctrl->getLinkTarget($this, "showPresentation"));
     }
     $this->tabs_gui->addSubTabTarget("md_adv_file_list", $this->ctrl->getLinkTarget($this, "showFiles"), "showFiles");
 }
 /**
  * init form table 'substitutions'
  *
  * @access protected
  */
 protected function initFormSubstitutions()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     if (!($visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType())) {
         return true;
     }
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     #$this->form->setTableWidth('100%');
     // substitution
     foreach ($visible_records as $obj_type => $records) {
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php';
         $sub = ilAdvancedMDSubstitution::_getInstanceByObjectType($obj_type);
         // Show section
         $section = new ilFormSectionHeaderGUI();
         $section->setSectionIcon(ilUtil::getImagePath('icon_' . $obj_type . '_s.png'), $this->lng->txt('objs_' . $obj_type));
         $section->setTitle($this->lng->txt('objs_' . $obj_type));
         $this->form->addItem($section);
         $check = new ilCheckboxInputGUI($this->lng->txt('description'), 'enabled_desc_' . $obj_type);
         $check->setValue(1);
         $check->setOptionTitle($this->lng->txt('md_adv_desc_show'));
         $check->setChecked($sub->isDescriptionEnabled() ? true : false);
         $this->form->addItem($check);
         $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'), 'enabled_field_names_' . $obj_type);
         $check->setValue(1);
         $check->setOptionTitle($this->lng->txt('md_adv_fields_show'));
         $check->setChecked($sub->enabledFieldNames() ? true : false);
         $this->form->addItem($check);
         #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
         #$area->setUseRte(true);
         #$area->setRteTagSet('standard');
         #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
         #$area->setRows(5);
         #$area->setCols(80);
         #$this->form->addItem($area);
         $definitions = ilAdvancedMDFieldDefinition::_getActiveDefinitionsByObjType($obj_type);
         $definitions = $sub->sortDefinitions($definitions);
         $counter = 1;
         foreach ($definitions as $definition_id) {
             $def = ilAdvancedMDFieldDefinition::_getInstanceByFieldId($definition_id);
             if ($def->isDeleted()) {
                 continue;
             }
             $title = ilAdvancedMDRecord::_lookupTitle($def->getRecordId());
             $title = $def->getTitle() . ' (' . $title . ')';
             $check = new ilCheckboxInputGUI($title, 'show[' . $obj_type . '][' . $definition_id . ']');
             $check->setValue(1);
             $check->setOptionTitle($this->lng->txt('md_adv_show'));
             $check->setChecked($sub->isSubstituted($definition_id));
             $pos = new ilTextInputGUI($this->lng->txt('position'), 'position[' . $obj_type . '][' . $definition_id . ']');
             $pos->setSize(3);
             $pos->setMaxLength(4);
             $pos->setValue(sprintf('%.1f', $counter++));
             $check->addSubItem($pos);
             $bold = new ilCheckboxInputGUI($this->lng->txt('bold'), 'bold[' . $obj_type . '][' . $definition_id . ']');
             $bold->setValue(1);
             $bold->setChecked($sub->isBold($definition_id));
             $check->addSubItem($bold);
             $bold = new ilCheckboxInputGUI($this->lng->txt('newline'), 'newline[' . $obj_type . '][' . $definition_id . ']');
             $bold->setValue(1);
             $bold->setChecked($sub->hasNewline($definition_id));
             $check->addSubItem($bold);
             $this->form->addItem($check);
         }
         // placeholder
         /*
         $custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders'));
         $tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData');
         foreach($records as $record)
         {
         	foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition)
         	{
         		$tpl->setCurrentBlock('field');
         		$tpl->setVariable('FIELD_NAME',$definition->getTitle());
         		$tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'.
         			'[/IF_F_'.$definition->getFieldId().']');
         		$tpl->parseCurrentBlock();
         	}
         	
         	$tpl->setCurrentBlock('record');
         	$tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for'));
         	$tpl->setVariable('TITLE',$record->getTitle());
         	$tpl->parseCurrentBlock();
         }
         $custom->setHTML($tpl->get());
         $this->form->addItem($custom);
         */
     }
     $this->form->setTitle($this->lng->txt('md_adv_substitution_table'));
     $this->form->addCommandButton('updateSubstitutions', $this->lng->txt('save'));
     return true;
 }