ILIAS  release_8 Revision v8.24
ilAdvancedMDSettingsGUI Class Reference
+ Collaboration diagram for ilAdvancedMDSettingsGUI:

Public Member Functions

 __construct (int $a_context, int $a_ref_id, ?string $a_obj_type=null, $a_sub_type=null)
 Constructor @access public. More...
 
 executeCommand ()
 
 showRecords ()
 
 updateSubstitutions ()
 Update substitution @access public. More...
 
 exportRecords ()
 Export records @access public. More...
 
 downloadFile ()
 Download XML file @access public. More...
 
 confirmDeleteFiles ()
 confirm delete files @access public More...
 
 deleteFiles ()
 Delete files @access public. More...
 
 confirmDeleteRecords ()
 Confirm delete @access public. More...
 
 deleteRecords ()
 Permanently delete records @access public. More...
 
 updateRecords ()
 Save records (assigned object typed) @access public. More...
 
 confirmDeleteFields ()
 
 deleteFields ()
 
 editRecord (ilPropertyFormGUI $form=null)
 
 updateFields ()
 Update fields @access public. More...
 
 updateRecord ()
 Update record @access public. More...
 
 createRecord (ilPropertyFormGUI $form=null)
 Show @access public. More...
 
 importRecord ()
 
 saveRecord ()
 Save record @access public. More...
 
 editField (ilPropertyFormGUI $a_form=null)
 Edit field @access public. More...
 
 updateField ()
 Update field @access public. More...
 
 createField (ilPropertyFormGUI $a_form=null)
 Show field type selection @access public. More...
 
 saveField ()
 
 editComplexOption (ilPropertyFormGUI $a_form=null)
 
 updateComplexOption ()
 

Data Fields

const CONTEXT_ADMINISTRATION = 1
 
const CONTEXT_OBJECT = 2
 

Protected Member Functions

 getRecordIdFromQuery ()
 
 getRecordIdsFromPost ()
 
 getFieldIdFromQuery ()
 
 getFieldIdsFromPost ()
 
 getFileIdsFromPost ()
 
 getFieldTypeFromQuery ()
 
 getFieldTypeFromPost ()
 
 getOidFromQuery ()
 
 getPositionsFromPost ()
 
 getTableOffsetFromPost ()
 
 getPermissions ()
 
 initContextParameters (int $context, int $ref_id, ?string $obj_type, $sub_type)
 
 showPresentation ()
 
 showFiles ()
 Show export files. More...
 
 editFields ()
 
 importRecords ()
 
 setRecordSubTabs (int $level=1, bool $show_settings=false)
 Set subtabs for record editing/creation. More...
 
 initImportForm ()
 
 initFieldForm (ilAdvancedMDFieldDefinition $a_definition)
 
 initForm ($a_mode)
 
 getSubstitutionFieldPermissions (string $a_obj_type, int $a_field_id)
 
 initFormSubstitutions ()
 init form table 'substitutions' @access protected More...
 
 loadRecordFormData (ilPropertyFormGUI $form)
 
 initRecordObject ()
 
 setSubTabs (int $context)
 Set sub tabs @access protected. More...
 
 getParsedRecordObjects ()
 
 initComplexOptionForm (ilAdvancedMDFieldDefinition $a_def)
 
 initLanguage (int $record_id)
 
 showLanguageSwitch (int $record_id, string $target)
 

Protected Attributes

const TAB_RECORD_SETTINGS = 'editRecord'
 
const TAB_TRANSLATION = 'translations'
 
ilPropertyFormGUI $import_form = null
 
ilPropertyFormGUI $form = null
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
RequestInterface $request
 
GlobalHttpState $http
 
RefineryFactory $refinery
 
ilTabsGUI $tabs_gui
 
UIFactory $ui_factory
 
Renderer $ui_renderer
 
ilToolbarGUI $toolbar
 
ilLogger $logger
 
ilAdvancedMDPermissionHelper $permissions
 
ilAdvancedMDRecord $record = null
 
int $ref_id
 
int $obj_id
 
string $obj_type = null
 
 $sub_type = null
 

Private Attributes

 $context = null
 
string $active_language = ''
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDSettingsGUI::__construct ( int  $a_context,
int  $a_ref_id,
?string  $a_obj_type = null,
  $a_sub_type = null 
)

Constructor @access public.

@noinspection PhpUndefinedMethodInspection

@noinspection PhpFieldAssignmentTypeMismatchInspection

Definition at line 78 of file class.ilAdvancedMDSettingsGUI.php.

