4include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
5include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
6include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDPermissionHelper.php');
7include_once
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordScope.php';
49 public function __construct($a_ref_id =
null, $a_obj_type =
null, $a_sub_type =
null)
56 $ilTabs =
$DIC[
'ilTabs'];
60 $this->lng->loadLanguageModule(
'meta');
62 $this->tabs_gui = $ilTabs;
64 $this->logger =
$GLOBALS[
'DIC']->logger()->amet();
66 $this->ref_id = $a_ref_id;
78 $this->obj_type = $a_obj_type;
79 $this->sub_type = $a_sub_type
106 $next_class = $this->ctrl->getNextClass($this);
107 $cmd = $this->ctrl->getCmd();
109 if (!$this->obj_id) {
113 switch ($next_class) {
114 case "ilpropertyformgui":
117 $this->record->getRecordId() > 0 ?
'edit' :
'create'
119 $GLOBALS[
'DIC']->ctrl()->forwardCommand($this->form);
124 $cmd =
'showRecords';
141 $ilToolbar =
$DIC[
'ilToolbar'];
142 $ilAccess =
$DIC[
'ilAccess'];
154 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
156 $button->setCaption(
"add");
157 $button->setUrl($this->ctrl->getLinkTarget($this,
"createRecord"));
158 $ilToolbar->addButtonInstance($button);
161 $ilToolbar->addSeparator();
166 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
168 $button->setCaption(
"import");
169 $button->setUrl($this->ctrl->getLinkTarget($this,
"importRecords"));
170 $ilToolbar->addButtonInstance($button);
173 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php");
175 $table_gui->setTitle($this->lng->txt(
"md_record_list_table"));
180 $table_gui->addMultiCommand(
"exportRecords", $this->lng->txt(
'export'));
181 $table_gui->setSelectAllCheckbox(
"record_id");
183 if ($ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
184 $table_gui->addMultiCommand(
"confirmDeleteRecords", $this->lng->txt(
"delete"));
185 $table_gui->addCommandButton(
"updateRecords", $this->lng->txt(
"save"));
188 $DIC->ui()->mainTemplate()->setContent($table_gui->getHTML());
195 if (is_object($this->form)) {
196 $this->tabs_gui->setSubTabActive(
'md_adv_presentation');
197 return $this->tpl->setContent($this->form->getHTML());
213 $ilAccess =
$DIC[
'ilAccess'];
215 if (!$ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
216 $this->ctrl->redirect($this,
"showPresentation");
222 if (in_array(
$obj_type, [
'cat',
'crs',
'sess',
'grp',
'iass'])) {
234 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
242 $sub->enableFieldNames((
int)
$_POST[
'enabled_field_names_' .
$obj_type]);
246 $definitions = $sub->sortDefinitions($definitions);
251 foreach ($definitions as
$def) {
252 $field_id =
$def->getFieldId();
253 $old_sub[$field_id] = array(
254 "active" => $sub->isSubstituted($field_id),
256 "bold" => $sub->isBold($field_id),
257 "newline" => $sub->hasNewline($field_id)
261 $sub->resetSubstitutions(array());
264 foreach ($definitions as
$def) {
265 $field_id =
$def->getFieldId();
266 $old = $old_sub[$field_id];
269 if ($perm_def[
"show"]) {
272 $active = $old[
"active"];
276 $new_sub[$field_id] = $old;
279 $new_sub[$field_id][
"pos"] = (int)
$_POST[
'position'][
$obj_type][$field_id];
281 if ($perm_def[
"bold"]) {
284 if ($perm_def[
"newline"]) {
290 if (
sizeof($new_sub)) {
292 foreach ($new_sub as $field_id => $field) {
293 $sub->appendSubstitution($field_id, $field[
"bold"], $field[
"newline"]);
301 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
302 $this->ctrl->redirect($this,
"showPresentation");
312 if (!isset(
$_POST[
'record_id'])) {
320 foreach (
$_POST[
'record_id'] as $record_id) {
327 $fail[] = $record->getTitle();
331 ilUtil::sendFailure($this->lng->txt(
'msg_no_perm_copy') .
" " . implode(
", ", $fail),
true);
332 $this->ctrl->redirect($this,
"showRecords");
335 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php');
337 $xml_writer->write();
339 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
341 $export_files->create($xml_writer->xmlDumpMem());
343 ilUtil::sendSuccess($this->lng->txt(
'md_adv_records_exported'));
356 $this->tabs_gui->setSubTabActive(
'md_adv_file_list');
358 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
360 $file_data =
$files->readFilesInfo();
362 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFilesTableGUI.php");
364 $table_gui->setTitle($this->lng->txt(
"md_record_export_table"));
365 $table_gui->parseFiles($file_data);
366 $table_gui->addMultiCommand(
"downloadFile", $this->lng->txt(
'download'));
368 if (
$GLOBALS[
'DIC']->access()->checkAccess(
'write',
'', $this->ref_id)) {
369 $table_gui->addMultiCommand(
"confirmDeleteFiles", $this->lng->txt(
"delete"));
371 $table_gui->addCommandButton(
'showFiles', $this->lng->txt(
'cancel'));
372 $table_gui->setSelectAllCheckbox(
"file_id");
374 $this->tpl->setContent($table_gui->getHTML());
386 if (!isset(
$_POST[
'file_id']) or count(
$_POST[
'file_id']) != 1) {
392 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
394 $abs_path =
$files->getAbsolutePathByFileId((
int)
$_POST[
'file_id'][0]);
407 if (!isset(
$_POST[
'file_id'])) {
413 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
417 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteFiles"));
418 $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_files_sure"));
419 $c_gui->setCancel($this->lng->txt(
"cancel"),
"showFiles");
420 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteFiles");
422 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
424 $file_data =
$files->readFilesInfo();
428 foreach (
$_POST[
"file_id"] as $file_id) {
429 $info = $file_data[$file_id];
430 $c_gui->addItem(
"file_id[]", $file_id, is_array(
$info[
'name']) ? implode(
',',
$info[
'name']) :
'No Records');
432 $this->tpl->setContent($c_gui->getHTML());
444 if (!isset(
$_POST[
'file_id'])) {
450 if (!
$GLOBALS[
'DIC']->access()->checkAccess(
'write',
'', $this->ref_id)) {
452 $GLOBALS[
'DIC']->ctrl()->redirect($this,
'showFiles');
455 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
458 foreach (
$_POST[
'file_id'] as $file_id) {
459 $files->deleteByFileId((
int) $file_id);
461 ilUtil::sendSuccess($this->lng->txt(
'md_adv_deleted_files'));
473 if (!isset(
$_POST[
'record_id'])) {
479 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
483 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteRecords"));
484 $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_record_sure"));
485 $c_gui->setCancel($this->lng->txt(
"cancel"),
"showRecords");
486 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteRecords");
489 foreach (
$_POST[
"record_id"] as $record_id) {
491 $c_gui->addItem(
"record_id[]", $record_id, $record->getTitle() ? $record->getTitle() :
'No Title');
493 $this->tpl->setContent($c_gui->getHTML());
504 if (!isset(
$_POST[
'record_id'])) {
512 foreach (
$_POST[
'record_id'] as $record_id) {
516 if (!$record->getParentObject()) {
517 $fail[] = $record->getTitle();
527 $fail[] = $record->getTitle();
531 ilUtil::sendFailure($this->lng->txt(
'msg_no_perm_delete') .
" " . implode(
", ", $fail),
true);
532 $this->ctrl->redirect($this,
"showRecords");
535 foreach (
$_POST[
'record_id'] as $record_id) {
539 ilUtil::sendSuccess($this->lng->txt(
'md_adv_deleted_records'),
true);
540 $this->ctrl->redirect($this,
"showRecords");
553 $positions =
$_POST[
'pos'];
556 $sorted_positions = [];
558 foreach ($positions as $record_id => $pos) {
559 $sorted_positions[$record_id] =
$i++;
562 $selected_global = array();
574 if ($this->mode == self::MODE_ADMINISTRATION) {
578 $obj_types = array();
579 if (is_array(
$_POST[
'obj_types'][$record_obj->getRecordId()])) {
580 foreach (
$_POST[
'obj_types'][$record_obj->getRecordId()] as
$type => $status) {
583 $obj_types[] = array(
586 "optional" => ((
int) $status == 2)
591 $record_obj->setAssignedObjectTypes($obj_types);
595 $record_obj->setActive(isset(
$_POST[
'active'][$record_obj->getRecordId()]));
598 $record_obj->setGlobalPosition((
int) $sorted_positions[$record_obj->getRecordId()]);
599 $record_obj->update();
602 if ($item[
'readonly'] &&
604 $_POST[
'active'][$item[
'id']]) {
605 $selected_global[] = $item[
'id'];
606 } elseif ($item[
'local']) {
608 $record_obj->setActive(isset(
$_POST[
'active'][$item[
'id']]));
609 $record_obj->update();
614 if ($this->mode == self::MODE_OBJECT) {
617 $local_position = new \ilAdvancedMDRecordObjectOrdering($item[
'id'], $this->obj_id,
$DIC->database());
618 $local_position->setPosition((
int) $sorted_positions[$item[
'id']]);
619 $local_position->save();
623 if ($this->obj_type) {
627 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
628 $this->ctrl->redirect($this,
"showRecords");
639 if (!isset(
$_POST[
'field_id'])) {
645 $this->ctrl->saveParameter($this,
'record_id');
647 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
651 $c_gui->setFormAction($this->ctrl->getFormAction($this,
"deleteFields"));
652 $c_gui->setHeaderText($this->lng->txt(
"md_adv_delete_fields_sure"));
653 $c_gui->setCancel($this->lng->txt(
"cancel"),
"editFields");
654 $c_gui->setConfirm($this->lng->txt(
"confirm"),
"deleteFields");
657 foreach (
$_POST[
"field_id"] as $field_id) {
659 $c_gui->addItem(
"field_id[]", $field_id, $field->getTitle() ? $field->getTitle() :
'No Title');
661 $this->tpl->setContent($c_gui->getHTML());
673 $this->ctrl->saveParameter($this,
'record_id');
675 if (!isset(
$_POST[
'field_id'])) {
683 foreach (
$_POST[
'field_id'] as $field_id) {
690 $fail[] = $field->getTitle();
694 ilUtil::sendFailure($this->lng->txt(
'msg_no_perm_delete') .
" " . implode(
", ", $fail),
true);
695 $this->ctrl->redirect($this,
"editFields");
698 foreach (
$_POST[
"field_id"] as $field_id) {
702 ilUtil::sendSuccess($this->lng->txt(
'md_adv_deleted_fields'),
true);
703 $this->ctrl->redirect($this,
"editFields");
715 $this->ctrl->saveParameter($this,
'record_id');
718 $this->tpl->setContent($this->form->getHTML());
725 $ilToolbar =
$DIC[
'ilToolbar'];
727 $this->ctrl->saveParameter($this,
'record_id');
732 $this->record->getRecordId(),
739 $filter_warn = array();
742 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
749 if (!$field->isFilterSupported()) {
750 $filter_warn[] = $this->lng->txt($field->getTypeTitle());
754 $ilToolbar->addInputItem($types);
756 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,
"createField"));
758 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
760 $button->setCaption(
"add");
761 $button->setCommand(
"createField");
762 $ilToolbar->addButtonInstance($button);
766 if (
sizeof($filter_warn)) {
767 ilUtil::sendInfo(sprintf($this->lng->txt(
"md_adv_field_filter_warning"), implode(
", ", $filter_warn)));
771 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
774 include_once(
"./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php");
776 $table_gui->setTitle($this->lng->txt(
"md_adv_field_table"));
777 $table_gui->parseDefinitions($fields);
778 if (
sizeof($fields)) {
779 $table_gui->addCommandButton(
"updateFields", $this->lng->txt(
"save"));
781 $table_gui->addCommandButton(
"showRecords", $this->lng->txt(
'cancel'));
782 $table_gui->addMultiCommand(
"confirmDeleteFields", $this->lng->txt(
"delete"));
783 $table_gui->setSelectAllCheckbox(
"field_id");
785 $this->tpl->setContent($table_gui->getHTML());
796 $this->ctrl->saveParameter($this,
'record_id');
798 if (!isset(
$_GET[
'record_id']) or !
$_GET[
'record_id']) {
804 include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
812 if (!isset(
$_POST[
'position']) or !is_array(
$_POST[
'position'])) {
817 asort(
$_POST[
'position'], SORT_NUMERIC);
818 $positions = array_flip(array_keys(
$_POST[
'position']));
819 foreach ($fields as $field) {
820 $field->setPosition($positions[$field->getFieldId()]);
825 foreach ($fields as $field) {
828 $field->getFieldId(),
832 $field->setSearchable(isset(
$_POST[
'searchable'][$field->getFieldId()]) ?
true :
false);
838 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
839 $this->ctrl->redirect($this,
"editFields");
851 if (!isset(
$_GET[
'record_id']) or !
$_GET[
'record_id']) {
859 $this->logger->dump(
$_POST);
861 if (!$this->record->validate()) {
866 $this->record->update();
867 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'));
884 $this->tpl->setContent($this->form->getHTML());
892 $this->tpl->setContent($this->import_form->getHTML());
902 if (is_object($this->import_form)) {
906 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
908 $this->import_form->setMultipart(
true);
909 $this->import_form->setFormAction($this->ctrl->getFormAction($this));
913 $file->setSuffixes(array(
'xml'));
914 $file->setRequired(
true);
915 $this->import_form->addItem($file);
917 $this->import_form->setTitle($this->lng->txt(
'md_adv_import_record'));
918 $this->import_form->addCommandButton(
'importRecord', $this->lng->txt(
'import'));
919 $this->import_form->addCommandButton(
'showRecords', $this->lng->txt(
'cancel'));
932 if (!$this->import_form->checkInput()) {
933 $this->import_form->setValuesByPost();
938 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordImportFiles.php');
940 if (!$create_time = $import_files->moveUploadedFile($_FILES[
'file'][
'tmp_name'])) {
946 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordParser.php');
951 $parser->setContext($this->obj_id, $this->obj_type, $this->sub_type);
961 ilUtil::sendSuccess($this->lng->txt(
'md_adv_added_new_record'),
true);
962 $this->ctrl->redirect($this,
"showRecords");
963 }
catch (ilSAXParserException $exc) {
965 $this->ctrl->redirect($this,
"importRecords");
969 $import_files->deleteFileByCreationDate($create_time);
986 if ($this->obj_type) {
987 $this->record->setAssignedObjectTypes(array(
989 "obj_type" => $this->obj_type,
990 "sub_type" => $this->sub_type,
995 if (!$this->record->validate()) {
1000 $this->record->save();
1002 ilUtil::sendSuccess($this->lng->txt(
'md_adv_added_new_record'));
1014 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"field_id"]) {
1018 $this->ctrl->saveParameter($this,
'record_id');
1019 $this->ctrl->saveParameter($this,
'field_id');
1025 $this->tpl->setContent($a_form->getHTML());
1036 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"field_id"]) {
1040 $this->ctrl->saveParameter($this,
'record_id');
1041 $this->ctrl->saveParameter($this,
'field_id');
1046 if (
$form->checkInput()) {
1048 if (!$field_definition->importDefinitionFormPostValuesNeedsConfirmation()) {
1049 $field_definition->update();
1051 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
1052 $this->ctrl->redirect($this,
"editFields");
1058 $form->setValuesByPost();
1063 $field_definition->prepareDefinitionFormConfirmation(
$form);
1077 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"ftype"]) {
1081 $this->ctrl->saveParameter($this,
'record_id');
1082 $this->ctrl->saveParameter($this,
'ftype');
1085 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1087 $field_definition->setRecordId($_REQUEST[
"record_id"]);
1090 $this->tpl->setContent($a_form->getHTML());
1100 if (!$_REQUEST[
"record_id"] || !$_REQUEST[
"ftype"]) {
1104 $this->ctrl->saveParameter($this,
'record_id');
1105 $this->ctrl->saveParameter($this,
'ftype');
1107 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1109 $field_definition->setRecordId($_REQUEST[
"record_id"]);
1112 if (
$form->checkInput()) {
1114 $field_definition->save();
1116 ilUtil::sendSuccess($this->lng->txt(
'save_settings'),
true);
1117 $this->ctrl->redirect($this,
"editFields");
1120 $form->setValuesByPost();
1131 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1134 $form->setFormAction($this->ctrl->getFormAction($this));
1143 $form->setTitle($this->lng->txt(
'md_adv_create_field'));
1144 $form->addCommandButton(
'saveField', $this->lng->txt(
'create'));
1146 $form->setTitle($this->lng->txt(
'md_adv_edit_field'));
1147 $form->addCommandButton(
'updateField', $this->lng->txt(
'save'));
1150 $form->addCommandButton(
'editFields', $this->lng->txt(
'cancel'));
1162 if (is_object($this->form)) {
1168 $this->record->getRecordId(),
1180 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1183 $this->form->setFormAction($this->ctrl->getFormAction($this));
1188 $title->setValue($this->record->getTitle());
1190 $title->setMaxLength(70);
1191 $title->setRequired(
true);
1192 $this->form->addItem(
$title);
1195 $title->setDisabled(
true);
1200 $desc->setValue($this->record->getDescription());
1203 $this->form->addItem($desc);
1206 $desc->setDisabled(
true);
1211 $check->setChecked($this->record->isActive());
1212 $check->setValue(1);
1213 $this->form->addItem($check);
1216 $check->setDisabled(
true);
1219 if (!$this->obj_type) {
1222 $scope->setChecked($this->record->enabledScope());
1223 $scope->setValue(1);
1224 $this->form->addItem($scope);
1227 $subitems->setValue($this->record->getScopeRefIds());
1228 $exp = $subitems->getExplorerGUI();
1230 $definition =
$GLOBALS[
'DIC'][
'objDefinition'];
1232 foreach ($definition->getAllRepositoryTypes() as
$type) {
1233 if ($definition->isContainer(
$type)) {
1234 $white_list[] =
$type;
1239 $exp->setTypeWhiteList($white_list);
1240 $exp->setSkipRootNode(
false);
1241 $exp->setRootId(ROOT_FOLDER_ID);
1242 $scope->addSubItem($subitems);
1245 if (!$this->obj_type) {
1247 $section->setTitle($this->lng->txt(
'md_obj_types'));
1252 0 => $this->lng->txt(
"meta_obj_type_inactive"),
1253 1 => $this->lng->txt(
"meta_obj_type_mandatory"),
1254 2 => $this->lng->txt(
"meta_obj_type_optional")
1260 $this->lng->loadLanguageModule(
$type[
"obj_type"]);
1263 switch (
$type[
"obj_type"]) {
1266 unset($type_options[1]);
1270 unset($type_options[1]);
1274 unset($type_options[2]);
1279 if ($a_mode ==
"edit") {
1280 foreach ($this->record->getAssignedObjectTypes() as $item) {
1281 if ($item[
"obj_type"] ==
$type[
"obj_type"] &&
1282 $item[
"sub_type"] ==
$type[
"sub_type"]) {
1283 $value = $item[
"optional"]
1291 $check->setOptions($type_options);
1292 $check->setValue($value);
1293 $this->form->addItem($check);
1296 $check->setDisabled(
true);
1303 $this->form->setTitle($this->lng->txt(
'md_adv_create_record'));
1304 $this->form->addCommandButton(
'saveRecord', $this->lng->txt(
'add'));
1305 $this->form->addCommandButton(
'showRecords', $this->lng->txt(
'cancel'));
1310 $this->form->setTitle($this->lng->txt(
'md_adv_edit_record'));
1311 $this->form->addCommandButton(
'updateRecord', $this->lng->txt(
'save'));
1312 $this->form->addCommandButton(
'showRecords', $this->lng->txt(
'cancel'));
1320 if ($a_obj_type ==
"crs") {
1337 } elseif ($a_obj_type ==
"cat") {
1354 } elseif ($a_obj_type ==
"sess") {
1371 } elseif ($a_obj_type ==
"grp") {
1388 } elseif ($a_obj_type ==
"iass") {
1417 $ilAccess =
$DIC[
'ilAccess'];
1419 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1426 $this->form->setFormAction($this->ctrl->getFormAction($this));
1427 #$this->form->setTableWidth('100%');
1433 if (in_array(
$obj_type, [
'crs',
'cat',
'sess',
'grp',
'iass'])) {
1445 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
1454 $check->setValue(1);
1455 $check->setOptionTitle($this->lng->txt(
'md_adv_desc_show'));
1456 $check->setChecked($sub->isDescriptionEnabled() ?
true :
false);
1457 $this->form->addItem($check);
1460 $check->setDisabled(
true);
1464 $check->setValue(1);
1465 $check->setOptionTitle($this->lng->txt(
'md_adv_fields_show'));
1466 $check->setChecked($sub->enabledFieldNames() ?
true :
false);
1467 $this->form->addItem($check);
1470 $check->setDisabled(
true);
1473 #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
1474 #$area->setUseRte(true);
1475 #$area->setRteTagSet('standard');
1476 #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
1478 #$area->setCols(80);
1479 #$this->form->addItem($area);
1486 $definitions = $sub->sortDefinitions($definitions);
1489 foreach ($definitions as
$def) {
1490 $definition_id =
$def->getFieldId();
1498 $check->setValue(1);
1499 $check->setOptionTitle($this->lng->txt(
'md_adv_show'));
1500 $check->setChecked($sub->isSubstituted($definition_id));
1502 if ($perm && !$perm[
"show"]) {
1503 $check->setDisabled(
true);
1508 $pos->setMaxLength(4);
1509 $pos->allowDecimals(
true);
1510 $pos->setValue(sprintf(
'%.1f', $counter++));
1511 $check->addSubItem($pos);
1513 if ($perm && !$perm_pos) {
1514 $pos->setDisabled(
true);
1519 $bold->setChecked($sub->isBold($definition_id));
1520 $check->addSubItem($bold);
1522 if ($perm && !$perm[
"bold"]) {
1523 $bold->setDisabled(
true);
1528 $bold->setChecked($sub->hasNewline($definition_id));
1529 $check->addSubItem($bold);
1531 if ($perm && !$perm[
"newline"]) {
1532 $bold->setDisabled(
true);
1536 $this->form->addItem($check);
1564 $this->form->setTitle($this->lng->txt(
'md_adv_substitution_table'));
1566 if ($ilAccess->checkAccess(
'write',
'', $_REQUEST[
"ref_id"])) {
1567 $this->form->addCommandButton(
'updateSubstitutions', $this->lng->txt(
'save'));
1582 $this->record->getRecordId(),
1604 if (!$this->obj_type) {
1606 $obj_types = array();
1607 if (is_array(
$_POST[
'obj_types'])) {
1608 foreach (
$_POST[
'obj_types'] as
$t => $value) {
1610 $t = explode(
":",
$t);
1611 $obj_types[] = array(
1614 "optional" => ($value > 1)
1619 $this->record->setAssignedObjectTypes($obj_types);
1624 foreach ((array)
$_POST[
'scope_containers_sel'] as
$ref_id) {
1629 $this->record->setScopes(
$_POST[
'scope'] ? $scopes : []);
1630 $this->record->enableScope(
$_POST[
'scope'] ?
true :
false);
1640 if (!is_object($this->record)) {
1641 $record_id = isset(
$_GET[
'record_id'])
1642 ?
$_GET[
'record_id']
1649 $this->record->setParentObject($this->obj_id);
1653 return $this->record;
1663 $this->tabs_gui->clearSubTabs();
1665 $this->tabs_gui->addSubTabTarget(
1666 "md_adv_record_list",
1667 $this->ctrl->getLinkTarget($this,
"showRecords"),
1676 $this->tabs_gui->addSubTabTarget(
1677 "md_adv_presentation",
1678 $this->ctrl->getLinkTarget($this,
"showPresentation")
1682 $this->tabs_gui->addSubTabTarget(
1684 $this->ctrl->getLinkTarget($this,
"showFiles"),
1698 if ($this->mode == self::MODE_OBJECT) {
1708 $parent_id = $record->getParentObject();
1710 if ($this->mode == self::MODE_ADMINISTRATION) {
1716 if ($parent_id && $parent_id != $this->obj_id) {
1721 if (!$parent_id && !$record->isActive()) {
1728 $record->getScopes()
1736 $tmp_arr[
'id'] = $record->getRecordId();
1737 $tmp_arr[
'active'] = $record->isActive();
1738 $tmp_arr[
'title'] = $record->getTitle();
1739 $tmp_arr[
'description'] = $record->getDescription();
1740 $tmp_arr[
'fields'] = array();
1741 $tmp_arr[
'obj_types'] = $record->getAssignedObjectTypes();
1743 $tmp_arr[
'position'] = $position;
1745 $tmp_arr[
'perm'] = $this->permissions->hasPermissions(
1747 $record->getRecordId(),
1757 if ($this->obj_type) {
1758 $tmp_arr[
"readonly"] = !(bool) $parent_id;
1759 $tmp_arr[
"local"] = $parent_id;
1762 $assigned = $optional =
false;
1763 foreach ($tmp_arr[
'obj_types'] as $idx => $item) {
1764 if ($item[
"obj_type"] == $this->obj_type &&
1765 $item[
"sub_type"] == $this->sub_type) {
1767 $optional = $item[
"optional"];
1768 $tmp_arr[
'obj_types'][$idx][
'context'] =
true;
1775 $tmp_arr[
'optional'] = $optional;
1778 $tmp_arr[
'active'] = in_array($record->getRecordId(), $selected);
An exception for terminatinating execution or to throw for unit testing.
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 CONTEXT_SUBSTITUTION_SESSION
const ACTION_RECORD_EXPORT
const ACTION_SUBSTITUTION_SHOW_FIELDNAMES
const SUBACTION_RECORD_DESCRIPTION
const ACTION_SUBSTITUTION_FIELD_POSITIONS
const ACTION_SUBSTITUTION_GROUP_SHOW_FIELD
const ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY
const ACTION_RECORD_CREATE_FIELD
const ACTION_SUBSTITUTION_GROUP_EDIT_FIELD_PROPERTY
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 CONTEXT_SUBSTITUTION_IASS
const ACTION_RECORD_TOGGLE_ACTIVATION
const SUBACTION_SUBSTITUTION_NEWLINE
const ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD
const ACTION_SUBSTITUTION_IASS_SHOW_FIELD
const ACTION_MD_CREATE_RECORD
const CONTEXT_SUBSTITUTION
const ACTION_RECORD_EDIT_PROPERTY
const ACTION_SUBSTITUTION_SESSION_SHOW_FIELD
const ACTION_MD_IMPORT_RECORDS
const SUBACTION_RECORD_OBJECT_TYPES
const ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY
const ACTION_SUBSTITUTION_IASS_EDIT_FIELD_PROPERTY
const ACTION_RECORD_DELETE
const CONTEXT_SUBSTITUTION_GROUP
const ACTION_FIELD_DELETE
SAX based XML parser for record import files.
const MODE_INSERT_VALIDATION
Scope restrictions for advanced md records.
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.
static isFilteredByScope($a_ref_id, array $scopes)
Check if a given ref id is not filtered by scope restriction.
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.
const MODE_ADMINISTRATION
confirmDeleteFiles()
confirm delete files
initFieldForm(ilAdvancedMDFieldDefinition $a_definition)
init field form
initFormSubstitutions()
init form table 'substitutions'
initImportForm()
show import form
__construct($a_ref_id=null, $a_obj_type=null, $a_sub_type=null)
Constructor.
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.
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 _lookupObjId($a_id)
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 sendFailure($a_info="", $a_keep=false)
Send Failure 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.
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
if(isset($_POST['submit'])) $form
foreach($_POST as $key=> $value) $res