/**
  * initialisation
  */
 function init()
 {
     $this->copy_enabled = false;
     $this->static_link_enabled = false;
     $this->delete_enabled = true;
     $this->cut_enabled = true;
     $this->subscribe_enabled = true;
     $this->link_enabled = false;
     $this->payment_enabled = true;
     $this->info_screen_enabled = true;
     $this->type = "crs";
     $this->gui_class_name = "ilobjcoursegui";
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php';
     $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
     if ($this->substitutions->isActive()) {
         $this->substitutions_enabled = true;
     }
 }
 /**
  * init
  *
  * @access public
  */
 public function init()
 {
     $this->copy_enabled = false;
     $this->static_link_enabled = true;
     $this->delete_enabled = true;
     $this->cut_enabled = true;
     $this->subscribe_enabled = true;
     $this->link_enabled = true;
     $this->info_screen_enabled = true;
     $this->type = 'rwik';
     $this->gui_class_name = 'ilobjremotefilegui';
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php';
     $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
     if ($this->substitutions->isActive()) {
         $this->substitutions_enabled = true;
     }
     // general commands array
     include_once 'Modules/RemoteFile/classes/class.ilObjRemoteFileAccess.php';
     $this->commands = ilObjRemoteFileAccess::_getCommands();
 }
 /**
  * initialisation
  */
 function init()
 {
     $this->static_link_enabled = true;
     $this->delete_enabled = true;
     $this->cut_enabled = true;
     $this->copy_enabled = true;
     $this->subscribe_enabled = true;
     $this->link_enabled = false;
     $this->payment_enabled = false;
     $this->info_screen_enabled = true;
     $this->type = "cat";
     $this->gui_class_name = "ilobjcategorygui";
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php';
     $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
     if ($this->substitutions->isActive()) {
         $this->substitutions_enabled = true;
     }
     // general commands array
     include_once './Modules/Category/classes/class.ilObjCategoryAccess.php';
     $this->commands = ilObjCategoryAccess::_getCommands();
 }
 /**
  * init form table 'substitutions'
  *
  * @access protected
  */
 protected function initFormSubstitutions()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     if (!($visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType())) {
         return;
     }
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     #$this->form->setTableWidth('100%');
     // substitution
     foreach ($visible_records as $obj_type => $records) {
         $perm = null;
         // :TODO: hardwird ?
         if (in_array($obj_type, array("crs", "cat"))) {
             $perm = $this->getPermissions()->hasPermissions(ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION, $obj_type, array(ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS));
         }
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php';
         $sub = ilAdvancedMDSubstitution::_getInstanceByObjectType($obj_type);
         // Show section
         $section = new ilFormSectionHeaderGUI();
         $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);
         if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION]) {
             $check->setDisabled(true);
         }
         $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);
         if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES]) {
             $check->setDisabled(true);
         }
         #$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);
         if ($perm) {
             $perm_pos = $perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS];
         }
         $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($obj_type);
         $definitions = $sub->sortDefinitions($definitions);
         $counter = 1;
         foreach ($definitions as $def) {
             $definition_id = $def->getFieldId();
             $perm = $this->getSubstitutionFieldPermissions($obj_type, $definition_id);
             $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));
             if ($perm && !$perm["show"]) {
                 $check->setDisabled(true);
             }
             $pos = new ilNumberInputGUI($this->lng->txt('position'), 'position[' . $obj_type . '][' . $definition_id . ']');
             $pos->setSize(3);
             $pos->setMaxLength(4);
             $pos->allowDecimals(true);
             $pos->setValue(sprintf('%.1f', $counter++));
             $check->addSubItem($pos);
             if ($perm && !$perm_pos) {
                 $pos->setDisabled(true);
             }
             $bold = new ilCheckboxInputGUI($this->lng->txt('bold'), 'bold[' . $obj_type . '][' . $definition_id . ']');
             $bold->setValue(1);
             $bold->setChecked($sub->isBold($definition_id));
             $check->addSubItem($bold);
             if ($perm && !$perm["bold"]) {
                 $bold->setDisabled(true);
             }
             $bold = new ilCheckboxInputGUI($this->lng->txt('newline'), 'newline[' . $obj_type . '][' . $definition_id . ']');
             $bold->setValue(1);
             $bold->setChecked($sub->hasNewline($definition_id));
             $check->addSubItem($bold);
             if ($perm && !$perm["newline"]) {
                 $bold->setDisabled(true);
             }
             $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;
 }
 /**
  * init ECS mappings
  *
  * @access private
  * 
  */
 private function initECSMappings()
 {
     return true;
     include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
     if (isset(self::$mappings) and is_object(self::$mappings)) {
         return true;
     }
     self::$mappings = ilECSDataMappingSettings::_getInstance();
     return true;
 }
 /**
  * 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;
 }