79 {
80 global $DIC;
81
82 $this->ctrl = $DIC->ctrl();
83 $this->lng = $DIC->language();
84 $this->lng->loadLanguageModule('meta');
85 $this->tpl = $DIC->ui()->mainTemplate();
86 $this->tabs_gui = $DIC->tabs();
87
88 $this->refinery = $DIC->refinery();
89 $this->toolbar = $DIC->toolbar();
90 $this->ui_factory = $DIC->ui()->factory();
91 $this->ui_renderer = $DIC->ui()->renderer();
92 $this->request = $DIC->http()->request();
93 $this->http = $DIC->http();
94
96 $this->logger = $DIC->logger()->amet();
97
98 $this->context = $a_context;
100 $this->context,
101 $a_ref_id,
102 $a_obj_type,
103 $a_sub_type
104 );
105
107 $this->permissions = ilAdvancedMDPermissionHelper::getInstance($DIC->user()->getId(), $this->ref_id);
108 }
initContextParameters(int $context, int $ref_id, ?string $obj_type, $sub_type)
static getInstance(int $a_user_id, int $a_ref_id)
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, ILIAS\Repository\ctrl(), ilClaimingPermissionHelper\getInstance(), ILIAS\FileDelivery\http(), initContextParameters(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), ILIAS\Repository\refinery(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteFields()

ilAdvancedMDSettingsGUI::confirmDeleteFields ( )

Definition at line 823 of file class.ilAdvancedMDSettingsGUI.php.

823 : void
824 {
825 $field_ids = $this->getFieldIdsFromPost();
826 if (!count($field_ids)) {
827 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
828 $this->editFields();
829 return;
830 }
831
832 $this->initRecordObject();
833 $this->setRecordSubTabs(2);
834
835 $c_gui = new ilConfirmationGUI();
836
837 // set confirm/cancel commands
838 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFields"));
839 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_fields_sure"));
840 $c_gui->setCancel($this->lng->txt("cancel"), "editFields");
841 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFields");
842
843 // add items to delete
844 foreach ($field_ids as $field_id) {
846 $c_gui->addItem("field_id[]", (string) $field_id, $field->getTitle() ?: 'No Title');
847 }
848 $this->tpl->setContent($c_gui->getHTML());
849 }
static getInstance(?int $a_field_id, ?int $a_type=null, string $language='')
setRecordSubTabs(int $level=1, bool $show_settings=false)
Set subtabs for record editing/creation.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstance(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmDeleteFiles()

ilAdvancedMDSettingsGUI::confirmDeleteFiles ( )

confirm delete files @access public

Definition at line 571 of file class.ilAdvancedMDSettingsGUI.php.

571 : void
572 {
573 $file_ids = $this->getFileIdsFromPost();
574 if (count($file_ids) !== 1) {
575 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
576 $this->showFiles();
577 return;
578 }
579
580 $c_gui = new ilConfirmationGUI();
581 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
582 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_files_sure"));
583 $c_gui->setCancel($this->lng->txt("cancel"), "showFiles");
584 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
585
587 $this->context === self::CONTEXT_ADMINISTRATION ? null : $this->obj_id
588 );
589 $file_data = $files->readFilesInfo();
590
591 // add items to delete
592 foreach ($file_ids as $file_id) {
593 $info = $file_data[$file_id];
594 $c_gui->addItem(
595 "file_id[]",
596 (string) $file_id,
597 is_array($info['name'] ?? false) ? implode(',', $info['name']) : 'No Records'
598 );
599 }
600 $this->tpl->setContent($c_gui->getHTML());
601 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmDeleteRecords()

ilAdvancedMDSettingsGUI::confirmDeleteRecords ( )

Confirm delete @access public.

Definition at line 636 of file class.ilAdvancedMDSettingsGUI.php.

636 : void
637 {
638 $this->initRecordObject();
639 $this->setRecordSubTabs();
640
641 $record_ids = $this->getRecordIdsFromPost();
642 if (!count($record_ids)) {
643 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
644 $this->showRecords();
645 return;
646 }
647
648 $c_gui = new ilConfirmationGUI();
649
650 // set confirm/cancel commands
651 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRecords"));
652 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_record_sure"));
653 $c_gui->setCancel($this->lng->txt("cancel"), "showRecords");
654 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRecords");
655
656 // add items to delete
657 foreach ($record_ids as $record_id) {
659 $c_gui->addItem("record_id[]", (string) $record_id, $record->getTitle() ?: 'No Title');
660 }
661 $this->tpl->setContent($c_gui->getHTML());
662 }
static _getInstanceByRecordId(int $a_record_id)

References ilAdvancedMDRecord\_getInstanceByRecordId(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ createField()

ilAdvancedMDSettingsGUI::createField ( ilPropertyFormGUI  $a_form = null)

Show field type selection @access public.

Definition at line 1338 of file class.ilAdvancedMDSettingsGUI.php.

1338 : void
1339 {
1340 $record_id = $this->getRecordIdFromQuery();
1341 $field_type = $this->getFieldTypeFromPost();
1342 if (!$field_type) {
1343 $field_type = $this->getFieldTypeFromQuery();
1344 }
1345
1346 $this->initRecordObject();
1347 $this->ctrl->setParameter($this, 'ftype', $field_type);
1348 $this->setRecordSubTabs(2);
1349 if (!$record_id || !$field_type) {
1350 $this->editFields();
1351 return;
1352 }
1353
1354 if (!$a_form) {
1355 $field_definition = ilAdvancedMDFieldDefinition::getInstance(null, $field_type);
1356 $field_definition->setRecordId($record_id);
1357 $a_form = $this->initFieldForm($field_definition);
1358 }
1359 $this->tpl->setContent($a_form->getHTML());
1360 }
initFieldForm(ilAdvancedMDFieldDefinition $a_definition)

References ILIAS\Repository\ctrl(), and ilAdvancedMDFieldDefinition\getInstance().

+ Here is the call graph for this function:

◆ createRecord()

ilAdvancedMDSettingsGUI::createRecord ( ilPropertyFormGUI  $form = null)

Show @access public.

Parameters

Definition at line 1081 of file class.ilAdvancedMDSettingsGUI.php.

1081 : void
1082 {
1083 $this->initRecordObject();
1084 $this->setRecordSubTabs();
1085 if (!$form instanceof ilPropertyFormGUI) {
1086 $this->initForm('create');
1087 }
1088 $this->tpl->setContent($this->form->getHTML());
1089 }
This class represents a property form user interface.
form( $class_path, string $cmd)

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ deleteFields()

ilAdvancedMDSettingsGUI::deleteFields ( )

Definition at line 851 of file class.ilAdvancedMDSettingsGUI.php.

851 : void
852 {
853 $this->ctrl->saveParameter($this, 'record_id');
854
855 $field_ids = $this->getFieldIdsFromPost();
856 if (!count($field_ids)) {
857 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
858 $this->editFields();
859 return;
860 }
861
862 // all fields have to be deletable
863 $fail = array();
864 foreach ($field_ids as $field_id) {
865 if (!$this->getPermissions()->hasPermission(
867 (string) $field_id,
869 )) {
871 $fail[] = $field->getTitle();
872 }
873 }
874 if ($fail) {
875 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_delete') . " " . implode(", ", $fail), true);
876 $this->ctrl->redirect($this, "editFields");
877 }
878
879 foreach ($field_ids as $field_id) {
881 $field->delete();
882 }
883 $this->tpl->setOnScreenMessage('success', $this->lng->txt('md_adv_deleted_fields'), true);
884 $this->ctrl->redirect($this, "editFields");
885 }

References ilAdvancedMDPermissionHelper\ACTION_FIELD_DELETE, ilAdvancedMDPermissionHelper\CONTEXT_FIELD, ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstance(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ deleteFiles()

ilAdvancedMDSettingsGUI::deleteFiles ( )

Delete files @access public.

Parameters

Definition at line 608 of file class.ilAdvancedMDSettingsGUI.php.

608 : void
609 {
610 $file_ids = $this->getFileIdsFromPost();
611 if (count($file_ids) === 0) {
612 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
613 $this->showFiles();
614 return;
615 }
616
617 if (!$GLOBALS['DIC']->access()->checkAccess('write', '', $this->ref_id)) {
618 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
619 $GLOBALS['DIC']->ctrl()->redirect($this, 'showFiles');
620 }
621
623 $this->context === self::CONTEXT_ADMINISTRATION ? null : $this->obj_id
624 );
625 foreach ($file_ids as $file_id) {
626 $files->deleteByFileId((int) $file_id);
627 }
628 $this->tpl->setOnScreenMessage('success', $this->lng->txt('md_adv_deleted_files'));
629 $this->showFiles();
630 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

References $GLOBALS, ILIAS\Repository\access(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ deleteRecords()

ilAdvancedMDSettingsGUI::deleteRecords ( )

Permanently delete records @access public.

Definition at line 668 of file class.ilAdvancedMDSettingsGUI.php.

668 : void
669 {
670 $record_ids = $this->getRecordIdsFromPost();
671 if (!count($record_ids)) {
672 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
673 $this->showRecords();
674 return;
675 }
676
677 // all records have to be deletable
678 $fail = array();
679 foreach ($record_ids as $record_id) {
680 // must not delete global records in local context
681 if ($this->context == self::CONTEXT_OBJECT) {
683 if (!$record->getParentObject()) {
684 $fail[] = $record->getTitle();
685 }
686 }
687
688 if (!$this->getPermissions()->hasPermission(
690 (string) $record_id,
692 )) {
694 $fail[] = $record->getTitle();
695 }
696 }
697 if ($fail) {
698 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_delete') . " " . implode(", ", $fail), true);
699 $this->ctrl->redirect($this, "showRecords");
700 }
701
702 foreach ($record_ids as $record_id) {
704 $record->delete();
705 }
706 $this->tpl->setOnScreenMessage('success', $this->lng->txt('md_adv_deleted_records'), true);
707 $this->ctrl->redirect($this, "showRecords");
708 }

References ilAdvancedMDRecord\_getInstanceByRecordId(), ilAdvancedMDPermissionHelper\ACTION_RECORD_DELETE, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ downloadFile()

ilAdvancedMDSettingsGUI::downloadFile ( )

Download XML file @access public.

Parameters

Definition at line 552 of file class.ilAdvancedMDSettingsGUI.php.

552 : void
553 {
554 $file_ids = $this->getFileIdsFromPost();
555 if (count($file_ids) !== 1) {
556 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('md_adv_select_one_file'));
557 $this->showFiles();
558 return;
559 }
561 $this->context === self::CONTEXT_ADMINISTRATION ? null : $this->obj_id
562 );
563 $abs_path = $files->getAbsolutePathByFileId($file_ids[0]);
564 ilFileDelivery::deliverFileLegacy($abs_path, 'ilias_meta_data_record.xml', 'application/xml');
565 }
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)

References ilFileDelivery\deliverFileLegacy(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ editComplexOption()

ilAdvancedMDSettingsGUI::editComplexOption ( ilPropertyFormGUI  $a_form = null)

Definition at line 2220 of file class.ilAdvancedMDSettingsGUI.php.

2220 : void
2221 {
2222 $field_id = $this->getFieldIdFromQuery();
2223 if (!$field_id) {
2224 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_select_one'));
2225 $this->ctrl->redirect($this, 'showRecords');
2226 }
2227
2228 $field_definition = ilAdvancedMDFieldDefinition::getInstance($field_id);
2229 if (!$field_definition->hasComplexOptions()) {
2230 $this->ctrl->redirect($this, "editField");
2231 }
2232
2233 if (!$a_form) {
2234 $a_form = $this->initComplexOptionForm($field_definition);
2235 }
2236
2237 $this->tpl->setContent($a_form->getHTML());
2238 }
initComplexOptionForm(ilAdvancedMDFieldDefinition $a_def)

References ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstance(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ editField()

ilAdvancedMDSettingsGUI::editField ( ilPropertyFormGUI  $a_form = null)

Edit field @access public.

Definition at line 1259 of file class.ilAdvancedMDSettingsGUI.php.

1259 : void
1260 {
1261 $record_id = $this->getRecordIdFromQuery();
1262 $field_id = $this->getFieldIdFromQuery();
1263 if (!$record_id || !$field_id) {
1264 $this->editFields();
1265 return;
1266 }
1267 $this->ctrl->saveParameter($this, 'field_id');
1268 $this->ctrl->saveParameter($this, 'record_id');
1269 $this->initRecordObject();
1270 $this->setRecordSubTabs(2);
1271
1272 $field_definition = ilAdvancedMDFieldDefinition::getInstance($field_id);
1273
1274 if (!$a_form instanceof ilPropertyFormGUI) {
1275 $this->initLanguage($this->record->getRecordId());
1276 $this->showLanguageSwitch($this->record->getRecordId(), 'editField');
1277 $a_form = $this->initFieldForm($field_definition);
1278 }
1279 $table = null;
1280 if ($field_definition->hasComplexOptions()) {
1281 $table = $field_definition->getComplexOptionsOverview($this, "editField");
1282 }
1283 $this->tpl->setContent($a_form->getHTML() . $table);
1284 }
showLanguageSwitch(int $record_id, string $target)

References ILIAS\Repository\ctrl(), and ilAdvancedMDFieldDefinition\getInstance().

+ Here is the call graph for this function:

◆ editFields()

ilAdvancedMDSettingsGUI::editFields ( )
protected

Definition at line 905 of file class.ilAdvancedMDSettingsGUI.php.

905 : void
906 {
907 global $DIC;
908
909 $record_id = $this->getRecordIdFromQuery();
910 if (!$record_id) {
911 $this->ctrl->redirect($this, 'showRecords');
912 }
913 $this->ctrl->saveParameter($this, 'record_id');
914 $this->initRecordObject();
915 $this->setRecordSubTabs();
916 $this->initLanguage($record_id);
917 $this->showLanguageSwitch($record_id, 'editFields');
918
919 $perm = $this->getPermissions()->hasPermissions(
921 (string) $this->record->getRecordId(),
922 array(
924 ,
926 )
927 );
928
929 $filter_warn = array();
931 // type selection
932 $types = new ilSelectInputGUI("", "ftype");
933 $options = array();
936 $options[$type] = $this->lng->txt($field->getTypeTitle());
937
938 if (!$field->isFilterSupported()) {
939 $filter_warn[] = $this->lng->txt($field->getTypeTitle());
940 }
941 }
942 $types->setOptions($options);
943
944 if (count($this->toolbar->getItems())) {
945 $this->toolbar->addSeparator();
946 }
947 $this->toolbar->addInputItem($types);
948
949 $this->toolbar->setFormAction($this->ctrl->getFormAction($this, "createField"));
950
951 $button = ilSubmitButton::getInstance();
952 $button->setCaption("add");
953 $button->setCommand("createField");
954 $this->toolbar->addButtonInstance($button);
955 }
956
957 // #17092
958 if (sizeof($filter_warn)) {
959 $this->tpl->setOnScreenMessage('info', sprintf($this->lng->txt("md_adv_field_filter_warning"), implode(", ", $filter_warn)));
960 }
961
962 // show field table
964 $this->record->getRecordId(),
965 false,
966 $this->active_language
967 );
968
969 $table_gui = new ilAdvancedMDFieldTableGUI(
970 $this,
971 'editFields',
972 $this->getPermissions(),
974 $this->record->getDefaultLanguage()
975 );
976 $table_gui->setTitle($this->lng->txt("md_adv_field_table"));
977 $table_gui->parseDefinitions($fields);
978 if (sizeof($fields)) {
979 $table_gui->addCommandButton("updateFields", $this->lng->txt("save"));
980 }
981 $table_gui->addCommandButton("showRecords", $this->lng->txt('cancel'));
982 $table_gui->addMultiCommand("confirmDeleteFields", $this->lng->txt("delete"));
983 $table_gui->setSelectAllCheckbox("field_id");
984
985 $this->tpl->setContent($table_gui->getHTML());
986 }
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
$type

References $DIC, $type, ilAdvancedMDPermissionHelper\ACTION_RECORD_CREATE_FIELD, ilAdvancedMDPermissionHelper\ACTION_RECORD_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ILIAS\Repository\ctrl(), ilSubmitButton\getInstance(), ilAdvancedMDFieldDefinition\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), ilAdvancedMDFieldDefinition\getValidTypes(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ editRecord()

ilAdvancedMDSettingsGUI::editRecord ( ilPropertyFormGUI  $form = null)

Definition at line 887 of file class.ilAdvancedMDSettingsGUI.php.

887 : void
888 {
889 $record_id = $this->getRecordIdFromQuery();
890 if (!$record_id) {
891 $this->ctrl->redirect($this, 'showRecords');
892 }
893 $this->initRecordObject();
894 $this->setRecordSubTabs(1, true);
895 $this->tabs_gui->activateTab(self::TAB_RECORD_SETTINGS);
896
897 if (!$form instanceof ilPropertyFormGUI) {
898 $this->initLanguage($record_id);
899 $this->showLanguageSwitch($record_id, 'editRecord');
900 $this->initForm('edit');
901 }
902 $this->tpl->setContent($this->form->getHTML());
903 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ executeCommand()

ilAdvancedMDSettingsGUI::executeCommand ( )

Definition at line 272 of file class.ilAdvancedMDSettingsGUI.php.

272 : void
273 {
274 $next_class = $this->ctrl->getNextClass($this);
275 $cmd = $this->ctrl->getCmd();
276 switch ($next_class) {
277
278 case strtolower(ilAdvancedMDRecordTranslationGUI::class):
279 $record = $this->initRecordObject();
280 $this->setRecordSubTabs(1, true);
281 $int_gui = new \ilAdvancedMDRecordTranslationGUI($record);
282 $this->ctrl->forwardCommand($int_gui);
283 break;
284
285 case "ilpropertyformgui":
286 $this->initRecordObject();
287 $this->initForm(
288 $this->record->getRecordId() > 0 ? 'edit' : 'create'
289 );
290 $GLOBALS['DIC']->ctrl()->forwardCommand($this->form);
291 break;
292
293 default:
294 if (!$cmd) {
295 $cmd = 'showRecords';
296 }
297 $this->$cmd();
298 }
299 }

References $GLOBALS, ILIAS\Repository\ctrl(), and ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ exportRecords()

ilAdvancedMDSettingsGUI::exportRecords ( )

Export records @access public.

Definition at line 483 of file class.ilAdvancedMDSettingsGUI.php.

483 : void
484 {
485 $record_ids = $this->getRecordIdsFromPost();
486 if (!count($record_ids)) {
487 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
488 $this->showRecords();
489 return;
490 }
491
492 // all records have to be exportable
493 $fail = array();
494 foreach ($record_ids as $record_id) {
495 if (!$this->getPermissions()->hasPermission(
497 (string) $record_id,
499 )) {
501 $fail[] = $record->getTitle();
502 }
503 }
504 if ($fail) {
505 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_perm_copy') . " " . implode(", ", $fail), true);
506 $this->ctrl->redirect($this, "showRecords");
507 }
508
509 $xml_writer = new ilAdvancedMDRecordXMLWriter((array) $record_ids);
510 $xml_writer->write();
511
512 $export_files = new ilAdvancedMDRecordExportFiles(
513 $this->context === self::CONTEXT_ADMINISTRATION ? null : $this->obj_id
514 );
515 $export_files->create($xml_writer->xmlDumpMem());
516
517 $this->tpl->setOnScreenMessage('success', $this->lng->txt('md_adv_records_exported'));
518 $this->showFiles();
519 }

References ilAdvancedMDRecord\_getInstanceByRecordId(), ilAdvancedMDPermissionHelper\ACTION_RECORD_EXPORT, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getFieldIdFromQuery()

ilAdvancedMDSettingsGUI::getFieldIdFromQuery ( )
protected

Definition at line 136 of file class.ilAdvancedMDSettingsGUI.php.

136 : ?int
137 {
138 if ($this->http->wrapper()->query()->has('field_id')) {
139 return $this->http->wrapper()->query()->retrieve(
140 'field_id',
141 $this->refinery->kindlyTo()->int()
142 );
143 }
144 return null;
145 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getFieldIdsFromPost()

ilAdvancedMDSettingsGUI::getFieldIdsFromPost ( )
protected

Definition at line 147 of file class.ilAdvancedMDSettingsGUI.php.

147 : SplFixedArray
148 {
149 if ($this->http->wrapper()->post()->has('field_id')) {
150 return SplFixedArray::fromArray(
151 $this->http->wrapper()->post()->retrieve(
152 'field_id',
153 $this->refinery->kindlyTo()->listOf(
154 $this->refinery->kindlyTo()->int()
155 )
156 )
157 );
158 }
159 return new SplFixedArray(0);
160 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getFieldTypeFromPost()

ilAdvancedMDSettingsGUI::getFieldTypeFromPost ( )
protected

Definition at line 188 of file class.ilAdvancedMDSettingsGUI.php.

188 : ?int
189 {
190 if ($this->http->wrapper()->post()->has('ftype')) {
191 return $this->http->wrapper()->post()->retrieve(
192 'ftype',
193 $this->refinery->kindlyTo()->int()
194 );
195 }
196 return null;
197 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getFieldTypeFromQuery()

ilAdvancedMDSettingsGUI::getFieldTypeFromQuery ( )
protected

Definition at line 177 of file class.ilAdvancedMDSettingsGUI.php.

177 : ?int
178 {
179 if ($this->http->wrapper()->query()->has('ftype')) {
180 return $this->http->wrapper()->query()->retrieve(
181 'ftype',
182 $this->refinery->kindlyTo()->int()
183 );
184 }
185 return null;
186 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getFileIdsFromPost()

ilAdvancedMDSettingsGUI::getFileIdsFromPost ( )
protected

Definition at line 162 of file class.ilAdvancedMDSettingsGUI.php.

162 : SplFixedArray
163 {
164 if ($this->http->wrapper()->post()->has('file_id')) {
165 return SplFixedArray::fromArray(
166 $this->http->wrapper()->post()->retrieve(
167 'file_id',
168 $this->refinery->kindlyTo()->dictOf(
169 $this->refinery->kindlyTo()->int()
170 )
171 )
172 );
173 }
174 return new SplFixedArray(0);
175 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getOidFromQuery()

ilAdvancedMDSettingsGUI::getOidFromQuery ( )
protected

Definition at line 199 of file class.ilAdvancedMDSettingsGUI.php.

199 : ?string
200 {
201 if ($this->http->wrapper()->query()->has('oid')) {
202 return $this->http->wrapper()->query()->retrieve(
203 'oid',
204 $this->refinery->kindlyTo()->string()
205 );
206 }
207 return null;
208 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getParsedRecordObjects()

ilAdvancedMDSettingsGUI::getParsedRecordObjects ( )
protected
Todo:
get rid of this (used in ilAdvancedMDRecordTableGUI) and the parsing there. Also get rid of the usage in ilAvancedMDSettingsGUI::updateRecords

Definition at line 2092 of file class.ilAdvancedMDSettingsGUI.php.

2092 : array
2093 {
2094 $res = [];
2095
2096 $sub_type = (!is_array($this->sub_type))
2097 ? [$this->sub_type]
2098 : $this->sub_type;
2099
2100 if ($this->context === self::CONTEXT_OBJECT) {
2101 // get all records selected for subtype
2102 foreach ($sub_type as $st) {
2103 $selected[$st] = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $st);
2104 }
2105 }
2106
2108 $orderings = new ilAdvancedMDRecordObjectOrderings();
2109 $records = $orderings->sortRecords($records, $this->obj_id);
2110
2111 $position = 0;
2112
2113 // get all records usuable in current context
2114 foreach ($records as $record) {
2115 $parent_id = $record->getParentObject();
2116
2117 if ($this->context == self::CONTEXT_ADMINISTRATION) {
2118 if ($parent_id) {
2119 continue;
2120 }
2121 } else {
2122 // does not match current object
2123 if ($parent_id && $parent_id != $this->obj_id) {
2124 continue;
2125 }
2126
2127 // inactive records only in administration
2128 if (!$parent_id && !$record->isActive()) {
2129 continue;
2130 }
2131 // scope needs to match in object context
2132 if (
2134 $this->ref_id,
2136 )
2137 ) {
2138 continue;
2139 }
2140 }
2141
2142 $tmp_arr = [];
2143 $tmp_arr['readonly'] = null;
2144 $tmp_arr['local'] = null;
2145 $tmp_arr['optional'] = null;
2146 $tmp_arr['id'] = $record->getRecordId();
2147 $tmp_arr['active'] = $record->isActive();
2148 $tmp_arr['title'] = $record->getTitle();
2149 $tmp_arr['description'] = $record->getDescription();
2150 $tmp_arr['fields'] = [];
2151 /*
2152 * This is a workaround to fix sorting by scope, see #21963
2153 */
2154 $tmp_arr['first_scope'] = ilObject::_lookupTitle(
2156 );
2157 $tmp_arr['obj_types'] = $record->getAssignedObjectTypes();
2158 foreach ($record->getAssignedObjectTypes() as $idx => $item) {
2159 $tmp_arr['obj_types'][$idx]['context'] = null;
2160 }
2161 $position += 10;
2162 $tmp_arr['position'] = $position;
2163
2164 $tmp_arr['perm'] = $this->permissions->hasPermissions(
2166 (string) $record->getRecordId(),
2167 array(
2169 ,
2171 ,
2173 ,
2176 )
2177 )
2178 );
2179
2180 if ($this->obj_type) {
2181 $tmp_arr["readonly"] = !(bool) $parent_id;
2182 $tmp_arr["local"] = $parent_id;
2183
2184 // local records are never optional (or unassigned)
2185 $assigned = (bool) $parent_id;
2186 $optional = false;
2187 foreach ($tmp_arr['obj_types'] as $idx => $item) {
2188 if ($item["obj_type"] == $this->obj_type &&
2189 in_array($item["sub_type"], $sub_type)) {
2190 $assigned = true;
2191 $optional = $item["optional"];
2192 $tmp_arr['obj_types'][$idx]['context'] = true;
2193 }
2194 }
2195 $tmp_arr['optional'] = $optional;
2196 if ($optional) {
2197 // in object context "active" means selected record
2198 // $tmp_arr['active'] = (is_array($selected[$item["sub_type"]]) && in_array($record->getRecordId(), $selected[$item["sub_type"]]));
2199 $tmp_arr['local_selected'] = [];
2200 foreach ($selected as $key => $records) {
2201 if (in_array($record->getRecordId(), $records)) {
2202 $tmp_arr['local_selected'][$this->obj_type][] = $key;
2203 }
2204 }
2205 }
2206 }
2207
2208 if ($assigned ?? true) {
2209 $res[] = $tmp_arr;
2210 }
2211 }
2212 return $res;
2213 }
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
static _getRecords()
Get records @access public.
static isFilteredByScope($a_ref_id, array $scopes)
Check if a given ref id is not filtered by scope restriction.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
$res
Definition: ltiservices.php:69
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, $res, ilAdvancedMDRecord\_getRecords(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT, ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_FIELDS, ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_TOGGLE_ACTIVATION, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ilAdvancedMDRecord\getObjRecSelection(), ilAdvancedMDRecord\isFilteredByScope(), and ilAdvancedMDPermissionHelper\SUBACTION_RECORD_OBJECT_TYPES.

+ Here is the call graph for this function:

◆ getPermissions()

ilAdvancedMDSettingsGUI::getPermissions ( )
protected
Returns
ilAdvancedMDPermissionHelper

Definition at line 245 of file class.ilAdvancedMDSettingsGUI.php.

246 {
247 return $this->permissions;
248 }
Advanced metadata permission helper.
ilAdvancedMDPermissionHelper $permissions

References $permissions.

◆ getPositionsFromPost()

ilAdvancedMDSettingsGUI::getPositionsFromPost ( )
protected
Returns
array<string, float>

Definition at line 213 of file class.ilAdvancedMDSettingsGUI.php.

213 : array
214 {
215 if ($this->http->wrapper()->post()->has('position')) {
216 return $this->http->wrapper()->post()->retrieve(
217 'position',
218 $this->refinery->kindlyTo()->dictOf(
219 $this->refinery->byTrying([
220 $this->refinery->kindlyTo()->float(),
221 $this->refinery->always(0)
222 ])
223 )
224 );
225 }
226 return [];
227 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getRecordIdFromQuery()

ilAdvancedMDSettingsGUI::getRecordIdFromQuery ( )
protected

Definition at line 110 of file class.ilAdvancedMDSettingsGUI.php.

110 : ?int
111 {
112 if ($this->http->wrapper()->query()->has('record_id')) {
113 return $this->http->wrapper()->query()->retrieve(
114 'record_id',
115 $this->refinery->kindlyTo()->int()
116 );
117 }
118 return null;
119 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getRecordIdsFromPost()

ilAdvancedMDSettingsGUI::getRecordIdsFromPost ( )
protected

Definition at line 121 of file class.ilAdvancedMDSettingsGUI.php.

121 : SplFixedArray
122 {
123 if ($this->http->wrapper()->post()->has('record_id')) {
124 return SplFixedArray::fromArray(
125 $this->http->wrapper()->post()->retrieve(
126 'record_id',
127 $this->refinery->kindlyTo()->listOf(
128 $this->refinery->kindlyTo()->int()
129 )
130 )
131 );
132 }
133 return new SplFixedArray(0);
134 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getSubstitutionFieldPermissions()

ilAdvancedMDSettingsGUI::getSubstitutionFieldPermissions ( string  $a_obj_type,
int  $a_field_id 
)
protected

Definition at line 1622 of file class.ilAdvancedMDSettingsGUI.php.

1622 : array
1623 {
1624 if ($a_obj_type == "crs") {
1625 $perm = $this->getPermissions()->hasPermissions(
1627 (string) $a_field_id,
1628 array(
1630 ,
1633 )
1634 ,
1637 )
1638 )
1639 );
1640 return array(
1642 ,
1644 ,
1646 );
1647 } elseif ($a_obj_type == "cat") {
1648 $perm = $this->getPermissions()->hasPermissions(
1650 (string) $a_field_id,
1651 array(
1653 ,
1656 )
1657 ,
1660 )
1661 )
1662 );
1663 return array(
1665 ,
1667 ,
1669 );
1670 } elseif ($a_obj_type == "sess") {
1671 $perm = $this->getPermissions()->hasPermissions(
1673 (string) $a_field_id,
1674 array(
1676 ,
1679 )
1680 ,
1683 )
1684 )
1685 );
1686 return array(
1688 ,
1690 ,
1692 );
1693 } elseif ($a_obj_type == "grp") {
1694 $perm = $this->getPermissions()->hasPermissions(
1696 (string) $a_field_id,
1697 array(
1699 ,
1702 )
1703 ,
1706 )
1707 )
1708 );
1709 return array(
1711 ,
1713 ,
1715 );
1716 } elseif ($a_obj_type == "iass") {
1717 $perm = $this->getPermissions()->hasPermissions(
1719 (string) $a_field_id,
1720 array(
1722 ,
1725 )
1726 ,
1729 )
1730 )
1731 );
1732 return array(
1734 ,
1736 ,
1738 );
1739 } elseif ($a_obj_type == "exc") {
1740 $perm = $this->getPermissions()->hasPermissions(
1742 (string) $a_field_id,
1743 array(
1745 ,
1748 )
1749 ,
1752 )
1753 )
1754 );
1755 return array(
1757 ,
1759 ,
1761 );
1762 } elseif ($a_obj_type == "prg") {
1763 $perm = $this->getPermissions()->hasPermissions(
1765 (string) $a_field_id,
1766 [
1768 [
1771 ],
1772 [
1775 ]
1776 ]
1777 );
1778 return array(
1780 ,
1782 ,
1784 );
1785 } elseif ($a_obj_type == "orgu") {
1786 $perm = $this->getPermissions()->hasPermissions(
1788 (string) $a_field_id,
1789 [
1791 ,
1792 [
1795 ]
1796 ,
1797 [
1800 ]
1801 ]
1802 );
1803 return [
1805 ,
1807 ,
1809 ];
1810 }
1811 return [];
1812 }

References ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_COURSE_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_EXERCISE_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_EXERCISE_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_GROUP_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_GROUP_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_IASS_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_IASS_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_ORG_UNIT_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_ORG_UNIT_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_PRG_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_PRG_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SESSION_SHOW_FIELD, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_CATEGORY, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_COURSE, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_EXERCISE, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_GROUP, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_IASS, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_ORG_UNIT, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_PRG, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_SESSION, ilAdvancedMDPermissionHelper\SUBACTION_SUBSTITUTION_BOLD, and ilAdvancedMDPermissionHelper\SUBACTION_SUBSTITUTION_NEWLINE.

◆ getTableOffsetFromPost()

ilAdvancedMDSettingsGUI::getTableOffsetFromPost ( )
protected

Definition at line 229 of file class.ilAdvancedMDSettingsGUI.php.

229 : int
230 {
231 // BT 35518: hacky solution for getting the table offset
232 if ($this->http->wrapper()->post()->has(ilAdvancedMDRecordTableGUI::ID . '_table_nav')) {
233 $nav = $this->http->wrapper()->post()->retrieve(
234 ilAdvancedMDRecordTableGUI::ID . '_table_nav',
235 $this->refinery->kindlyTo()->string()
236 );
237 return (int) explode(':', $nav)[2];
238 }
239 return 0;
240 }

