ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAdvancedMDFieldDefinition.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Refinery\Factory as RefineryFactory;
28
36{
40 /*public const TYPE_SELECT = Type::SELECT->value;
41 public const TYPE_TEXT = Type::TEXT->value;
42 public const TYPE_DATE = Type::DATE->value;
43 public const TYPE_DATETIME = Type::DATETIME->value;
44 public const TYPE_INTEGER = Type::INTEGER->value;
45 public const TYPE_FLOAT = Type::FLOAT->value;
46 public const TYPE_LOCATION = Type::LOCATION->value;
47 public const TYPE_SELECT_MULTI = Type::SELECT_MULTI->value;
48 public const TYPE_ADDRESS = Type::ADDRESS->value;
49 public const TYPE_EXTERNAL_LINK = Type::EXTERNAL_LINK->value;
50 public const TYPE_INTERNAL_LINK = Type::INTERNAL_LINK->value;*/
51
52 public const TYPE_SELECT = 1;
53 public const TYPE_TEXT = 2;
54 public const TYPE_DATE = 3;
55 public const TYPE_DATETIME = 4;
56 public const TYPE_INTEGER = 5;
57 public const TYPE_FLOAT = 6;
58 public const TYPE_LOCATION = 7;
59 public const TYPE_SELECT_MULTI = 8;
60 public const TYPE_ADDRESS = 99;
61 public const TYPE_EXTERNAL_LINK = 9;
62 public const TYPE_INTERNAL_LINK = 10;
63
65
66 protected ?ilADTDefinition $adt_def = null;
67 protected ?ilADT $adt = null;
68
69 protected string $language = '';
70
71 protected ilDBInterface $db;
72 private DBGateway $db_gateway;
73 protected ilLanguage $lng;
74 protected ilLogger $logger;
76 protected RefineryFactory $refinery;
77
78 public function __construct(GenericData $generic_data, string $language = '')
79 {
80 global $DIC;
81
82 $this->lng = $DIC->language();
83 $this->language = $DIC->language()->getLangKey();
84 $this->refinery = $DIC->refinery();
85 $this->http = $DIC->http();
86
87
88 if ($language) {
89 $this->language = $language;
90 }
92 $this->logger = $DIC->logger()->amet();
93 $this->db = $DIC->database();
94 $this->db_gateway = new DatabaseGatewayImplementation($this->db);
95
96 $this->generic_data = $generic_data;
97 if (!empty($generic_data->getFieldValues())) {
98 $this->importFieldDefinition($generic_data->getFieldValues());
99 }
100 }
101
102 public static function getInstance(
103 ?int $a_field_id,
104 ?int $a_type = null,
105 string $language = ''
107 global $DIC;
108
110
111 if (self::isValidType((int) $a_type)) {
116 Type::from($a_type),
117 0,
118 '',
119 '',
120 '',
121 0,
122 false,
123 false,
124 []
125 );
126 }
127
128 if ($a_field_id) {
129 $generic_data = $db_gateway->readByID($a_field_id);
130 }
131
132 if (isset($generic_data)) {
134 }
135 throw new ilException("unknown type " . $a_type);
136 }
137
138 protected static function getInstanceWithData(
139 GenericData $generic_data,
140 string $language = ''
142 $class = "ilAdvancedMDFieldDefinition" . $generic_data->type()->stringValue();
143 return new $class($generic_data, $language);
144 }
145
146 public static function exists(int $a_field_id): bool
147 {
148 global $DIC;
149
150 $db = $DIC['ilDB'];
151 $set = $db->query("SELECT field_type" .
152 " FROM adv_mdf_definition" .
153 " WHERE field_id = " . $db->quote($a_field_id, "integer"));
154 if ($db->fetchAssoc($set)) {
155 return true;
156 }
157 return false;
158 }
159
163 public static function getInstanceByTypeString(string $a_type): ?ilAdvancedMDFieldDefinition
164 {
165 // see self::getTypeString()
166 $map = array(
167 self::TYPE_TEXT => "Text",
168 self::TYPE_SELECT => "Select",
169 self::TYPE_DATE => "Date",
170 self::TYPE_DATETIME => "DateTime",
171 self::TYPE_FLOAT => "Float",
172 self::TYPE_LOCATION => "Location",
173 self::TYPE_INTEGER => "Integer",
174 self::TYPE_SELECT_MULTI => "SelectMulti",
175 self::TYPE_EXTERNAL_LINK => 'ExternalLink',
176 self::TYPE_INTERNAL_LINK => 'InternalLink',
177 self::TYPE_ADDRESS => "Address"
178 );
179 $map = array_flip($map);
180 if (array_key_exists($a_type, $map)) {
181 return self::getInstance(null, $map[$a_type]);
182 }
183 return null;
184 }
185
193 public static function getInstancesByRecordId(
194 $a_record_id,
195 $a_only_searchable = false,
196 string $language = ''
197 ): array {
198 global $DIC;
199
200 $db_gateway = new DatabaseGatewayImplementation($DIC->database());
201
202 $defs = [];
203 foreach ($db_gateway->readByRecords($a_only_searchable, $a_record_id) as $data) {
204 $defs[$data->id()] = self::getInstanceWithData($data);
205 }
206 return $defs;
207 }
208
214 public static function getInstancesByObjType($a_obj_type, $a_active_only = true): array
215 {
216 global $DIC;
217
218 $ilDB = $DIC->database();
219 $db_gateway = new DatabaseGatewayImplementation($ilDB);
220
221 $query = "SELECT amf.* FROM adv_md_record_objs aro" .
222 " JOIN adv_md_record amr ON aro.record_id = amr.record_id" .
223 " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id" .
224 " WHERE obj_type = " . $ilDB->quote($a_obj_type, 'text');
225 if ($a_active_only) {
226 $query .= " AND active = " . $ilDB->quote(1, "integer");
227 }
228 $query .= " ORDER BY aro.record_id,position";
229
230 $res = $ilDB->query($query);
231 $ids = [];
232 while ($row = $ilDB->fetchAssoc($res)) {
233 $ids[] = (int) $row["field_id"];
234 }
235 $data = $db_gateway->readByIDs(...$ids);
236
237 $defs = [];
238 foreach ($data as $datum) {
239 $defs[$datum->id()] = self::getInstanceWithData($datum);
240 }
241
242 return $defs;
243 }
244
245 public static function getInstanceByImportId(string $a_import_id): ?ilAdvancedMDFieldDefinition
246 {
247 global $DIC;
248
249 $db_gateway = new DatabaseGatewayImplementation($DIC->database());
250
251 if (is_null($data = $db_gateway->readByImportID($a_import_id))) {
252 return null;
253 }
254 return self::getInstanceWithData($data);
255 }
256
261 public static function getSearchableDefinitionIds()
262 {
263 global $DIC;
264
265 $ilDB = $DIC['ilDB'];
266
267 $field_ids = array();
268
269 $query = "SELECT field_id FROM adv_md_record amr" .
270 " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)" .
271 " WHERE active = " . $ilDB->quote(1, "integer") .
272 " AND searchable = " . $ilDB->quote(1, "integer");
273 $set = $ilDB->query($query);
274 while ($row = $ilDB->fetchAssoc($set)) {
275 $field_ids[] = (int) $row["field_id"];
276 }
277 return $field_ids;
278 }
279
286 public static function getADTGroupForDefinitions(array $a_defs): ilADT
287 {
288 $factory = ilADTFactory::getInstance();
289 $group_def = $factory->getDefinitionInstanceByType("Group");
290 foreach ($a_defs as $def) {
291 $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
292 }
293 $group = $factory->getInstanceByDefinition($group_def);
294
295 // bind adt instances to definition
296 foreach ($group->getElements() as $element_id => $element) {
297 $a_defs[$element_id]->setADT($element);
298 }
299 return $group;
300 }
301
306 public static function getValidTypes(): array
307 {
308 $types = Type::cases();
309 $values = [];
310 foreach ($types as $type) {
311 $values[] = $type->value;
312 }
313 return $values;
314 }
315
316 public static function isValidType(int $a_type): bool
317 {
318 return !is_null(Type::tryFrom($a_type));
319 }
320
324 abstract public function getType(): int;
325
329 protected static function getTypeString(int $a_type): string
330 {
331 return (string) (Type::tryFrom($a_type)?->stringValue());
332 }
333
337 public function useDefaultLanguageMode(string $language): bool
338 {
339 if (!strlen($language)) {
340 return true;
341 }
342 $record = ilAdvancedMDRecord::_getInstanceByRecordId($this->getRecordID());
343 return strcmp($record->getDefaultLanguage(), $language) === 0;
344 }
345
349 public function getTypeTitle(): string
350 {
351 return "udf_type_" . strtolower(self::getTypeString($this->getType()));
352 }
353
357 abstract protected function initADTDefinition(): ilADTDefinition;
358
364 {
365 if (!$this->adt_def instanceof ilADTDefinition) {
366 $this->adt_def = $this->initADTDefinition();
367 }
368 return $this->adt_def;
369 }
370
371 public function getADT(): ilADT
372 {
373 if (!$this->adt instanceof ilADT) {
374 $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
375 }
376 return $this->adt;
377 }
378
383 protected function setADT(ilADT $a_adt): void
384 {
385 if (!$this->adt instanceof ilADT) {
386 $this->adt = $a_adt;
387 }
388 }
389
393 public function getFieldId(): ?int
394 {
395 return $this->generic_data->id();
396 }
397
401 public function setRecordId(int $a_id): void
402 {
403 $this->generic_data->setRecordID($a_id);
404 }
405
409 public function getRecordId(): int
410 {
411 return $this->generic_data->getRecordID();
412 }
413
417 public function setImportId(string $a_id_string): void
418 {
419 $this->generic_data->setImportID(trim($a_id_string));
420 }
421
425 public function getImportId(): string
426 {
427 return $this->generic_data->getImportID();
428 }
429
433 public function setPosition(int $a_pos): void
434 {
435 $this->generic_data->setPosition($a_pos);
436 }
437
441 public function getPosition(): int
442 {
443 return $this->generic_data->getPosition();
444 }
445
449 public function setTitle(string $a_title): void
450 {
451 $this->generic_data->setTitle(trim($a_title));
452 }
453
457 public function getTitle(): string
458 {
459 return $this->generic_data->getTitle();
460 }
461
465 public function setDescription(string $a_desc): void
466 {
467 $this->generic_data->setDescription(trim($a_desc));
468 }
469
473 public function getDescription(): string
474 {
475 return $this->generic_data->getDescription();
476 }
477
481 public function isSearchSupported(): bool
482 {
483 return true;
484 }
485
489 public function isFilterSupported(): bool
490 {
491 return true;
492 }
493
497 public function setSearchable(bool $a_status): void
498 {
499 // see above
500 if (!$this->isSearchSupported()) {
501 $a_status = false;
502 }
503 $this->generic_data->setSearchable($a_status);
504 }
505
509 public function isSearchable(): bool
510 {
511 return $this->generic_data->isSearchable();
512 }
513
517 public function setRequired(bool $a_status): void
518 {
519 $this->generic_data->setRequired($a_status);
520 }
521
525 public function isRequired(): bool
526 {
527 return $this->generic_data->isRequired();
528 }
529
533 protected function importFieldDefinition(array $a_def): void
534 {
535 }
536
540 protected function getFieldDefinition(): array
541 {
542 return [];
543 }
544
548 public function getFieldDefinitionForTableGUI(string $content_language): array
549 {
550 return [];
551 }
552
557 ilPropertyFormGUI $a_form,
558 bool $a_disabled = false,
559 string $language = ''
560 ): void {
561 }
562
566 public function addToFieldDefinitionForm(
567 ilPropertyFormGUI $a_form,
568 ilAdvancedMDPermissionHelper $a_permissions,
569 string $language = ''
570 ): void {
571 global $DIC;
572 $lng = $DIC['lng'];
573
574 $perm = $a_permissions->hasPermissions(
576 (string) $this->getFieldId(),
577 array(
580 )
581 ,
584 )
585 ,
588 )
589 ,
592 )
593 )
594 );
595
596 // title
597 $translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($this->getRecordId());
598
599 $title = new ilTextInputGUI($lng->txt('title'), 'title');
600 $title->setValue($this->getTitle());
601 $title->setSize(20);
602 $title->setMaxLength(70);
603 $title->setRequired(true);
604 if ($this->getFieldId()) {
605 $translations->modifyTranslationInfoForTitle($this->getFieldId(), $a_form, $title, $language);
606 } else {
607 $title->setValue($this->getTitle());
608 }
609
610 $a_form->addItem($title);
611
613 $title->setDisabled(true);
614 }
615
616 // desc
617 $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
618 $desc->setValue($this->getDescription());
619 $desc->setRows(3);
620 $desc->setCols(50);
621 if ($this->getFieldId()) {
622 $translations->modifyTranslationInfoForDescription($this->getFieldId(), $a_form, $desc, $language);
623 } else {
624 $desc->setValue($this->getDescription());
625 }
626
627 $a_form->addItem($desc);
628
630 $desc->setDisabled(true);
631 }
632
633 // searchable
634 $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
635 $check->setChecked($this->isSearchable());
636 $check->setValue("1");
637 $a_form->addItem($check);
638
640 !$this->isSearchSupported()) {
641 $check->setDisabled(true);
642 }
643
644 /* required
645 $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
646 $check->setChecked($this->isRequired());
647 $check->setValue(1);
648 $a_form->addItem($check);
649 */
650
651 $this->addCustomFieldToDefinitionForm(
652 $a_form,
654 $language
655 );
656 }
657
661 public function importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language = ''): void
662 {
663 // type-specific
664 }
665
670 ilPropertyFormGUI $a_form,
671 ilAdvancedMDPermissionHelper $a_permissions,
672 string $active_language
673 ): void {
674 $record = ilAdvancedMDRecord::_getInstanceByRecordId($this->getRecordID());
675 $is_translation = (($active_language !== '') && ($active_language != $record->getDefaultLanguage()));
676 if (!$a_form->getItemByPostVar("title")->getDisabled() && !$is_translation) {
677 $this->setTitle($a_form->getInput("title"));
678 }
679 if (!$a_form->getItemByPostVar("description")->getDisabled() && !$is_translation) {
680 $this->setDescription($a_form->getInput("description"));
681 }
682 if (!$a_form->getItemByPostVar("searchable")->getDisabled()) {
683 $this->setSearchable((bool) $a_form->getInput("searchable"));
684 }
685
686 if ($a_permissions->hasPermission(
688 (string) $this->getFieldId(),
691 )) {
692 $this->importCustomDefinitionFormPostValues($a_form, $active_language);
693 }
694 }
695
697 {
698 return false;
699 }
700
702 {
703 }
704
706 {
707 $a_form->getItemByPostVar("title")->setDisabled(true);
708 $a_form->getItemByPostVar("description")->setDisabled(true);
709 $a_form->getItemByPostVar("searchable")->setDisabled(true);
710
711 // checkboxes have no hidden on disabled
712 if ($a_form->getInput("searchable")) {
713 $hidden = new ilHiddenInputGUI("searchable");
714 $hidden->setValue("1");
715 $a_form->addItem($hidden);
716 }
717
718 $this->prepareCustomDefinitionFormConfirmation($a_form);
719 }
720
724 public function generateImportId(int $a_field_id): string
725 {
726 return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
727 }
728
732 public function save(bool $keep_pos_and_import_id = false, bool $keep_import_id = false): void
733 {
734 if ($this->getFieldId()) {
735 $this->update();
736 return;
737 }
738
739 /*
740 * This has to be set before update and creation here, the alternative
741 * would be to set this in all children of this class, everywhere
742 * where type-specific settings are set.
743 */
744 $this->generic_data->setFieldValues($this->getFieldDefinition());
745
746 if ($keep_pos_and_import_id) {
747 $field_id = $this->db_gateway->create($this->generic_data);
748 } elseif ($keep_import_id) {
749 $field_id = $this->db_gateway->createWithNewPosition($this->generic_data);
750 } else {
751 $field_id = $this->db_gateway->createFromScratch($this->generic_data);
752 }
753
754 $this->generic_data = $this->db_gateway->readByID($field_id);
755 }
756
760 public function update(): void
761 {
762 if (!$this->getFieldId()) {
763 $this->save();
764 return;
765 }
766
767 /*
768 * This has to be set before update and creation here, the alternative
769 * would be to set this in all children of this class, everywhere
770 * where type-specific settings are set.
771 */
772 $this->generic_data->setFieldValues($this->getFieldDefinition());
773
774 $this->db_gateway->update($this->generic_data);
775 }
776
780 public function delete(): void
781 {
782 if (!$this->getFieldId()) {
783 return;
784 }
785
786 // delete all values
787 ilAdvancedMDValues::_deleteByFieldId($this->getFieldId(), $this->getADT());
788
789 $this->db_gateway->delete($this->getFieldId());
790 }
791
797 public function toXML(ilXmlWriter $a_writer): void
798 {
799 $a_writer->xmlStartTag('Field', array(
800 'id' => $this->getImportId(),
801 'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
802 'fieldType' => self::getTypeString($this->getType())
803 ));
804
805 $a_writer->xmlElement('FieldTitle', null, $this->getTitle());
806 $a_writer->xmlElement('FieldDescription', null, $this->getDescription());
807
808 $translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($this->getRecordId());
809 $a_writer->xmlStartTag('FieldTranslations');
810 foreach ($translations->getTranslations($this->getFieldId()) as $translation) {
811 $a_writer->xmlStartTag('FieldTranslation', ['language' => $translation->getLangKey()]);
812 $a_writer->xmlElement(
813 'FieldTranslationTitle',
814 [],
815 $translation->getTitle()
816 );
817 $a_writer->xmlElement(
818 'FieldTranslationDescription',
819 [],
820 $translation->getDescription()
821 );
822 $a_writer->xmlEndTag('FieldTranslation');
823 }
824 $a_writer->xmlEndTag('FieldTranslations');
825 $a_writer->xmlElement('FieldPosition', null, $this->getPosition());
826
827 $this->addPropertiesToXML($a_writer);
828
829 $a_writer->xmlEndTag('Field');
830 }
831
835 protected function addPropertiesToXML(ilXmlWriter $a_writer): void
836 {
837 // type-specific properties
838 }
839
843 public function importXMLProperty(string $a_key, string $a_value): void
844 {
845 }
846
850 abstract public function getValueForXML(ilADT $element): string;
851
856 abstract public function importValueFromXML(string $a_cdata): void;
857
861 public function importFromECS(string $a_ecs_type, $a_value, string $a_sub_id): bool
862 {
863 return false;
864 }
865
869 public function prepareElementForEditor(ilADTFormBridge $a_bridge): void
870 {
871 // type-specific
872 }
873
880 public function getSearchQueryParserValue(ilADTSearchBridge $a_adt_search): string
881 {
882 return '';
883 }
884
885 public function getSearchValueSerialized(ilADTSearchBridge $a_adt_search): string
886 {
887 return $a_adt_search->getSerializedValue();
888 }
889
893 public function setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value): void
894 {
895 $a_adt_search->setSerializedValue($a_value);
896 }
897
901 protected function parseSearchObjects(array $a_records, array $a_object_types): array
902 {
903 $res = [];
904 $obj_ids = [];
905 foreach ($a_records as $record) {
906 if ($record["sub_type"] == "-") {
907 $obj_ids[] = $record["obj_id"];
908 }
909 }
910
911 $sql = "SELECT obj_id,type" .
912 " FROM object_data" .
913 " WHERE " . $this->db->in("obj_id", $obj_ids, false, "integer") .
914 " AND " . $this->db->in("type", $a_object_types, false, "text");
915 $set = $this->db->query($sql);
916 while ($row = $this->db->fetchAssoc($set)) {
917 $res[] = $row;
918 }
919 return $res;
920 }
921
922 public function searchSubObjects(ilADTSearchBridge $a_adt_search, int $a_obj_id, string $sub_obj_type): array
923 {
925
926 // :TODO:
927 if ($a_adt_search instanceof ilADTLocationSearchBridgeSingle) {
928 $element_id = "loc";
929 }
930
931 $condition = $a_adt_search->getSQLCondition($element_id);
932 if ($condition) {
934 "adv_md_values",
935 $this->getADT()->getType(),
936 $this->getFieldId(),
937 $condition
938 );
939 if (sizeof($objects)) {
940 $res = array();
941 foreach ($objects as $item) {
942 if ($item["obj_id"] == $a_obj_id &&
943 $item["sub_type"] == $sub_obj_type) {
944 $res[] = $item["sub_id"];
945 }
946 }
947 return $res;
948 }
949 }
950
951 return array();
952 }
953
957 public function searchObjects(
958 ilADTSearchBridge $a_adt_search,
959 ilQueryParser $a_parser,
960 array $a_object_types,
961 string $a_locate,
962 string $a_search_type
963 ): array {
964 // search type only supported/needed for text
965 $condition = $a_adt_search->getSQLCondition(ilADTActiveRecordByType::SINGLE_COLUMN_NAME);
966 if ($condition) {
968 "adv_md_values",
969 $this->getADT()->getType(),
970 $this->getFieldId(),
971 $condition,
972 $a_locate
973 );
974 if (sizeof($objects)) {
975 return $this->parseSearchObjects($objects, $a_object_types);
976 }
977 }
978 return [];
979 }
980
987 public function getLuceneSearchString($a_value)
988 {
989 return $a_value;
990 }
991
995 public function prepareElementForSearch(ilADTSearchBridge $a_bridge): void
996 {
997 }
998
1002 public function _clone(int $a_new_record_id): self
1003 {
1004 $empty_generic_data = new GenericDataImplementation(
1005 $this->generic_data->type(),
1006 0,
1007 '',
1008 '',
1009 '',
1010 0,
1011 false,
1012 false,
1013 []
1014 );
1015
1016 $class = get_class($this);
1017 $obj = new $class($empty_generic_data);
1018 $obj->setRecordId($a_new_record_id);
1019 $obj->setTitle($this->getTitle());
1020 $obj->setDescription($this->getDescription());
1021 $obj->setRequired($this->isRequired());
1022 $obj->setPosition($this->getPosition());
1023 $obj->setSearchable($this->isSearchable());
1024 $obj->importFieldDefinition($this->getFieldDefinition());
1025 $obj->save(true);
1026
1027 return $obj;
1028 }
1029 //
1030 // complex options
1031 //
1032
1033 public function hasComplexOptions(): bool
1034 {
1035 return false;
1036 }
1037
1043 public function getComplexOptionsOverview(object $a_parent_gui, string $parent_cmd): ?string
1044 {
1045 return null;
1046 }
1047}
$check
Definition: buildRTE.php:81
Builds data types.
Definition: Factory.php:36
ADT Active Record by type helper class This class expects a valid primary for all actions!
static find(string $a_table, string $a_type, int $a_field_id, string $a_condition, ?string $a_additional_fields=null)
Find entries.
ADT definition base class.
ADT form bridge base class.
ADT search bridge base class.
setSerializedValue(string $a_value)
Set current value(s) in serialized form (for easy persisting)
getSerializedValue()
Get current value(s) in serialized form (for easy persisting)
getSQLCondition(string $a_element_id, int $mode=self::SQL_LIKE, array $quotedWords=[])
Get SQL condition for current value(s)
ADT base class.
Definition: class.ilADT.php:26
__construct(GenericData $generic_data, string $language='')
getLuceneSearchString($a_value)
Get search string in lucene syntax.
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
Add custom input elements to definition form.
importValueFromXML(string $a_cdata)
Import value from xml.
addPropertiesToXML(ilXmlWriter $a_writer)
Add (type-specific) properties to xml export.
static getInstanceByImportId(string $a_import_id)
importFieldDefinition(array $a_def)
Import (type-specific) field definition from DB.
getSearchValueSerialized(ilADTSearchBridge $a_adt_search)
setDescription(string $a_desc)
Set description.
useDefaultLanguageMode(string $language)
Check if default language mode has to be used: no language given or language equals default language.
static getInstanceByTypeString(string $a_type)
Get instance by type string (used by import)
importFromECS(string $a_ecs_type, $a_value, string $a_sub_id)
Import meta data from ECS.
getComplexOptionsOverview(object $a_parent_gui, string $parent_cmd)
setImportId(string $a_id_string)
Set import id.
static getADTGroupForDefinitions(array $a_defs)
Init ADTGroup for definitions.
_clone(int $a_new_record_id)
Clone field definition.
initADTDefinition()
Init adt instance.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
isSearchSupported()
Is search supported at all.
parseSearchObjects(array $a_records, array $a_object_types)
Add object-data needed for global search to AMD search results.
getSearchQueryParserValue(ilADTSearchBridge $a_adt_search)
Get value for search query parser.
getFieldDefinitionForTableGUI(string $content_language)
Parse properties for table gui.
const TYPE_SELECT
TODO: put this in when minimum php version is set to 8.2.
getADTDefinition()
Get ADT definition instance.
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language='')
Import custom post values from definition form.
getFieldDefinition()
Get (type-specific) field definition.
static getInstanceWithData(GenericData $generic_data, string $language='')
save(bool $keep_pos_and_import_id=false, bool $keep_import_id=false)
Create new field entry.
searchSubObjects(ilADTSearchBridge $a_adt_search, int $a_obj_id, string $sub_obj_type)
static getTypeString(int $a_type)
Get type as string.
setSearchable(bool $a_status)
Toggle searchable.
setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value)
Set value from search persistence.
importXMLProperty(string $a_key, string $a_value)
Import property from XML.
prepareElementForSearch(ilADTSearchBridge $a_bridge)
Prepare search form elements.
static getSearchableDefinitionIds()
Get searchable definition ids (performance is key)
generateImportId(int $a_field_id)
Generate unique record id.
searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, string $a_locate, string $a_search_type)
Search objects.
isFilterSupported()
Is search by filter supported.
prepareElementForEditor(ilADTFormBridge $a_bridge)
Prepare editor form elements.
importDefinitionFormPostValues(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $active_language)
Import post values from definition form.
prepareDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
prepareCustomDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
static getInstance(?int $a_field_id, ?int $a_type=null, string $language='')
setRequired(bool $a_status)
Toggle required.
getValueForXML(ilADT $element)
Parse ADT value for xml (export)
Advanced metadata permission helper.
static _getInstanceByRecordId(int $a_record_id)
static _deleteByFieldId(int $a_field_id, ilADT $a_adt)
Delete values by field_id.
This class represents a checkbox property in a property form.
hasPermission(int $a_context_type, string $a_context_id, int $a_action_id, ?int $a_action_sub_id=null)
Check permission.
Base class for ILIAS Exception handling.
This class represents a hidden form property in a property form.
language handling
Component logger with individual log levels by component id.
This class represents a property form user interface.
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-...
getItemByPostVar(string $a_post_var)
This class represents a text area property in a property form.
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
const IL_INST_ID
Definition: constants.php:40
Interface GlobalHttpState.
Interface ilDBInterface.
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
$res
Definition: ltiservices.php:69
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26