4include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
 
    5include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
 
    6include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDPermissionHelper.php');
 
   33        public function __construct($a_obj_id = 
null, $a_obj_type = 
null, $a_sub_type = 
null)
 
   39                $this->lng->loadLanguageModule(
'meta');
 
   41                $this->tabs_gui = $ilTabs;
 
   43                $this->obj_id = $a_obj_id;
 
   44                $this->obj_type = $a_obj_type;
 
   45                $this->sub_type = $a_sub_type 
 
   72                $next_class = $this->ctrl->getNextClass($this);
 
   73                $cmd = $this->ctrl->getCmd();
 
  100                global $ilToolbar, $ilAccess;
 
  112                        include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";              
 
  114                        $button->setCaption(
"add");
 
  115                        $button->setUrl($this->ctrl->getLinkTarget($this, 
"createRecord"));             
 
  116                        $ilToolbar->addButtonInstance($button);
 
  120                                $ilToolbar->addSeparator();
 
  126                        include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";              
 
  128                        $button->setCaption(
"import");
 
  129                        $button->setUrl($this->ctrl->getLinkTarget($this, 
"importRecords"));            
 
  130                        $ilToolbar->addButtonInstance($button);                 
 
  133                $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.show_records.html',
'Services/AdvancedMetaData');
 
  135                include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php");
 
  137                $table_gui->setTitle($this->lng->txt(
"md_record_list_table"));
 
  142                $table_gui->addMultiCommand(
"exportRecords",$this->lng->txt(
'export'));         
 
  143                $table_gui->setSelectAllCheckbox(
"record_id");
 
  145                if($ilAccess->checkAccess(
'write',
'',
$_REQUEST[
"ref_id"]))
 
  147                        $table_gui->addMultiCommand(
"confirmDeleteRecords", $this->lng->txt(
"delete"));         
 
  148                        $table_gui->addCommandButton(
"updateRecords", $this->lng->txt(
"save"));
 
  152                $this->tpl->setVariable(
'RECORD_TABLE',$table_gui->getHTML());
 
  161                        if (is_object($this->form))
 
  163                                $this->tabs_gui->setSubTabActive(
'md_adv_presentation');
 
  164                                return $this->tpl->setContent($this->form->getHTML());
 
  180                if(!$ilAccess->checkAccess(
'write',
'',
$_REQUEST[
"ref_id"]))
 
  182                        $this->ctrl->redirect($this, 
"showPresentation");
 
  189                        if(in_array(
$obj_type, array(
"crs", 
"cat")))
 
  201                        include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
 
  211                                $sub->enableFieldNames((
int) 
$_POST[
'enabled_field_names_'.
$obj_type]);
 
  215                        $definitions = $sub->sortDefinitions($definitions);
 
  220                        foreach($definitions as $def)
 
  222                                $field_id = $def->getFieldId();
 
  223                                $old_sub[$field_id] = array(
 
  224                                        "active" => $sub->isSubstituted($field_id),
 
  226                                        "bold" => $sub->isBold($field_id),
 
  227                                        "newline" => $sub->hasNewline($field_id)                                        
 
  231                        $sub->resetSubstitutions(array());
 
  234                        foreach($definitions as $def)
 
  236                                $field_id = $def->getFieldId();
 
  237                                $old = $old_sub[$field_id];
 
  240                                if($perm_def[
"show"])
 
  246                                        $active = $old[
"active"];
 
  251                                        $new_sub[$field_id] = $old;
 
  255                                                $new_sub[$field_id][
"pos"] = (int)
$_POST[
'position'][
$obj_type][$field_id];
 
  257                                        if($perm_def[
"bold"])
 
  261                                        if($perm_def[
"newline"])
 
  271                                foreach($new_sub as $field_id => $field)
 
  273                                        $sub->appendSubstitution($field_id, $field[
"bold"], $field[
"newline"]);
 
  282                $this->ctrl->redirect($this, 
"showPresentation");
 
  292                if(!isset(
$_POST[
'record_id']))
 
  301                foreach(
$_POST[
'record_id'] as $record_id)
 
  309                                $fail[] = $record->getTitle(); 
 
  315                        $this->ctrl->redirect($this, 
"showRecords");    
 
  318                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php');
 
  320                $xml_writer->write();
 
  322                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
 
  324                $export_files->create($xml_writer->xmlDumpMem());
 
  339                $this->tabs_gui->setSubTabActive(
'md_adv_file_list');
 
  341                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
 
  343                $file_data = $files->readFilesInfo();
 
  345                include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFilesTableGUI.php");
 
  347                $table_gui->setTitle($this->lng->txt(
"md_record_export_table"));
 
  348                $table_gui->parseFiles($file_data);
 
  349                $table_gui->addMultiCommand(
"downloadFile",$this->lng->txt(
'download'));
 
  350                $table_gui->addMultiCommand(
"confirmDeleteFiles", $this->lng->txt(
"delete"));
 
  351                $table_gui->addCommandButton(
'showFiles',$this->lng->txt(
'cancel'));
 
  352                $table_gui->setSelectAllCheckbox(
"file_id");
 
  354                $this->tpl->setContent($table_gui->getHTML());
 
  366                if(!isset(
$_POST[
'file_id']) or count(
$_POST[
'file_id']) != 1)
 
  373                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
 
  375                $abs_path = $files->getAbsolutePathByFileId((
int) 
$_POST[
'file_id'][0]);
 
  388                if(!isset(
$_POST[
'file_id']))
 
  395                include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  399                $c_gui->setFormAction($this->ctrl->getFormAction($this, 
"deleteFiles"));
 
  400                $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_files_sure"));
 
  401                $c_gui->setCancel($this->lng->txt(
"cancel"), 
"showFiles");
 
  402                $c_gui->setConfirm($this->lng->txt(
"confirm"), 
"deleteFiles");
 
  404                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
 
  406                $file_data = $files->readFilesInfo();
 
  410                foreach(
$_POST[
"file_id"] as $file_id)
 
  412                        $info = $file_data[$file_id];
 
  413                        $c_gui->addItem(
"file_id[]", $file_id, is_array(
$info[
'name']) ? implode(
',',
$info[
'name']) : 
'No Records');
 
  415                $this->tpl->setContent($c_gui->getHTML());
 
  427                if(!isset(
$_POST[
'file_id']))
 
  434                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
 
  437                foreach(
$_POST[
'file_id'] as $file_id)
 
  439                        $files->deleteByFileId((
int) $file_id);
 
  453                if(!isset(
$_POST[
'record_id']))
 
  460                include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  464                $c_gui->setFormAction($this->ctrl->getFormAction($this, 
"deleteRecords"));
 
  465                $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_record_sure"));
 
  466                $c_gui->setCancel($this->lng->txt(
"cancel"), 
"showRecords");
 
  467                $c_gui->setConfirm($this->lng->txt(
"confirm"), 
"deleteRecords");
 
  470                foreach(
$_POST[
"record_id"] as $record_id)
 
  473                        $c_gui->addItem(
"record_id[]", $record_id, $record->getTitle() ? $record->getTitle() : 
'No Title');
 
  475                $this->tpl->setContent($c_gui->getHTML());
 
  486                if(!isset(
$_POST[
'record_id']))
 
  495                foreach(
$_POST[
'record_id'] as $record_id)
 
  501                                if(!$record->getParentObject())
 
  503                                        $fail[] = $record->getTitle();
 
  513                                $fail[] = $record->getTitle(); 
 
  519                        $this->ctrl->redirect($this, 
"showRecords");    
 
  522                foreach(
$_POST[
'record_id'] as $record_id)
 
  528                $this->ctrl->redirect($this, 
"showRecords");    
 
  540                $selected_global = array();
 
  558                                        $obj_types = array();
 
  559                                        if (is_array(
$_POST[
'obj_types'][$record_obj->getRecordId()]))
 
  561                                                foreach (
$_POST[
'obj_types'][$record_obj->getRecordId()] as $type => $status)
 
  565                                                                $type = explode(
":", $type);
 
  566                                                                $obj_types[] = array(
 
  569                                                                        "optional" => ((
int)$status == 2)
 
  574                                        $record_obj->setAssignedObjectTypes($obj_types);
 
  579                                        $record_obj->setActive(isset(
$_POST[
'active'][$record_obj->getRecordId()]));
 
  582                                $record_obj->update();
 
  587                                if($item[
'readonly'] &&
 
  589                                        $_POST[
'active'][$item[
'id']])
 
  591                                        $selected_global[] = $item[
'id'];
 
  593                                else if($item[
'local'])
 
  596                                        $record_obj->setActive(isset(
$_POST[
'active'][$item[
'id']]));
 
  597                                        $record_obj->update();
 
  608                $this->ctrl->redirect($this, 
"showRecords");
 
  619                if(!isset(
$_POST[
'field_id']))
 
  626                $this->ctrl->saveParameter($this,
'record_id');
 
  628                include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  632                $c_gui->setFormAction($this->ctrl->getFormAction($this, 
"deleteFields"));
 
  633                $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_fields_sure"));
 
  634                $c_gui->setCancel($this->lng->txt(
"cancel"), 
"editFields");
 
  635                $c_gui->setConfirm($this->lng->txt(
"confirm"), 
"deleteFields");
 
  638                foreach(
$_POST[
"field_id"] as $field_id)
 
  641                        $c_gui->addItem(
"field_id[]", $field_id, $field->getTitle() ? $field->getTitle() : 
'No Title');
 
  643                $this->tpl->setContent($c_gui->getHTML());
 
  655                $this->ctrl->saveParameter($this,
'record_id');
 
  657                if(!isset(
$_POST[
'field_id']))
 
  666                foreach(
$_POST[
'field_id'] as $field_id)
 
  674                                $fail[] = $field->getTitle(); 
 
  680                        $this->ctrl->redirect($this, 
"editFields");     
 
  683                foreach(
$_POST[
"field_id"] as $field_id)
 
  689                $this->ctrl->redirect($this, 
"editFields");
 
  701                $this->ctrl->saveParameter($this,
'record_id');
 
  704                $this->tpl->setContent($this->form->getHTML());
 
  712                $this->ctrl->saveParameter($this,
'record_id');
 
  717                        $this->record->getRecordId(),
 
  723                $filter_warn = array();
 
  727                        include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
  733                                $options[$type] = $this->lng->txt($field->getTypeTitle());
 
  735                                if(!$field->isFilterSupported())
 
  737                                        $filter_warn[] = $this->lng->txt($field->getTypeTitle());
 
  741                        $ilToolbar->addInputItem($types);               
 
  743                        $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 
"createField"));
 
  745                        include_once 
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";            
 
  747                        $button->setCaption(
"add");
 
  748                        $button->setCommand(
"createField");
 
  749                        $ilToolbar->addButtonInstance($button);                 
 
  753                if(
sizeof($filter_warn))
 
  755                        ilUtil::sendInfo(sprintf($this->lng->txt(
"md_adv_field_filter_warning"), implode(
", ", $filter_warn)));
 
  759                include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
 
  762                include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php");
 
  764                $table_gui->setTitle($this->lng->txt(
"md_adv_field_table"));
 
  765                $table_gui->parseDefinitions($fields);
 
  768                        $table_gui->addCommandButton(
"updateFields", $this->lng->txt(
"save"));
 
  770                $table_gui->addCommandButton(
"showRecords", $this->lng->txt(
'cancel'));
 
  771                $table_gui->addMultiCommand(
"confirmDeleteFields", $this->lng->txt(
"delete"));
 
  772                $table_gui->setSelectAllCheckbox(
"field_id");
 
  774                $this->tpl->setContent($table_gui->getHTML());
 
  785                $this->ctrl->saveParameter($this,
'record_id');
 
  787                if(!isset(
$_GET[
'record_id']) or !
$_GET[
'record_id'])
 
  794                include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
 
  802                        if(!isset(
$_POST[
'position']) or !is_array(
$_POST[
'position']))
 
  808                        asort(
$_POST[
'position'],SORT_NUMERIC);
 
  809                        $positions = array_flip(array_keys(
$_POST[
'position']));        
 
  810                        foreach($fields as $field)
 
  812                                $field->setPosition($positions[$field->getFieldId()]);
 
  817                foreach($fields as $field)
 
  821                                $field->getFieldId(),
 
  825                                $field->setSearchable(isset(
$_POST[
'searchable'][$field->getFieldId()]) ? 
true : 
false);
 
  832                $this->ctrl->redirect($this, 
"editFields");             
 
  846                if(!isset(
$_GET[
'record_id']) or !
$_GET[
'record_id'])
 
  855                if(!$this->record->validate())
 
  861                $this->record->update();
 
  879                $this->tpl->setContent($this->form->getHTML());                         
 
  887                $this->tpl->setContent($this->import_form->getHTML());
 
  897                if(is_object($this->import_form))
 
  902                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  904                $this->import_form->setMultipart(
true);
 
  905                $this->import_form->setFormAction($this->ctrl->getFormAction($this));
 
  909                $file->setSuffixes(array(
'xml'));
 
  910                $file->setRequired(
true);
 
  911                $this->import_form->addItem(
$file);
 
  913                $this->import_form->setTitle($this->lng->txt(
'md_adv_import_record'));
 
  914                $this->import_form->addCommandButton(
'importRecord',$this->lng->txt(
'import'));
 
  915                $this->import_form->addCommandButton(
'showRecords',$this->lng->txt(
'cancel'));
 
  928                if(!$this->import_form->checkInput())
 
  930                        $this->import_form->setValuesByPost();
 
  935                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordImportFiles.php');
 
  937                if(!$create_time = $import_files->moveUploadedFile($_FILES[
'file'][
'tmp_name']))
 
  945                        include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordParser.php');
 
  951                                $parser->setContext($this->obj_id, $this->obj_type, $this->sub_type);
 
  956                        $parser->startParsing();
 
  960                        $parser->startParsing();
 
  962                        $this->ctrl->redirect($this, 
"showRecords");
 
  964                catch(ilSAXParserException $exc)
 
  967                        $this->ctrl->redirect($this, 
"importRecords");
 
  971                $import_files->deleteFileByCreationDate($create_time);
 
  992                        $this->record->setAssignedObjectTypes(array(
 
  994                                        "obj_type"=>$this->obj_type, 
 
  995                                        "sub_type"=>$this->sub_type,
 
 1000                if(!$this->record->validate())
 
 1006                $this->record->save();
 
 1025                 $this->ctrl->saveParameter($this,
'record_id');
 
 1026                 $this->ctrl->saveParameter($this,
'field_id');
 
 1033                 $this->tpl->setContent($a_form->getHTML());
 
 1051                $this->ctrl->saveParameter($this,
'record_id');
 
 1052                $this->ctrl->saveParameter($this,
'field_id');                            
 
 1057                if($form->checkInput())
 
 1059                        $field_definition->importDefinitionFormPostValues($form, $this->
getPermissions());                      
 
 1060                        if(!$field_definition->importDefinitionFormPostValuesNeedsConfirmation())
 
 1062                                $field_definition->update();
 
 1065                                $this->ctrl->redirect($this, 
"editFields");
 
 1073                $form->setValuesByPost();               
 
 1079                        $field_definition->prepareDefinitionFormConfirmation($form);
 
 1099                $this->ctrl->saveParameter($this,
'record_id');
 
 1100                $this->ctrl->saveParameter($this,
'ftype');
 
 1104                        include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
 
 1106                        $field_definition->setRecordId(
$_REQUEST[
"record_id"]);
 
 1109                $this->tpl->setContent($a_form->getHTML());     
 
 1126                $this->ctrl->saveParameter($this,
'record_id');
 
 1127                $this->ctrl->saveParameter($this,
'ftype');
 
 1129                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
 
 1131                $field_definition->setRecordId(
$_REQUEST[
"record_id"]);
 
 1134                if($form->checkInput())
 
 1136                        $field_definition->importDefinitionFormPostValues($form, $this->
getPermissions());
 
 1137                        $field_definition->save();
 
 1140                        $this->ctrl->redirect($this, 
"editFields");                     
 
 1143                $form->setValuesByPost();
 
 1154                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1157                $form->setFormAction($this->ctrl->getFormAction($this));
 
 1160                $type->setValue($this->lng->txt($a_definition->
getTypeTitle()));
 
 1161                $form->addItem($type);
 
 1167                        $form->setTitle($this->lng->txt(
'md_adv_create_field'));
 
 1168                        $form->addCommandButton(
'saveField',$this->lng->txt(
'create'));                                         
 
 1172                        $form->setTitle($this->lng->txt(
'md_adv_edit_field'));
 
 1173                        $form->addCommandButton(
'updateField',$this->lng->txt(
'save'));                 
 
 1176                $form->addCommandButton(
'editFields',$this->lng->txt(
'cancel'));
 
 1188                if(is_object($this->form))
 
 1195                        $this->record->getRecordId(),
 
 1206                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1209                $this->form->setFormAction($this->ctrl->getFormAction($this));
 
 1214                $title->setValue($this->record->getTitle());
 
 1215                $title->setSize(20);
 
 1216                $title->setMaxLength(70);
 
 1217                $title->setRequired(
true);
 
 1218                $this->form->addItem($title);
 
 1222                        $title->setDisabled(
true);
 
 1227                $desc->setValue($this->record->getDescription());
 
 1230                $this->form->addItem($desc);
 
 1234                        $desc->setDisabled(
true);
 
 1239                $check->setChecked($this->record->isActive());
 
 1240                $check->setValue(1);
 
 1241                $this->form->addItem($check);
 
 1245                        $check->setDisabled(
true);
 
 1248                if(!$this->obj_type)
 
 1251                        $section->setTitle($this->lng->txt(
'md_obj_types'));
 
 1256                                0 => $this->lng->txt(
"meta_obj_type_inactive"),
 
 1257                                1 => $this->lng->txt(
"meta_obj_type_mandatory"),
 
 1258                                2 => $this->lng->txt(
"meta_obj_type_optional")
 
 1264                                $t = $type[
"obj_type"].
":".$type[
"sub_type"];
 
 1265                                $this->lng->loadLanguageModule($type[
"obj_type"]);
 
 1268                                switch($type[
"obj_type"])
 
 1272                                                unset($type_options[1]);
 
 1276                                                unset($type_options[1]);
 
 1280                                                unset($type_options[2]);
 
 1285                                if($a_mode == 
"edit")
 
 1287                                        foreach($this->record->getAssignedObjectTypes() as $item)
 
 1289                                                if($item[
"obj_type"] == $type[
"obj_type"] &&
 
 1290                                                        $item[
"sub_type"] == $type[
"sub_type"])
 
 1292                                                        $value = $item[
"optional"]
 
 1300                                $check->setOptions($type_options);
 
 1301                                $check->setValue($value);
 
 1302                                $this->form->addItem($check);
 
 1306                                        $check->setDisabled(
true);
 
 1314                                $this->form->setTitle($this->lng->txt(
'md_adv_create_record'));
 
 1315                                $this->form->addCommandButton(
'saveRecord',$this->lng->txt(
'add'));
 
 1316                                $this->form->addCommandButton(
'showRecords',$this->lng->txt(
'cancel'));
 
 1321                                $this->form->setTitle($this->lng->txt(
'md_adv_edit_record'));
 
 1322                                $this->form->addCommandButton(
'updateRecord',$this->lng->txt(
'save'));
 
 1323                                $this->form->addCommandButton(
'showRecords',$this->lng->txt(
'cancel'));
 
 1331                if($a_obj_type == 
"crs")
 
 1349                else if($a_obj_type == 
"cat")
 
 1378                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1386                $this->form->setFormAction($this->ctrl->getFormAction($this));
 
 1387                #$this->form->setTableWidth('100%'); 
 1394                        if(in_array(
$obj_type, array(
"crs", 
"cat")))
 
 1406                        include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
 
 1411                        $section->setTitle($this->lng->txt(
'objs_'.$obj_type));
 
 1414                        $check = 
new ilCheckboxInputGUI($this->lng->txt(
'description'),
'enabled_desc_'.$obj_type);
 
 1415                        $check->setValue(1);
 
 1416                        $check->setOptionTitle($this->lng->txt(
'md_adv_desc_show'));
 
 1417                        $check->setChecked($sub->isDescriptionEnabled() ? 
true : 
false);
 
 1418                        $this->form->addItem($check);
 
 1422                                $check->setDisabled(
true);
 
 1425                        $check = 
new ilCheckboxInputGUI($this->lng->txt(
'md_adv_field_names'),
'enabled_field_names_'.$obj_type);
 
 1426                        $check->setValue(1);
 
 1427                        $check->setOptionTitle($this->lng->txt(
'md_adv_fields_show'));
 
 1428                        $check->setChecked($sub->enabledFieldNames() ? 
true : 
false);
 
 1429                        $this->form->addItem($check);
 
 1433                                $check->setDisabled(
true);
 
 1436                        #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type); 
 1437                        #$area->setUseRte(true); 
 1438                        #$area->setRteTagSet('standard'); 
 1439                        #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString())); 
 1441                        #$area->setCols(80); 
 1442                        #$this->form->addItem($area); 
 1450                        $definitions = $sub->sortDefinitions($definitions);
 
 1453                        foreach($definitions as $def)
 
 1455                                $definition_id = $def->getFieldId();
 
 1460                                $title = $def->getTitle().
' ('.$title.
')';                                                              
 
 1463                                $check->setValue(1);
 
 1464                                $check->setOptionTitle($this->lng->txt(
'md_adv_show'));
 
 1465                                $check->setChecked($sub->isSubstituted($definition_id));
 
 1467                                if($perm && !$perm[
"show"])
 
 1469                                        $check->setDisabled(
true);
 
 1472                                $pos = 
new ilNumberInputGUI($this->lng->txt(
'position'),
'position['.$obj_type.
']['.$definition_id.
']');
 
 1474                                $pos->setMaxLength(4);
 
 1475                                $pos->allowDecimals(
true);                              
 
 1476                                $pos->setValue(sprintf(
'%.1f',$counter++));
 
 1477                                $check->addSubItem($pos);
 
 1479                                if($perm && !$perm_pos)
 
 1481                                        $pos->setDisabled(
true);
 
 1484                                $bold = 
new ilCheckboxInputGUI($this->lng->txt(
'bold'),
'bold['.$obj_type.
']['.$definition_id.
']');
 
 1486                                $bold->setChecked($sub->isBold($definition_id));
 
 1487                                $check->addSubItem($bold);
 
 1489                                if($perm && !$perm[
"bold"])
 
 1491                                        $bold->setDisabled(
true);
 
 1494                                $bold = 
new ilCheckboxInputGUI($this->lng->txt(
'newline'),
'newline['.$obj_type.
']['.$definition_id.
']');
 
 1496                                $bold->setChecked($sub->hasNewline($definition_id));
 
 1497                                $check->addSubItem($bold);
 
 1499                                if($perm && !$perm[
"newline"])
 
 1501                                        $bold->setDisabled(
true);
 
 1505                                $this->form->addItem($check);
 
 1533                $this->form->setTitle($this->lng->txt(
'md_adv_substitution_table'));
 
 1535                if($ilAccess->checkAccess(
'write',
'',
$_REQUEST[
"ref_id"]))
 
 1537                        $this->form->addCommandButton(
'updateSubstitutions',$this->lng->txt(
'save'));
 
 1552                        $this->record->getRecordId(),
 
 1576                if(!$this->obj_type)
 
 1580                                $obj_types = array();
 
 1581                                if (is_array(
$_POST[
'obj_types']))
 
 1583                                        foreach (
$_POST[
'obj_types'] as 
$t => $value)
 
 1587                                                        $t = explode(
":", 
$t);
 
 1588                                                        $obj_types[] = array(
 
 1591                                                                "optional" => ($value > 1)
 
 1596                                $this->record->setAssignedObjectTypes($obj_types);
 
 1608                if(!is_object($this->record))
 
 1610                        $record_id = isset(
$_GET[
'record_id']) 
 
 1611                                ? 
$_GET[
'record_id'] 
 
 1619                                $this->record->setParentObject($this->obj_id);
 
 1623                return $this->record;
 
 1633                $this->tabs_gui->clearSubTabs();
 
 1635                $this->tabs_gui->addSubTabTarget(
"md_adv_record_list",
 
 1636                                                                 $this->ctrl->getLinkTarget($this, 
"showRecords"),
 
 1645                        $this->tabs_gui->addSubTabTarget(
"md_adv_presentation",
 
 1646                                                                         $this->ctrl->getLinkTarget($this, 
"showPresentation"));
 
 1649                $this->tabs_gui->addSubTabTarget(
"md_adv_file_list",
 
 1650                                                                 $this->ctrl->getLinkTarget($this, 
"showFiles"),
 
 1670                        $parent_id = $record->getParentObject();
 
 1672                        if(!$this->obj_type)
 
 1683                                        $parent_id != $this->obj_id)
 
 1690                                        !$record->isActive())
 
 1697                        $tmp_arr[
'id'] = $record->getRecordId();
 
 1698                        $tmp_arr[
'active'] = $record->isActive();
 
 1699                        $tmp_arr[
'title'] = $record->getTitle();
 
 1700                        $tmp_arr[
'description'] = $record->getDescription();
 
 1701                        $tmp_arr[
'fields'] = array();
 
 1702                        $tmp_arr[
'obj_types'] = $record->getAssignedObjectTypes();
 
 1704                        $tmp_arr[
'perm'] = $this->permissions->hasPermissions(
 
 1706                                $record->getRecordId(),
 
 1717                                $tmp_arr[
"readonly"] = !(bool)$parent_id;
 
 1718                                $tmp_arr[
"local"] = $parent_id;
 
 1721                                $assigned = $optional = 
false;
 
 1722                                foreach($tmp_arr[
'obj_types'] as $idx => $item)
 
 1724                                        if($item[
"obj_type"] == $this->obj_type &&
 
 1725                                                $item[
"sub_type"] == $this->sub_type)
 
 1728                                                $optional = $item[
"optional"];                                          
 
 1729                                                $tmp_arr[
'obj_types'][$idx][
'context'] = 
true;
 
 1737                                $tmp_arr[
'optional'] = $optional;
 
 1741                                        $tmp_arr[
'active'] = in_array($record->getRecordId(), $selected);
 
AMD field abstract base class.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
getFieldId()
Get field_id.
static getValidTypes()
Get all valid types.
addToFieldDefinitionForm(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
Add input elements to definition form.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
getTypeTitle()
Get type title (lang id)
const ACTION_SUBSTITUTION_COURSE_SHOW_FIELD
const SUBACTION_FIELD_SEARCHABLE
const ACTION_RECORD_EXPORT
const ACTION_SUBSTITUTION_SHOW_FIELDNAMES
const SUBACTION_RECORD_DESCRIPTION
const ACTION_SUBSTITUTION_FIELD_POSITIONS
const ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY
const ACTION_RECORD_CREATE_FIELD
const CONTEXT_SUBSTITUTION_COURSE
const CONTEXT_SUBSTITUTION_CATEGORY
const ACTION_RECORD_EDIT_FIELDS
const ACTION_RECORD_FIELD_POSITIONS
const SUBACTION_RECORD_TITLE
const ACTION_SUBSTITUTION_SHOW_DESCRIPTION
const SUBACTION_SUBSTITUTION_BOLD
const ACTION_FIELD_EDIT_PROPERTY
const ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY
const ACTION_RECORD_TOGGLE_ACTIVATION
const SUBACTION_SUBSTITUTION_NEWLINE
const ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD
const ACTION_MD_CREATE_RECORD
const CONTEXT_SUBSTITUTION
const ACTION_RECORD_EDIT_PROPERTY
const ACTION_MD_IMPORT_RECORDS
const SUBACTION_RECORD_OBJECT_TYPES
const ACTION_RECORD_DELETE
const ACTION_FIELD_DELETE
SAX based XML parser for record import files.
const MODE_INSERT_VALIDATION
static _lookupTitle($a_record_id)
Lookup title.
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
static _getAllRecordsByObjectType()
Get records by obj_type Note: this returns only records with no sub types! @access public.
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
static _getActivatedObjTypes()
get activated obj types
static _getRecords()
Get records.
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
updateSubstitutions()
Update substitution.
showFiles()
show export files
setSubTabs()
Set sub tabs.
updateRecord()
Update record.
showRecords()
show record list
updateRecords()
Save records (assigned object typed)
initForm($a_mode)
Init Form.
editField(ilPropertyFormGUI $a_form=null)
Edit field.
importRecord()
import xml file
executeCommand()
Execute command.
initRecordObject()
Init record object.
confirmDeleteFiles()
confirm delete files
initFieldForm(ilAdvancedMDFieldDefinition $a_definition)
init field form
initFormSubstitutions()
init form table 'substitutions'
initImportForm()
show import form
deleteRecords()
Permanently delete records.
loadRecordFormData()
load record form data
exportRecords()
Export records.
editRecord()
Edit one record.
updateFields()
Update fields.
deleteFields()
delete fields
confirmDeleteRecords()
Confirm delete.
__construct($a_obj_id=null, $a_obj_type=null, $a_sub_type=null)
Constructor.
downloadFile()
Download XML file.
getParsedRecordObjects()
Get and cache record objects.
getSubstitutionFieldPermissions($a_obj_type, $a_field_id)
updateField()
Update field.
createField(ilPropertyFormGUI $a_form=null)
Show field type selection.
confirmDeleteFields()
show delete fields confirmation screen
deleteFiles()
Delete files.
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static getInstance($a_user_id=null, $a_ref_id=null)
Factory.
Confirmation screen class.
This class represents a non editable value in a property form.
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
if(!is_array($argv)) $options