References ILIAS\FileDelivery\http(), ilAdvancedMDRecordTableGUI\ID, and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ importRecord()

ilAdvancedMDSettingsGUI::importRecord ( )

Definition at line 1170 of file class.ilAdvancedMDSettingsGUI.php.

1170 : void
1171 {
1172 $this->initImportForm();
1173 if (!$this->import_form->checkInput()) {
1174 $this->import_form->setValuesByPost();
1175 $this->importRecords();
1176 return;
1177 }
1178
1179 $import_files = new ilAdvancedMDRecordImportFiles();
1180 if (!$create_time = $import_files->moveUploadedFile($_FILES['file']['tmp_name'])) {
1181 $this->createRecord();
1182 return;
1183 }
1184
1185 try {
1186 $parser = new ilAdvancedMDRecordParser($import_files->getImportFileByCreationDate($create_time));
1187
1188 // local import?
1189 if ($this->context === self::CONTEXT_OBJECT) {
1190 $parser->setContext($this->obj_id, $this->obj_type, $this->sub_type);
1191 }
1192
1193 // Validate
1195 $parser->startParsing();
1196
1197 // Insert
1198 $parser->setMode(ilAdvancedMDRecordParser::MODE_INSERT);
1199 $parser->startParsing();
1200 $this->tpl->setOnScreenMessage('success', $this->lng->txt('md_adv_added_new_record'), true);
1201 $this->ctrl->redirect($this, "showRecords");
1202 } catch (ilSaxParserException $exc) {
1203 $this->tpl->setOnScreenMessage('failure', $exc->getMessage(), true);
1204 $this->ctrl->redirect($this, "importRecords");
1205 }
1206
1207 // Finally delete import file
1208 $import_files->deleteFileByCreationDate($create_time);
1209 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createRecord(ilPropertyFormGUI $form=null)
Show @access public.
SaxParserException thrown by ilSaxParser if property throwException is set.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilAdvancedMDRecordParser\MODE_INSERT, and ilAdvancedMDRecordParser\MODE_INSERT_VALIDATION.

+ Here is the call graph for this function:

◆ importRecords()

ilAdvancedMDSettingsGUI::importRecords ( )
protected

Definition at line 1091 of file class.ilAdvancedMDSettingsGUI.php.

1091 : void
1092 {
1093 $this->initRecordObject();
1094 $this->setRecordSubTabs();
1095
1096 // Import Table
1097 $this->initImportForm();
1098 $this->tpl->setContent($this->import_form->getHTML());
1099 }

◆ initComplexOptionForm()

ilAdvancedMDSettingsGUI::initComplexOptionForm ( ilAdvancedMDFieldDefinition  $a_def)
protected

Definition at line 2240 of file class.ilAdvancedMDSettingsGUI.php.

2241 {
2242 $this->ctrl->saveParameter($this, "record_id");
2243 $this->ctrl->saveParameter($this, "field_id");
2244 $this->ctrl->saveParameter($this, "oid");
2245
2246 $form = new ilPropertyFormGUI();
2247 $form->setTitle($this->lng->txt("md_adv_edit_complex_option"));
2248 $form->setFormAction($this->ctrl->getFormAction($this, "updateComplexOption"));
2249
2250 $oid = $this->getOidFromQuery();
2251 $a_def->initOptionForm($form, $oid);
2252
2253 $form->addCommandButton("updateComplexOption", $this->lng->txt("save"));
2254 $form->addCommandButton("editField", $this->lng->txt("cancel"));
2255
2256 return $form;
2257 }
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initContextParameters()

ilAdvancedMDSettingsGUI::initContextParameters ( int  $context,
int  $ref_id,
?string  $obj_type,
  $sub_type 
)
protected
Parameters
string | string[] | null$sub_type

Definition at line 253 of file class.ilAdvancedMDSettingsGUI.php.

258 : void {
259 if ($context === self::CONTEXT_ADMINISTRATION) {
260 $this->ref_id = $ref_id;
261 $this->obj_id = null;
262 $this->obj_type = null;
263 $this->sub_type = null;
264 } else {
265 $this->ref_id = $ref_id;
266 $this->obj_id = ilObject::_lookupObjId($ref_id);
267 $this->obj_type = $obj_type;
268 $this->sub_type = $sub_type;
269 }
270 }

References $ref_id.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ initFieldForm()

ilAdvancedMDSettingsGUI::initFieldForm ( ilAdvancedMDFieldDefinition  $a_definition)
protected

Definition at line 1399 of file class.ilAdvancedMDSettingsGUI.php.

1400 {
1401 $is_creation_mode = $a_definition->getFieldId() ? false : true;
1402
1403 $form = new ilPropertyFormGUI();
1404 $form->setFormAction($this->ctrl->getFormAction($this));
1405
1406 $translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($this->record->getRecordId());
1407 if ($is_creation_mode) {
1408 $form->setDescription($a_definition->getDescription());
1409 } else {
1410 $form->setDescription($translations->getFormTranslationInfo(
1411 $a_definition->getFieldId(),
1412 $this->active_language
1413 ));
1414 }
1415 $type = new ilNonEditableValueGUI($this->lng->txt("type"));
1416 $type->setValue($this->lng->txt($a_definition->getTypeTitle()));
1418 $a_definition->addToFieldDefinitionForm($form, $this->getPermissions(), $this->active_language);
1419
1420 if ($is_creation_mode) {
1421 $form->setTitle($this->lng->txt('md_adv_create_field'));
1422 $form->addCommandButton('saveField', $this->lng->txt('create'));
1423 } else {
1424 $form->setTitle($this->lng->txt('md_adv_edit_field'));
1425 $form->addCommandButton('updateField', $this->lng->txt('save'));
1426 }
1427
1428 $form->addCommandButton('editFields', $this->lng->txt('cancel'));
1429
1430 return $form;
1431 }
addToFieldDefinitionForm(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $language='')
Add input elements to definition form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $type, ilAdvancedMDFieldDefinition\addToFieldDefinitionForm(), ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getDescription(), ilAdvancedMDFieldDefinition\getFieldId(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getTypeTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initForm()

ilAdvancedMDSettingsGUI::initForm (   $a_mode)
protected

Definition at line 1433 of file class.ilAdvancedMDSettingsGUI.php.

1434 {
1435 if ($this->form instanceof ilPropertyFormGUI) {
1436 return $this->form;
1437 }
1438 $perm = $this->getPermissions()->hasPermissions(
1440 (string) $this->record->getRecordId(),
1441 array(
1444 )
1445 ,
1448 )
1449 ,
1452 )
1453 ,
1455 )
1456 );
1457
1458 $this->form = new ilPropertyFormGUI();
1459
1460 $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
1461 $this->form->setDescription($translations->getFormTranslationInfo($this->active_language));
1462 $this->form->setFormAction($this->ctrl->getFormAction($this));
1463
1464 // title
1465 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
1466 $title->setValue($this->record->getTitle());
1467 $title->setSize(20);
1468 $title->setMaxLength(70);
1469 $title->setRequired(true);
1470
1472 $title->setDisabled(true);
1473 }
1474 $this->form->addItem($title);
1475 $translations->modifyTranslationInfoForTitle($this->form, $title, $this->active_language);
1476
1477 // desc
1478 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
1479 $desc->setValue($this->record->getDescription());
1480 $desc->setRows(3);
1481
1483 $desc->setDisabled(true);
1484 }
1485 $this->form->addItem($desc);
1486 $translations->modifyTranslationInfoForDescription($this->form, $desc, $this->active_language);
1487
1488 // active
1489 $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_active'), 'active');
1490 $check->setChecked($this->record->isActive());
1491 $check->setValue("1");
1492 $this->form->addItem($check);
1493
1495 $check->setDisabled(true);
1496 }
1497
1498 if (!$this->obj_type) {
1499 // scope
1500 $scope = new ilCheckboxInputGUI($this->lng->txt('md_adv_scope'), 'scope');
1501 $scope->setInfo($this->lng->txt('md_adv_scope_info'));
1502 $scope->setChecked($this->record->enabledScope());
1503 $scope->setValue("1");
1504 $this->form->addItem($scope);
1505 $subitems = new ilRepositorySelector2InputGUI(
1506 $this->lng->txt('md_adv_scope_objects'),
1507 "scope_containers",
1508 true,
1509 $this->form
1510 );
1511 $subitems->setValue($this->record->getScopeRefIds());
1512 $exp = $subitems->getExplorerGUI();
1513
1514 $definition = $GLOBALS['DIC']['objDefinition'];
1515 $white_list = [];
1516 foreach ($definition->getAllRepositoryTypes() as $type) {
1517 if ($definition->isContainer($type)) {
1518 $white_list[] = $type;
1519 }
1520 }
1521
1522 $exp->setTypeWhiteList($white_list);
1523 $exp->setSkipRootNode(false);
1524 $exp->setRootId(ROOT_FOLDER_ID);
1525 $scope->addSubItem($subitems);
1526 }
1527
1528 if (!$this->obj_type) {
1529 $section = new ilFormSectionHeaderGUI();
1530 $section->setTitle($this->lng->txt('md_obj_types'));
1531 $this->form->addItem($section);
1532
1533 // see ilAdvancedMDRecordTableGUI::fillRow()
1534 $options = array(
1535 0 => $this->lng->txt("meta_obj_type_inactive"),
1536 1 => $this->lng->txt("meta_obj_type_mandatory"),
1537 2 => $this->lng->txt("meta_obj_type_optional")
1538 );
1539
1541 $t = $type["obj_type"] . ":" . $type["sub_type"];
1542 $this->lng->loadLanguageModule($type["obj_type"]);
1543
1544 /*
1545 * BT 35914: workaround for hiding portfolio pages in portfolios,
1546 * since they only get data from portfolio templates
1547 */
1548 $hidden = false;
1549 if ($type["obj_type"] == "prtf" && $type["sub_type"] == "pfpg") {
1550 $hidden = true;
1551 }
1552 // EmployeeTalks get their md from templates
1553 if ($type["obj_type"] == "tals" && $type["sub_type"] == "etal") {
1554 $hidden = true;
1555 }
1556
1557
1558 $type_options = $options;
1559 switch ($type["obj_type"]) {
1560 case "orgu":
1561 // currently only optional records for org unit (types)
1562 unset($type_options[1]);
1563 break;
1564 case "talt":
1565 // currently only optional records for talk templates (types)
1566 unset($type_options[1]);
1567 break;
1568 case "rcrs":
1569 // optional makes no sense for ecs-courses
1570 unset($type_options[2]);
1571 break;
1572 }
1573
1574 $value = 0;
1575 if ($a_mode == "edit") {
1576 foreach ($this->record->getAssignedObjectTypes() as $item) {
1577 if ($item["obj_type"] == $type["obj_type"] &&
1578 $item["sub_type"] == $type["sub_type"]) {
1579 $value = $item["optional"]
1580 ? 2
1581 : 1;
1582 }
1583 }
1584 }
1585
1586 $sel_name = 'obj_types__' . $t;
1587
1588 if ($hidden) {
1589 $hidden = new ilHiddenInputGUI($sel_name);
1590 $hidden->setValue((string) $value);
1591 $this->form->addItem($hidden);
1592 continue;
1593 }
1594
1595 $check = new ilSelectInputGUI($type['text'], $sel_name);
1596 //$check = new ilSelectInputGUI($type["text"], 'obj_types[' . $t . ']');
1597 $check->setOptions($type_options);
1598 $check->setValue($value);
1599 $this->form->addItem($check);
1600
1602 $check->setDisabled(true);
1603 }
1604 }
1605 }
1606
1607 switch ($a_mode) {
1608 case 'create':
1609 $this->form->setTitle($this->lng->txt('md_adv_create_record'));
1610 $this->form->addCommandButton('saveRecord', $this->lng->txt('add'));
1611 $this->form->addCommandButton('showRecords', $this->lng->txt('cancel'));
1612 break;
1613
1614 case 'edit':
1615 $this->form->setTitle($this->lng->txt('md_adv_edit_record'));
1616 $this->form->addCommandButton('updateRecord', $this->lng->txt('save'));
1617 $this->form->addCommandButton('showRecords', $this->lng->txt('cancel'));
1618 }
1619 return $this->form;
1620 }
$check
Definition: buildRTE.php:81
static _getAssignableObjectTypes(bool $a_include_text=false)
Get assignable object type @access public.
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
const ROOT_FOLDER_ID
Definition: constants.php:32
$scope
Definition: ltiregstart.php:53

