ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 require_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;
34  const TYPE_SELECT_MULTI = 8;
35 
42  public function __construct($a_field_id = null)
43  {
44  $this->init();
45  $this->read($a_field_id);
46  }
47 
55  public static function getInstance($a_field_id, $a_type = null)
56  {
57  global $ilDB;
58 
59  if(!$a_type)
60  {
61  $set = $ilDB->query("SELECT field_type".
62  " FROM adv_mdf_definition".
63  " WHERE field_id = ".$ilDB->quote($a_field_id, "integer"));
64  $a_type = $ilDB->fetchAssoc($set);
65  $a_type = $a_type["field_type"];
66  }
67 
68  if(self::isValidType($a_type))
69  {
70  $class = "ilAdvancedMDFieldDefinition".self::getTypeString($a_type);
71  require_once "Services/AdvancedMetaData/classes/Types/class.".$class.".php";
72  return new $class($a_field_id);
73  }
74 
75  throw new ilException("unknown type ".$a_type);
76  }
77 
84  public static function getInstanceByTypeString($a_type)
85  {
86  // see self::getTypeString()
87  $map = array(
88  self::TYPE_TEXT => "Text",
89  self::TYPE_SELECT => "Select",
90  self::TYPE_DATE => "Date",
91  self::TYPE_DATETIME => "DateTime",
92  self::TYPE_FLOAT => "Float",
93  self::TYPE_LOCATION => "Location",
94  self::TYPE_INTEGER => "Integer",
95  self::TYPE_SELECT_MULTI => "SelectMulti"
96  );
97  $map = array_flip($map);
98  if(array_key_exists($a_type, $map))
99  {
100  return self::getInstance(null, $map[$a_type]);
101  }
102  }
103 
111  public static function getInstancesByRecordId($a_record_id, $a_only_searchable = false)
112  {
113  global $ilDB;
114 
115  $defs = array();
116 
117  $query = "SELECT * FROM adv_mdf_definition".
118  " WHERE record_id = ".$ilDB->quote($a_record_id, "integer");
119  if($a_only_searchable)
120  {
121  $query .= " AND searchable = ".$ilDB->quote(1, "integer");
122  }
123  $query .= " ORDER BY position";
124  $set = $ilDB->query($query);
125  while($row = $ilDB->fetchAssoc($set))
126  {
127  $field = self::getInstance(null, $row["field_type"]);
128  $field->import($row);
129  $defs[$row["field_id"]] = $field;
130  }
131 
132  return $defs;
133  }
134 
135  public static function getInstancesByObjType($a_obj_type, $a_active_only = true)
136  {
137  global $ilDB;
138 
139  $defs = array();
140 
141  $query = "SELECT amf.* FROM adv_md_record_objs aro".
142  " JOIN adv_md_record amr ON aro.record_id = amr.record_id".
143  " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id".
144  " WHERE obj_type = ".$ilDB->quote($a_obj_type,'text');
145  if((bool)$a_active_only)
146  {
147  $query .= " AND active = ".$ilDB->quote(1, "integer");
148  }
149  $query .= " ORDER BY aro.record_id,position";
150  $res = $ilDB->query($query);
151  while($row = $ilDB->fetchAssoc($res))
152  {
153  $field = self::getInstance(null, $row["field_type"]);
154  $field->import($row);
155  $defs[$row["field_id"]] = $field;
156  }
157  return $defs;
158  }
159 
166  public static function getInstanceByImportId($a_import_id)
167  {
168  global $ilDB;
169 
170  $query = "SELECT field_id, field_type FROM adv_mdf_definition".
171  " WHERE import_id = ".$ilDB->quote($a_import_id,'text');
172  $set = $ilDB->query($query);
173  if($ilDB->numRows($set))
174  {
175  $row = $ilDB->fetchAssoc($set);
176  return self::getInstance($row["field_id"], $row["field_type"]);
177  }
178  }
179 
185  public static function getSearchableDefinitionIds()
186  {
187  global $ilDB;
188 
189  $field_ids = array();
190 
191  $query = "SELECT field_id FROM adv_md_record amr".
192  " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)".
193  " WHERE active = ".$ilDB->quote(1, "integer").
194  " AND searchable = ".$ilDB->quote(1, "integer");
195  $set = $ilDB->query($query);
196  while($row = $ilDB->fetchAssoc($set))
197  {
198  $field_ids[] = $row["field_id"];
199  }
200  return $field_ids;
201  }
202 
209  public static function getADTGroupForDefinitions(array $a_defs)
210  {
211  $factory = ilADTFactory::getInstance();
212  $group_def = $factory->getDefinitionInstanceByType("Group");
213  foreach($a_defs as $def)
214  {
215  $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
216  }
217  $group = $factory->getInstanceByDefinition($group_def);
218 
219  // bind adt instances to definition
220  foreach($group->getElements() as $element_id => $element)
221  {
222  $a_defs[$element_id]->setADT($element);
223  }
224 
225  return $group;
226  }
227 
231  protected function init()
232  {
233  $this->setRequired(false);
234  $this->setSearchable(false);
235  }
236 
237 
238  //
239  // generic types
240  //
241 
247  public static function getValidTypes()
248  {
249  return array(self::TYPE_TEXT, self::TYPE_DATE, self::TYPE_DATETIME,
250  self::TYPE_SELECT, self::TYPE_INTEGER, self::TYPE_FLOAT,
251  self::TYPE_LOCATION, self::TYPE_SELECT_MULTI);
252  }
253 
260  public static function isValidType($a_type)
261  {
262  return in_array((int)$a_type, self::getValidTypes());
263  }
264 
270  abstract public function getType();
271 
278  protected static function getTypeString($a_type)
279  {
280  if(self::isValidType($a_type))
281  {
282  $map = array(
283  self::TYPE_TEXT => "Text",
284  self::TYPE_SELECT => "Select",
285  self::TYPE_DATE => "Date",
286  self::TYPE_DATETIME => "DateTime",
287  self::TYPE_FLOAT => "Float",
288  self::TYPE_LOCATION => "Location",
289  self::TYPE_INTEGER => "Integer",
290  self::TYPE_SELECT_MULTI => "SelectMulti"
291  );
292  return $map[$a_type];
293  }
294  }
295 
301  public function getTypeTitle()
302  {
303  // :TODO: reuse udf stuff here ?!
304  return "udf_type_".strtolower(self::getTypeString($this->getType()));
305  }
306 
307 
308 
309  //
310  // ADT
311  //
312 
318  abstract protected function initADTDefinition();
319 
325  public function getADTDefinition()
326  {
327  if(!$this->adt_def instanceof ilADTDefinition)
328  {
329  $this->adt_def = $this->initADTDefinition();
330  }
331  return $this->adt_def;
332  }
333 
339  public function getADT()
340  {
341  if(!$this->adt instanceof ilADT)
342  {
343  $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
344  }
345  return $this->adt;
346  }
347 
354  protected function setADT(ilADT $a_adt)
355  {
356  if(!$this->adt instanceof ilADT)
357  {
358  $this->adt = $a_adt;
359  }
360  }
361 
362  //
363  // properties
364  //
365 
371  protected function setFieldId($a_id)
372  {
373  $this->field_id = (int)$a_id;
374  }
375 
381  public function getFieldId()
382  {
383  return $this->field_id;
384  }
385 
391  public function setRecordId($a_id)
392  {
393  $this->record_id = (int)$a_id;
394  }
395 
401  public function getRecordId()
402  {
403  return $this->record_id;
404  }
405 
411  public function setImportId($a_id_string)
412  {
413  if($a_id_string !== null)
414  {
415  $a_id_string = trim($a_id_string);
416  }
417  $this->import_id = $a_id_string;
418  }
419 
425  public function getImportId()
426  {
427  return $this->import_id;
428  }
429 
435  public function setPosition($a_pos)
436  {
437  $this->position = (int)$a_pos;
438  }
439 
445  public function getPosition()
446  {
447  return $this->position;
448  }
449 
455  public function setTitle($a_title)
456  {
457  if($a_title !== null)
458  {
459  $a_title = trim($a_title);
460  }
461  $this->title = $a_title;
462  }
463 
469  public function getTitle()
470  {
471  return $this->title;
472  }
473 
479  public function setDescription($a_desc)
480  {
481  if($a_desc !== null)
482  {
483  $a_desc = trim($a_desc);
484  }
485  $this->description = $a_desc;
486  }
487 
493  public function getDescription()
494  {
495  return $this->description;
496  }
497 
503  public function isSearchSupported()
504  {
505  return true;
506  }
507 
513  public function isFilterSupported()
514  {
515  return true;
516  }
517 
523  public function setSearchable($a_status)
524  {
525  // see above
526  if(!$this->isSearchSupported())
527  {
528  $a_status = false;
529  }
530  $this->searchable = (bool)$a_status;
531  }
532 
538  public function isSearchable()
539  {
540  return $this->searchable;
541  }
542 
548  public function setRequired($a_status)
549  {
550  $this->required = (bool)$a_status;
551  }
552 
558  public function isRequired()
559  {
560  return $this->required;
561  }
562 
563 
564  //
565  // definition (NOT ADT-based)
566  //
567 
573  protected function importFieldDefinition(array $a_def)
574  {
575 
576  }
577 
583  protected function getFieldDefinition()
584  {
585  // type-specific properties
586  }
587 
594  {
595  // type-specific properties
596  }
597 
604  protected function addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled = false)
605  {
606  // type-specific
607  }
608 
616  {
617  global $lng;
618 
619  $perm = $a_permissions->hasPermissions(
621  $this->getFieldId(),
622  array(
631  ));
632 
633  // title
634  $title = new ilTextInputGUI($lng->txt('title'), 'title');
635  $title->setValue($this->getTitle());
636  $title->setSize(20);
637  $title->setMaxLength(70);
638  $title->setRequired(true);
639  $a_form->addItem($title);
640 
642  {
643  $title->setDisabled(true);
644  }
645 
646  // desc
647  $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
648  $desc->setValue($this->getDescription());
649  $desc->setRows(3);
650  $desc->setCols(50);
651  $a_form->addItem($desc);
652 
654  {
655  $desc->setDisabled(true);
656  }
657 
658  // searchable
659  $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
660  $check->setChecked($this->isSearchable());
661  $check->setValue(1);
662  $a_form->addItem($check);
663 
665  !$this->isSearchSupported())
666  {
667  $check->setDisabled(true);
668  }
669 
670  /* required
671  $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
672  $check->setChecked($this->isRequired());
673  $check->setValue(1);
674  $a_form->addItem($check);
675  */
676 
677  $this->addCustomFieldToDefinitionForm($a_form,
679  }
680 
687  {
688  // type-specific
689  }
690 
698  {
699  if(!$a_form->getItemByPostVar("title")->getDisabled())
700  {
701  $this->setTitle($a_form->getInput("title"));
702  }
703  if(!$a_form->getItemByPostVar("description")->getDisabled())
704  {
705  $this->setDescription($a_form->getInput("description"));
706  }
707  if(!$a_form->getItemByPostVar("searchable")->getDisabled())
708  {
709  $this->setSearchable($a_form->getInput("searchable"));
710  }
711 
712  if($a_permissions->hasPermission(
714  $this->getFieldId(),
717  {
718  $this->importCustomDefinitionFormPostValues($a_form);
719  }
720  }
721 
723  {
724  return false;
725  }
726 
728  {
729  // type-specific
730  }
731 
733  {
734  $a_form->getItemByPostVar("title")->setDisabled(true);
735  $a_form->getItemByPostVar("description")->setDisabled(true);
736  $a_form->getItemByPostVar("searchable")->setDisabled(true);
737 
738  // checkboxes have no hidden on disabled
739  if($a_form->getInput("searchable"))
740  {
741  $hidden = new ilHiddenInputGUI("searchable");
742  $hidden->setValue(1);
743  $a_form->addItem($hidden);
744  }
745 
747  }
748 
749 
750  //
751  // definition CRUD
752  //
753 
759  protected function getLastPosition()
760  {
761  global $ilDB;
762 
763  $sql = "SELECT max(position) pos".
764  " FROM adv_mdf_definition".
765  " WHERE record_id = ".$ilDB->quote($this->getRecordId(), "integer");
766  $set = $ilDB->query($sql);
767  if($ilDB->numRows($set))
768  {
769  $pos = $ilDB->fetchAssoc($set);
770  return (int)$pos["pos"];
771  }
772 
773  return 0;
774  }
775 
782  public function generateImportId($a_field_id)
783  {
784  return 'il_'.IL_INST_ID.'_adv_md_field_'.$a_field_id;
785  }
786 
792  protected function getDBProperties()
793  {
794  $fields = array(
795  "field_type" => array("integer", $this->getType()),
796  "record_id" => array("integer", $this->getRecordId()),
797  "import_id" => array("text", $this->getImportId()),
798  "title" => array("text", $this->getTitle()),
799  "description" => array("text", $this->getDescription()),
800  "position" => array("integer", $this->getPosition()),
801  "searchable" => array("integer", $this->isSearchable()),
802  "required" => array("integer", $this->isRequired())
803  );
804 
805  $def = $this->getFieldDefinition();
806  if(is_array($def))
807  {
808  $fields["field_values"] = array("text", serialize($def));
809  }
810 
811  return $fields;
812  }
813 
819  protected function import(array $a_data)
820  {
821  $this->setFieldId($a_data["field_id"]);
822 
823  $this->setRecordId($a_data["record_id"]);
824  $this->setImportId($a_data["import_id"]);
825  $this->setTitle($a_data["title"]);
826  $this->setDescription($a_data["description"]);
827  $this->setPosition($a_data["position"]);
828  $this->setSearchable($a_data["searchable"]);
829  $this->setRequired($a_data["required"]);
830 
831  if($a_data["field_values"])
832  {
833  $this->importFieldDefinition(unserialize($a_data["field_values"]));
834  }
835  }
836 
840  protected function read($a_field_id)
841  {
842  global $ilDB;
843 
844  if(!(int)$a_field_id)
845  {
846  return;
847  }
848 
849  $sql = "SELECT * FROM adv_mdf_definition".
850  " WHERE field_id = ".$ilDB->quote($a_field_id, "integer");
851  $set = $ilDB->query($sql);
852  if($ilDB->numRows($set))
853  {
854  $row = $ilDB->fetchAssoc($set);
855  $this->import($row);
856  }
857  }
858 
862  public function save($a_keep_pos = false)
863  {
864  global $ilDB;
865 
866  if($this->getFieldId())
867  {
868  return $this->update();
869  }
870 
871  $next_id = $ilDB->nextId("adv_mdf_definition");
872 
873  // append
874  if(!$a_keep_pos)
875  {
876  $this->setPosition($this->getLastPosition()+1);
877  }
878 
879  // needs unique import id
880  if(!$this->getImportId())
881  {
882  $this->setImportId($this->generateImportId($next_id));
883  }
884 
885  $fields = $this->getDBProperties();
886  $fields["field_id"] = array("integer", $next_id);
887 
888  $ilDB->insert("adv_mdf_definition", $fields);
889 
890  $this->setFieldId($next_id);
891  }
892 
896  public function update()
897  {
898  global $ilDB;
899 
900  if(!$this->getFieldId())
901  {
902  return $this->save();
903  }
904 
905  $ilDB->update("adv_mdf_definition",
906  $this->getDBProperties(),
907  array("field_id"=>array("integer", $this->getFieldId())));
908  }
909 
913  public function delete()
914  {
915  global $ilDB;
916 
917  if(!$this->getFieldId())
918  {
919  return;
920  }
921 
922  // delete all values
923  include_once("Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
925 
926  $query = "DELETE FROM adv_mdf_definition".
927  " WHERE field_id = ".$ilDB->quote($this->getFieldId(), "integer");
928  $ilDB->manipulate($query);
929  }
930 
931 
932  //
933  // export/import
934  //
935 
943  public function toXML(ilXmlWriter $a_writer)
944  {
945  $a_writer->xmlStartTag('Field',array(
946  'id' => $this->generateImportId($this->getFieldId()),
947  'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
948  'fieldType' => self::getTypeString($this->getType())));
949 
950  $a_writer->xmlElement('FieldTitle',null,$this->getTitle());
951  $a_writer->xmlElement('FieldDescription',null,$this->getDescription());
952  $a_writer->xmlElement('FieldPosition',null,$this->getPosition());
953 
954  $this->addPropertiesToXML($a_writer);
955 
956  $a_writer->xmlEndTag('Field');
957  }
958 
964  protected function addPropertiesToXML(ilXmlWriter $a_writer)
965  {
966  // type-specific properties
967  }
968 
975  public function importXMLProperty($a_key, $a_value)
976  {
977 
978  }
979 
986  abstract public function getValueForXML(ilADT $element);
987 
993  abstract public function importValueFromXML($a_cdata);
994 
1003  public function importFromECS($a_ecs_type, $a_value, $a_sub_id)
1004  {
1005  return false;
1006  }
1007 
1008 
1009  //
1010  // presentation
1011  //
1012 
1018  public function prepareElementForEditor(ilADTFormBridge $a_bridge)
1019  {
1020  // type-specific
1021  }
1022 
1023 
1024  //
1025  // search
1026  //
1027 
1034  public function getSearchQueryParserValue(ilADTSearchBridge $a_adt_search)
1035  {
1036  return '';
1037  }
1038 
1045  public function getSearchValueSerialized(ilADTSearchBridge $a_adt_search)
1046  {
1047  return $a_adt_search->getSerializedValue();
1048  }
1049 
1056  public function setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value)
1057  {
1058  return $a_adt_search->setSerializedValue($a_value);
1059  }
1060 
1068  protected function parseSearchObjects(array $a_records, array $a_object_types)
1069  {
1070  global $ilDB;
1071 
1072  $res = array();
1073 
1074  $obj_ids = array();
1075  foreach($a_records as $record)
1076  {
1077  if($record["sub_type"] == "-")
1078  {
1079  $obj_ids[] = $record["obj_id"];
1080  }
1081  }
1082 
1083  $sql = "SELECT obj_id,type".
1084  " FROM object_data".
1085  " WHERE ".$ilDB->in("obj_id", $obj_ids, "", "integer").
1086  " AND ".$ilDB->in("type", $a_object_types, "", "text");
1087  $set = $ilDB->query($sql);
1088  while($row = $ilDB->fetchAssoc($set))
1089  {
1090  $res[] = $row;
1091  }
1092 
1093  return $res;
1094  }
1095 
1096  public function searchSubObjects(ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
1097  {
1098  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1100 
1101  // :TODO:
1102  if($a_adt_search instanceof ilADTLocationSearchBridgeSingle)
1103  {
1104  $element_id = "loc";
1105  }
1106 
1107  $condition = $a_adt_search->getSQLCondition($element_id);
1108  if($condition)
1109  {
1110  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition);
1111  if(sizeof($objects))
1112  {
1113  $res = array();
1114  foreach($objects as $item)
1115  {
1116  if($item["obj_id"] == $a_obj_id &&
1117  $item["sub_type"] == $sub_obj_type)
1118  {
1119  $res[] = $item["sub_id"];
1120  }
1121  }
1122  return $res;
1123  }
1124  }
1125 
1126  return array();
1127  }
1128 
1139  public function searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
1140  {
1141  // search type only supported/needed for text
1142 
1143  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1144  $condition = $a_adt_search->getSQLCondition(ilADTActiveRecordByType::SINGLE_COLUMN_NAME);
1145  if($condition)
1146  {
1147  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
1148  if(sizeof($objects))
1149  {
1150  return $this->parseSearchObjects($objects, $a_object_types);
1151  }
1152  return array();
1153  }
1154  }
1155 
1162  public function getLuceneSearchString($a_value)
1163  {
1164  return $a_value;
1165  }
1166 
1172  public function prepareElementForSearch(ilADTSearchBridge $a_bridge)
1173  {
1174  // type-specific
1175  }
1176 
1183  public function _clone($a_new_record_id)
1184  {
1185  $class = get_class($this);
1186  $obj = new $class();
1187  $obj->setRecordId($a_new_record_id);
1188  $obj->setTitle($this->getTitle());
1189  $obj->setDescription($this->getDescription());
1190  $obj->setRequired($this->isRequired());
1191  $obj->setPosition($this->getPosition());
1192  $obj->setSearchable($this->isSearchable());
1193  $obj->importFieldDefinition($this->getFieldDefinition());
1194  $obj->save(true);
1195 
1196  return $obj;
1197  }
1198 }
1199 
1200 ?>
parseSearchObjects(array $a_records, array $a_object_types)
Add object-data needed for global search to AMD search results.
isFilterSupported()
Is search by filter supported.
Base class for ILIAS Exception handling.
setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value)
Set value from search persistence.
getItemByPostVar($a_post_var)
Get Item by POST variable.
save($a_keep_pos=false)
Create new field entry.
This class represents a property form user interface.
hasPermissions($a_context_type, $a_context_id, array $a_action_ids)
Check permissions.
getADTDefinition()
Get ADT definition instance.
ADT form bridge base class.
importValueFromXML($a_cdata)
Import value from xml.
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled=false)
Add custom input elements to definition form.
importDefinitionFormPostValues(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
Import post values from definition form.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
setValue($a_value)
Set Value.
searchSubObjects(ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
static getADTGroupForDefinitions(array $a_defs)
Init ADTGroup for definitions.
XML writer class.
setSerializedValue($a_value)
Set current value(s) in serialized form (for easy persisting)
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
This class represents a checkbox property in a property form.
static _deleteByFieldId($a_field_id, ilADT $a_adt)
Delete values by field_id.
addItem($a_item)
Add Item (Property, SectionHeader).
importFromECS($a_ecs_type, $a_value, $a_sub_id)
Import meta data from ECS.
static getInstance()
Get singleton.
ADT base class.
Definition: class.ilADT.php:11
static getInstanceByImportId($a_import_id)
Get definition instance by import id.
xmlEndTag($tag)
Writes an endtag.
static getTypeString($a_type)
Get type string.
getDBProperties()
Get all definition properties for DB.
hasPermission($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
Check permission.
prepareCustomDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
getFieldDefinitionForTableGUI()
Parse properties for table gui.
$a_type
Definition: workflow.php:93
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form)
Import custom post values from definition form.
setChecked($a_checked)
Set Checked.
getSerializedValue()
Get current value(s) in serialized form (for easy persisting)
This class represents a hidden form property in a property form.
static find($a_table, $a_type, $a_field_id, $a_condition, $a_additional_fields=null)
Find entries.
getSearchQueryParserValue(ilADTSearchBridge $a_adt_search)
Get value for search query parser.
Advanced metadata permission helper.
getSearchValueSerialized(ilADTSearchBridge $a_adt_search)
Get value for search persistence.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static getSearchableDefinitionIds()
Get searchable definition ids (performance is key)
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
addToFieldDefinitionForm(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
Add input elements to definition form.
setSearchable($a_status)
Toggle searchable.
This class represents a text property in a property form.
generateImportId($a_field_id)
Generate unique record id.
getLastPosition()
Get last position of record.
__construct($a_field_id=null)
Constructor.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
importXMLProperty($a_key, $a_value)
Import property from XML.
prepareElementForSearch(ilADTSearchBridge $a_bridge)
Prepare search form elements.
static getValidTypes()
Get all valid types.
Create styles array
The data for the language used.
prepareElementForEditor(ilADTFormBridge $a_bridge)
Prepare editor form elements.
getLuceneSearchString($a_value)
Get search string in lucene syntax.
ADT search bridge base class.
getFieldDefinition()
Get (type-specific) field definition.
setADT(ilADT $a_adt)
Set ADT instance.
addPropertiesToXML(ilXmlWriter $a_writer)
Add (type-specific) properties to xml export.
getValueForXML(ilADT $element)
Parse ADT value for xml (export)
read($a_field_id)
Read field definition.
_clone($a_new_record_id)
Clone field definition.
importFieldDefinition(array $a_def)
Import (type-specific) field definition from DB.
global $lng
Definition: privfeed.php:17
This class represents a text area property in a property form.
global $ilDB
searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
Search objects.
initADTDefinition()
Init adt instance.
ADT definition base class.
isSearchSupported()
Is search supported at all.
getSQLCondition($a_element_id)
Get SQL condition for current value(s)
static getInstanceByTypeString($a_type)
Get instance by type string (used by import)
static isValidType($a_type)
Is given type valid.
prepareDefinitionFormConfirmation(ilPropertyFormGUI $a_form)