ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  const TYPE_EXTERNAL_LINK = 9;
36  const TYPE_INTERNAL_LINK = 10;
37 
44  public function __construct($a_field_id = null)
45  {
46  $this->init();
47  $this->read($a_field_id);
48  }
49 
57  public static function getInstance($a_field_id, $a_type = null)
58  {
59  global $DIC;
60 
61  $ilDB = $DIC['ilDB'];
62 
63  if (!$a_type) {
64  $set = $ilDB->query("SELECT field_type" .
65  " FROM adv_mdf_definition" .
66  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
67  $a_type = $ilDB->fetchAssoc($set);
68  $a_type = $a_type["field_type"];
69  }
70 
71  if (self::isValidType($a_type)) {
72  $class = "ilAdvancedMDFieldDefinition" . self::getTypeString($a_type);
73  require_once "Services/AdvancedMetaData/classes/Types/class." . $class . ".php";
74  return new $class($a_field_id);
75  }
76 
77  throw new ilException("unknown type " . $a_type);
78  }
79 
86  public static function getInstanceByTypeString($a_type)
87  {
88  // see self::getTypeString()
89  $map = array(
90  self::TYPE_TEXT => "Text",
91  self::TYPE_SELECT => "Select",
92  self::TYPE_DATE => "Date",
93  self::TYPE_DATETIME => "DateTime",
94  self::TYPE_FLOAT => "Float",
95  self::TYPE_LOCATION => "Location",
96  self::TYPE_INTEGER => "Integer",
97  self::TYPE_SELECT_MULTI => "SelectMulti" ,
98  self::TYPE_EXTERNAL_LINK => 'ExternalLink',
99  self::TYPE_INTERNAL_LINK => 'InternalLink'
100  );
101  $map = array_flip($map);
102  if (array_key_exists($a_type, $map)) {
103  return self::getInstance(null, $map[$a_type]);
104  }
105  }
106 
114  public static function getInstancesByRecordId($a_record_id, $a_only_searchable = false)
115  {
116  global $DIC;
117 
118  $ilDB = $DIC['ilDB'];
119 
120  $defs = array();
121 
122  $query = "SELECT * FROM adv_mdf_definition" .
123  " WHERE record_id = " . $ilDB->quote($a_record_id, "integer");
124  if ($a_only_searchable) {
125  $query .= " AND searchable = " . $ilDB->quote(1, "integer");
126  }
127  $query .= " ORDER BY position";
128  $set = $ilDB->query($query);
129  while ($row = $ilDB->fetchAssoc($set)) {
130  $field = self::getInstance(null, $row["field_type"]);
131  $field->import($row);
132  $defs[$row["field_id"]] = $field;
133  }
134 
135  return $defs;
136  }
137 
138  public static function getInstancesByObjType($a_obj_type, $a_active_only = true)
139  {
140  global $DIC;
141 
142  $ilDB = $DIC['ilDB'];
143 
144  $defs = array();
145 
146  $query = "SELECT amf.* FROM adv_md_record_objs aro" .
147  " JOIN adv_md_record amr ON aro.record_id = amr.record_id" .
148  " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id" .
149  " WHERE obj_type = " . $ilDB->quote($a_obj_type, 'text');
150  if ((bool) $a_active_only) {
151  $query .= " AND active = " . $ilDB->quote(1, "integer");
152  }
153  $query .= " ORDER BY aro.record_id,position";
154  $res = $ilDB->query($query);
155  while ($row = $ilDB->fetchAssoc($res)) {
156  $field = self::getInstance(null, $row["field_type"]);
157  $field->import($row);
158  $defs[$row["field_id"]] = $field;
159  }
160  return $defs;
161  }
162 
169  public static function getInstanceByImportId($a_import_id)
170  {
171  global $DIC;
172 
173  $ilDB = $DIC['ilDB'];
174 
175  $query = "SELECT field_id, field_type FROM adv_mdf_definition" .
176  " WHERE import_id = " . $ilDB->quote($a_import_id, 'text');
177  $set = $ilDB->query($query);
178  if ($ilDB->numRows($set)) {
179  $row = $ilDB->fetchAssoc($set);
180  return self::getInstance($row["field_id"], $row["field_type"]);
181  }
182  }
183 
189  public static function getSearchableDefinitionIds()
190  {
191  global $DIC;
192 
193  $ilDB = $DIC['ilDB'];
194 
195  $field_ids = array();
196 
197  $query = "SELECT field_id FROM adv_md_record amr" .
198  " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)" .
199  " WHERE active = " . $ilDB->quote(1, "integer") .
200  " AND searchable = " . $ilDB->quote(1, "integer");
201  $set = $ilDB->query($query);
202  while ($row = $ilDB->fetchAssoc($set)) {
203  $field_ids[] = $row["field_id"];
204  }
205  return $field_ids;
206  }
207 
214  public static function getADTGroupForDefinitions(array $a_defs)
215  {
217  $group_def = $factory->getDefinitionInstanceByType("Group");
218  foreach ($a_defs as $def) {
219  $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
220  }
221  $group = $factory->getInstanceByDefinition($group_def);
222 
223  // bind adt instances to definition
224  foreach ($group->getElements() as $element_id => $element) {
225  $a_defs[$element_id]->setADT($element);
226  }
227 
228  return $group;
229  }
230 
234  protected function init()
235  {
236  $this->setRequired(false);
237  $this->setSearchable(false);
238  }
239 
240 
241  //
242  // generic types
243  //
244 
250  public static function getValidTypes()
251  {
252  return array(
253  self::TYPE_TEXT,
254  self::TYPE_DATE,
255  self::TYPE_DATETIME,
256  self::TYPE_SELECT,
257  self::TYPE_INTEGER,
258  self::TYPE_FLOAT,
259  self::TYPE_LOCATION,
260  self::TYPE_SELECT_MULTI,
261  self::TYPE_EXTERNAL_LINK,
262  self::TYPE_INTERNAL_LINK
263  );
264  }
265 
272  public static function isValidType($a_type)
273  {
274  return in_array((int) $a_type, self::getValidTypes());
275  }
276 
282  abstract public function getType();
283 
290  protected static function getTypeString($a_type)
291  {
292  if (self::isValidType($a_type)) {
293  $map = array(
294  self::TYPE_TEXT => "Text",
295  self::TYPE_SELECT => "Select",
296  self::TYPE_DATE => "Date",
297  self::TYPE_DATETIME => "DateTime",
298  self::TYPE_FLOAT => "Float",
299  self::TYPE_LOCATION => "Location",
300  self::TYPE_INTEGER => "Integer",
301  self::TYPE_SELECT_MULTI => "SelectMulti" ,
302  self::TYPE_EXTERNAL_LINK => 'ExternalLink',
303  self::TYPE_INTERNAL_LINK => 'InternalLink'
304  );
305  return $map[$a_type];
306  }
307  }
308 
314  public function getTypeTitle()
315  {
316  // :TODO: reuse udf stuff here ?!
317  return "udf_type_" . strtolower(self::getTypeString($this->getType()));
318  }
319 
320 
321 
322  //
323  // ADT
324  //
325 
331  abstract protected function initADTDefinition();
332 
338  public function getADTDefinition()
339  {
340  if (!$this->adt_def instanceof ilADTDefinition) {
341  $this->adt_def = $this->initADTDefinition();
342  }
343  return $this->adt_def;
344  }
345 
351  public function getADT()
352  {
353  if (!$this->adt instanceof ilADT) {
354  $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
355  }
356  return $this->adt;
357  }
358 
365  protected function setADT(ilADT $a_adt)
366  {
367  if (!$this->adt instanceof ilADT) {
368  $this->adt = $a_adt;
369  }
370  }
371 
372  //
373  // properties
374  //
375 
381  protected function setFieldId($a_id)
382  {
383  $this->field_id = (int) $a_id;
384  }
385 
391  public function getFieldId()
392  {
393  return $this->field_id;
394  }
395 
401  public function setRecordId($a_id)
402  {
403  $this->record_id = (int) $a_id;
404  }
405 
411  public function getRecordId()
412  {
413  return $this->record_id;
414  }
415 
421  public function setImportId($a_id_string)
422  {
423  if ($a_id_string !== null) {
424  $a_id_string = trim($a_id_string);
425  }
426  $this->import_id = $a_id_string;
427  }
428 
434  public function getImportId()
435  {
436  return $this->import_id;
437  }
438 
444  public function setPosition($a_pos)
445  {
446  $this->position = (int) $a_pos;
447  }
448 
454  public function getPosition()
455  {
456  return $this->position;
457  }
458 
464  public function setTitle($a_title)
465  {
466  if ($a_title !== null) {
467  $a_title = trim($a_title);
468  }
469  $this->title = $a_title;
470  }
471 
477  public function getTitle()
478  {
479  return $this->title;
480  }
481 
487  public function setDescription($a_desc)
488  {
489  if ($a_desc !== null) {
490  $a_desc = trim($a_desc);
491  }
492  $this->description = $a_desc;
493  }
494 
500  public function getDescription()
501  {
502  return $this->description;
503  }
504 
510  public function isSearchSupported()
511  {
512  return true;
513  }
514 
520  public function isFilterSupported()
521  {
522  return true;
523  }
524 
530  public function setSearchable($a_status)
531  {
532  // see above
533  if (!$this->isSearchSupported()) {
534  $a_status = false;
535  }
536  $this->searchable = (bool) $a_status;
537  }
538 
544  public function isSearchable()
545  {
546  return $this->searchable;
547  }
548 
554  public function setRequired($a_status)
555  {
556  $this->required = (bool) $a_status;
557  }
558 
564  public function isRequired()
565  {
566  return $this->required;
567  }
568 
569 
570  //
571  // definition (NOT ADT-based)
572  //
573 
579  protected function importFieldDefinition(array $a_def)
580  {
581  }
582 
588  protected function getFieldDefinition()
589  {
590  // type-specific properties
591  }
592 
599  {
600  // type-specific properties
601  }
602 
609  protected function addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled = false)
610  {
611  // type-specific
612  }
613 
621  {
622  global $DIC;
623 
624  $lng = $DIC['lng'];
625 
626  $perm = $a_permissions->hasPermissions(
628  $this->getFieldId(),
629  array(
638  )
639  );
640 
641  // title
642  $title = new ilTextInputGUI($lng->txt('title'), 'title');
643  $title->setValue($this->getTitle());
644  $title->setSize(20);
645  $title->setMaxLength(70);
646  $title->setRequired(true);
647  $a_form->addItem($title);
648 
650  $title->setDisabled(true);
651  }
652 
653  // desc
654  $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
655  $desc->setValue($this->getDescription());
656  $desc->setRows(3);
657  $desc->setCols(50);
658  $a_form->addItem($desc);
659 
661  $desc->setDisabled(true);
662  }
663 
664  // searchable
665  $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
666  $check->setChecked($this->isSearchable());
667  $check->setValue(1);
668  $a_form->addItem($check);
669 
671  !$this->isSearchSupported()) {
672  $check->setDisabled(true);
673  }
674 
675  /* required
676  $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
677  $check->setChecked($this->isRequired());
678  $check->setValue(1);
679  $a_form->addItem($check);
680  */
681 
683  $a_form,
685  );
686  }
687 
694  {
695  // type-specific
696  }
697 
705  {
706  if (!$a_form->getItemByPostVar("title")->getDisabled()) {
707  $this->setTitle($a_form->getInput("title"));
708  }
709  if (!$a_form->getItemByPostVar("description")->getDisabled()) {
710  $this->setDescription($a_form->getInput("description"));
711  }
712  if (!$a_form->getItemByPostVar("searchable")->getDisabled()) {
713  $this->setSearchable($a_form->getInput("searchable"));
714  }
715 
716  if ($a_permissions->hasPermission(
718  $this->getFieldId(),
721  )) {
722  $this->importCustomDefinitionFormPostValues($a_form);
723  }
724  }
725 
727  {
728  return false;
729  }
730 
732  {
733  // type-specific
734  }
735 
737  {
738  $a_form->getItemByPostVar("title")->setDisabled(true);
739  $a_form->getItemByPostVar("description")->setDisabled(true);
740  $a_form->getItemByPostVar("searchable")->setDisabled(true);
741 
742  // checkboxes have no hidden on disabled
743  if ($a_form->getInput("searchable")) {
744  $hidden = new ilHiddenInputGUI("searchable");
745  $hidden->setValue(1);
746  $a_form->addItem($hidden);
747  }
748 
750  }
751 
752 
753  //
754  // definition CRUD
755  //
756 
762  protected function getLastPosition()
763  {
764  global $DIC;
765 
766  $ilDB = $DIC['ilDB'];
767 
768  $sql = "SELECT max(position) pos" .
769  " FROM adv_mdf_definition" .
770  " WHERE record_id = " . $ilDB->quote($this->getRecordId(), "integer");
771  $set = $ilDB->query($sql);
772  if ($ilDB->numRows($set)) {
773  $pos = $ilDB->fetchAssoc($set);
774  return (int) $pos["pos"];
775  }
776 
777  return 0;
778  }
779 
786  public function generateImportId($a_field_id)
787  {
788  return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
789  }
790 
796  protected function getDBProperties()
797  {
798  $fields = array(
799  "field_type" => array("integer", $this->getType()),
800  "record_id" => array("integer", $this->getRecordId()),
801  "import_id" => array("text", $this->getImportId()),
802  "title" => array("text", $this->getTitle()),
803  "description" => array("text", $this->getDescription()),
804  "position" => array("integer", $this->getPosition()),
805  "searchable" => array("integer", $this->isSearchable()),
806  "required" => array("integer", $this->isRequired())
807  );
808 
809  $def = $this->getFieldDefinition();
810  if (is_array($def)) {
811  $fields["field_values"] = array("text", serialize($def));
812  }
813 
814  return $fields;
815  }
816 
822  protected function import(array $a_data)
823  {
824  $this->setFieldId($a_data["field_id"]);
825 
826  $this->setRecordId($a_data["record_id"]);
827  $this->setImportId($a_data["import_id"]);
828  $this->setTitle($a_data["title"]);
829  $this->setDescription($a_data["description"]);
830  $this->setPosition($a_data["position"]);
831  $this->setSearchable($a_data["searchable"]);
832  $this->setRequired($a_data["required"]);
833  if ($a_data["field_values"]) {
834  $this->importFieldDefinition(unserialize($a_data["field_values"]));
835  }
836  }
837 
841  protected function read($a_field_id)
842  {
843  global $DIC;
844 
845  $ilDB = $DIC['ilDB'];
846 
847  if (!(int) $a_field_id) {
848  return;
849  }
850 
851  $sql = "SELECT * FROM adv_mdf_definition" .
852  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer");
853  $set = $ilDB->query($sql);
854  if ($ilDB->numRows($set)) {
855  $row = $ilDB->fetchAssoc($set);
856  $this->import($row);
857  }
858  }
859 
863  public function save($a_keep_pos = false)
864  {
865  global $DIC;
866 
867  $ilDB = $DIC['ilDB'];
868 
869  if ($this->getFieldId()) {
870  return $this->update();
871  }
872 
873  $next_id = $ilDB->nextId("adv_mdf_definition");
874 
875  // append
876  if (!$a_keep_pos) {
877  $this->setPosition($this->getLastPosition() + 1);
878  }
879 
880  // needs unique import id
881  if (!$this->getImportId()) {
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 $DIC;
899 
900  $ilDB = $DIC['ilDB'];
901 
902  if (!$this->getFieldId()) {
903  return $this->save();
904  }
905 
906  $ilDB->update(
907  "adv_mdf_definition",
908  $this->getDBProperties(),
909  array("field_id" => array("integer", $this->getFieldId()))
910  );
911  }
912 
916  public function delete()
917  {
918  global $DIC;
919 
920  $ilDB = $DIC['ilDB'];
921 
922  if (!$this->getFieldId()) {
923  return;
924  }
925 
926  // delete all values
927  include_once("Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
929 
930  $query = "DELETE FROM adv_mdf_definition" .
931  " WHERE field_id = " . $ilDB->quote($this->getFieldId(), "integer");
932  $ilDB->manipulate($query);
933  }
934 
935 
936  //
937  // export/import
938  //
939 
947  public function toXML(ilXmlWriter $a_writer)
948  {
949  $a_writer->xmlStartTag('Field', array(
950  'id' => $this->generateImportId($this->getFieldId()),
951  'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
952  'fieldType' => self::getTypeString($this->getType())));
953 
954  $a_writer->xmlElement('FieldTitle', null, $this->getTitle());
955  $a_writer->xmlElement('FieldDescription', null, $this->getDescription());
956  $a_writer->xmlElement('FieldPosition', null, $this->getPosition());
957 
958  $this->addPropertiesToXML($a_writer);
959 
960  $a_writer->xmlEndTag('Field');
961  }
962 
968  protected function addPropertiesToXML(ilXmlWriter $a_writer)
969  {
970  // type-specific properties
971  }
972 
979  public function importXMLProperty($a_key, $a_value)
980  {
981  }
982 
989  abstract public function getValueForXML(ilADT $element);
990 
996  abstract public function importValueFromXML($a_cdata);
997 
1006  public function importFromECS($a_ecs_type, $a_value, $a_sub_id)
1007  {
1008  return false;
1009  }
1010 
1011 
1012  //
1013  // presentation
1014  //
1015 
1021  public function prepareElementForEditor(ilADTFormBridge $a_bridge)
1022  {
1023  // type-specific
1024  }
1025 
1026 
1027  //
1028  // search
1029  //
1030 
1037  public function getSearchQueryParserValue(ilADTSearchBridge $a_adt_search)
1038  {
1039  return '';
1040  }
1041 
1048  public function getSearchValueSerialized(ilADTSearchBridge $a_adt_search)
1049  {
1050  return $a_adt_search->getSerializedValue();
1051  }
1052 
1059  public function setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value)
1060  {
1061  return $a_adt_search->setSerializedValue($a_value);
1062  }
1063 
1071  protected function parseSearchObjects(array $a_records, array $a_object_types)
1072  {
1073  global $DIC;
1074 
1075  $ilDB = $DIC['ilDB'];
1076 
1077  $res = array();
1078 
1079  $obj_ids = array();
1080  foreach ($a_records as $record) {
1081  if ($record["sub_type"] == "-") {
1082  $obj_ids[] = $record["obj_id"];
1083  }
1084  }
1085 
1086  $sql = "SELECT obj_id,type" .
1087  " FROM object_data" .
1088  " WHERE " . $ilDB->in("obj_id", $obj_ids, "", "integer") .
1089  " AND " . $ilDB->in("type", $a_object_types, "", "text");
1090  $set = $ilDB->query($sql);
1091  while ($row = $ilDB->fetchAssoc($set)) {
1092  $res[] = $row;
1093  }
1094 
1095  return $res;
1096  }
1097 
1098  public function searchSubObjects(ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
1099  {
1100  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1102 
1103  // :TODO:
1104  if ($a_adt_search instanceof ilADTLocationSearchBridgeSingle) {
1105  $element_id = "loc";
1106  }
1107 
1108  $condition = $a_adt_search->getSQLCondition($element_id);
1109  if ($condition) {
1110  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition);
1111  if (sizeof($objects)) {
1112  $res = array();
1113  foreach ($objects as $item) {
1114  if ($item["obj_id"] == $a_obj_id &&
1115  $item["sub_type"] == $sub_obj_type) {
1116  $res[] = $item["sub_id"];
1117  }
1118  }
1119  return $res;
1120  }
1121  }
1122 
1123  return array();
1124  }
1125 
1136  public function searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
1137  {
1138  // search type only supported/needed for text
1139 
1140  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1141  $condition = $a_adt_search->getSQLCondition(ilADTActiveRecordByType::SINGLE_COLUMN_NAME);
1142  if ($condition) {
1143  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
1144  if (sizeof($objects)) {
1145  return $this->parseSearchObjects($objects, $a_object_types);
1146  }
1147  return array();
1148  }
1149  }
1150 
1157  public function getLuceneSearchString($a_value)
1158  {
1159  return $a_value;
1160  }
1161 
1167  public function prepareElementForSearch(ilADTSearchBridge $a_bridge)
1168  {
1169  // type-specific
1170  }
1171 
1178  public function _clone($a_new_record_id)
1179  {
1180  $class = get_class($this);
1181  $obj = new $class();
1182  $obj->setRecordId($a_new_record_id);
1183  $obj->setTitle($this->getTitle());
1184  $obj->setDescription($this->getDescription());
1185  $obj->setRequired($this->isRequired());
1186  $obj->setPosition($this->getPosition());
1187  $obj->setSearchable($this->isSearchable());
1188  $obj->importFieldDefinition((array) $this->getFieldDefinition());
1189  $obj->save(true);
1190 
1191  return $obj;
1192  }
1193 }
parseSearchObjects(array $a_records, array $a_object_types)
Add object-data needed for global search to AMD search results.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
isFilterSupported()
Is search by filter supported.
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.
global $DIC
Definition: saml.php:7
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.
$factory
Definition: metadata.php:43
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)
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:92
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.
foreach($_POST as $key=> $value) $res
$lng
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.
$query
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.
prepareElementForEditor(ilADTFormBridge $a_bridge)
Prepare editor form elements.
$row
getLuceneSearchString($a_value)
Get search string in lucene syntax.
ADT search bridge base class.
getFieldDefinition()
Get (type-specific) field definition.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
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.
This class represents a text area property in a property form.
global $ilDB
$def
Definition: croninfo.php:21
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)