References $check, $GLOBALS, $scope, $type, ilAdvancedMDRecord\_getAssignableObjectTypes(), ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_TOGGLE_ACTIVATION, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ILIAS\Repository\lng(), ROOT_FOLDER_ID, ilAdvancedMDPermissionHelper\SUBACTION_RECORD_DESCRIPTION, ilAdvancedMDPermissionHelper\SUBACTION_RECORD_OBJECT_TYPES, and ilAdvancedMDPermissionHelper\SUBACTION_RECORD_TITLE.

+ Here is the call graph for this function:

◆ initFormSubstitutions()

ilAdvancedMDSettingsGUI::initFormSubstitutions ( )
protected

init form table 'substitutions' @access protected

Definition at line 1818 of file class.ilAdvancedMDSettingsGUI.php.

1819 {
1820 global $DIC;
1821
1822 $ilAccess = $DIC['ilAccess'];
1823
1824 if (!$visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType()) {
1825 return null;
1826 }
1827
1828 $this->form = new ilPropertyFormGUI();
1829 $this->form->setFormAction($this->ctrl->getFormAction($this));
1830 #$this->form->setTableWidth('100%');
1831
1832 // substitution
1833 foreach ($visible_records as $obj_type => $records) {
1834 $perm = null;
1835
1836 if (in_array($obj_type, $this->permissions->getAllowedObjectTypes())) {
1837 $perm = $this->getPermissions()->hasPermissions(
1839 (string) $obj_type,
1840 array(
1842 ,
1844 ,
1846 )
1847 );
1848 }
1849
1851
1852 // Show section
1853 $section = new ilFormSectionHeaderGUI();
1854 $section->setTitle($this->lng->txt('objs_' . $obj_type));
1855 $this->form->addItem($section);
1856
1857 $check = new ilCheckboxInputGUI($this->lng->txt('description'), 'enabled_desc_' . $obj_type);
1858 $check->setValue("1");
1859 $check->setOptionTitle($this->lng->txt('md_adv_desc_show'));
1860 $check->setChecked($sub->isDescriptionEnabled());
1861 $this->form->addItem($check);
1862
1864 $check->setDisabled(true);
1865 }
1866
1867 $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'), 'enabled_field_names_' . $obj_type);
1868 $check->setValue("1");
1869 $check->setOptionTitle($this->lng->txt('md_adv_fields_show'));
1870 $check->setChecked($sub->enabledFieldNames());
1871 $this->form->addItem($check);
1872
1874 $check->setDisabled(true);
1875 }
1876
1877 $perm_pos = null;
1878 if ($perm) {
1880 }
1881
1883 $definitions = $sub->sortDefinitions($definitions);
1884
1885 $counter = 1;
1886 foreach ($definitions as $def) {
1887 $definition_id = $def->getFieldId();
1888
1889 $perm = $this->getSubstitutionFieldPermissions($obj_type, $definition_id);
1890
1891 $title = ilAdvancedMDRecord::_lookupTitle((int) $def->getRecordId());
1892 $title = $def->getTitle() . ' (' . $title . ')';
1893
1894 $check = new ilCheckboxInputGUI($title, 'show_' . $obj_type . '_' . $definition_id);
1895 $check->setValue("1");
1896 $check->setOptionTitle($this->lng->txt('md_adv_show'));
1897 $check->setChecked($sub->isSubstituted($definition_id));
1898
1899 if ($perm && !$perm["show"]) {
1900 $check->setDisabled(true);
1901 }
1902
1903 $pos = new ilNumberInputGUI(
1904 $this->lng->txt('position'),
1905 'position_' . $obj_type . '_' . $definition_id
1906 );
1907 $pos->setSize(3);
1908 $pos->setMaxLength(4);
1909 $pos->allowDecimals(true);
1910 $pos->setValue(sprintf('%.1f', $counter++));
1911 $check->addSubItem($pos);
1912
1913 if ($perm && !$perm_pos) {
1914 $pos->setDisabled(true);
1915 }
1916
1917 $bold = new ilCheckboxInputGUI(
1918 $this->lng->txt('bold'),
1919 'bold_' . $obj_type . '_' . $definition_id
1920 );
1921 $bold->setValue("1");
1922 $bold->setChecked($sub->isBold($definition_id));
1923 $check->addSubItem($bold);
1924
1925 if ($perm && !$perm["bold"]) {
1926 $bold->setDisabled(true);
1927 }
1928
1929 $bold = new ilCheckboxInputGUI(
1930 $this->lng->txt('newline'),
1931 'newline_' . $obj_type . '_' . $definition_id
1932 );
1933 $bold->setValue("1");
1934 $bold->setChecked($sub->hasNewline($definition_id));
1935 $check->addSubItem($bold);
1936
1937 if ($perm && !$perm["newline"]) {
1938 $bold->setDisabled(true);
1939 }
1940
1941 $this->form->addItem($check);
1942 }
1943 }
1944 $this->form->setTitle($this->lng->txt('md_adv_substitution_table'));
1945
1946 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1947 $this->form->addCommandButton('updateSubstitutions', $this->lng->txt('save'));
1948 }
1949 return $this->form;
1950 }
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static _lookupTitle(int $a_record_id)
static _getAllRecordsByObjectType()
Get records by obj_type Note: this returns only records with no sub types!
getSubstitutionFieldPermissions(string $a_obj_type, int $a_field_id)
static _getInstanceByObjectType(string $a_type)
This class represents a number property in a property form.

References $check, $DIC, ilAdvancedMDRecord\_getAllRecordsByObjectType(), ilAdvancedMDSubstitution\_getInstanceByObjectType(), ilAdvancedMDRecord\_lookupTitle(), ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initImportForm()

ilAdvancedMDSettingsGUI::initImportForm ( )
protected

Definition at line 1149 of file class.ilAdvancedMDSettingsGUI.php.

