ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilDB;
60 
61  if (!$a_type) {
62  $set = $ilDB->query("SELECT field_type" .
63  " FROM adv_mdf_definition" .
64  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer"));
65  $a_type = $ilDB->fetchAssoc($set);
66  $a_type = $a_type["field_type"];
67  }
68 
69  if (self::isValidType($a_type)) {
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  self::TYPE_EXTERNAL_LINK => 'ExternalLink',
97  self::TYPE_INTERNAL_LINK => 'InternalLink'
98  );
99  $map = array_flip($map);
100  if (array_key_exists($a_type, $map)) {
101  return self::getInstance(null, $map[$a_type]);
102  }
103  }
104 
112  public static function getInstancesByRecordId($a_record_id, $a_only_searchable = false)
113  {
114  global $ilDB;
115 
116  $defs = array();
117 
118  $query = "SELECT * FROM adv_mdf_definition" .
119  " WHERE record_id = " . $ilDB->quote($a_record_id, "integer");
120  if ($a_only_searchable) {
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  $field = self::getInstance(null, $row["field_type"]);
127  $field->import($row);
128  $defs[$row["field_id"]] = $field;
129  }
130 
131  return $defs;
132  }
133 
134  public static function getInstancesByObjType($a_obj_type, $a_active_only = true)
135  {
136  global $ilDB;
137 
138  $defs = array();
139 
140  $query = "SELECT amf.* FROM adv_md_record_objs aro" .
141  " JOIN adv_md_record amr ON aro.record_id = amr.record_id" .
142  " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id" .
143  " WHERE obj_type = " . $ilDB->quote($a_obj_type, 'text');
144  if ((bool) $a_active_only) {
145  $query .= " AND active = " . $ilDB->quote(1, "integer");
146  }
147  $query .= " ORDER BY aro.record_id,position";
148  $res = $ilDB->query($query);
149  while ($row = $ilDB->fetchAssoc($res)) {
150  $field = self::getInstance(null, $row["field_type"]);
151  $field->import($row);
152  $defs[$row["field_id"]] = $field;
153  }
154  return $defs;
155  }
156 
163  public static function getInstanceByImportId($a_import_id)
164  {
165  global $ilDB;
166 
167  $query = "SELECT field_id, field_type FROM adv_mdf_definition" .
168  " WHERE import_id = " . $ilDB->quote($a_import_id, 'text');
169  $set = $ilDB->query($query);
170  if ($ilDB->numRows($set)) {
171  $row = $ilDB->fetchAssoc($set);
172  return self::getInstance($row["field_id"], $row["field_type"]);
173  }
174  }
175 
181  public static function getSearchableDefinitionIds()
182  {
183  global $ilDB;
184 
185  $field_ids = array();
186 
187  $query = "SELECT field_id FROM adv_md_record amr" .
188  " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)" .
189  " WHERE active = " . $ilDB->quote(1, "integer") .
190  " AND searchable = " . $ilDB->quote(1, "integer");
191  $set = $ilDB->query($query);
192  while ($row = $ilDB->fetchAssoc($set)) {
193  $field_ids[] = $row["field_id"];
194  }
195  return $field_ids;
196  }
197 
204  public static function getADTGroupForDefinitions(array $a_defs)
205  {
207  $group_def = $factory->getDefinitionInstanceByType("Group");
208  foreach ($a_defs as $def) {
209  $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
210  }
211  $group = $factory->getInstanceByDefinition($group_def);
212 
213  // bind adt instances to definition
214  foreach ($group->getElements() as $element_id => $element) {
215  $a_defs[$element_id]->setADT($element);
216  }
217 
218  return $group;
219  }
220 
224  protected function init()
225  {
226  $this->setRequired(false);
227  $this->setSearchable(false);
228  }
229 
230 
231  //
232  // generic types
233  //
234 
240  public static function getValidTypes()
241  {
242  return array(
243  self::TYPE_TEXT,
244  self::TYPE_DATE,
245  self::TYPE_DATETIME,
246  self::TYPE_SELECT,
247  self::TYPE_INTEGER,
248  self::TYPE_FLOAT,
249  self::TYPE_LOCATION,
250  self::TYPE_SELECT_MULTI,
251  self::TYPE_EXTERNAL_LINK,
252  self::TYPE_INTERNAL_LINK
253  );
254  }
255 
262  public static function isValidType($a_type)
263  {
264  return in_array((int) $a_type, self::getValidTypes());
265  }
266 
272  abstract public function getType();
273 
280  protected static function getTypeString($a_type)
281  {
282  if (self::isValidType($a_type)) {
283  $map = array(
284  self::TYPE_TEXT => "Text",
285  self::TYPE_SELECT => "Select",
286  self::TYPE_DATE => "Date",
287  self::TYPE_DATETIME => "DateTime",
288  self::TYPE_FLOAT => "Float",
289  self::TYPE_LOCATION => "Location",
290  self::TYPE_INTEGER => "Integer",
291  self::TYPE_SELECT_MULTI => "SelectMulti" ,
292  self::TYPE_EXTERNAL_LINK => 'ExternalLink',
293  self::TYPE_INTERNAL_LINK => 'InternalLink'
294  );
295  return $map[$a_type];
296  }
297  }
298 
304  public function getTypeTitle()
305  {
306  // :TODO: reuse udf stuff here ?!
307  return "udf_type_" . strtolower(self::getTypeString($this->getType()));
308  }
309 
310 
311 
312  //
313  // ADT
314  //
315 
321  abstract protected function initADTDefinition();
322 
328  public function getADTDefinition()
329  {
330  if (!$this->adt_def instanceof ilADTDefinition) {
331  $this->adt_def = $this->initADTDefinition();
332  }
333  return $this->adt_def;
334  }
335 
341  public function getADT()
342  {
343  if (!$this->adt instanceof ilADT) {
344  $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
345  }
346  return $this->adt;
347  }
348 
355  protected function setADT(ilADT $a_adt)
356  {
357  if (!$this->adt instanceof ilADT) {
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  $a_id_string = trim($a_id_string);
415  }
416  $this->import_id = $a_id_string;
417  }
418 
424  public function getImportId()
425  {
426  return $this->import_id;
427  }
428 
434  public function setPosition($a_pos)
435  {
436  $this->position = (int) $a_pos;
437  }
438 
444  public function getPosition()
445  {
446  return $this->position;
447  }
448 
454  public function setTitle($a_title)
455  {
456  if ($a_title !== null) {
457  $a_title = trim($a_title);
458  }
459  $this->title = $a_title;
460  }
461 
467  public function getTitle()
468  {
469  return $this->title;
470  }
471 
477  public function setDescription($a_desc)
478  {
479  if ($a_desc !== null) {
480  $a_desc = trim($a_desc);
481  }
482  $this->description = $a_desc;
483  }
484 
490  public function getDescription()
491  {
492  return $this->description;
493  }
494 
500  public function isSearchSupported()
501  {
502  return true;
503  }
504 
510  public function isFilterSupported()
511  {
512  return true;
513  }
514 
520  public function setSearchable($a_status)
521  {
522  // see above
523  if (!$this->isSearchSupported()) {
524  $a_status = false;
525  }
526  $this->searchable = (bool) $a_status;
527  }
528 
534  public function isSearchable()
535  {
536  return $this->searchable;
537  }
538 
544  public function setRequired($a_status)
545  {
546  $this->required = (bool) $a_status;
547  }
548 
554  public function isRequired()
555  {
556  return $this->required;
557  }
558 
559 
560  //
561  // definition (NOT ADT-based)
562  //
563 
569  protected function importFieldDefinition(array $a_def)
570  {
571  }
572 
578  protected function getFieldDefinition()
579  {
580  // type-specific properties
581  }
582 
589  {
590  // type-specific properties
591  }
592 
599  protected function addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled = false)
600  {
601  // type-specific
602  }
603 
611  {
612  global $lng;
613 
614  $perm = $a_permissions->hasPermissions(
616  $this->getFieldId(),
617  array(
626  )
627  );
628 
629  // title
630  $title = new ilTextInputGUI($lng->txt('title'), 'title');
631  $title->setValue($this->getTitle());
632  $title->setSize(20);
633  $title->setMaxLength(70);
634  $title->setRequired(true);
635  $a_form->addItem($title);
636 
638  $title->setDisabled(true);
639  }
640 
641  // desc
642  $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
643  $desc->setValue($this->getDescription());
644  $desc->setRows(3);
645  $desc->setCols(50);
646  $a_form->addItem($desc);
647 
649  $desc->setDisabled(true);
650  }
651 
652  // searchable
653  $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
654  $check->setChecked($this->isSearchable());
655  $check->setValue(1);
656  $a_form->addItem($check);
657 
659  !$this->isSearchSupported()) {
660  $check->setDisabled(true);
661  }
662 
663  /* required
664  $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
665  $check->setChecked($this->isRequired());
666  $check->setValue(1);
667  $a_form->addItem($check);
668  */
669 
671  $a_form,
673  );
674  }
675 
682  {
683  // type-specific
684  }
685 
693  {
694  if (!$a_form->getItemByPostVar("title")->getDisabled()) {
695  $this->setTitle($a_form->getInput("title"));
696  }
697  if (!$a_form->getItemByPostVar("description")->getDisabled()) {
698  $this->setDescription($a_form->getInput("description"));
699  }
700  if (!$a_form->getItemByPostVar("searchable")->getDisabled()) {
701  $this->setSearchable($a_form->getInput("searchable"));
702  }
703 
704  if ($a_permissions->hasPermission(
706  $this->getFieldId(),
709  )) {
710  $this->importCustomDefinitionFormPostValues($a_form);
711  }
712  }
713 
715  {
716  return false;
717  }
718 
720  {
721  // type-specific
722  }
723 
725  {
726  $a_form->getItemByPostVar("title")->setDisabled(true);
727  $a_form->getItemByPostVar("description")->setDisabled(true);
728  $a_form->getItemByPostVar("searchable")->setDisabled(true);
729 
730  // checkboxes have no hidden on disabled
731  if ($a_form->getInput("searchable")) {
732  $hidden = new ilHiddenInputGUI("searchable");
733  $hidden->setValue(1);
734  $a_form->addItem($hidden);
735  }
736 
738  }
739 
740 
741  //
742  // definition CRUD
743  //
744 
750  protected function getLastPosition()
751  {
752  global $ilDB;
753 
754  $sql = "SELECT max(position) pos" .
755  " FROM adv_mdf_definition" .
756  " WHERE record_id = " . $ilDB->quote($this->getRecordId(), "integer");
757  $set = $ilDB->query($sql);
758  if ($ilDB->numRows($set)) {
759  $pos = $ilDB->fetchAssoc($set);
760  return (int) $pos["pos"];
761  }
762 
763  return 0;
764  }
765 
772  public function generateImportId($a_field_id)
773  {
774  return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
775  }
776 
782  protected function getDBProperties()
783  {
784  $fields = array(
785  "field_type" => array("integer", $this->getType()),
786  "record_id" => array("integer", $this->getRecordId()),
787  "import_id" => array("text", $this->getImportId()),
788  "title" => array("text", $this->getTitle()),
789  "description" => array("text", $this->getDescription()),
790  "position" => array("integer", $this->getPosition()),
791  "searchable" => array("integer", $this->isSearchable()),
792  "required" => array("integer", $this->isRequired())
793  );
794 
795  $def = $this->getFieldDefinition();
796  if (is_array($def)) {
797  $fields["field_values"] = array("text", serialize($def));
798  }
799 
800  return $fields;
801  }
802 
808  protected function import(array $a_data)
809  {
810  $this->setFieldId($a_data["field_id"]);
811 
812  $this->setRecordId($a_data["record_id"]);
813  $this->setImportId($a_data["import_id"]);
814  $this->setTitle($a_data["title"]);
815  $this->setDescription($a_data["description"]);
816  $this->setPosition($a_data["position"]);
817  $this->setSearchable($a_data["searchable"]);
818  $this->setRequired($a_data["required"]);
819  if ($a_data["field_values"]) {
820  $this->importFieldDefinition(unserialize($a_data["field_values"]));
821  }
822  }
823 
827  protected function read($a_field_id)
828  {
829  global $ilDB;
830 
831  if (!(int) $a_field_id) {
832  return;
833  }
834 
835  $sql = "SELECT * FROM adv_mdf_definition" .
836  " WHERE field_id = " . $ilDB->quote($a_field_id, "integer");
837  $set = $ilDB->query($sql);
838  if ($ilDB->numRows($set)) {
839  $row = $ilDB->fetchAssoc($set);
840  $this->import($row);
841  }
842  }
843 
847  public function save($a_keep_pos = false)
848  {
849  global $ilDB;
850 
851  if ($this->getFieldId()) {
852  return $this->update();
853  }
854 
855  $next_id = $ilDB->nextId("adv_mdf_definition");
856 
857  // append
858  if (!$a_keep_pos) {
859  $this->setPosition($this->getLastPosition()+1);
860  }
861 
862  // needs unique import id
863  if (!$this->getImportId()) {
864  $this->setImportId($this->generateImportId($next_id));
865  }
866 
867  $fields = $this->getDBProperties();
868  $fields["field_id"] = array("integer", $next_id);
869 
870  $ilDB->insert("adv_mdf_definition", $fields);
871 
872  $this->setFieldId($next_id);
873  }
874 
878  public function update()
879  {
880  global $ilDB;
881 
882  if (!$this->getFieldId()) {
883  return $this->save();
884  }
885 
886  $ilDB->update(
887  "adv_mdf_definition",
888  $this->getDBProperties(),
889  array("field_id"=>array("integer", $this->getFieldId()))
890  );
891  }
892 
896  public function delete()
897  {
898  global $ilDB;
899 
900  if (!$this->getFieldId()) {
901  return;
902  }
903 
904  // delete all values
905  include_once("Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
907 
908  $query = "DELETE FROM adv_mdf_definition" .
909  " WHERE field_id = " . $ilDB->quote($this->getFieldId(), "integer");
910  $ilDB->manipulate($query);
911  }
912 
913 
914  //
915  // export/import
916  //
917 
925  public function toXML(ilXmlWriter $a_writer)
926  {
927  $a_writer->xmlStartTag('Field', array(
928  'id' => $this->generateImportId($this->getFieldId()),
929  'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
930  'fieldType' => self::getTypeString($this->getType())));
931 
932  $a_writer->xmlElement('FieldTitle', null, $this->getTitle());
933  $a_writer->xmlElement('FieldDescription', null, $this->getDescription());
934  $a_writer->xmlElement('FieldPosition', null, $this->getPosition());
935 
936  $this->addPropertiesToXML($a_writer);
937 
938  $a_writer->xmlEndTag('Field');
939  }
940 
946  protected function addPropertiesToXML(ilXmlWriter $a_writer)
947  {
948  // type-specific properties
949  }
950 
957  public function importXMLProperty($a_key, $a_value)
958  {
959  }
960 
967  abstract public function getValueForXML(ilADT $element);
968 
974  abstract public function importValueFromXML($a_cdata);
975 
984  public function importFromECS($a_ecs_type, $a_value, $a_sub_id)
985  {
986  return false;
987  }
988 
989 
990  //
991  // presentation
992  //
993 
999  public function prepareElementForEditor(ilADTFormBridge $a_bridge)
1000  {
1001  // type-specific
1002  }
1003 
1004 
1005  //
1006  // search
1007  //
1008 
1015  public function getSearchQueryParserValue(ilADTSearchBridge $a_adt_search)
1016  {
1017  return '';
1018  }
1019 
1026  public function getSearchValueSerialized(ilADTSearchBridge $a_adt_search)
1027  {
1028  return $a_adt_search->getSerializedValue();
1029  }
1030 
1037  public function setSearchValueSerialized(ilADTSearchBridge $a_adt_search, $a_value)
1038  {
1039  return $a_adt_search->setSerializedValue($a_value);
1040  }
1041 
1049  protected function parseSearchObjects(array $a_records, array $a_object_types)
1050  {
1051  global $ilDB;
1052 
1053  $res = array();
1054 
1055  $obj_ids = array();
1056  foreach ($a_records as $record) {
1057  if ($record["sub_type"] == "-") {
1058  $obj_ids[] = $record["obj_id"];
1059  }
1060  }
1061 
1062  $sql = "SELECT obj_id,type" .
1063  " FROM object_data" .
1064  " WHERE " . $ilDB->in("obj_id", $obj_ids, "", "integer") .
1065  " AND " . $ilDB->in("type", $a_object_types, "", "text");
1066  $set = $ilDB->query($sql);
1067  while ($row = $ilDB->fetchAssoc($set)) {
1068  $res[] = $row;
1069  }
1070 
1071  return $res;
1072  }
1073 
1074  public function searchSubObjects(ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
1075  {
1076  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1078 
1079  // :TODO:
1080  if ($a_adt_search instanceof ilADTLocationSearchBridgeSingle) {
1081  $element_id = "loc";
1082  }
1083 
1084  $condition = $a_adt_search->getSQLCondition($element_id);
1085  if ($condition) {
1086  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition);
1087  if (sizeof($objects)) {
1088  $res = array();
1089  foreach ($objects as $item) {
1090  if ($item["obj_id"] == $a_obj_id &&
1091  $item["sub_type"] == $sub_obj_type) {
1092  $res[] = $item["sub_id"];
1093  }
1094  }
1095  return $res;
1096  }
1097  }
1098 
1099  return array();
1100  }
1101 
1112  public function searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
1113  {
1114  // search type only supported/needed for text
1115 
1116  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1117  $condition = $a_adt_search->getSQLCondition(ilADTActiveRecordByType::SINGLE_COLUMN_NAME);
1118  if ($condition) {
1119  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
1120  if (sizeof($objects)) {
1121  return $this->parseSearchObjects($objects, $a_object_types);
1122  }
1123  return array();
1124  }
1125  }
1126 
1133  public function getLuceneSearchString($a_value)
1134  {
1135  return $a_value;
1136  }
1137 
1143  public function prepareElementForSearch(ilADTSearchBridge $a_bridge)
1144  {
1145  // type-specific
1146  }
1147 
1154  public function _clone($a_new_record_id)
1155  {
1156  $class = get_class($this);
1157  $obj = new $class();
1158  $obj->setRecordId($a_new_record_id);
1159  $obj->setTitle($this->getTitle());
1160  $obj->setDescription($this->getDescription());
1161  $obj->setRequired($this->isRequired());
1162  $obj->setPosition($this->getPosition());
1163  $obj->setSearchable($this->isSearchable());
1164  $obj->importFieldDefinition((array) $this->getFieldDefinition());
1165  $obj->save(true);
1166 
1167  return $obj;
1168  }
1169 }
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.
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:47
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
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.
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.
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.
global $lng
Definition: privfeed.php:17
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)