ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAdvancedMDSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
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';
17{
18 protected $lng;
19 protected $tpl;
20 protected $ctrl;
21 protected $tabs;
22 protected $permissions; // [ilAdvancedMDPermissionHelper]
23 protected $ref_id = null;
24 protected $obj_id = null; // [int]
25 protected $obj_type = null; // [string]
26 protected $sub_type = null; // [string]
27
31 private $logger = null;
32
39 public function __construct($a_ref_id = null, $a_obj_type = null, $a_sub_type = null)
40 {
41 global $tpl,$lng,$ilCtrl,$ilTabs;
42
43 $this->ctrl = $ilCtrl;
44 $this->lng = $lng;
45 $this->lng->loadLanguageModule('meta');
46 $this->tpl = $tpl;
47 $this->tabs_gui = $ilTabs;
48
49 $this->logger = $GLOBALS['DIC']->logger()->amet();
50
51 $this->ref_id = $a_ref_id;
52 if ($this->ref_id) {
53 $this->obj_id = ilObject::_lookupObjId($a_ref_id);
54 }
55 $this->obj_type = $a_obj_type;
56 $this->sub_type = $a_sub_type
57 ? $a_sub_type
58 : "-";
59
60 if (
61 $this->obj_id &&
62 !$this->obj_type) {
63 $this->obj_type = ilObject::_lookupType($this->obj_id);
64 }
65
66 $this->permissions = ilAdvancedMDPermissionHelper::getInstance();
67 }
68
69 protected function getPermissions()
70 {
71 return $this->permissions;
72 }
73
81 public function executeCommand()
82 {
83 $next_class = $this->ctrl->getNextClass($this);
84 $cmd = $this->ctrl->getCmd();
85
86 if (!$this->obj_id) {
87 $this->setSubTabs();
88 }
89
90 switch ($next_class) {
91 case "ilpropertyformgui":
92 $this->initRecordObject();
93 $this->initForm(
94 $this->record->getRecordId() > 0 ? 'edit' : 'create'
95 );
96 $GLOBALS['DIC']->ctrl()->forwardCommand($this->form);
97 break;
98
99 default:
100 if (!$cmd) {
101 $cmd = 'showRecords';
102 }
103 $this->$cmd();
104 }
105 }
106
114 public function showRecords()
115 {
116 global $ilToolbar, $ilAccess;
117
118 $perm = $this->getPermissions()->hasPermissions(
120 $_REQUEST["ref_id"],
121 array(
124 )
125 );
126
128 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
129 $button = ilLinkButton::getInstance();
130 $button->setCaption("add");
131 $button->setUrl($this->ctrl->getLinkTarget($this, "createRecord"));
132 $ilToolbar->addButtonInstance($button);
133
135 $ilToolbar->addSeparator();
136 }
137 }
138
140 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
141 $button = ilLinkButton::getInstance();
142 $button->setCaption("import");
143 $button->setUrl($this->ctrl->getLinkTarget($this, "importRecords"));
144 $ilToolbar->addButtonInstance($button);
145 }
146
147 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.show_records.html', 'Services/AdvancedMetaData');
148
149 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php");
150 $table_gui = new ilAdvancedMDRecordTableGUI($this, "showRecords", $this->getPermissions(), (bool) $this->obj_id);
151 $table_gui->setTitle($this->lng->txt("md_record_list_table"));
152 $table_gui->setData($this->getParsedRecordObjects());
153
154 // permissions?
155 //$table_gui->addCommandButton('createRecord',$this->lng->txt('add'));
156 $table_gui->addMultiCommand("exportRecords", $this->lng->txt('export'));
157 $table_gui->setSelectAllCheckbox("record_id");
158
159 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
160 $table_gui->addMultiCommand("confirmDeleteRecords", $this->lng->txt("delete"));
161 $table_gui->addCommandButton("updateRecords", $this->lng->txt("save"));
162 }
163
164
165 $this->tpl->setVariable('RECORD_TABLE', $table_gui->getHTML());
166
167 return true;
168 }
169
170 public function showPresentation()
171 {
172 if ($this->initFormSubstitutions()) {
173 if (is_object($this->form)) {
174 $this->tabs_gui->setSubTabActive('md_adv_presentation');
175 return $this->tpl->setContent($this->form->getHTML());
176 }
177 }
178 return $this->showRecords();
179 }
180
187 public function updateSubstitutions()
188 {
189 global $ilAccess;
190
191 if (!$ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
192 $this->ctrl->redirect($this, "showPresentation");
193 }
194
196 $perm = null;
197 // :TODO: hardwired?
198 if (in_array($obj_type, ['cat','crs','sess'])) {
199 $perm = $this->getPermissions()->hasPermissions(
201 $obj_type,
202 array(
206 )
207 );
208 }
209
210 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
212
214 $sub->enableDescription($_POST['enabled_desc_' . $obj_type]);
215 }
216
218 $sub->enableFieldNames((int) $_POST['enabled_field_names_' . $obj_type]);
219 }
220
222 $definitions = $sub->sortDefinitions($definitions);
223
224 // gather existing data
225 $counter = 1;
226 $old_sub = array();
227 foreach ($definitions as $def) {
228 $field_id = $def->getFieldId();
229 $old_sub[$field_id] = array(
230 "active" => $sub->isSubstituted($field_id),
231 "pos" => $counter++,
232 "bold" => $sub->isBold($field_id),
233 "newline" => $sub->hasNewline($field_id)
234 );
235 }
236
237 $sub->resetSubstitutions(array());
238
239 $new_sub = array();
240 foreach ($definitions as $def) {
241 $field_id = $def->getFieldId();
242 $old = $old_sub[$field_id];
243
244 $perm_def = $this->getSubstitutionFieldPermissions($obj_type, $field_id);
245 if ($perm_def["show"]) {
246 $active = (isset($_POST['show'][$obj_type][$field_id]) && $_POST['show'][$obj_type][$field_id]);
247 } else {
248 $active = $old["active"];
249 }
250
251 if ($active) {
252 $new_sub[$field_id] = $old;
253
255 $new_sub[$field_id]["pos"] = (int) $_POST['position'][$obj_type][$field_id];
256 }
257 if ($perm_def["bold"]) {
258 $new_sub[$field_id]["bold"] = (isset($_POST['bold'][$obj_type][$field_id]) && $_POST['bold'][$obj_type][$field_id]);
259 }
260 if ($perm_def["newline"]) {
261 $new_sub[$field_id]["newline"] = (isset($_POST['newline'][$obj_type][$field_id]) && $_POST['newline'][$obj_type][$field_id]);
262 }
263 }
264 }
265
266 if (sizeof($new_sub)) {
267 $new_sub = ilUtil::sortArray($new_sub, "pos", "asc", true, true);
268 foreach ($new_sub as $field_id => $field) {
269 $sub->appendSubstitution($field_id, $field["bold"], $field["newline"]);
270 }
271 }
272
273 $sub->update();
274 }
275
276
277 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
278 $this->ctrl->redirect($this, "showPresentation");
279 }
280
286 public function exportRecords()
287 {
288 if (!isset($_POST['record_id'])) {
289 ilUtil::sendFailure($this->lng->txt('select_one'));
290 $this->showRecords();
291 return false;
292 }
293
294 // all records have to be exportable
295 $fail = array();
296 foreach ($_POST['record_id'] as $record_id) {
297 if (!$this->getPermissions()->hasPermission(
299 $record_id,
301 )) {
302 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
303 $fail[] = $record->getTitle();
304 }
305 }
306 if ($fail) {
307 ilUtil::sendFailure($this->lng->txt('msg_no_perm_copy') . " " . implode(", ", $fail), true);
308 $this->ctrl->redirect($this, "showRecords");
309 }
310
311 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php');
312 $xml_writer = new ilAdvancedMDRecordXMLWriter($_POST['record_id']);
313 $xml_writer->write();
314
315 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
316 $export_files = new ilAdvancedMDRecordExportFiles($this->obj_id);
317 $export_files->create($xml_writer->xmlDumpMem());
318
319 ilUtil::sendSuccess($this->lng->txt('md_adv_records_exported'));
320 $this->showFiles();
321 }
322
330 public function showFiles()
331 {
332 $this->tabs_gui->setSubTabActive('md_adv_file_list');
333
334 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
335 $files = new ilAdvancedMDRecordExportFiles($this->obj_id);
336 $file_data = $files->readFilesInfo();
337
338 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFilesTableGUI.php");
339 $table_gui = new ilAdvancedMDRecordExportFilesTableGUI($this, "showFiles");
340 $table_gui->setTitle($this->lng->txt("md_record_export_table"));
341 $table_gui->parseFiles($file_data);
342 $table_gui->addMultiCommand("downloadFile", $this->lng->txt('download'));
343
344 if ($GLOBALS['DIC']->access()->checkAccess('write', '', $this->ref_id)) {
345 $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
346 }
347 $table_gui->addCommandButton('showFiles', $this->lng->txt('cancel'));
348 $table_gui->setSelectAllCheckbox("file_id");
349
350 $this->tpl->setContent($table_gui->getHTML());
351 }
352
360 public function downloadFile()
361 {
362 if (!isset($_POST['file_id']) or count($_POST['file_id']) != 1) {
363 ilUtil::sendFailure($this->lng->txt('md_adv_select_one_file'));
364 $this->showFiles();
365 return false;
366 }
367
368 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
369 $files = new ilAdvancedMDRecordExportFiles($this->obj_id);
370 $abs_path = $files->getAbsolutePathByFileId((int) $_POST['file_id'][0]);
371
372 ilUtil::deliverFile($abs_path, 'ilias_meta_data_record.xml', 'application/xml');
373 }
374
381 public function confirmDeleteFiles()
382 {
383 if (!isset($_POST['file_id'])) {
384 ilUtil::sendFailure($this->lng->txt('select_one'));
385 $this->showFiles();
386 return false;
387 }
388
389 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
390 $c_gui = new ilConfirmationGUI();
391
392 // set confirm/cancel commands
393 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
394 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_files_sure"));
395 $c_gui->setCancel($this->lng->txt("cancel"), "showFiles");
396 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
397
398 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
399 $files = new ilAdvancedMDRecordExportFiles($this->obj_id);
400 $file_data = $files->readFilesInfo();
401
402
403 // add items to delete
404 foreach ($_POST["file_id"] as $file_id) {
405 $info = $file_data[$file_id];
406 $c_gui->addItem("file_id[]", $file_id, is_array($info['name']) ? implode(',', $info['name']) : 'No Records');
407 }
408 $this->tpl->setContent($c_gui->getHTML());
409 }
410
418 public function deleteFiles()
419 {
420 if (!isset($_POST['file_id'])) {
421 ilUtil::sendFailure($this->lng->txt('select_one'));
422 $this->editFiles();
423 return false;
424 }
425
426 if (!$GLOBALS['DIC']->access()->checkAccess('write', '', $this->ref_id)) {
427 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
428 $GLOBALS['DIC']->ctrl()->redirect($this, 'showFiles');
429 }
430
431 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
432 $files = new ilAdvancedMDRecordExportFiles($this->obj_id);
433
434 foreach ($_POST['file_id'] as $file_id) {
435 $files->deleteByFileId((int) $file_id);
436 }
437 ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_files'));
438 $this->showFiles();
439 }
440
447 public function confirmDeleteRecords()
448 {
449 if (!isset($_POST['record_id'])) {
450 ilUtil::sendFailure($this->lng->txt('select_one'));
451 $this->showRecords();
452 return false;
453 }
454
455 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
456 $c_gui = new ilConfirmationGUI();
457
458 // set confirm/cancel commands
459 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRecords"));
460 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_record_sure"));
461 $c_gui->setCancel($this->lng->txt("cancel"), "showRecords");
462 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRecords");
463
464 // add items to delete
465 foreach ($_POST["record_id"] as $record_id) {
466 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
467 $c_gui->addItem("record_id[]", $record_id, $record->getTitle() ? $record->getTitle() : 'No Title');
468 }
469 $this->tpl->setContent($c_gui->getHTML());
470 }
471
478 public function deleteRecords()
479 {
480 if (!isset($_POST['record_id'])) {
481 ilUtil::sendFailure($this->lng->txt('select_one'));
482 $this->showRecords();
483 return false;
484 }
485
486 // all records have to be deletable
487 $fail = array();
488 foreach ($_POST['record_id'] as $record_id) {
489 // must not delete global records in local context
490 if ($this->obj_id) {
491 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
492 if (!$record->getParentObject()) {
493 $fail[] = $record->getTitle();
494 }
495 }
496
497 if (!$this->getPermissions()->hasPermission(
499 $record_id,
501 )) {
502 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
503 $fail[] = $record->getTitle();
504 }
505 }
506 if ($fail) {
507 ilUtil::sendFailure($this->lng->txt('msg_no_perm_delete') . " " . implode(", ", $fail), true);
508 $this->ctrl->redirect($this, "showRecords");
509 }
510
511 foreach ($_POST['record_id'] as $record_id) {
512 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
513 $record->delete();
514 }
515 ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_records'), true);
516 $this->ctrl->redirect($this, "showRecords");
517 }
518
526 public function updateRecords()
527 {
528 $selected_global = array();
529 foreach ($this->getParsedRecordObjects() as $item) {
530 $perm = $this->getPermissions()->hasPermissions(
532 $item['id'],
533 array(
537 )
538 );
539
540 if (!$this->obj_type) {
541 $record_obj = ilAdvancedMDRecord::_getInstanceByRecordId($item['id']);
542
544 $obj_types = array();
545 if (is_array($_POST['obj_types'][$record_obj->getRecordId()])) {
546 foreach ($_POST['obj_types'][$record_obj->getRecordId()] as $type => $status) {
547 if ($status) {
548 $type = explode(":", $type);
549 $obj_types[] = array(
550 "obj_type" => ilUtil::stripSlashes($type[0]),
551 "sub_type" => ilUtil::stripSlashes($type[1]),
552 "optional" => ((int) $status == 2)
553 );
554 }
555 }
556 }
557 $record_obj->setAssignedObjectTypes($obj_types);
558 }
559
561 $record_obj->setActive(isset($_POST['active'][$record_obj->getRecordId()]));
562 }
563
564 $record_obj->update();
566 // global, optional record
567 if ($item['readonly'] &&
568 $item['optional'] &&
569 $_POST['active'][$item['id']]) {
570 $selected_global[] = $item['id'];
571 } elseif ($item['local']) {
572 $record_obj = ilAdvancedMDRecord::_getInstanceByRecordId($item['id']);
573 $record_obj->setActive(isset($_POST['active'][$item['id']]));
574 $record_obj->update();
575 }
576 }
577 }
578
579 if ($this->obj_type) {
580 ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $selected_global);
581 }
582
583 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
584 $this->ctrl->redirect($this, "showRecords");
585 }
586
593 public function confirmDeleteFields()
594 {
595 if (!isset($_POST['field_id'])) {
596 ilUtil::sendFailure($this->lng->txt('select_one'));
597 $this->editFields();
598 return false;
599 }
600
601 $this->ctrl->saveParameter($this, 'record_id');
602
603 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
604 $c_gui = new ilConfirmationGUI();
605
606 // set confirm/cancel commands
607 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFields"));
608 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_fields_sure"));
609 $c_gui->setCancel($this->lng->txt("cancel"), "editFields");
610 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFields");
611
612 // add items to delete
613 foreach ($_POST["field_id"] as $field_id) {
615 $c_gui->addItem("field_id[]", $field_id, $field->getTitle() ? $field->getTitle() : 'No Title');
616 }
617 $this->tpl->setContent($c_gui->getHTML());
618 }
619
627 public function deleteFields()
628 {
629 $this->ctrl->saveParameter($this, 'record_id');
630
631 if (!isset($_POST['field_id'])) {
632 ilUtil::sendFailure($this->lng->txt('select_one'));
633 $this->editFields();
634 return false;
635 }
636
637 // all fields have to be deletable
638 $fail = array();
639 foreach ($_POST['field_id'] as $field_id) {
640 if (!$this->getPermissions()->hasPermission(
642 $field_id,
644 )) {
646 $fail[] = $field->getTitle();
647 }
648 }
649 if ($fail) {
650 ilUtil::sendFailure($this->lng->txt('msg_no_perm_delete') . " " . implode(", ", $fail), true);
651 $this->ctrl->redirect($this, "editFields");
652 }
653
654 foreach ($_POST["field_id"] as $field_id) {
656 $field->delete();
657 }
658 ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_fields'), true);
659 $this->ctrl->redirect($this, "editFields");
660 }
661
669 public function editRecord()
670 {
671 $this->ctrl->saveParameter($this, 'record_id');
672 $this->initRecordObject();
673 $this->initForm('edit');
674 $this->tpl->setContent($this->form->getHTML());
675 }
676
677 public function editFields()
678 {
679 global $ilToolbar;
680
681 $this->ctrl->saveParameter($this, 'record_id');
682 $this->initRecordObject();
683
684 $perm = $this->getPermissions()->hasPermissions(
686 $this->record->getRecordId(),
687 array(
690 )
691 );
692
693 $filter_warn = array();
695 // type selection
696 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
697 $types = new ilSelectInputGUI("", "ftype");
698 $options = array();
701 $options[$type] = $this->lng->txt($field->getTypeTitle());
702
703 if (!$field->isFilterSupported()) {
704 $filter_warn[] = $this->lng->txt($field->getTypeTitle());
705 }
706 }
707 $types->setOptions($options);
708 $ilToolbar->addInputItem($types);
709
710 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "createField"));
711
712 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
713 $button = ilSubmitButton::getInstance();
714 $button->setCaption("add");
715 $button->setCommand("createField");
716 $ilToolbar->addButtonInstance($button);
717 }
718
719 // #17092
720 if (sizeof($filter_warn)) {
721 ilUtil::sendInfo(sprintf($this->lng->txt("md_adv_field_filter_warning"), implode(", ", $filter_warn)));
722 }
723
724 // show field table
725 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
726 $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->record->getRecordId());
727
728 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php");
730 $table_gui->setTitle($this->lng->txt("md_adv_field_table"));
731 $table_gui->parseDefinitions($fields);
732 if (sizeof($fields)) {
733 $table_gui->addCommandButton("updateFields", $this->lng->txt("save"));
734 }
735 $table_gui->addCommandButton("showRecords", $this->lng->txt('cancel'));
736 $table_gui->addMultiCommand("confirmDeleteFields", $this->lng->txt("delete"));
737 $table_gui->setSelectAllCheckbox("field_id");
738
739 $this->tpl->setContent($table_gui->getHTML());
740 }
741
748 public function updateFields()
749 {
750 $this->ctrl->saveParameter($this, 'record_id');
751
752 if (!isset($_GET['record_id']) or !$_GET['record_id']) {
753 ilUtil::sendFailure($this->lng->txt('select_one'));
754 $this->editFields();
755 return false;
756 }
757
758 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
760
761 if ($this->getPermissions()->hasPermission(
763 $_GET['record_id'],
765 )) {
766 if (!isset($_POST['position']) or !is_array($_POST['position'])) {
767 $this->editFields();
768 return false;
769 }
770 // sort by position
771 asort($_POST['position'], SORT_NUMERIC);
772 $positions = array_flip(array_keys($_POST['position']));
773 foreach ($fields as $field) {
774 $field->setPosition($positions[$field->getFieldId()]);
775 $field->update();
776 }
777 }
778
779 foreach ($fields as $field) {
780 if ($this->getPermissions()->hasPermission(
782 $field->getFieldId(),
785 )) {
786 $field->setSearchable(isset($_POST['searchable'][$field->getFieldId()]) ? true : false);
787 $field->update();
788 }
789 }
790
791
792 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
793 $this->ctrl->redirect($this, "editFields");
794 }
795
803 public function updateRecord()
804 {
805 if (!isset($_GET['record_id']) or !$_GET['record_id']) {
806 ilUtil::sendFailure($this->lng->txt('select_one'));
807 $this->showRecords();
808 return false;
809 }
810 $this->initRecordObject();
811 $this->loadRecordFormData();
812
813 $this->logger->dump($_POST);
814
815 if (!$this->record->validate()) {
816 ilUtil::sendFailure($this->lng->txt('fill_out_all_required_fields'));
817 $this->editRecord();
818 return false;
819 }
820 $this->record->update();
821 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
822 $this->showRecords();
823 return true;
824 }
825
826
834 public function createRecord()
835 {
836 $this->initRecordObject();
837 $this->initForm('create');
838 $this->tpl->setContent($this->form->getHTML());
839 return true;
840 }
841
842 public function importRecords()
843 {
844 // Import Table
845 $this->initImportForm();
846 $this->tpl->setContent($this->import_form->getHTML());
847 }
848
854 protected function initImportForm()
855 {
856 if (is_object($this->import_form)) {
857 return true;
858 }
859
860 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
861 $this->import_form = new ilPropertyFormGUI();
862 $this->import_form->setMultipart(true);
863 $this->import_form->setFormAction($this->ctrl->getFormAction($this));
864
865 // add file property
866 $file = new ilFileInputGUI($this->lng->txt('file'), 'file');
867 $file->setSuffixes(array('xml'));
868 $file->setRequired(true);
869 $this->import_form->addItem($file);
870
871 $this->import_form->setTitle($this->lng->txt('md_adv_import_record'));
872 $this->import_form->addCommandButton('importRecord', $this->lng->txt('import'));
873 $this->import_form->addCommandButton('showRecords', $this->lng->txt('cancel'));
874 }
875
883 public function importRecord()
884 {
885 $this->initImportForm();
886 if (!$this->import_form->checkInput()) {
887 $this->import_form->setValuesByPost();
888 $this->createRecord();
889 return false;
890 }
891
892 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordImportFiles.php');
893 $import_files = new ilAdvancedMDRecordImportFiles();
894 if (!$create_time = $import_files->moveUploadedFile($_FILES['file']['tmp_name'])) {
895 $this->createRecord();
896 return false;
897 }
898
899 try {
900 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordParser.php');
901 $parser = new ilAdvancedMDRecordParser($import_files->getImportFileByCreationDate($create_time));
902
903 // local import?
904 if ($this->obj_id) {
905 $parser->setContext($this->obj_id, $this->obj_type, $this->sub_type);
906 }
907
908 // Validate
910 $parser->startParsing();
911
912 // Insert
914 $parser->startParsing();
915 ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'), true);
916 $this->ctrl->redirect($this, "showRecords");
917 } catch (ilSAXParserException $exc) {
918 ilUtil::sendFailure($exc->getMessage(), true);
919 $this->ctrl->redirect($this, "importRecords");
920 }
921
922 // Finally delete import file
923 $import_files->deleteFileByCreationDate($create_time);
924 return true;
925 }
926
927
935 public function saveRecord()
936 {
937 $this->initRecordObject();
938 $this->loadRecordFormData();
939
940 if ($this->obj_type) {
941 $this->record->setAssignedObjectTypes(array(
942 array(
943 "obj_type"=>$this->obj_type,
944 "sub_type"=>$this->sub_type,
945 "optional"=>false
946 )));
947 }
948
949 if (!$this->record->validate()) {
950 ilUtil::sendFailure($this->lng->txt('fill_out_all_required_fields'));
951 $this->createRecord();
952 return false;
953 }
954 $this->record->save();
955
956 ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'));
957 $this->showRecords();
958 }
959
966 public function editField(ilPropertyFormGUI $a_form = null)
967 {
968 if (!$_REQUEST["record_id"] || !$_REQUEST["field_id"]) {
969 return $this->editFields();
970 }
971
972 $this->ctrl->saveParameter($this, 'record_id');
973 $this->ctrl->saveParameter($this, 'field_id');
974
975 if (!$a_form) {
976 $field_definition = ilAdvancedMDFieldDefinition::getInstance((int) $_REQUEST['field_id']);
977 $a_form = $this->initFieldForm($field_definition);
978 }
979 $this->tpl->setContent($a_form->getHTML());
980 }
981
988 public function updateField()
989 {
990 if (!$_REQUEST["record_id"] || !$_REQUEST["field_id"]) {
991 return $this->editFields();
992 }
993
994 $this->ctrl->saveParameter($this, 'record_id');
995 $this->ctrl->saveParameter($this, 'field_id');
996
997 $confirm = false;
998 $field_definition = ilAdvancedMDFieldDefinition::getInstance((int) $_REQUEST['field_id']);
999 $form = $this->initFieldForm($field_definition);
1000 if ($form->checkInput()) {
1001 $field_definition->importDefinitionFormPostValues($form, $this->getPermissions());
1002 if (!$field_definition->importDefinitionFormPostValuesNeedsConfirmation()) {
1003 $field_definition->update();
1004
1005 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1006 $this->ctrl->redirect($this, "editFields");
1007 } else {
1008 $confirm = true;
1009 }
1010 }
1011
1012 $form->setValuesByPost();
1013
1014 // fields needs confirmation of updated settings
1015 if ($confirm) {
1016 ilUtil::sendInfo($this->lng->txt("md_adv_confirm_definition"));
1017 $field_definition->prepareDefinitionFormConfirmation($form);
1018 }
1019
1020 $this->editField($form);
1021 }
1022
1029 public function createField(ilPropertyFormGUI $a_form = null)
1030 {
1031 if (!$_REQUEST["record_id"] || !$_REQUEST["ftype"]) {
1032 return $this->editFields();
1033 }
1034
1035 $this->ctrl->saveParameter($this, 'record_id');
1036 $this->ctrl->saveParameter($this, 'ftype');
1037
1038 if (!$a_form) {
1039 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1040 $field_definition = ilAdvancedMDFieldDefinition::getInstance(null, $_REQUEST["ftype"]);
1041 $field_definition->setRecordId($_REQUEST["record_id"]);
1042 $a_form = $this->initFieldForm($field_definition);
1043 }
1044 $this->tpl->setContent($a_form->getHTML());
1045 }
1046
1052 public function saveField()
1053 {
1054 if (!$_REQUEST["record_id"] || !$_REQUEST["ftype"]) {
1055 return $this->editFields();
1056 }
1057
1058 $this->ctrl->saveParameter($this, 'record_id');
1059 $this->ctrl->saveParameter($this, 'ftype');
1060
1061 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1062 $field_definition = ilAdvancedMDFieldDefinition::getInstance(null, $_REQUEST["ftype"]);
1063 $field_definition->setRecordId($_REQUEST["record_id"]);
1064 $form = $this->initFieldForm($field_definition);
1065
1066 if ($form->checkInput()) {
1067 $field_definition->importDefinitionFormPostValues($form, $this->getPermissions());
1068 $field_definition->save();
1069
1070 ilUtil::sendSuccess($this->lng->txt('save_settings'), true);
1071 $this->ctrl->redirect($this, "editFields");
1072 }
1073
1074 $form->setValuesByPost();
1075 $this->createField($form);
1076 }
1077
1083 protected function initFieldForm(ilAdvancedMDFieldDefinition $a_definition)
1084 {
1085 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1086
1087 $form = new ilPropertyFormGUI();
1088 $form->setFormAction($this->ctrl->getFormAction($this));
1089
1090 $type = new ilNonEditableValueGUI($this->lng->txt("type"));
1091 $type->setValue($this->lng->txt($a_definition->getTypeTitle()));
1092 $form->addItem($type);
1093
1094 $a_definition->addToFieldDefinitionForm($form, $this->getPermissions());
1095
1096 if (!$a_definition->getFieldId()) {
1097 $form->setTitle($this->lng->txt('md_adv_create_field'));
1098 $form->addCommandButton('saveField', $this->lng->txt('create'));
1099 } else {
1100 $form->setTitle($this->lng->txt('md_adv_edit_field'));
1101 $form->addCommandButton('updateField', $this->lng->txt('save'));
1102 }
1103
1104 $form->addCommandButton('editFields', $this->lng->txt('cancel'));
1105
1106 return $form;
1107 }
1108
1114 protected function initForm($a_mode)
1115 {
1116 if (is_object($this->form)) {
1117 return true;
1118 }
1119
1120 $perm = $this->getPermissions()->hasPermissions(
1122 $this->record->getRecordId(),
1123 array(
1131 )
1132 );
1133
1134 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1135
1136 $this->form = new ilPropertyFormGUI();
1137 $this->form->setFormAction($this->ctrl->getFormAction($this));
1138
1139
1140 // title
1141 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
1142 $title->setValue($this->record->getTitle());
1143 $title->setSize(20);
1144 $title->setMaxLength(70);
1145 $title->setRequired(true);
1146 $this->form->addItem($title);
1147
1149 $title->setDisabled(true);
1150 }
1151
1152 // desc
1153 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
1154 $desc->setValue($this->record->getDescription());
1155 $desc->setRows(3);
1156 $desc->setCols(50);
1157 $this->form->addItem($desc);
1158
1160 $desc->setDisabled(true);
1161 }
1162
1163 // active
1164 $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_active'), 'active');
1165 $check->setChecked($this->record->isActive());
1166 $check->setValue(1);
1167 $this->form->addItem($check);
1168
1170 $check->setDisabled(true);
1171 }
1172
1173 if (!$this->obj_type) {
1174 // scope
1175 $scope = new ilCheckboxInputGUI($this->lng->txt('md_adv_scope'), 'scope');
1176 $scope->setChecked($this->record->enabledScope());
1177 $scope->setValue(1);
1178 $this->form->addItem($scope);
1179
1180 $subitems = new ilRepositorySelector2InputGUI($this->lng->txt("objects"), "scope_containers", true);
1181 $subitems->setValue($this->record->getScopeRefIds());
1182 $exp = $subitems->getExplorerGUI();
1183
1184 $definition = $GLOBALS['objDefinition'];
1185 $white_list = [];
1186 foreach ($definition->getAllRepositoryTypes() as $type) {
1187 if ($definition->isContainer($type)) {
1188 $white_list[] = $type;
1189 }
1190 }
1191
1192
1193 $exp->setTypeWhiteList($white_list);
1194 $exp->setSkipRootNode(false);
1195 $exp->setRootId(ROOT_FOLDER_ID);
1196 $scope->addSubItem($subitems);
1197 }
1198
1199 if (!$this->obj_type) {
1201 $section->setTitle($this->lng->txt('md_obj_types'));
1202 $this->form->addItem($section);
1203
1204 // see ilAdvancedMDRecordTableGUI::fillRow()
1205 $options = array(
1206 0 => $this->lng->txt("meta_obj_type_inactive"),
1207 1 => $this->lng->txt("meta_obj_type_mandatory"),
1208 2 => $this->lng->txt("meta_obj_type_optional")
1209 );
1210
1211
1213 $t = $type["obj_type"] . ":" . $type["sub_type"];
1214 $this->lng->loadLanguageModule($type["obj_type"]);
1215
1216 $type_options = $options;
1217 switch ($type["obj_type"]) {
1218 case "orgu":
1219 // currently only optional records for org unit (types)
1220 unset($type_options[1]);
1221 break;
1222 case "prg":
1223 // currently only optional records for study programme (types)
1224 unset($type_options[1]);
1225 break;
1226 case "rcrs":
1227 // optional makes no sense for ecs-courses
1228 unset($type_options[2]);
1229 break;
1230 }
1231
1232 $value = 0;
1233 if ($a_mode == "edit") {
1234 foreach ($this->record->getAssignedObjectTypes() as $item) {
1235 if ($item["obj_type"] == $type["obj_type"] &&
1236 $item["sub_type"] == $type["sub_type"]) {
1237 $value = $item["optional"]
1238 ? 2
1239 : 1;
1240 }
1241 }
1242 }
1243
1244 $check = new ilSelectInputGUI($type["text"], 'obj_types[' . $t . ']');
1245 $check->setOptions($type_options);
1246 $check->setValue($value);
1247 $this->form->addItem($check);
1248
1250 $check->setDisabled(true);
1251 }
1252 }
1253 }
1254
1255 switch ($a_mode) {
1256 case 'create':
1257 $this->form->setTitle($this->lng->txt('md_adv_create_record'));
1258 $this->form->addCommandButton('saveRecord', $this->lng->txt('add'));
1259 $this->form->addCommandButton('showRecords', $this->lng->txt('cancel'));
1260
1261 return true;
1262
1263 case 'edit':
1264 $this->form->setTitle($this->lng->txt('md_adv_edit_record'));
1265 $this->form->addCommandButton('updateRecord', $this->lng->txt('save'));
1266 $this->form->addCommandButton('showRecords', $this->lng->txt('cancel'));
1267
1268 return true;
1269 }
1270 }
1271
1272 protected function getSubstitutionFieldPermissions($a_obj_type, $a_field_id)
1273 {
1274 if ($a_obj_type == "crs") {
1275 $perm = $this->getPermissions()->hasPermissions(
1277 $a_field_id,
1278 array(
1284 )
1285 );
1286 return array(
1290 );
1291 } elseif ($a_obj_type == "cat") {
1292 $perm = $this->getPermissions()->hasPermissions(
1294 $a_field_id,
1295 array(
1301 )
1302 );
1303 return array(
1307 );
1308 } elseif ($a_obj_type == "sess") {
1309 $perm = $this->getPermissions()->hasPermissions(
1311 $a_field_id,
1312 array(
1318 )
1319 );
1320 return array(
1324 );
1325 }
1326 }
1327
1333 protected function initFormSubstitutions()
1334 {
1335 global $ilAccess;
1336
1337 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1338
1339 if (!$visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType()) {
1340 return;
1341 }
1342
1343 $this->form = new ilPropertyFormGUI();
1344 $this->form->setFormAction($this->ctrl->getFormAction($this));
1345 #$this->form->setTableWidth('100%');
1346
1347 // substitution
1348 foreach ($visible_records as $obj_type => $records) {
1349 $perm = null;
1350 // :TODO: hardwird ?
1351 if (in_array($obj_type, ['crs','cat','sess'])) {
1352 $perm = $this->getPermissions()->hasPermissions(
1354 $obj_type,
1355 array(
1359 )
1360 );
1361 }
1362
1363 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
1365
1366 // Show section
1368 $section->setTitle($this->lng->txt('objs_' . $obj_type));
1369 $this->form->addItem($section);
1370
1371 $check = new ilCheckboxInputGUI($this->lng->txt('description'), 'enabled_desc_' . $obj_type);
1372 $check->setValue(1);
1373 $check->setOptionTitle($this->lng->txt('md_adv_desc_show'));
1374 $check->setChecked($sub->isDescriptionEnabled() ? true : false);
1375 $this->form->addItem($check);
1376
1378 $check->setDisabled(true);
1379 }
1380
1381 $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'), 'enabled_field_names_' . $obj_type);
1382 $check->setValue(1);
1383 $check->setOptionTitle($this->lng->txt('md_adv_fields_show'));
1384 $check->setChecked($sub->enabledFieldNames() ? true : false);
1385 $this->form->addItem($check);
1386
1388 $check->setDisabled(true);
1389 }
1390
1391 #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
1392 #$area->setUseRte(true);
1393 #$area->setRteTagSet('standard');
1394 #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
1395 #$area->setRows(5);
1396 #$area->setCols(80);
1397 #$this->form->addItem($area);
1398
1399 if ($perm) {
1401 }
1402
1404 $definitions = $sub->sortDefinitions($definitions);
1405
1406 $counter = 1;
1407 foreach ($definitions as $def) {
1408 $definition_id = $def->getFieldId();
1409
1410 $perm = $this->getSubstitutionFieldPermissions($obj_type, $definition_id);
1411
1413 $title = $def->getTitle() . ' (' . $title . ')';
1414
1415 $check = new ilCheckboxInputGUI($title, 'show[' . $obj_type . '][' . $definition_id . ']');
1416 $check->setValue(1);
1417 $check->setOptionTitle($this->lng->txt('md_adv_show'));
1418 $check->setChecked($sub->isSubstituted($definition_id));
1419
1420 if ($perm && !$perm["show"]) {
1421 $check->setDisabled(true);
1422 }
1423
1424 $pos = new ilNumberInputGUI($this->lng->txt('position'), 'position[' . $obj_type . '][' . $definition_id . ']');
1425 $pos->setSize(3);
1426 $pos->setMaxLength(4);
1427 $pos->allowDecimals(true);
1428 $pos->setValue(sprintf('%.1f', $counter++));
1429 $check->addSubItem($pos);
1430
1431 if ($perm && !$perm_pos) {
1432 $pos->setDisabled(true);
1433 }
1434
1435 $bold = new ilCheckboxInputGUI($this->lng->txt('bold'), 'bold[' . $obj_type . '][' . $definition_id . ']');
1436 $bold->setValue(1);
1437 $bold->setChecked($sub->isBold($definition_id));
1438 $check->addSubItem($bold);
1439
1440 if ($perm && !$perm["bold"]) {
1441 $bold->setDisabled(true);
1442 }
1443
1444 $bold = new ilCheckboxInputGUI($this->lng->txt('newline'), 'newline[' . $obj_type . '][' . $definition_id . ']');
1445 $bold->setValue(1);
1446 $bold->setChecked($sub->hasNewline($definition_id));
1447 $check->addSubItem($bold);
1448
1449 if ($perm && !$perm["newline"]) {
1450 $bold->setDisabled(true);
1451 }
1452
1453
1454 $this->form->addItem($check);
1455 }
1456
1457
1458 // placeholder
1459 /*
1460 $custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders'));
1461 $tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData');
1462 foreach($records as $record)
1463 {
1464 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition)
1465 {
1466 $tpl->setCurrentBlock('field');
1467 $tpl->setVariable('FIELD_NAME',$definition->getTitle());
1468 $tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'.
1469 '[/IF_F_'.$definition->getFieldId().']');
1470 $tpl->parseCurrentBlock();
1471 }
1472
1473 $tpl->setCurrentBlock('record');
1474 $tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for'));
1475 $tpl->setVariable('TITLE',$record->getTitle());
1476 $tpl->parseCurrentBlock();
1477 }
1478 $custom->setHTML($tpl->get());
1479 $this->form->addItem($custom);
1480 */
1481 }
1482 $this->form->setTitle($this->lng->txt('md_adv_substitution_table'));
1483
1484 if ($ilAccess->checkAccess('write', '', $_REQUEST["ref_id"])) {
1485 $this->form->addCommandButton('updateSubstitutions', $this->lng->txt('save'));
1486 }
1487
1488 return true;
1489 }
1490
1496 protected function loadRecordFormData()
1497 {
1498 $perm = $this->getPermissions()->hasPermissions(
1500 $this->record->getRecordId(),
1501 array(
1509 )
1510 );
1511
1513 $this->record->setActive(ilUtil::stripSlashes($_POST['active']));
1514 }
1516 $this->record->setTitle(ilUtil::stripSlashes($_POST['title']));
1517 }
1519 $this->record->setDescription(ilUtil::stripSlashes($_POST['desc']));
1520 }
1521
1522 if (!$this->obj_type) {
1524 $obj_types = array();
1525 if (is_array($_POST['obj_types'])) {
1526 foreach ($_POST['obj_types'] as $t => $value) {
1527 if ($value) {
1528 $t = explode(":", $t);
1529 $obj_types[] = array(
1530 "obj_type" => ilUtil::stripSlashes($t[0]),
1531 "sub_type" => ilUtil::stripSlashes($t[1]),
1532 "optional" => ($value > 1)
1533 );
1534 }
1535 }
1536 }
1537 $this->record->setAssignedObjectTypes($obj_types);
1538 }
1539 }
1540
1541 $scopes = [];
1542 foreach ((array) $_POST['scope_containers_sel'] as $ref_id) {
1543 $scope = new ilAdvancedMDRecordScope();
1544 $scope->setRefId($ref_id);
1545 $scopes[] = $scope;
1546 }
1547 $this->record->setScopes($_POST['scope'] ? $scopes : []);
1548 $this->record->enableScope($_POST['scope'] ? true : false);
1549 }
1550
1556 protected function initRecordObject()
1557 {
1558 if (!is_object($this->record)) {
1559 $record_id = isset($_GET['record_id'])
1560 ? $_GET['record_id']
1561 : 0;
1562 $this->record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
1563
1564 // bind to parent object (aka local adv md)
1565 if (!$record_id &&
1566 $this->obj_id) {
1567 $this->record->setParentObject($this->obj_id);
1568 }
1569 }
1570
1571 return $this->record;
1572 }
1573
1579 protected function setSubTabs()
1580 {
1581 $this->tabs_gui->clearSubTabs();
1582
1583 $this->tabs_gui->addSubTabTarget(
1584 "md_adv_record_list",
1585 $this->ctrl->getLinkTarget($this, "showRecords"),
1586 '',
1587 '',
1588 '',
1589 true
1590 );
1591
1592
1594 $this->tabs_gui->addSubTabTarget(
1595 "md_adv_presentation",
1596 $this->ctrl->getLinkTarget($this, "showPresentation")
1597 );
1598 }
1599
1600 $this->tabs_gui->addSubTabTarget(
1601 "md_adv_file_list",
1602 $this->ctrl->getLinkTarget($this, "showFiles"),
1603 "showFiles"
1604 );
1605 }
1606
1612 protected function getParsedRecordObjects()
1613 {
1614 $res = array();
1615
1616 if ($this->obj_type) {
1617 $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
1618 }
1619
1620 foreach (ilAdvancedMDRecord::_getRecords() as $record) {
1621 $parent_id = $record->getParentObject();
1622
1623 if (!$this->obj_type) {
1624 if ($parent_id) {
1625 continue;
1626 }
1627 } else {
1628 // does not match current object
1629 if ($parent_id && $parent_id != $this->obj_id) {
1630 continue;
1631 }
1632
1633 // inactive records only in administration
1634 if (!$parent_id && !$record->isActive()) {
1635 continue;
1636 }
1637 // scope needs to match in object context
1638 if (
1640 $this->ref_id,
1641 $record->getScopes()
1642 )
1643 ) {
1644 continue;
1645 }
1646 }
1647
1648 $tmp_arr = array();
1649 $tmp_arr['id'] = $record->getRecordId();
1650 $tmp_arr['active'] = $record->isActive();
1651 $tmp_arr['title'] = $record->getTitle();
1652 $tmp_arr['description'] = $record->getDescription();
1653 $tmp_arr['fields'] = array();
1654 $tmp_arr['obj_types'] = $record->getAssignedObjectTypes();
1655
1656 $tmp_arr['perm'] = $this->permissions->hasPermissions(
1658 $record->getRecordId(),
1659 array(
1665 )
1666 );
1667
1668 if ($this->obj_type) {
1669 $tmp_arr["readonly"] = !(bool) $parent_id;
1670 $tmp_arr["local"] = $parent_id;
1671
1672 // local records are never optional
1673 $assigned = $optional = false;
1674 foreach ($tmp_arr['obj_types'] as $idx => $item) {
1675 if ($item["obj_type"] == $this->obj_type &&
1676 $item["sub_type"] == $this->sub_type) {
1677 $assigned = true;
1678 $optional = $item["optional"];
1679 $tmp_arr['obj_types'][$idx]['context'] = true;
1680 break;
1681 }
1682 }
1683 if (!$assigned) {
1684 continue;
1685 }
1686 $tmp_arr['optional'] = $optional;
1687 if ($optional) {
1688 // in object context "active" means selected record
1689 $tmp_arr['active'] = in_array($record->getRecordId(), $selected);
1690 }
1691 }
1692
1693 $res[] = $tmp_arr;
1694 }
1695
1696 return $res;
1697 }
1698}
sprintf('%.4f', $callTime)
$parser
Definition: BPMN2Parser.php:23
$section
Definition: Utf8Test.php:83
$files
Definition: add-vimline.php:18
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
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.
SAX based XML parser for record import files.
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.
updateRecords()
Save records (assigned object typed)
editField(ilPropertyFormGUI $a_form=null)
Edit field.
initFieldForm(ilAdvancedMDFieldDefinition $a_definition)
init field form
initFormSubstitutions()
init form table 'substitutions'
__construct($a_ref_id=null, $a_obj_type=null, $a_sub_type=null)
Constructor.
deleteRecords()
Permanently delete records.
getParsedRecordObjects()
Get and cache record objects.
getSubstitutionFieldPermissions($a_obj_type, $a_field_id)
createField(ilPropertyFormGUI $a_form=null)
Show field type selection.
confirmDeleteFields()
show delete fields confirmation screen
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
This class represents a checkbox property in a property form.
static getInstance($a_user_id=null, $a_ref_id=null)
Factory.
Confirmation screen class.
This class represents a file property in a property form.
This class represents a section header in a property form.
static getInstance()
Factory.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
This class represents a selection list property in a property form.
static getInstance()
Factory.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static 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.
$counter
$def
Definition: croninfo.php:21
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
$type
if(isset($_POST['submit'])) $form
$old
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res
$records
Definition: simple_test.php:22