1149 : void
1150 {
1151 if (is_object($this->import_form)) {
1152 return;
1153 }
1154
1155 $this->import_form = new ilPropertyFormGUI();
1156 $this->import_form->setMultipart(true);
1157 $this->import_form->setFormAction($this->ctrl->getFormAction($this));
1158
1159 // add file property
1160 $file = new ilFileInputGUI($this->lng->txt('file'), 'file');
1161 $file->setSuffixes(array('xml'));
1162 $file->setRequired(true);
1163 $this->import_form->addItem($file);
1164
1165 $this->import_form->setTitle($this->lng->txt('md_adv_import_record'));
1166 $this->import_form->addCommandButton('importRecord', $this->lng->txt('import'));
1167 $this->import_form->addCommandButton('showRecords', $this->lng->txt('cancel'));
1168 }
This class represents a file property in a property form.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initLanguage()

ilAdvancedMDSettingsGUI::initLanguage ( int  $record_id)
protected

Definition at line 2277 of file class.ilAdvancedMDSettingsGUI.php.

2277 : void
2278 {
2280 // read active language
2281 $default = '';
2282 foreach ($translations->getTranslations() as $translation) {
2283 if ($translation->getLangKey() == $translations->getDefaultLanguage()) {
2284 $default = $translation->getLangKey();
2285 }
2286 }
2287 $active = $this->request->getQueryParams()['mdlang'] ?? $default;
2288 $this->active_language = $active;
2289 }

References ilAdvancedMDRecordTranslations\getInstanceByRecordId().

+ Here is the call graph for this function:

◆ initRecordObject()

ilAdvancedMDSettingsGUI::initRecordObject ( )
protected
Todo:
get rid of $this->obj_id switch

Definition at line 2038 of file class.ilAdvancedMDSettingsGUI.php.

2039 {
2040 if (!$this->record instanceof ilAdvancedMDRecord) {
2041 $record_id = $this->getRecordIdFromQuery();
2042 $this->record = ilAdvancedMDRecord::_getInstanceByRecordId((int) $record_id);
2043 $this->ctrl->saveParameter($this, 'record_id');
2044
2045 // bind to parent object (aka local adv md)
2046 if (!$record_id && $this->obj_id) {
2047 $this->record->setParentObject($this->obj_id);
2048 }
2049 }
2050 return $this->record;
2051 }

References ilAdvancedMDRecord\_getInstanceByRecordId(), and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ loadRecordFormData()

ilAdvancedMDSettingsGUI::loadRecordFormData ( ilPropertyFormGUI  $form)
protected

Definition at line 1952 of file class.ilAdvancedMDSettingsGUI.php.

1953 {
1954 $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
1955
1956 $perm = $this->getPermissions()->hasPermissions(
1958 (string) $this->record->getRecordId(),
1959 array(
1962 )
1963 ,
1966 )
1967 ,
1970 )
1971 ,
1973 )
1974 );
1975
1977 $this->record->setActive((bool) $form->getInput('active'));
1978 }
1980 if (
1981 $translations->getDefaultTranslation() == null ||
1982 $translations->getDefaultTranslation()->getLangKey() == $this->active_language
1983 ) {
1984 $this->record->setTitle((string) $form->getInput('title'));
1985 }
1986 }
1988 if (
1989 $translations->getDefaultTranslation() == null ||
1990 $translations->getDefaultTranslation()->getLangKey() == $this->active_language) {
1991 $this->record->setDescription($form->getInput('desc'));
1992 }
1993 }
1994
1995 if (!$this->obj_type) {
1997 $obj_types = [];
1999 $t = $type["obj_type"] . ":" . $type["sub_type"];
2000 $value = $form->getInput('obj_types__' . $t);
2001 if (!$value) {
2002 continue;
2003 }
2004 $obj_types[] = [
2005 'obj_type' => $type['obj_type'],
2006 'sub_type' => $type['sub_type'],
2007 'optional' => ($value > 1)
2008 ];
2009 }
2010 $this->record->setAssignedObjectTypes($obj_types);
2011 }
2012 }
2013
2014 $scopes = $form->getInput('scope');
2015 $scopes_selection = $form->getInput('scope_containers_sel');
2016 if ($scopes && is_array($scopes_selection)) {
2017 $this->record->enableScope(true);
2018 $this->record->setScopes(
2019 array_map(
2020 function (string $scope_ref_id) {
2022 $scope->setRefId((int) $scope_ref_id);
2023 return $scope;
2024 },
2025 $scopes_selection
2026 )
2027 );
2028 } else {
2029 $this->record->enableScope(false);
2030 $this->record->setScopes([]);
2031 }
2032 return $this->record;
2033 }
Scope restrictions for advanced md records.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
$scopes
Definition: ltitoken.php:99

References $scope, $scopes, $type, ilAdvancedMDRecord\_getAssignableObjectTypes(), ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_TOGGLE_ACTIVATION, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ilPropertyFormGUI\getInput(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDPermissionHelper\SUBACTION_RECORD_DESCRIPTION, ilAdvancedMDPermissionHelper\SUBACTION_RECORD_OBJECT_TYPES, and ilAdvancedMDPermissionHelper\SUBACTION_RECORD_TITLE.

+ Here is the call graph for this function:

◆ saveField()

ilAdvancedMDSettingsGUI::saveField ( )

Definition at line 1362 of file class.ilAdvancedMDSettingsGUI.php.

1362 : void
1363 {
1364 $record_id = $this->getRecordIdFromQuery();
1365 $ftype = $this->getFieldTypeFromQuery();
1366
1367 if (!$record_id || !$ftype) {
1368 $this->editFields();
1369 return;
1370 }
1371
1372 $this->initRecordObject();
1373 $this->initLanguage($record_id);
1374 $this->ctrl->saveParameter($this, 'ftype');
1375
1376 $field_definition = ilAdvancedMDFieldDefinition::getInstance(
1377 null,
1378 $ftype
1379 );
1380 $field_definition->setRecordId($record_id);
1381 $form = $this->initFieldForm($field_definition);
1382
1383 if ($form->checkInput()) {
1384 $field_definition->importDefinitionFormPostValues($form, $this->getPermissions(), $this->active_language);
1385 $field_definition->save();
1386
1387 $translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record_id);
1388 $translations->read();
1389 $translations->updateFromForm($field_definition->getFieldId(), $this->active_language, $form);
1390
1391 $this->tpl->setOnScreenMessage('success', $this->lng->txt('save_settings'), true);
1392 $this->ctrl->redirect($this, "editFields");
1393 }
1394
1396 $this->createField($form);
1397 }
createField(ilPropertyFormGUI $a_form=null)
Show field type selection @access public.

References ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveRecord()

ilAdvancedMDSettingsGUI::saveRecord ( )

Save record @access public.

Parameters

Definition at line 1216 of file class.ilAdvancedMDSettingsGUI.php.

1216 : void
1217 {
1218 $this->initRecordObject();
1219 $form = $this->initForm('create');
1220 if (!$this->form->checkInput()) {
1221 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
1222 $this->createRecord($this->form);
1223 return;
1224 }
1225
1227 if ($this->obj_type) {
1228 $sub_types = (!is_array($this->sub_type))
1229 ? [$this->sub_type]
1230 : $this->sub_type;
1231 $assigned_object_types = array_map(function ($sub_type) {
1232 return [
1233 "obj_type" => $this->obj_type,
1234 "sub_type" => $sub_type,
1235 "optional" => false
1236 ];
1237 }, $sub_types);
1238 $this->record->setAssignedObjectTypes($assigned_object_types);
1239 }
1240
1241 $record->setDefaultLanguage($this->lng->getDefaultLanguage());
1242 $record->save();
1243
1245 $translations->addTranslationEntry($record->getDefaultLanguage(), true);
1246 $translations->updateTranslations(
1248 $this->form->getInput('title'),
1249 $this->form->getInput('desc')
1250 );
1251 $this->tpl->setOnScreenMessage('success', $this->lng->txt('md_adv_added_new_record'), true);
1252 $this->ctrl->redirect($this, 'showRecords');
1253 }
setDefaultLanguage(string $language_code)
loadRecordFormData(ilPropertyFormGUI $form)

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setRecordSubTabs()

ilAdvancedMDSettingsGUI::setRecordSubTabs ( int  $level = 1,
bool  $show_settings = false 
)
protected

Set subtabs for record editing/creation.

Definition at line 1104 of file class.ilAdvancedMDSettingsGUI.php.

1104 : void
1105 {
1106 $this->tabs_gui->clearTargets();
1107 $this->tabs_gui->clearSubTabs();
1108
1109 if ($level == 1) {
1110 $this->tabs_gui->setBackTarget(
1111 $this->lng->txt('md_adv_record_list'),
1112 $this->ctrl->getLinkTarget($this, 'showRecords')
1113 );
1114
1115 if ($show_settings) {
1116 $this->tabs_gui->addTab(
1117 self::TAB_RECORD_SETTINGS,
1118 $this->lng->txt('settings'),
1119 $this->ctrl->getLinkTarget($this, self::TAB_RECORD_SETTINGS)
1120 );
1121 $this->ctrl->setParameterByClass(
1122 strtolower(\ilAdvancedMDRecordTranslationGUI::class),
1123 'record_id',
1124 $this->record->getRecordId()
1125 );
1126 $this->lng->loadLanguageModule('obj');
1127 $this->tabs_gui->addTab(
1128 self::TAB_TRANSLATION,
1129 $this->lng->txt('obj_multilinguality'),
1130 $this->ctrl->getLinkTargetByClass(
1131 strtolower(\ilAdvancedMDRecordTranslationGUI::class),
1132 ''
1133 )
1134 );
1135 }
1136 }
1137 if ($level == 2) {
1138 $this->tabs_gui->setBack2Target(
1139 $this->lng->txt('md_adv_record_list'),
1140 $this->ctrl->getLinkTarget($this, 'showRecords')
1141 );
1142 $this->tabs_gui->setBackTarget(
1143 $this->lng->txt('md_adv_field_list'),
1144 $this->ctrl->getLinkTarget($this, 'editFields')
1145 );
1146 }
1147 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setSubTabs()

ilAdvancedMDSettingsGUI::setSubTabs ( int  $context)
protected

Set sub tabs @access protected.

Definition at line 2057 of file class.ilAdvancedMDSettingsGUI.php.

2057 : void
2058 {
2059 if ($context == self::CONTEXT_OBJECT) {
2060 return;
2061 }
2062
2063 $this->tabs_gui->clearSubTabs();
2064
2065 $this->tabs_gui->addSubTabTarget(
2066 "md_adv_record_list",
2067 $this->ctrl->getLinkTarget($this, "showRecords"),
2068 '',
2069 '',
2070 '',
2071 true
2072 );
2073
2075 $this->tabs_gui->addSubTabTarget(
2076 "md_adv_presentation",
2077 $this->ctrl->getLinkTarget($this, "showPresentation")
2078 );
2079 }
2080
2081 $this->tabs_gui->addSubTabTarget(
2082 "md_adv_file_list",
2083 $this->ctrl->getLinkTarget($this, "showFiles"),
2084 "showFiles"
2085 );
2086 }

References $context, ilAdvancedMDRecord\_getAllRecordsByObjectType(), and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ showFiles()

ilAdvancedMDSettingsGUI::showFiles ( )
protected

Show export files.

Definition at line 524 of file class.ilAdvancedMDSettingsGUI.php.

