ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
class.ilAdvancedMDFieldDefinition.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Refinery\Factory as RefineryFactory;
28use ILIAS\UI\Factory as UIFactory;
29use ILIAS\UI\Renderer as UIRenderer;
31use ILIAS\UI\Component\Table\Data as DataTable;
32
40{
44 /*public const TYPE_SELECT = Type::SELECT->value;
45 public const TYPE_TEXT = Type::TEXT->value;
46 public const TYPE_DATE = Type::DATE->value;
47 public const TYPE_DATETIME = Type::DATETIME->value;
48 public const TYPE_INTEGER = Type::INTEGER->value;
49 public const TYPE_FLOAT = Type::FLOAT->value;
50 public const TYPE_LOCATION = Type::LOCATION->value;
51 public const TYPE_SELECT_MULTI = Type::SELECT_MULTI->value;
52 public const TYPE_ADDRESS = Type::ADDRESS->value;
53 public const TYPE_EXTERNAL_LINK = Type::EXTERNAL_LINK->value;
54 public const TYPE_INTERNAL_LINK = Type::INTERNAL_LINK->value;*/
55
56 public const TYPE_SELECT = 1;
57 public const TYPE_TEXT = 2;
58 public const TYPE_DATE = 3;
59 public const TYPE_DATETIME = 4;
60 public const TYPE_INTEGER = 5;
61 public const TYPE_FLOAT = 6;
62 public const TYPE_LOCATION = 7;
63 public const TYPE_SELECT_MULTI = 8;
64 public const TYPE_ADDRESS = 99;
65 public const TYPE_EXTERNAL_LINK = 9;
66 public const TYPE_INTERNAL_LINK = 10;
67
69
70 protected ?ilADTDefinition $adt_def = null;
71 protected ?ilADT $adt = null;
72
73 protected string $language = '';
74
75 protected ilDBInterface $db;
76 private DBGateway $db_gateway;
77 protected ilLanguage $lng;
78 protected ilLogger $logger;
80 protected RefineryFactory $refinery;
81 protected UIFactory $ui_factory;
82 protected UIRenderer $ui_renderer;
83 protected ilCtrl $ctrl;
84
85 public function __construct(GenericData $generic_data, string $language = '')
86 {
87 global $DIC;
88
89 $this->lng = $DIC->language();
90 $this->language = $DIC->language()->getLangKey();
91 $this->refinery = $DIC->refinery();
92 $this->http = $DIC->http();
93 $this->ui_factory = $DIC->ui()->factory();
94 $this->ui_renderer = $DIC->ui()->renderer();
95 $this->ctrl = $DIC->ctrl();
96
97
98 if ($language) {
99 $this->language = $language;
100 }
102 $this->logger = $DIC->logger()->amet();
103 $this->db = $DIC->database();
104 $this->db_gateway = new DatabaseGatewayImplementation($this->db);
105
106 $this->generic_data = $generic_data;
107 if (!empty($generic_data->getFieldValues())) {
108 $this->importFieldDefinition($generic_data->getFieldValues());
109 }
110 }
111
112 public static function getInstance(
113 ?int $a_field_id,
114 ?int $a_type = null,
115 string $language = ''
117 global $DIC;
118
120
121 if (self::isValidType((int) $a_type)) {
126 Type::from($a_type),
127 0,
128 '',
129 '',
130 '',
131 0,
132 false,
133 false,
134 []
135 );
136 }
137
138 if ($a_field_id) {
139 $generic_data = $db_gateway->readByID($a_field_id);
140 }
141
142 if (isset($generic_data)) {
144 }
145 throw new ilException("unknown type " . $a_type);
146 }
147
148 protected static function getInstanceWithData(
149 GenericData $generic_data,
150 string $language = ''
152 $class = "ilAdvancedMDFieldDefinition" . $generic_data->type()->stringValue();
153 return new $class($generic_data, $language);
154 }
155
156 public static function exists(int $a_field_id): bool
157 {
158 global $DIC;
159
160 $db = $DIC['ilDB'];
161 $set = $db->query("SELECT field_type" .
162 " FROM adv_mdf_definition" .
163 " WHERE field_id = " . $db->quote($a_field_id, "integer"));
164 if ($db->fetchAssoc($set)) {
165 return true;
166 }
167 return false;
168 }
169
173 public static function getInstanceByTypeString(string $a_type): ?ilAdvancedMDFieldDefinition
174 {
175 // see self::getTypeString()
176 $map = array(
177 self::TYPE_TEXT => "Text",
178 self::TYPE_SELECT => "Select",
179 self::TYPE_DATE => "Date",
180 self::TYPE_DATETIME => "DateTime",
181 self::TYPE_FLOAT => "Float",
182 self::TYPE_LOCATION => "Location",
183 self::TYPE_INTEGER => "Integer",
184 self::TYPE_SELECT_MULTI => "SelectMulti",
185 self::TYPE_EXTERNAL_LINK => 'ExternalLink',
186 self::TYPE_INTERNAL_LINK => 'InternalLink',
187 self::TYPE_ADDRESS => "Address"
188 );
189 $map = array_flip($map);
190 if (array_key_exists($a_type, $map)) {
191 return self::getInstance(null, $map[$a_type]);
192 }
193 return null;
194 }
195
203 public static function getInstancesByRecordId(
204 $a_record_id,
205 $a_only_searchable = false,
206 string $language = ''
207 ): array {
208 global $DIC;
209
210 $db_gateway = new DatabaseGatewayImplementation($DIC->database());
211
212 $defs = [];
213 foreach ($db_gateway->readByRecords($a_only_searchable, $a_record_id) as $data) {
214 $defs[$data->id()] = self::getInstanceWithData($data);
215 }
216 return $defs;
217 }
218
224 public static function getInstancesByObjType($a_obj_type, $a_active_only = true): array
225 {
226 global $DIC;
227
228 $ilDB = $DIC->database();
229 $db_gateway = new DatabaseGatewayImplementation($ilDB);
230
231 $query = "SELECT amf.* FROM adv_md_record_objs aro" .
232 " JOIN adv_md_record amr ON aro.record_id = amr.record_id" .
233 " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id" .
234 " WHERE obj_type = " . $ilDB->quote($a_obj_type, 'text');
235 if ($a_active_only) {
236 $query .= " AND active = " . $ilDB->quote(1, "integer");
237 }
238 $query .= " ORDER BY aro.record_id,position";
239
240 $res = $ilDB->query($query);
241 $ids = [];
242 while ($row = $ilDB->fetchAssoc($res)) {
243 $ids[] = (int) $row["field_id"];
244 }
245 $data = $db_gateway->readByIDs(...$ids);
246
247 $defs = [];
248 foreach ($data as $datum) {
249 $defs[$datum->id()] = self::getInstanceWithData($datum);
250 }
251
252 return $defs;
253 }
254
255 public static function getInstanceByImportId(string $a_import_id): ?ilAdvancedMDFieldDefinition
256 {
257 global $DIC;
258
259 $db_gateway = new DatabaseGatewayImplementation($DIC->database());
260
261 if (is_null($data = $db_gateway->readByImportID($a_import_id))) {
262 return null;
263 }
264 return self::getInstanceWithData($data);
265 }
266
271 public static function getSearchableDefinitionIds()
272 {
273 global $DIC;
274
275 $ilDB = $DIC['ilDB'];
276
277 $field_ids = array();
278
279 $query = "SELECT field_id FROM adv_md_record amr" .
280 " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)" .
281 " WHERE active = " . $ilDB->quote(1, "integer") .
282 " AND searchable = " . $ilDB->quote(1, "integer");
283 $set = $ilDB->query($query);
284 while ($row = $ilDB->fetchAssoc($set)) {
285 $field_ids[] = (int) $row["field_id"];
286 }
287 return $field_ids;
288 }
289
296 public static function getADTGroupForDefinitions(array $a_defs): ilADT
297 {
298 $factory = ilADTFactory::getInstance();
299 $group_def = $factory->getDefinitionInstanceByType("Group");
300 foreach ($a_defs as $def) {
301 $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
302 }
303 $group = $factory->getInstanceByDefinition($group_def);
304
305 // bind adt instances to definition
306 foreach ($group->getElements() as $element_id => $element) {
307 $a_defs[$element_id]->setADT($element);
308 }
309 return $group;
310 }
311
316 public static function getValidTypes(): array
317 {
318 $types = Type::cases();
319 $values = [];
320 foreach ($types as $type) {
321 $values[] = $type->value;
322 }
323 return $values;
324 }
325
326 public static function isValidType(int $a_type): bool
327 {
328 return !is_null(Type::tryFrom($a_type));
329 }
330
334 abstract public function getType(): int;
335
339 protected static function getTypeString(int $a_type): string
340 {
341 return (string) (Type::tryFrom($a_type)?->stringValue());
342 }
343
347 public function useDefaultLanguageMode(string $language): bool
348 {
349 if (!strlen($language)) {
350 return true;
351 }
352 $record = ilAdvancedMDRecord::_getInstanceByRecordId($this->getRecordID());
353 return strcmp($record->getDefaultLanguage(), $language) === 0;
354 }
355
359 public function getTypeTitle(): string
360 {
361 return "udf_type_" . strtolower(self::getTypeString($this->getType()));
362 }
363
367 abstract protected function initADTDefinition(): ilADTDefinition;
368
374 {
375 if (!$this->adt_def instanceof ilADTDefinition) {
376 $this->adt_def = $this->initADTDefinition();
377 }
378 return $this->adt_def;
379 }
380
381 public function getADT(): ilADT
382 {
383 if (!$this->adt instanceof ilADT) {
384 $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
385 }
386 return $this->adt;
387 }
388
393 protected function setADT(ilADT $a_adt): void
394 {
395 if (!$this->adt instanceof ilADT) {
396 $this->adt = $a_adt;
397 }
398 }
399
403 public function getFieldId(): ?int
404 {
405 return $this->generic_data->id();
406 }
407
411 public function setRecordId(int $a_id): void
412 {
413 $this->generic_data->setRecordID($a_id);
414 }
415
419 public function getRecordId(): int
420 {
421 return $this->generic_data->getRecordID();
422 }
423
427 public function setImportId(string $a_id_string): void
428 {
429 $this->generic_data->setImportID(trim($a_id_string));
430 }
431
435 public function getImportId(): string
436 {
437 return $this->generic_data->getImportID();
438 }
439
443 public function setPosition(int $a_pos): void
444 {
445 $this->generic_data->setPosition($a_pos);
446 }
447
451 public function getPosition(): int
452 {
453 return $this->generic_data->getPosition();
454 }
455
459 public function setTitle(string $a_title): void
460 {
461 $this->generic_data->setTitle(trim($a_title));
462 }
463
467 public function getTitle(): string
468 {
469 return $this->generic_data->getTitle();
470 }
471
475 public function setDescription(string $a_desc): void
476 {
477 $this->generic_data->setDescription(trim($a_desc));
478 }
479
483 public function getDescription(): string
484 {
485 return $this->generic_data->getDescription();
486 }
487
491 public function isSearchSupported(): bool
492 {
493 return true;
494 }
495
499 public function isFilterSupported(): bool
500 {
501 return true;
502 }
503
507 public function setSearchable(bool $a_status): void
508 {
509 // see above
510 if (!$this->isSearchSupported()) {
511 $a_status = false;
512 }
513 $this->generic_data->setSearchable($a_status);
514 }
515
519 public function isSearchable(): bool
520 {
521 return $this->generic_data->isSearchable();
522 }
523
527 public function setRequired(bool $a_status): void
528 {
529 $this->generic_data->setRequired($a_status);
530 }
531
535 public function isRequired(): bool
536 {
537 return $this->generic_data->isRequired();
538 }
539
543 protected function importFieldDefinition(array $a_def): void
544 {
545 }
546
550 protected function getFieldDefinition(): array
551 {
552 return [];
553 }
554
558 public function getFieldDefinitionForTableGUI(string $content_language): array
559 {
560 return [];
561 }
562
567 ilPropertyFormGUI $a_form,
568 bool $a_disabled = false,
569 string $language = ''
570 ): void {
571 }
572
576 public function addToFieldDefinitionForm(
577 ilPropertyFormGUI $a_form,
578 ilAdvancedMDPermissionHelper $a_permissions,
579 string $language = ''
580 ): void {
581 global $DIC;
582 $lng = $DIC['lng'];
583
584 $perm = $a_permissions->hasPermissions(
586 (int) $this->getFieldId(),
587 array(
590 )
591 ,
594 )
595 ,
598 )
599 ,
602 )
603 )
604 );
605
606 // title
607 $translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($this->getRecordId());
608
609 $title = new ilTextInputGUI($lng->txt('title'), 'title');
610 $title->setValue($this->getTitle());
611 $title->setSize(20);
612 $title->setMaxLength(70);
613 $title->setRequired(true);
614 if ($this->getFieldId()) {
615 $translations->modifyTranslationInfoForTitle($this->getFieldId(), $a_form, $title, $language);
616 } else {
617 $title->setValue($this->getTitle());
618 }
619
620 $a_form->addItem($title);
621
623 $title->setDisabled(true);
624 }
625
626 // desc
627 $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
628 $desc->setValue($this->getDescription());
629 $desc->setRows(3);
630 $desc->setCols(50);
631 if ($this->getFieldId()) {
632 $translations->modifyTranslationInfoForDescription($this->getFieldId(), $a_form, $desc, $language);
633 } else {
634 $desc->setValue($this->getDescription());
635 }
636
637 $a_form->addItem($desc);
638
640 $desc->setDisabled(true);
641 }
642
643 // searchable
644 $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
645 $check->setChecked($this->isSearchable());
646 $check->setValue("1");
647 $a_form->addItem($check);
648
650 !$this->isSearchSupported()) {
651 $check->setDisabled(true);
652 }
653
654 /* required
655 $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
656 $check->setChecked($this->isRequired());
657 $check->setValue(1);
658 $a_form->addItem($check);
659 */
660
661 $this->addCustomFieldToDefinitionForm(
662 $a_form,
664 $language
665 );
666 }
667
671 public function importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language = ''): void
672 {
673 // type-specific
674 }
675
680 ilPropertyFormGUI $a_form,
681 ilAdvancedMDPermissionHelper $a_permissions,
682 string $active_language
683 ): void {
684 $record = ilAdvancedMDRecord::_getInstanceByRecordId($this->getRecordID());
685 $is_translation = (($active_language !== '') && ($active_language != $record->getDefaultLanguage()));
686 if (!$a_form->getItemByPostVar("title")->getDisabled() && !$is_translation) {
687 $this->setTitle($a_form->getInput("title"));
688 }
689 if (!$a_form->getItemByPostVar("description")->getDisabled() && !$is_translation) {
690 $this->setDescription($a_form->getInput("description"));
691 }
692 if (!$a_form->getItemByPostVar("searchable")->getDisabled()) {
693 $this->setSearchable((bool) $a_form->getInput("searchable"));
694 }
695
696 if ($a_permissions->hasPermission(
698 (int) $this->getFieldId(),
701 )) {
702 $this->importCustomDefinitionFormPostValues($a_form, $active_language);
703 }
704 }
705
707 {
708 return false;
709 }
710
712 {
713 }
714
716 {
717 $a_form->getItemByPostVar("title")->setDisabled(true);
718 $a_form->getItemByPostVar("description")->setDisabled(true);
719 $a_form->getItemByPostVar("searchable")->setDisabled(true);
720
721 // checkboxes have no hidden on disabled
722 if ($a_form->getInput("searchable")) {
723 $hidden = new ilHiddenInputGUI("searchable");
724 $hidden->setValue("1");
725 $a_form->addItem($hidden);
726 }
727
728 $this->prepareCustomDefinitionFormConfirmation($a_form);
729 }
730
734 public function generateImportId(int $a_field_id): string
735 {
736 return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
737 }
738
742 public function save(bool $keep_pos_and_import_id = false, bool $keep_import_id = false): void
743 {
744 if ($this->getFieldId()) {
745 $this->update();
746 return;
747 }
748
749 /*
750 * This has to be set before update and creation here, the alternative
751 * would be to set this in all children of this class, everywhere
752 * where type-specific settings are set.
753 */
754 $this->generic_data->setFieldValues($this->getFieldDefinition());
755
756 if ($keep_pos_and_import_id) {
757 $field_id = $this->db_gateway->create($this->generic_data);
758 } elseif ($keep_import_id) {
759 $field_id = $this->db_gateway->createWithNewPosition($this->generic_data);
760 } else {
761 $field_id = $this->db_gateway->createFromScratch($this->generic_data);
762 }
763
764 $this->generic_data = $this->db_gateway->readByID($field_id);
765 }
766
770 public function update(): void
771 {
772 if (!$this->getFieldId()) {
773 $this->save();
774 return;
775 }
776
777 /*
778 * This has to be set before update and creation here, the alternative
779 * would be to set this in all children of this class, everywhere
780 * where type-specific settings are set.
781 */
782 $this->generic_data->setFieldValues($this->getFieldDefinition());
783
784 $this->db_gateway->update($this->generic_data);
785 }
786
790 public function delete(): void
791 {
792 if (!$this->getFieldId()) {
793 return;
794 }
795
796 // delete all values
797 ilAdvancedMDValues::_deleteByFieldId($this->getFieldId(), $this->getADT());
798
799 $this->db_gateway->delete($this->getFieldId());
800 }
801
807 public function toXML(ilXmlWriter $a_writer): void
808 {
809 $a_writer->xmlStartTag('Field', array(
810 'id' => $this->getImportId(),
811 'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
812 'fieldType' => self::getTypeString($this->getType())
813 ));
814
815 $a_writer->xmlElement('FieldTitle', null, $this->getTitle());
816 $a_writer->xmlElement('FieldDescription', null, $this->getDescription());
817
818 $translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($this->getRecordId());
819 $a_writer->xmlStartTag('FieldTranslations');
820 foreach ($translations->getTranslations($this->getFieldId()) as $translation) {
821 $a_writer->xmlStartTag('FieldTranslation', ['language' => $translation->getLangKey()]);
822 $a_writer->xmlElement(
823 'FieldTranslationTitle',
824 [],
825 $translation->getTitle()
826 );
827 $a_writer->xmlElement(
828 'FieldTranslationDescription',
829 [],
830 $translation->getDescription()
831 );
832 $a_writer->xmlEndTag('FieldTranslation');
833 }
834 $a_writer->xmlEndTag('FieldTranslations');
835 $a_writer->xmlElement('FieldPosition', null, $this->getPosition());
836
837 $this->addPropertiesToXML($a_writer);
838
839 $a_writer->xmlEndTag('Field');
840 }
841
845 protected function addPropertiesToXML(ilXmlWriter $a_writer): void
846 {
847 // type-specific properties
848 }
849
853 public function importXMLProperty(string $a_key, string $a_value): void
854 {
855 }
856
860 abstract public function getValueForXML(ilADT $element): string;
861
866 abstract public function importValueFromXML(string $a_cdata): void;
867
871 public function importFromECS(string $a_ecs_type, $a_value, string $a_sub_id): bool
872 {
873 return false;
874 }
875
879 public function prepareElementForEditor(ilADTFormBridge $a_bridge): void
880 {
881 // type-specific
882 }
883
890 public function getSearchQueryParserValue(ilADTSearchBridge $a_adt_search): string
891 {
892 return '';
893 }
894
895 public function getSearchValueSerialized(ilADTSearchBridge $a_adt_search): string
896 {
897 return $a_adt_search->getSerializedValue();
898 }
899
903 public function setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value): void
904 {
905 $a_adt_search->setSerializedValue($a_value);
906 }
907
911 protected function parseSearchObjects(array $a_records, array $a_object_types): array
912 {
913 $res = [];
914 $obj_ids = [];
915 foreach ($a_records as $record) {
916 if ($record["sub_type"] == "-") {
917 $obj_ids[] = $record["obj_id"];
918 }
919 }
920
921 $sql = "SELECT obj_id,type" .
922 " FROM object_data" .
923 " WHERE " . $this->db->in("obj_id", $obj_ids, false, "integer") .
924 " AND " . $this->db->in("type", $a_object_types, false, "text");
925 $set = $this->db->query($sql);
926 while ($row = $this->db->fetchAssoc($set)) {
927 $res[] = $row;
928 }
929 return $res;
930 }
931
932 public function searchSubObjects(ilADTSearchBridge $a_adt_search, int $a_obj_id, string $sub_obj_type): array
933 {
935
936 // :TODO:
937 if ($a_adt_search instanceof ilADTLocationSearchBridgeSingle) {
938 $element_id = "loc";
939 }
940
941 $condition = $a_adt_search->getSQLCondition($element_id);
942 if ($condition) {
944 "adv_md_values",
945 $this->getADT()->getType(),
946 $this->getFieldId(),
947 $condition
948 );
949 if (sizeof($objects)) {
950 $res = array();
951 foreach ($objects as $item) {
952 if ($item["obj_id"] == $a_obj_id &&
953 $item["sub_type"] == $sub_obj_type) {
954 $res[] = $item["sub_id"];
955 }
956 }
957 return $res;
958 }
959 }
960
961 return array();
962 }
963
967 public function searchObjects(
968 ilADTSearchBridge $a_adt_search,
969 ilQueryParser $a_parser,
970 array $a_object_types,
971 string $a_locate,
972 string $a_search_type
973 ): array {
974 // search type only supported/needed for text
975 $condition = $a_adt_search->getSQLCondition(ilADTActiveRecordByType::SINGLE_COLUMN_NAME);
976 if ($condition) {
978 "adv_md_values",
979 $this->getADT()->getType(),
980 $this->getFieldId(),
981 $condition,
982 $a_locate
983 );
984 if (sizeof($objects)) {
985 return $this->parseSearchObjects($objects, $a_object_types);
986 }
987 }
988 return [];
989 }
990
997 public function getLuceneSearchString($a_value)
998 {
999 return $a_value;
1000 }
1001
1005 public function prepareElementForSearch(ilADTSearchBridge $a_bridge): void
1006 {
1007 }
1008
1012 public function _clone(int $a_new_record_id): self
1013 {
1014 $empty_generic_data = new GenericDataImplementation(
1015 $this->generic_data->type(),
1016 0,
1017 '',
1018 '',
1019 '',
1020 0,
1021 false,
1022 false,
1023 []
1024 );
1025
1026 $class = get_class($this);
1027 $obj = new $class($empty_generic_data);
1028 $obj->setRecordId($a_new_record_id);
1029 $obj->setTitle($this->getTitle());
1030 $obj->setDescription($this->getDescription());
1031 $obj->setRequired($this->isRequired());
1032 $obj->setPosition($this->getPosition());
1033 $obj->setSearchable($this->isSearchable());
1034 $obj->importFieldDefinition($this->getFieldDefinition());
1035 $obj->save(true);
1036
1037 return $obj;
1038 }
1039 //
1040 // complex options
1041 //
1042
1043 public function hasComplexOptions(): bool
1044 {
1045 return false;
1046 }
1047
1051 public function getComplexOptionsOverview(): ?DataTable
1052 {
1053 return null;
1054 }
1055}
$check
Definition: buildRTE.php:81
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
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.
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, int $a_context_id, int $a_action_id, ?int $a_action_sub_id=null)
Check permission.
Class ilCtrl provides processing control methods.
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.
A component is the most general form of an entity in the UI.
Definition: Component.php:28
This describes a Data Table.
Definition: Data.php:33
An entity that renders components to a string output.
Definition: Renderer.php:31
Interface ilDBInterface.
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:26
foreach($_POST as $key=> $value) $res
global $DIC
Definition: shib_login.php:26
$data
Definition: storeScorm.php:45