ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilAdvancedMDFieldDefinition.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "Services/ADT/classes/class.ilADTFactory.php";
5
15{
16 protected $field_id; // [int]
17 protected $record_id; // [int]
18 protected $import_id; // [string]
19 protected $position; // [int]
20 protected $title; // [string]
21 protected $description; // [string]
22 protected $searchable; // [bool]
23 protected $required; // [bool]
24 protected $adt_def; // [ilADTDefinition]
25 protected $adt; // [ilADT]
26
27 const TYPE_SELECT = 1;
28 const TYPE_TEXT = 2;
29 const TYPE_DATE = 3;
30 const TYPE_DATETIME = 4;
31 const TYPE_INTEGER = 5;
32 const TYPE_FLOAT = 6;
33 const TYPE_LOCATION = 7;
35 const TYPE_ADDRESS = 99;
38
45 public function __construct($a_field_id = null)
46 {
47 $this->init();
48 $this->read($a_field_id);
49 }
50
58 public static function getInstance($a_field_id, $a_type = null)
59 {
60 global $DIC;
61
62 $ilDB = $DIC['ilDB'];
63
64 if (!$a_type) {
65 $set = $ilDB->query("SELECT field_type" .
66 " FROM adv_mdf_definition" .
67 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
68 $a_type = $ilDB->fetchAssoc($set);
69 $a_type = $a_type["field_type"];
70 }
71
72 if (self::isValidType($a_type)) {
73 $class = "ilAdvancedMDFieldDefinition" . self::getTypeString($a_type);
74 require_once "Services/AdvancedMetaData/classes/Types/class." . $class . ".php";
75 return new $class($a_field_id);
76 }
77
78 throw new ilException("unknown type " . $a_type);
79 }
80
86 public static function exists($a_field_id)
87 {
88 global $DIC;
89
90 $ilDB = $DIC['ilDB'];
91
92 $set = $ilDB->query("SELECT field_type" .
93 " FROM adv_mdf_definition" .
94 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
95 if ($ilDB->fetchAssoc($set)) {
96 return true;
97 }
98 return false;
99 }
100
107 public static function getInstanceByTypeString($a_type)
108 {
109 // see self::getTypeString()
110 $map = array(
111 self::TYPE_TEXT => "Text",
112 self::TYPE_SELECT => "Select",
113 self::TYPE_DATE => "Date",
114 self::TYPE_DATETIME => "DateTime",
115 self::TYPE_FLOAT => "Float",
116 self::TYPE_LOCATION => "Location",
117 self::TYPE_INTEGER => "Integer",
118 self::TYPE_SELECT_MULTI => "SelectMulti" ,
119 self::TYPE_EXTERNAL_LINK => 'ExternalLink',
120 self::TYPE_INTERNAL_LINK => 'InternalLink',
121 self::TYPE_ADDRESS => "Address"
122 );
123 $map = array_flip($map);
124 if (array_key_exists($a_type, $map)) {
125 return self::getInstance(null, $map[$a_type]);
126 }
127 }
128
136 public static function getInstancesByRecordId($a_record_id, $a_only_searchable = false)
137 {
138 global $DIC;
139
140 $ilDB = $DIC['ilDB'];
141
142 $defs = array();
143
144 $query = "SELECT * FROM adv_mdf_definition" .
145 " WHERE record_id = " . $ilDB->quote($a_record_id, "integer");
146 if ($a_only_searchable) {
147 $query .= " AND searchable = " . $ilDB->quote(1, "integer");
148 }
149 $query .= " ORDER BY position";
150 $set = $ilDB->query($query);
151 while ($row = $ilDB->fetchAssoc($set)) {
152 $field = self::getInstance(null, $row["field_type"]);
153 $field->import($row);
154 $defs[$row["field_id"]] = $field;
155 }
156
157 return $defs;
158 }
159
160 public static function getInstancesByObjType($a_obj_type, $a_active_only = true)
161 {
162 global $DIC;
163
164 $ilDB = $DIC['ilDB'];
165
166 $defs = array();
167
168 $query = "SELECT amf.* FROM adv_md_record_objs aro" .
169 " JOIN adv_md_record amr ON aro.record_id = amr.record_id" .
170 " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id" .
171 " WHERE obj_type = " . $ilDB->quote($a_obj_type, 'text');
172 if ((bool) $a_active_only) {
173 $query .= " AND active = " . $ilDB->quote(1, "integer");
174 }
175 $query .= " ORDER BY aro.record_id,position";
176 $res = $ilDB->query($query);
177 while ($row = $ilDB->fetchAssoc($res)) {
178 $field = self::getInstance(null, $row["field_type"]);
179 $field->import($row);
180 $defs[$row["field_id"]] = $field;
181 }
182 return $defs;
183 }
184
191 public static function getInstanceByImportId($a_import_id)
192 {
193 global $DIC;
194
195 $ilDB = $DIC['ilDB'];
196
197 $query = "SELECT field_id, field_type FROM adv_mdf_definition" .
198 " WHERE import_id = " . $ilDB->quote($a_import_id, 'text');
199 $set = $ilDB->query($query);
200 if ($ilDB->numRows($set)) {
201 $row = $ilDB->fetchAssoc($set);
202 return self::getInstance($row["field_id"], $row["field_type"]);
203 }
204 }
205
211 public static function getSearchableDefinitionIds()
212 {
213 global $DIC;
214
215 $ilDB = $DIC['ilDB'];
216
217 $field_ids = array();
218
219 $query = "SELECT field_id FROM adv_md_record amr" .
220 " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)" .
221 " WHERE active = " . $ilDB->quote(1, "integer") .
222 " AND searchable = " . $ilDB->quote(1, "integer");
223 $set = $ilDB->query($query);
224 while ($row = $ilDB->fetchAssoc($set)) {
225 $field_ids[] = $row["field_id"];
226 }
227 return $field_ids;
228 }
229
236 public static function getADTGroupForDefinitions(array $a_defs)
237 {
239 $group_def = $factory->getDefinitionInstanceByType("Group");
240 foreach ($a_defs as $def) {
241 $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
242 }
243 $group = $factory->getInstanceByDefinition($group_def);
244
245 // bind adt instances to definition
246 foreach ($group->getElements() as $element_id => $element) {
247 $a_defs[$element_id]->setADT($element);
248 }
249
250 return $group;
251 }
252
256 protected function init()
257 {
258 $this->setRequired(false);
259 $this->setSearchable(false);
260 }
261
262
263 //
264 // generic types
265 //
266
272 public static function getValidTypes()
273 {
274 return array(
275 self::TYPE_TEXT,
276 self::TYPE_DATE,
277 self::TYPE_DATETIME,
278 self::TYPE_SELECT,
279 self::TYPE_INTEGER,
280 self::TYPE_FLOAT,
281 self::TYPE_LOCATION,
282 self::TYPE_SELECT_MULTI,
283 self::TYPE_EXTERNAL_LINK,
284 self::TYPE_INTERNAL_LINK,
285 self::TYPE_ADDRESS
286 );
287 }
288
295 public static function isValidType($a_type)
296 {
297 return in_array((int) $a_type, self::getValidTypes());
298 }
299
305 abstract public function getType();
306
313 protected static function getTypeString($a_type)
314 {
315 if (self::isValidType($a_type)) {
316 $map = array(
317 self::TYPE_TEXT => "Text",
318 self::TYPE_SELECT => "Select",
319 self::TYPE_DATE => "Date",
320 self::TYPE_DATETIME => "DateTime",
321 self::TYPE_FLOAT => "Float",
322 self::TYPE_LOCATION => "Location",
323 self::TYPE_INTEGER => "Integer",
324 self::TYPE_SELECT_MULTI => "SelectMulti" ,
325 self::TYPE_EXTERNAL_LINK => 'ExternalLink',
326 self::TYPE_INTERNAL_LINK => 'InternalLink',
327 self::TYPE_ADDRESS => "Address"
328 );
329 return $map[$a_type];
330 }
331 }
332
338 public function getTypeTitle()
339 {
340 // :TODO: reuse udf stuff here ?!
341 return "udf_type_" . strtolower(self::getTypeString($this->getType()));
342 }
343
344
345
346 //
347 // ADT
348 //
349
355 abstract protected function initADTDefinition();
356
362 public function getADTDefinition()
363 {
364 if (!$this->adt_def instanceof ilADTDefinition) {
365 $this->adt_def = $this->initADTDefinition();
366 }
367 return $this->adt_def;
368 }
369
375 public function getADT()
376 {
377 if (!$this->adt instanceof ilADT) {
378 $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
379 }
380 return $this->adt;
381 }
382
389 protected function setADT(ilADT $a_adt)
390 {
391 if (!$this->adt instanceof ilADT) {
392 $this->adt = $a_adt;
393 }
394 }
395
396 //
397 // properties
398 //
399
405 protected function setFieldId($a_id)
406 {
407 $this->field_id = (int) $a_id;
408 }
409
415 public function getFieldId()
416 {
417 return $this->field_id;
418 }
419
425 public function setRecordId($a_id)
426 {
427 $this->record_id = (int) $a_id;
428 }
429
435 public function getRecordId()
436 {
437 return $this->record_id;
438 }
439
445 public function setImportId($a_id_string)
446 {
447 if ($a_id_string !== null) {
448 $a_id_string = trim($a_id_string);
449 }
450 $this->import_id = $a_id_string;
451 }
452
458 public function getImportId()
459 {
460 return $this->import_id;
461 }
462
468 public function setPosition($a_pos)
469 {
470 $this->position = (int) $a_pos;
471 }
472
478 public function getPosition()
479 {
480 return $this->position;
481 }
482
488 public function setTitle($a_title)
489 {
490 if ($a_title !== null) {
491 $a_title = trim($a_title);
492 }
493 $this->title = $a_title;
494 }
495
501 public function getTitle()
502 {
503 return $this->title;
504 }
505
511 public function setDescription($a_desc)
512 {
513 if ($a_desc !== null) {
514 $a_desc = trim($a_desc);
515 }
516 $this->description = $a_desc;
517 }
518
524 public function getDescription()
525 {
526 return $this->description;
527 }
528
534 public function isSearchSupported()
535 {
536 return true;
537 }
538
544 public function isFilterSupported()
545 {
546 return true;
547 }
548
554 public function setSearchable($a_status)
555 {
556 // see above
557 if (!$this->isSearchSupported()) {
558 $a_status = false;
559 }
560 $this->searchable = (bool) $a_status;
561 }
562
568 public function isSearchable()
569 {
570 return $this->searchable;
571 }
572
578 public function setRequired($a_status)
579 {
580 $this->required = (bool) $a_status;
581 }
582
588 public function isRequired()
589 {
590 return $this->required;
591 }
592
593
594 //
595 // definition (NOT ADT-based)
596 //
597
603 protected function importFieldDefinition(array $a_def)
604 {
605 }
606
612 protected function getFieldDefinition()
613 {
614 // type-specific properties
615 }
616
623 {
624 // type-specific properties
625 }
626
633 protected function addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled = false)
634 {
635 // type-specific
636 }
637
645 {
646 global $DIC;
647
648 $lng = $DIC['lng'];
649
650 $perm = $a_permissions->hasPermissions(
652 $this->getFieldId(),
653 array(
662 )
663 );
664
665 // title
666 $title = new ilTextInputGUI($lng->txt('title'), 'title');
667 $title->setValue($this->getTitle());
668 $title->setSize(20);
669 $title->setMaxLength(70);
670 $title->setRequired(true);
671 $a_form->addItem($title);
672
674 $title->setDisabled(true);
675 }
676
677 // desc
678 $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
679 $desc->setValue($this->getDescription());
680 $desc->setRows(3);
681 $desc->setCols(50);
682 $a_form->addItem($desc);
683
685 $desc->setDisabled(true);
686 }
687
688 // searchable
689 $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
690 $check->setChecked($this->isSearchable());
691 $check->setValue(1);
692 $a_form->addItem($check);
693
695 !$this->isSearchSupported()) {
696 $check->setDisabled(true);
697 }
698
699 /* required
700 $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
701 $check->setChecked($this->isRequired());
702 $check->setValue(1);
703 $a_form->addItem($check);
704 */
705
707 $a_form,
709 );
710 }
711
718 {
719 // type-specific
720 }
721
729 {
730 if (!$a_form->getItemByPostVar("title")->getDisabled()) {
731 $this->setTitle($a_form->getInput("title"));
732 }
733 if (!$a_form->getItemByPostVar("description")->getDisabled()) {
734 $this->setDescription($a_form->getInput("description"));
735 }
736 if (!$a_form->getItemByPostVar("searchable")->getDisabled()) {
737 $this->setSearchable($a_form->getInput("searchable"));
738 }
739
740 if ($a_permissions->hasPermission(
742 $this->getFieldId(),
745 )) {
747 }
748 }
749
751 {
752 return false;
753 }
754
756 {
757 // type-specific
758 }
759
761 {
762 $a_form->getItemByPostVar("title")->setDisabled(true);
763 $a_form->getItemByPostVar("description")->setDisabled(true);
764 $a_form->getItemByPostVar("searchable")->setDisabled(true);
765
766 // checkboxes have no hidden on disabled
767 if ($a_form->getInput("searchable")) {
768 $hidden = new ilHiddenInputGUI("searchable");
769 $hidden->setValue(1);
770 $a_form->addItem($hidden);
771 }
772
774 }
775
776
777 //
778 // definition CRUD
779 //
780
786 protected function getLastPosition()
787 {
788 global $DIC;
789
790 $ilDB = $DIC['ilDB'];
791
792 $sql = "SELECT max(position) pos" .
793 " FROM adv_mdf_definition" .
794 " WHERE record_id = " . $ilDB->quote($this->getRecordId(), "integer");
795 $set = $ilDB->query($sql);
796 if ($ilDB->numRows($set)) {
797 $pos = $ilDB->fetchAssoc($set);
798 return (int) $pos["pos"];
799 }
800
801 return 0;
802 }
803
810 public function generateImportId($a_field_id)
811 {
812 return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
813 }
814
820 protected function getDBProperties()
821 {
822 $fields = array(
823 "field_type" => array("integer", $this->getType()),
824 "record_id" => array("integer", $this->getRecordId()),
825 "import_id" => array("text", $this->getImportId()),
826 "title" => array("text", $this->getTitle()),
827 "description" => array("text", $this->getDescription()),
828 "position" => array("integer", $this->getPosition()),
829 "searchable" => array("integer", $this->isSearchable()),
830 "required" => array("integer", $this->isRequired())
831 );
832
833 $def = $this->getFieldDefinition();
834 if (is_array($def)) {
835 $fields["field_values"] = array("text", serialize($def));
836 }
837
838 return $fields;
839 }
840
846 protected function import(array $a_data)
847 {
848 $this->setFieldId($a_data["field_id"]);
849
850 $this->setRecordId($a_data["record_id"]);
851 $this->setImportId($a_data["import_id"]);
852 $this->setTitle($a_data["title"]);
853 $this->setDescription($a_data["description"]);
854 $this->setPosition($a_data["position"]);
855 $this->setSearchable($a_data["searchable"]);
856 $this->setRequired($a_data["required"]);
857 if ($a_data["field_values"]) {
858 $this->importFieldDefinition(unserialize($a_data["field_values"]));
859 }
860 }
861
865 protected function read($a_field_id)
866 {
867 global $DIC;
868
869 $ilDB = $DIC['ilDB'];
870
871 if (!(int) $a_field_id) {
872 return;
873 }
874
875 $sql = "SELECT * FROM adv_mdf_definition" .
876 " WHERE field_id = " . $ilDB->quote($a_field_id, "integer");
877 $set = $ilDB->query($sql);
878 if ($ilDB->numRows($set)) {
879 $row = $ilDB->fetchAssoc($set);
880 $this->import($row);
881 }
882 }
883
887 public function save($a_keep_pos = false)
888 {
889 global $DIC;
890
891 $ilDB = $DIC['ilDB'];
892
893 if ($this->getFieldId()) {
894 return $this->update();
895 }
896
897 $next_id = $ilDB->nextId("adv_mdf_definition");
898
899 // append
900 if (!$a_keep_pos) {
901 $this->setPosition($this->getLastPosition() + 1);
902 }
903
904 // needs unique import id
905 if (!$this->getImportId()) {
906 $this->setImportId($this->generateImportId($next_id));
907 }
908
909 $fields = $this->getDBProperties();
910 $fields["field_id"] = array("integer", $next_id);
911
912 $ilDB->insert("adv_mdf_definition", $fields);
913
914 $this->setFieldId($next_id);
915 }
916
920 public function update()
921 {
922 global $DIC;
923
924 $ilDB = $DIC['ilDB'];
925
926 if (!$this->getFieldId()) {
927 return $this->save();
928 }
929
930 $ilDB->update(
931 "adv_mdf_definition",
932 $this->getDBProperties(),
933 array("field_id" => array("integer", $this->getFieldId()))
934 );
935 }
936
940 public function delete()
941 {
942 global $DIC;
943
944 $ilDB = $DIC['ilDB'];
945
946 if (!$this->getFieldId()) {
947 return;
948 }
949
950 // delete all values
951 include_once("Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
953
954 $query = "DELETE FROM adv_mdf_definition" .
955 " WHERE field_id = " . $ilDB->quote($this->getFieldId(), "integer");
956 $ilDB->manipulate($query);
957 }
958
959
960 //
961 // export/import
962 //
963
971 public function toXML(ilXmlWriter $a_writer)
972 {
973 $a_writer->xmlStartTag('Field', array(
974 'id' => $this->generateImportId($this->getFieldId()),
975 'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
976 'fieldType' => self::getTypeString($this->getType())));
977
978 $a_writer->xmlElement('FieldTitle', null, $this->getTitle());
979 $a_writer->xmlElement('FieldDescription', null, $this->getDescription());
980 $a_writer->xmlElement('FieldPosition', null, $this->getPosition());
981
982 $this->addPropertiesToXML($a_writer);
983
984 $a_writer->xmlEndTag('Field');
985 }
986
992 protected function addPropertiesToXML(ilXmlWriter $a_writer)
993 {
994 // type-specific properties
995 }
996
1003 public function importXMLProperty($a_key, $a_value)
1004 {
1005 }
1006
1013 abstract public function getValueForXML(ilADT $element);
1014
1020 abstract public function importValueFromXML($a_cdata);
1021
1030 public function importFromECS($a_ecs_type, $a_value, $a_sub_id)
1031 {
1032 return false;
1033 }
1034
1035
1036 //
1037 // presentation
1038 //
1039
1045 public function prepareElementForEditor(ilADTFormBridge $a_bridge)
1046 {
1047 // type-specific
1048 }
1049
1050
1051 //
1052 // search
1053 //
1054
1061 public function getSearchQueryParserValue(ilADTSearchBridge $a_adt_search)
1062 {
1063 return '';
1064 }
1065
1072 public function getSearchValueSerialized(ilADTSearchBridge $a_adt_search)
1073 {
1074 return $a_adt_search->getSerializedValue();
1075 }
1076
1083 public function setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value)
1084 {
1085 return $a_adt_search->setSerializedValue($a_value);
1086 }
1087
1095 protected function parseSearchObjects(array $a_records, array $a_object_types)
1096 {
1097 global $DIC;
1098
1099 $ilDB = $DIC['ilDB'];
1100
1101 $res = array();
1102
1103 $obj_ids = array();
1104 foreach ($a_records as $record) {
1105 if ($record["sub_type"] == "-") {
1106 $obj_ids[] = $record["obj_id"];
1107 }
1108 }
1109
1110 $sql = "SELECT obj_id,type" .
1111 " FROM object_data" .
1112 " WHERE " . $ilDB->in("obj_id", $obj_ids, "", "integer") .
1113 " AND " . $ilDB->in("type", $a_object_types, "", "text");
1114 $set = $ilDB->query($sql);
1115 while ($row = $ilDB->fetchAssoc($set)) {
1116 $res[] = $row;
1117 }
1118
1119 return $res;
1120 }
1121
1122 public function searchSubObjects(ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
1123 {
1124 include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1126
1127 // :TODO:
1128 if ($a_adt_search instanceof ilADTLocationSearchBridgeSingle) {
1129 $element_id = "loc";
1130 }
1131
1132 $condition = $a_adt_search->getSQLCondition($element_id);
1133 if ($condition) {
1134 $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition);
1135 if (sizeof($objects)) {
1136 $res = array();
1137 foreach ($objects as $item) {
1138 if ($item["obj_id"] == $a_obj_id &&
1139 $item["sub_type"] == $sub_obj_type) {
1140 $res[] = $item["sub_id"];
1141 }
1142 }
1143 return $res;
1144 }
1145 }
1146
1147 return array();
1148 }
1149
1160 public function searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
1161 {
1162 // search type only supported/needed for text
1163
1164 include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1166 if ($condition) {
1167 $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
1168 if (sizeof($objects)) {
1169 return $this->parseSearchObjects($objects, $a_object_types);
1170 }
1171 return array();
1172 }
1173 }
1174
1181 public function getLuceneSearchString($a_value)
1182 {
1183 return $a_value;
1184 }
1185
1192 {
1193 // type-specific
1194 }
1195
1202 public function _clone($a_new_record_id)
1203 {
1204 $class = get_class($this);
1205 $obj = new $class();
1206 $obj->setRecordId($a_new_record_id);
1207 $obj->setTitle($this->getTitle());
1208 $obj->setDescription($this->getDescription());
1209 $obj->setRequired($this->isRequired());
1210 $obj->setPosition($this->getPosition());
1211 $obj->setSearchable($this->isSearchable());
1212 $obj->importFieldDefinition((array) $this->getFieldDefinition());
1213 $obj->save(true);
1214
1215 return $obj;
1216 }
1217 //
1218 // complex options
1219 //
1220
1221 public function hasComplexOptions()
1222 {
1223 return false;
1224 }
1225
1231 public function getComplexOptionsOverview($a_parent_gui, string $parent_cmd) : ?string
1232 {
1233 return null;
1234 }
1235}
An exception for terminatinating execution or to throw for unit testing.
static find($a_table, $a_type, $a_field_id, $a_condition, $a_additional_fields=null)
Find entries.
ADT definition base class.
static getInstance()
Get singleton.
ADT form bridge base class.
ADT search bridge base class.
setSerializedValue($a_value)
Set current value(s) in serialized form (for easy persisting)
getSQLCondition($a_element_id)
Get SQL condition for current value(s)
getSerializedValue()
Get current value(s) in serialized form (for easy persisting)
ADT base class.
Definition: class.ilADT.php:12
getLuceneSearchString($a_value)
Get search string in lucene syntax.
getLastPosition()
Get last position of record.
importXMLProperty($a_key, $a_value)
Import property from XML.
static getInstanceByTypeString($a_type)
Get instance by type string (used by import)
importFromECS($a_ecs_type, $a_value, $a_sub_id)
Import meta data from ECS.
static getInstanceByImportId($a_import_id)
Get definition instance by import id.
addPropertiesToXML(ilXmlWriter $a_writer)
Add (type-specific) properties to xml export.
static exists($a_field_id)
Check if field exists.
importFieldDefinition(array $a_def)
Import (type-specific) field definition from DB.
getSearchValueSerialized(ilADTSearchBridge $a_adt_search)
Get value for search persistence.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
static getADTGroupForDefinitions(array $a_defs)
Init ADTGroup for definitions.
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.
getADTDefinition()
Get ADT definition instance.
getComplexOptionsOverview($a_parent_gui, string $parent_cmd)
importDefinitionFormPostValues(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
Import post values from definition form.
getFieldDefinition()
Get (type-specific) field definition.
read($a_field_id)
Read field definition.
addToFieldDefinitionForm(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
Add input elements to definition form.
getFieldDefinitionForTableGUI()
Parse properties for table gui.
getDBProperties()
Get all definition properties for DB.
searchSubObjects(ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value)
Set value from search persistence.
static getTypeString($a_type)
Get type string.
generateImportId($a_field_id)
Generate unique record id.
_clone($a_new_record_id)
Clone field definition.
importValueFromXML($a_cdata)
Import value from xml.
prepareElementForSearch(ilADTSearchBridge $a_bridge)
Prepare search form elements.
static getSearchableDefinitionIds()
Get searchable definition ids (performance is key)
isFilterSupported()
Is search by filter supported.
searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
Search objects.
prepareElementForEditor(ilADTFormBridge $a_bridge)
Prepare editor form elements.
prepareDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
prepareCustomDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
__construct($a_field_id=null)
Constructor.
save($a_keep_pos=false)
Create new field entry.
getValueForXML(ilADT $element)
Parse ADT value for xml (export)
static isValidType($a_type)
Is given type valid.
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled=false)
Add custom input elements to definition form.
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form)
Import custom post values from definition form.
Advanced metadata permission helper.
static _deleteByFieldId($a_field_id, ilADT $a_adt)
Delete values by field_id.
This class represents a checkbox property in a property form.
hasPermission($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
Check permission.
hasPermissions($a_context_type, $a_context_id, array $a_action_ids)
Check permissions.
Base class for ILIAS Exception handling.
This class represents a hidden form property in a property form.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
getItemByPostVar($a_post_var)
Get Item by POST variable.
This class represents a text area property in a property form.
This class represents a text property in a property form.
XML writer class.
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
$factory
Definition: metadata.php:58
$query
$lng
foreach($_POST as $key=> $value) $res
global $ilDB
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46