524 : void
525 {
526 $this->setSubTabs($this->context);
527 $this->tabs_gui->setSubTabActive('md_adv_file_list');
528
530 $this->context === self::CONTEXT_ADMINISTRATION ? null : $this->obj_id
531 );
532 $file_data = $files->readFilesInfo();
533
534 $table_gui = new ilAdvancedMDRecordExportFilesTableGUI($this, "showFiles");
535 $table_gui->setTitle($this->lng->txt("md_record_export_table"));
536 $table_gui->parseFiles($file_data);
537 $table_gui->addMultiCommand("downloadFile", $this->lng->txt('download'));
538
539 if ($GLOBALS['DIC']->access()->checkAccess('write', '', $this->ref_id)) {
540 $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
541 }
542 $table_gui->setSelectAllCheckbox("file_id");
543
544 $this->tpl->setContent($table_gui->getHTML());
545 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSubTabs(int $context)
Set sub tabs @access protected.

References $GLOBALS, ILIAS\Repository\access(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ showLanguageSwitch()

ilAdvancedMDSettingsGUI::showLanguageSwitch ( int  $record_id,
string  $target 
)
protected

Definition at line 2291 of file class.ilAdvancedMDSettingsGUI.php.

2291 : void
2292 {
2294
2295 if (count($translations->getTranslations()) <= 1) {
2296 return;
2297 }
2298 $actions = [];
2299 foreach ($translations->getTranslations() as $translation) {
2300 $this->ctrl->setParameter($this, 'mdlang', $translation->getLangKey());
2301 $actions[$translation->getLangKey()] = $this->ctrl->getLinkTarget(
2302 $this,
2303 $target
2304 );
2305 }
2306 $this->ctrl->setParameter($this, 'mdlang', $this->active_language);
2307 $view_control = $this->ui_factory->viewControl()->mode(
2308 $actions,
2309 $this->lng->txt('meta_aria_language_selection')
2310 )->withActive($this->active_language);
2311 $this->toolbar->addComponent($view_control);
2312 }

References ILIAS\Repository\ctrl(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ showPresentation()

ilAdvancedMDSettingsGUI::showPresentation ( )
protected

Definition at line 362 of file class.ilAdvancedMDSettingsGUI.php.

362 : void
363 {
364 $this->setSubTabs($this->context);
365 $form = $this->initFormSubstitutions();
366 if ($form instanceof ilPropertyFormGUI) {
367 $this->tabs_gui->setSubTabActive('md_adv_presentation');
368 $this->tpl->setContent($this->form->getHTML());
369 return;
370 }
371 $this->showRecords();
372 }
initFormSubstitutions()
init form table 'substitutions' @access protected

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ showRecords()

ilAdvancedMDSettingsGUI::showRecords ( )

Definition at line 301 of file class.ilAdvancedMDSettingsGUI.php.

301 : void
302 {
303 global $DIC;
304
305 $ilToolbar = $DIC['ilToolbar'];
306 $ilAccess = $DIC['ilAccess'];
307
308 $this->setSubTabs($this->context);
309
310 $perm = $this->getPermissions()->hasPermissions(
312 (string) $this->ref_id,
313 array(
316 )
317 );
318
320 $button = ilLinkButton::getInstance();
321 $button->setCaption("add");
322 $button->setUrl($this->ctrl->getLinkTarget($this, "createRecord"));
323 $ilToolbar->addButtonInstance($button);
324
326 $ilToolbar->addSeparator();
327 }
328 }
329
331 $button = ilLinkButton::getInstance();
332 $button->setCaption("import");
333 $button->setUrl($this->ctrl->getLinkTarget($this, "importRecords"));
334 $ilToolbar->addButtonInstance($button);
335 }
336
337 $obj_type_context = ($this->obj_id > 0)
338 ? ilObject::_lookupType($this->obj_id)
339 : "";
340 $table_gui = new ilAdvancedMDRecordTableGUI(
341 $this,
342 "showRecords",
343 $this->getPermissions(),
344 $obj_type_context
345 );
346 $table_gui->setTitle($this->lng->txt("md_record_list_table"));
347 $table_gui->setData($this->getParsedRecordObjects());
348
349 // permissions?
350 //$table_gui->addCommandButton('createRecord',$this->lng->txt('add'));
351 $table_gui->addMultiCommand("exportRecords", $this->lng->txt('export'));
352 $table_gui->setSelectAllCheckbox("record_id");
353
354 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
355 $table_gui->addMultiCommand("confirmDeleteRecords", $this->lng->txt("delete"));
356 $table_gui->addCommandButton("updateRecords", $this->lng->txt("save"));
357 }
358
359 $DIC->ui()->mainTemplate()->setContent($table_gui->getHTML());
360 }
static _lookupType(int $id, bool $reference=false)

References $DIC, ilObject\_lookupType(), ilAdvancedMDPermissionHelper\ACTION_MD_CREATE_RECORD, ilAdvancedMDPermissionHelper\ACTION_MD_IMPORT_RECORDS, ilAdvancedMDPermissionHelper\CONTEXT_MD, ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ updateComplexOption()

ilAdvancedMDSettingsGUI::updateComplexOption ( )

Definition at line 2259 of file class.ilAdvancedMDSettingsGUI.php.

2259 : void
2260 {
2261 $field_id = $this->getFieldIdFromQuery();
2262 $field_definition = ilAdvancedMDFieldDefinition::getInstance($field_id);
2263 $oid = $this->getOidFromQuery();
2264
2265 if ($field_definition->hasComplexOptions()) {
2266 $form = $this->initComplexOptionForm($field_definition);
2267 if ($form->checkInput() &&
2268 $field_definition->updateComplexOption($form, $oid)) {
2269 $field_definition->update();
2270 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
2271 }
2272 }
2273
2274 $this->ctrl->redirect($this, "editField");
2275 }

References ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstance(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ updateField()

ilAdvancedMDSettingsGUI::updateField ( )

Update field @access public.

Definition at line 1290 of file class.ilAdvancedMDSettingsGUI.php.

1290 : void
1291 {
1292 $record_id = $this->getRecordIdFromQuery();
1293 $field_id = $this->getFieldIdFromQuery();
1294 $this->ctrl->saveParameter($this, 'record_id');
1295 $this->ctrl->saveParameter($this, 'field_id');
1296
1297 if (!$record_id || !$field_id) {
1298 $this->editFields();
1299 return;
1300 }
1301
1302 $this->initRecordObject();
1303 $this->initLanguage($record_id);
1304 $this->showLanguageSwitch($record_id, 'editField');
1305
1306 $confirm = false;
1307 $field_definition = ilAdvancedMDFieldDefinition::getInstance($field_id);
1308 $form = $this->initFieldForm($field_definition);
1309 if ($form->checkInput()) {
1310 $field_definition->importDefinitionFormPostValues($form, $this->getPermissions(), $this->active_language);
1311 if (!$field_definition->importDefinitionFormPostValuesNeedsConfirmation()) {
1312 $field_definition->update();
1313 $translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($this->record->getRecordId());
1314 $translations->updateFromForm($field_id, $this->active_language, $form);
1315
1316 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1317 $this->ctrl->redirect($this, 'editField');
1318 } else {
1319 $confirm = true;
1320 }
1321 }
1322
1324
1325 // fields needs confirmation of updated settings
1326 if ($confirm) {
1327 $this->tpl->setOnScreenMessage('info', $this->lng->txt("md_adv_confirm_definition"));
1328 $field_definition->prepareDefinitionFormConfirmation($form);
1329 }
1330
1331 $this->editField($form);
1332 }
editField(ilPropertyFormGUI $a_form=null)
Edit field @access public.

References ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ updateFields()

ilAdvancedMDSettingsGUI::updateFields ( )

Update fields @access public.

Definition at line 992 of file class.ilAdvancedMDSettingsGUI.php.

992 : void
993 {
994 $this->ctrl->saveParameter($this, 'record_id');
995 $positions = $this->getPositionsFromPost();
996 asort($positions, SORT_NUMERIC);
997 $record_id = $this->getRecordIdFromQuery();
998 if (!$record_id) {
999 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1000 $this->editFields();
1001 return;
1002 }
1003
1005
1006 if ($this->getPermissions()->hasPermission(
1008 (string) $record_id,
1010 )) {
1011 $positions_flipped = array_flip(array_keys($positions));
1012 foreach ($fields as $field) {
1013 $field->setPosition((int) $positions_flipped[$field->getFieldId()]);
1014 $field->update();
1015 }
1016 }
1017
1018 foreach ($fields as $field) {
1019 if ($this->getPermissions()->hasPermission(
1021 (string) $field->getFieldId(),
1024 )) {
1025 $post_searchable = (array) ($this->http->request()->getParsedBody()['searchable'] ?? []);
1026 $field->setSearchable((bool) ($post_searchable[$field->getFieldId()] ?? false));
1027 $field->update();
1028 }
1029 }
1030
1031 $language = $this->request->getQueryParams()['mdlang'] ?? false;
1032 if ($language) {
1033 $this->ctrl->setParameter($this, 'mdlang', $this->request->getQueryParams()['mdlang']);
1034 }
1035 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1036 $this->ctrl->redirect($this, "editFields");
1037 }

References ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\CONTEXT_FIELD, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ilAdvancedMDPermissionHelper\SUBACTION_FIELD_SEARCHABLE.

+ Here is the call graph for this function:

◆ updateRecord()

ilAdvancedMDSettingsGUI::updateRecord ( )

Update record @access public.

Parameters

Definition at line 1044 of file class.ilAdvancedMDSettingsGUI.php.

1044 : void
1045 {
1046 $record_id = $this->getRecordIdFromQuery();
1047 if (!$record_id) {
1048 $this->ctrl->redirect($this, 'showRecords');
1049 }
1050 $this->initRecordObject();
1051 $this->initLanguage($record_id);
1052 $this->showLanguageSwitch($record_id, 'editRecord');
1053
1054 $form = $this->initForm('edit');
1055 if (!$this->form->checkInput()) {
1056 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
1057 $this->form->setValuesByPost();
1058 $this->editRecord($this->form);
1059 return;
1060 }
1061
1062 $this->loadRecordFormData($form);
1063 $this->record->update();
1064
1065 $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($this->record->getRecordId());
1066 $translations->updateTranslations(
1067 $this->active_language,
1068 $this->form->getInput('title'),
1069 $this->form->getInput('desc')
1070 );
1071
1072 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1073 $this->ctrl->redirect($this, 'editRecord');
1074 }
editRecord(ilPropertyFormGUI $form=null)

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ updateRecords()

ilAdvancedMDSettingsGUI::updateRecords ( )

Save records (assigned object typed) @access public.

Parameters

Definition at line 715 of file class.ilAdvancedMDSettingsGUI.php.

715 : void
716 {
717 // sort positions and renumber
718 $positions = $this->getPositionsFromPost();
719 asort($positions, SORT_NUMERIC);
720
721 $sorted_positions = [];
722 $i = 1 + $this->getTableOffsetFromPost();
723 foreach ($positions as $record_id => $pos) {
724 $sorted_positions[(int) $record_id] = $i++;
725 }
726 $selected_global = array();
727
728 $post_active = (array) ($this->http->request()->getParsedBody()['active'] ?? []);
729 if ($this->obj_id > 0) {
731 }
732 foreach ($this->getParsedRecordObjects() as $item) {
733 // BT 35518: this is kind of a hacky solution to skip items not in the table due to pagination
734 if (!array_key_exists($item['id'], $sorted_positions)) {
735 continue;
736 }
737
738 $perm = $this->getPermissions()->hasPermissions(
740 (string) $item['id'],
741 array(
743 ,
746 )
747 )
748 );
749
750
751 $record_obj = ilAdvancedMDRecord::_getInstanceByRecordId($item['id']);
752
754 $obj_types = array();
755 $post_object_types = (array) ($this->http->request()->getParsedBody()['obj_types'] ?? []);
756 if (is_array($post_object_types[$record_obj->getRecordId()] ?? false)) {
757 foreach ($post_object_types[$record_obj->getRecordId()] as $type => $status) {
758 if ($status) {
759 $type = explode(":", $type);
760 $obj_types[] = array(
761 "obj_type" => ilUtil::stripSlashes($type[0]),
762 "sub_type" => ilUtil::stripSlashes($type[1]),
763 "optional" => ((int) $status == 2)
764 );
765 }
766 }
767 }
768
769 // global records in global administration and local records in local administration
770 if (!$item['readonly']) {
771 // table adv_md_record_objs
772 $record_obj->setAssignedObjectTypes($obj_types);
773 } else { // global records in local administration
774 foreach ($obj_types as $t) {
775 // table adv_md_obj_rec_select
776 ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $t["sub_type"], [$record_obj->getRecordId()], false);
777 }
778 }
779 }
780
781 if ($this->context == self::CONTEXT_ADMINISTRATION) {
783 $record_obj->setActive(isset($post_active[$record_obj->getRecordId()]));
784 }
785
786 if (isset($sorted_positions[$record_obj->getRecordId()])) {
787 $record_obj->setGlobalPosition((int) $sorted_positions[$record_obj->getRecordId()]);
788 }
789 $record_obj->update();
791 // global, optional record
792 if ($item['readonly'] &&
793 $item['optional'] &&
794 ($post_active[$item['id']] ?? false)) {
795 $selected_global[] = $item['id'];
796 } elseif ($item['local']) {
797 $record_obj = ilAdvancedMDRecord::_getInstanceByRecordId($item['id']);
798 $record_obj->setActive((bool) ($post_active[$item['id']] ?? false));
799 $record_obj->update();
800 }
801 }
802
803 // save local sorting
804 if ($this->context == self::CONTEXT_OBJECT) {
805 if (isset($sorted_positions[$item['id']])) {
806 global $DIC;
807
808 $local_position = new \ilAdvancedMDRecordObjectOrdering(
809 $item['id'],
810 $this->obj_id,
811 $DIC->database()
812 );
813 $local_position->setPosition((int) $sorted_positions[$item['id']]);
814 $local_position->save();
815 }
816 }
817 }
818
819 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
820 $this->ctrl->redirect($this, "showRecords");
821 }
static deleteObjRecSelection(int $a_obj_id)
Delete repository object record selection.
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
$i
Definition: metadata.php:41

References $DIC, $i, $type, ilAdvancedMDRecord\_getInstanceByRecordId(), ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_TOGGLE_ACTIVATION, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ILIAS\Repository\ctrl(), ilAdvancedMDRecord\deleteObjRecSelection(), ILIAS\FileDelivery\http(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilAdvancedMDRecord\saveObjRecSelection(), ilUtil\stripSlashes(), and ilAdvancedMDPermissionHelper\SUBACTION_RECORD_OBJECT_TYPES.

+ Here is the call graph for this function:

◆ updateSubstitutions()

ilAdvancedMDSettingsGUI::updateSubstitutions ( )

Update substitution @access public.

Definition at line 378 of file class.ilAdvancedMDSettingsGUI.php.

378 : void
379 {
380 global $DIC;
381
382 $ilAccess = $DIC['ilAccess'];
383
384 if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
385 $this->ctrl->redirect($this, "showPresentation");
386 }
387
388 $form = $this->initFormSubstitutions();
389 if (!$form instanceof ilPropertyFormGUI) {
390 $this->ctrl->redirect($this, 'showPresentation');
391 return;
392 }
393 if (!$form->checkInput()) {
394 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), true);
395 $this->ctrl->redirect($this, "showPresentation");
396 }
397
399 $perm = null;
400
401 if (in_array($obj_type, $this->permissions->getAllowedObjectTypes())) {
402 $perm = $this->getPermissions()->hasPermissions(
404 "0",
405 array(
407 ,
409 ,
411 )
412 );
413 }
416 $sub->enableDescription((bool) $form->getInput('enabled_desc_' . $obj_type));
417 }
418
420 $sub->enableFieldNames((bool) $form->getInput('enabled_field_names_' . $obj_type));
421 }
422
424 $definitions = $sub->sortDefinitions($definitions);
425
426 // gather existing data
427 $counter = 1;
428 $old_sub = array();
429 foreach ($definitions as $def) {
430 $field_id = $def->getFieldId();
431 $old_sub[$field_id] = array(
432 "active" => $sub->isSubstituted($field_id),
433 "pos" => $counter++,
434 "bold" => $sub->isBold($field_id),
435 "newline" => $sub->hasNewline($field_id)
436 );
437 }
438
439 $sub->resetSubstitutions();
440
441 $new_sub = [];
442 foreach ($definitions as $def) {
443 $field_id = $def->getFieldId();
444 $old = $old_sub[$field_id];
445
446 $perm_def = $this->getSubstitutionFieldPermissions($obj_type, $field_id);
447 if ($perm_def["show"] ?? false) {
448 $active = (bool) $form->getInput('show_' . $obj_type . '_' . $field_id);
449 } else {
450 $active = $old["active"] ?? false;
451 }
452 if ($active) {
453 $new_sub[$field_id] = $old;
455 $new_sub[$field_id]['pos'] = (int) $form->getInput('position_' . $obj_type . '_' . $field_id);
456 }
457 if ($perm_def["bold"] ?? false) {
458 $new_sub[$field_id]['bold'] = (bool) $form->getInput('bold_' . $obj_type . '_' . $field_id);
459 }
460 if ($perm_def["newline"] ?? false) {
461 $new_sub[$field_id]['newline'] = (bool) $form->getInput('newline_' . $obj_type . '_' . $field_id);
462 }
463 }
464 }
465
466 if (sizeof($new_sub)) {
467 $new_sub = ilArrayUtil::sortArray($new_sub, "pos", "asc", true, true);
468 foreach ($new_sub as $field_id => $field) {
469 $sub->appendSubstitution($field_id, (bool) $field["bold"], (bool) $field["newline"]);
470 }
471 }
472 $sub->update();
473 }
474
475 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
476 $this->ctrl->redirect($this, "showPresentation");
477 }
static _getActivatedObjTypes()
get activated obj types
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)

References $DIC, ilAdvancedMDRecord\_getActivatedObjTypes(), ilAdvancedMDSubstitution\_getInstanceByObjectType(), ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION, ILIAS\Repository\ctrl(), ilAdvancedMDFieldDefinition\getInstancesByObjType(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ilArrayUtil\sortArray().

+ Here is the call graph for this function:

Field Documentation

◆ $active_language

string ilAdvancedMDSettingsGUI::$active_language = ''
private

Definition at line 65 of file class.ilAdvancedMDSettingsGUI.php.

◆ $context

ilAdvancedMDSettingsGUI::$context = null
private

Definition at line 45 of file class.ilAdvancedMDSettingsGUI.php.

◆ $ctrl

ilCtrl ilAdvancedMDSettingsGUI::$ctrl
protected

Definition at line 51 of file class.ilAdvancedMDSettingsGUI.php.

◆ $form

ilPropertyFormGUI ilAdvancedMDSettingsGUI::$form = null
protected

Definition at line 47 of file class.ilAdvancedMDSettingsGUI.php.

◆ $http

GlobalHttpState ilAdvancedMDSettingsGUI::$http
protected

Definition at line 53 of file class.ilAdvancedMDSettingsGUI.php.

◆ $import_form

ilPropertyFormGUI ilAdvancedMDSettingsGUI::$import_form = null
protected

Definition at line 46 of file class.ilAdvancedMDSettingsGUI.php.

◆ $lng

ilLanguage ilAdvancedMDSettingsGUI::$lng
protected

Definition at line 49 of file class.ilAdvancedMDSettingsGUI.php.

◆ $logger

ilLogger ilAdvancedMDSettingsGUI::$logger
protected

Definition at line 60 of file class.ilAdvancedMDSettingsGUI.php.

◆ $obj_id

int ilAdvancedMDSettingsGUI::$obj_id
protected

Definition at line 67 of file class.ilAdvancedMDSettingsGUI.php.

◆ $obj_type

string ilAdvancedMDSettingsGUI::$obj_type = null
protected

Definition at line 68 of file class.ilAdvancedMDSettingsGUI.php.

◆ $permissions

ilAdvancedMDPermissionHelper ilAdvancedMDSettingsGUI::$permissions
protected

Definition at line 62 of file class.ilAdvancedMDSettingsGUI.php.

Referenced by getPermissions().

◆ $record

ilAdvancedMDRecord ilAdvancedMDSettingsGUI::$record = null
protected

Definition at line 63 of file class.ilAdvancedMDSettingsGUI.php.

◆ $ref_id

int ilAdvancedMDSettingsGUI::$ref_id
protected

Definition at line 66 of file class.ilAdvancedMDSettingsGUI.php.

Referenced by initContextParameters().

◆ $refinery

RefineryFactory ilAdvancedMDSettingsGUI::$refinery
protected

Definition at line 54 of file class.ilAdvancedMDSettingsGUI.php.

◆ $request

RequestInterface ilAdvancedMDSettingsGUI::$request
protected

Definition at line 52 of file class.ilAdvancedMDSettingsGUI.php.

◆ $sub_type

ilAdvancedMDSettingsGUI::$sub_type = null
protected

Definition at line 72 of file class.ilAdvancedMDSettingsGUI.php.

◆ $tabs_gui

ilTabsGUI ilAdvancedMDSettingsGUI::$tabs_gui
protected

Definition at line 56 of file class.ilAdvancedMDSettingsGUI.php.

◆ $toolbar

ilToolbarGUI ilAdvancedMDSettingsGUI::$toolbar
protected

Definition at line 59 of file class.ilAdvancedMDSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilAdvancedMDSettingsGUI::$tpl
protected

Definition at line 50 of file class.ilAdvancedMDSettingsGUI.php.

◆ $ui_factory

UIFactory ilAdvancedMDSettingsGUI::$ui_factory
protected

Definition at line 57 of file class.ilAdvancedMDSettingsGUI.php.

◆ $ui_renderer

Renderer ilAdvancedMDSettingsGUI::$ui_renderer
protected

Definition at line 58 of file class.ilAdvancedMDSettingsGUI.php.

◆ CONTEXT_ADMINISTRATION

const ilAdvancedMDSettingsGUI::CONTEXT_ADMINISTRATION = 1

Definition at line 35 of file class.ilAdvancedMDSettingsGUI.php.

Referenced by ilObjMDSettingsGUI\executeCommand().

◆ CONTEXT_OBJECT

const ilAdvancedMDSettingsGUI::CONTEXT_OBJECT = 2

◆ TAB_RECORD_SETTINGS

const ilAdvancedMDSettingsGUI::TAB_RECORD_SETTINGS = 'editRecord'
protected

Definition at line 38 of file class.ilAdvancedMDSettingsGUI.php.

◆ TAB_TRANSLATION

const ilAdvancedMDSettingsGUI::TAB_TRANSLATION = 'translations'
protected

Definition at line 39 of file class.ilAdvancedMDSettingsGUI.php.


The documentation for this class was generated from the following file: