ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAdvancedMDFieldDefinition Class Reference

AMD field abstract base class. More...

+ Inheritance diagram for ilAdvancedMDFieldDefinition:
+ Collaboration diagram for ilAdvancedMDFieldDefinition:

Public Member Functions

 __construct ($a_field_id=null)
 Constructor. More...
 
 getType ()
 Get type. More...
 
 getTypeTitle ()
 Get type title (lang id) More...
 
 getADTDefinition ()
 Get ADT definition instance. More...
 
 getADT ()
 Get ADT instance. More...
 
 getFieldId ()
 Get field_id. More...
 
 setRecordId ($a_id)
 Set record id. More...
 
 getRecordId ()
 Get record id. More...
 
 setImportId ($a_id_string)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setPosition ($a_pos)
 Set position. More...
 
 getPosition ()
 Get position. More...
 
 setTitle ($a_title)
 Get title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription ($a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 isSearchSupported ()
 Is search supported at all. More...
 
 isFilterSupported ()
 Is search by filter supported. More...
 
 setSearchable ($a_status)
 Toggle searchable. More...
 
 isSearchable ()
 Is searchable. More...
 
 setRequired ($a_status)
 Toggle required. More...
 
 isRequired ()
 Is required field. More...
 
 getFieldDefinitionForTableGUI ()
 Parse properties for table gui. More...
 
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Import post values from definition form. More...
 
 importDefinitionFormPostValuesNeedsConfirmation ()
 
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 generateImportId ($a_field_id)
 Generate unique record id. More...
 
 save ($a_keep_pos=false)
 Create new field entry. More...
 
 update ()
 Update field entry. More...
 
 delete ()
 Delete field entry. More...
 
 toXML (ilXmlWriter $a_writer)
 To Xml. More...
 
 importXMLProperty ($a_key, $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML ($a_cdata)
 Import value from xml. More...
 
 importFromECS ($a_ecs_type, $a_value, $a_sub_id)
 Import meta data from ECS. More...
 
 prepareElementForEditor (ilADTFormBridge $a_bridge)
 Prepare editor form elements. More...
 
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser. More...
 
 getSearchValueSerialized (ilADTSearchBridge $a_adt_search)
 Get value for search persistence. More...
 
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence. More...
 
 searchSubObjects (ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
 
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
 Search objects. More...
 
 getLuceneSearchString ($a_value)
 Get search string in lucene syntax. More...
 
 prepareElementForSearch (ilADTSearchBridge $a_bridge)
 Prepare search form elements. More...
 
 _clone ($a_new_record_id)
 Clone field definition. More...
 

Static Public Member Functions

static getInstance ($a_field_id, $a_type=null)
 Get definition instance by type. More...
 
static getInstanceByTypeString ($a_type)
 Get instance by type string (used by import) More...
 
static getInstancesByRecordId ($a_record_id, $a_only_searchable=false)
 Get definitions by record id. More...
 
static getInstancesByObjType ($a_obj_type, $a_active_only=true)
 
static getInstanceByImportId ($a_import_id)
 Get definition instance by import id. More...
 
static getSearchableDefinitionIds ()
 Get searchable definition ids (performance is key) More...
 
static getADTGroupForDefinitions (array $a_defs)
 Init ADTGroup for definitions. More...
 
static getValidTypes ()
 Get all valid types. More...
 
static isValidType ($a_type)
 Is given type valid. More...
 

Data Fields

const TYPE_SELECT = 1
 
const TYPE_TEXT = 2
 
const TYPE_DATE = 3
 
const TYPE_DATETIME = 4
 
const TYPE_INTEGER = 5
 
const TYPE_FLOAT = 6
 
const TYPE_LOCATION = 7
 
const TYPE_SELECT_MULTI = 8
 
const TYPE_EXTERNAL_LINK = 9
 
const TYPE_INTERNAL_LINK = 10
 

Protected Member Functions

 init ()
 Init properties. More...
 
 initADTDefinition ()
 Init adt instance. More...
 
 setADT (ilADT $a_adt)
 Set ADT instance. More...
 
 setFieldId ($a_id)
 Set field_id. More...
 
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB. More...
 
 getFieldDefinition ()
 Get (type-specific) field definition. More...
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false)
 Add custom input elements to definition form. More...
 
 getLastPosition ()
 Get last position of record. More...
 
 getDBProperties ()
 Get all definition properties for DB. More...
 
 import (array $a_data)
 Import from DB. More...
 
 read ($a_field_id)
 Read field definition. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export. More...
 
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results. More...
 

Static Protected Member Functions

static getTypeString ($a_type)
 Get type string. More...
 

Protected Attributes

 $field_id
 
 $record_id
 
 $import_id
 
 $position
 
 $title
 
 $description
 
 $searchable
 
 $required
 
 $adt_def
 
 $adt
 

Detailed Description

AMD field abstract base class.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 14 of file class.ilAdvancedMDFieldDefinition.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDFieldDefinition::__construct (   $a_field_id = null)

Constructor.

Parameters
init$a_field_id
Returns
self

Definition at line 44 of file class.ilAdvancedMDFieldDefinition.php.

References init(), and read().

45  {
46  $this->init();
47  $this->read($a_field_id);
48  }
read($a_field_id)
Read field definition.
+ Here is the call graph for this function:

Member Function Documentation

◆ _clone()

ilAdvancedMDFieldDefinition::_clone (   $a_new_record_id)

Clone field definition.

Parameters
type$a_new_record_id
Returns
self

Definition at line 1154 of file class.ilAdvancedMDFieldDefinition.php.

References array, getDescription(), getFieldDefinition(), getPosition(), getTitle(), isRequired(), and isSearchable().

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  }
Create styles array
The data for the language used.
getFieldDefinition()
Get (type-specific) field definition.
+ Here is the call graph for this function:

◆ addCustomFieldToDefinitionForm()

ilAdvancedMDFieldDefinition::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
  $a_disabled = false 
)
protected

Add custom input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
bool$a_disabled

Definition at line 599 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by addToFieldDefinitionForm().

600  {
601  // type-specific
602  }
+ Here is the caller graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinition::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Add (type-specific) properties to xml export.

Parameters
ilXmlWriter$a_writer

Definition at line 946 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by toXML().

947  {
948  // type-specific properties
949  }
+ Here is the caller graph for this function:

◆ addToFieldDefinitionForm()

ilAdvancedMDFieldDefinition::addToFieldDefinitionForm ( ilPropertyFormGUI  $a_form,
ilAdvancedMDPermissionHelper  $a_permissions 
)

Add input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
ilAdvancedMDPermissionHelper$a_form

Definition at line 610 of file class.ilAdvancedMDFieldDefinition.php.

References $lng, $title, ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, addCustomFieldToDefinitionForm(), ilPropertyFormGUI\addItem(), array, ilAdvancedMDPermissionHelper\CONTEXT_FIELD, getDescription(), getFieldId(), getTitle(), ilClaimingPermissionHelper\hasPermissions(), isSearchable(), isSearchSupported(), ilCheckboxInputGUI\setChecked(), ilTextAreaInputGUI\setValue(), ilAdvancedMDPermissionHelper\SUBACTION_FIELD_DESCRIPTION, ilAdvancedMDPermissionHelper\SUBACTION_FIELD_PROPERTIES, ilAdvancedMDPermissionHelper\SUBACTION_FIELD_SEARCHABLE, and ilAdvancedMDPermissionHelper\SUBACTION_FIELD_TITLE.

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

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  }
hasPermissions($a_context_type, $a_context_id, array $a_action_ids)
Check permissions.
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, $a_disabled=false)
Add custom input elements to definition form.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setChecked($a_checked)
Set Checked.
This class represents a text property in a property form.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
This class represents a text area property in a property form.
isSearchSupported()
Is search supported at all.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilAdvancedMDFieldDefinition::delete ( )

Delete field entry.

Definition at line 896 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, ilAdvancedMDValues\_deleteByFieldId(), getADT(), and getFieldId().

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  }
static _deleteByFieldId($a_field_id, ilADT $a_adt)
Delete values by field_id.
$query
global $ilDB
+ Here is the call graph for this function:

◆ generateImportId()

ilAdvancedMDFieldDefinition::generateImportId (   $a_field_id)

Generate unique record id.

Parameters
int$a_field_id
Returns
string

Definition at line 772 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by save(), and toXML().

773  {
774  return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
775  }
+ Here is the caller graph for this function:

◆ getADT()

ilAdvancedMDFieldDefinition::getADT ( )

Get ADT instance.

Returns
ilADT

Definition at line 341 of file class.ilAdvancedMDFieldDefinition.php.

References $adt, getADTDefinition(), and ilADTFactory\getInstance().

Referenced by delete(), ilAdvancedMDFieldDefinitionDate\importFromECS(), ilAdvancedMDFieldDefinitionDateTime\importFromECS(), ilAdvancedMDFieldDefinitionText\importFromECS(), ilAdvancedMDFieldDefinitionExternalLink\importValueFromXML(), ilAdvancedMDFieldDefinitionDate\importValueFromXML(), ilAdvancedMDFieldDefinitionDateTime\importValueFromXML(), ilAdvancedMDFieldDefinitionInternalLink\importValueFromXML(), ilAdvancedMDFieldDefinitionLocation\importValueFromXML(), ilAdvancedMDFieldDefinitionText\importValueFromXML(), ilAdvancedMDFieldDefinitionSelectMulti\importValueFromXML(), ilAdvancedMDFieldDefinitionInteger\importValueFromXML(), ilAdvancedMDFieldDefinitionSelect\importValueFromXML(), ilAdvancedMDFieldDefinitionInternalLink\searchObjects(), ilAdvancedMDFieldDefinitionText\searchObjects(), searchObjects(), and searchSubObjects().

342  {
343  if (!$this->adt instanceof ilADT) {
344  $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
345  }
346  return $this->adt;
347  }
getADTDefinition()
Get ADT definition instance.
static getInstance()
Get singleton.
ADT base class.
Definition: class.ilADT.php:11
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getADTDefinition()

ilAdvancedMDFieldDefinition::getADTDefinition ( )

Get ADT definition instance.

Returns
ilADTDefinition

Definition at line 328 of file class.ilAdvancedMDFieldDefinition.php.

References $adt_def, and initADTDefinition().

Referenced by getADT(), ilAdvancedMDFieldDefinitionSelectMulti\importCustomDefinitionFormPostValues(), and ilAdvancedMDFieldDefinitionSelectMulti\update().

329  {
330  if (!$this->adt_def instanceof ilADTDefinition) {
331  $this->adt_def = $this->initADTDefinition();
332  }
333  return $this->adt_def;
334  }
initADTDefinition()
Init adt instance.
ADT definition base class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getADTGroupForDefinitions()

static ilAdvancedMDFieldDefinition::getADTGroupForDefinitions ( array  $a_defs)
static

Init ADTGroup for definitions.

Parameters
array$a_defs
Returns
ilADTGroup

Definition at line 204 of file class.ilAdvancedMDFieldDefinition.php.

References $def, $factory, and ilADTFactory\getInstance().

Referenced by ilAdvancedMDValues\getADTGroup(), and ilAdvancedMDValues\queryForRecords().

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  }
$factory
Definition: metadata.php:47
static getInstance()
Get singleton.
$def
Definition: croninfo.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDBProperties()

ilAdvancedMDFieldDefinition::getDBProperties ( )
protected

Get all definition properties for DB.

Returns
array

Definition at line 782 of file class.ilAdvancedMDFieldDefinition.php.

References $def, array, getDescription(), getFieldDefinition(), getImportId(), getPosition(), getRecordId(), getTitle(), getType(), isRequired(), and isSearchable().

Referenced by save(), and update().

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  }
Create styles array
The data for the language used.
getFieldDefinition()
Get (type-specific) field definition.
$def
Definition: croninfo.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilAdvancedMDFieldDefinition::getDescription ( )

Get description.

Returns
string

Definition at line 490 of file class.ilAdvancedMDFieldDefinition.php.

References $description.

Referenced by _clone(), addToFieldDefinitionForm(), getDBProperties(), and toXML().

+ Here is the caller graph for this function:

◆ getFieldDefinition()

ilAdvancedMDFieldDefinition::getFieldDefinition ( )
protected

Get (type-specific) field definition.

Returns
array

Definition at line 578 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by _clone(), and getDBProperties().

579  {
580  // type-specific properties
581  }
+ Here is the caller graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinition::getFieldDefinitionForTableGUI ( )

Parse properties for table gui.

Returns
array

Definition at line 588 of file class.ilAdvancedMDFieldDefinition.php.

589  {
590  // type-specific properties
591  }

◆ getFieldId()

◆ getImportId()

ilAdvancedMDFieldDefinition::getImportId ( )

Get import id.

Returns
string

Definition at line 424 of file class.ilAdvancedMDFieldDefinition.php.

References $import_id.

Referenced by getDBProperties(), and save().

+ Here is the caller graph for this function:

◆ getInstance()

static ilAdvancedMDFieldDefinition::getInstance (   $a_field_id,
  $a_type = null 
)
static

Get definition instance by type.

Parameters
int$a_field_id
int$a_type
Returns
self

Definition at line 57 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and $ilDB.

Referenced by ilAdvancedMDSettingsGUI\confirmDeleteFields(), ilAdvancedMDSettingsGUI\createField(), ilAdvancedMDSettingsGUI\deleteFields(), ilAdvancedMDSettingsGUI\editField(), ilAdvancedMDSettingsGUI\editFields(), ilLuceneAdvancedSearchFields\getFormElement(), ilLuceneAdvancedSearchFields\parseFieldQuery(), ilLuceneAdvancedSearchFields\readSections(), ilAdvancedMDSettingsGUI\saveField(), ilAdvancedSearchGUI\searchAdvancedMD(), ilAdvancedMDRecordGUI\showECSStart(), and ilAdvancedMDSettingsGUI\updateField().

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  }
$a_type
Definition: workflow.php:92
global $ilDB
+ Here is the caller graph for this function:

◆ getInstanceByImportId()

static ilAdvancedMDFieldDefinition::getInstanceByImportId (   $a_import_id)
static

Get definition instance by import id.

Parameters
string$a_import_id
Returns
self

Definition at line 163 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, and $row.

Referenced by ilAdvancedMDParser\initValue().

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  }
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getInstanceByTypeString()

static ilAdvancedMDFieldDefinition::getInstanceByTypeString (   $a_type)
static

Get instance by type string (used by import)

Parameters
string$a_type
Returns
self

Definition at line 84 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and array.

Referenced by ilAdvancedMDRecordParser\initFieldObject().

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  }
$a_type
Definition: workflow.php:92
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getInstancesByObjType()

static ilAdvancedMDFieldDefinition::getInstancesByObjType (   $a_obj_type,
  $a_active_only = true 
)
static

Definition at line 134 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, $res, $row, and array.

Referenced by ilECSSettingsGUI\exportMappings(), ilECSSettingsGUI\importMappings(), ilAdvancedMDSettingsGUI\initFormSubstitutions(), ilECSSettingsGUI\initMappingsForm(), ilAdvancedMDRecordGUI\parseAppointmentPresentation(), and ilAdvancedMDSettingsGUI\updateSubstitutions().

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  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getInstancesByRecordId()

static ilAdvancedMDFieldDefinition::getInstancesByRecordId (   $a_record_id,
  $a_only_searchable = false 
)
static

Get definitions by record id.

Parameters
int$a_record_id
bool$a_only_searchable
Returns
array self

Definition at line 112 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, $row, and array.

Referenced by ilAdvancedMDRecord\_clone(), ilGlossaryTerm\_copyTerm(), ilAdvancedMDRecord\_delete(), ilAdvancedMDSettingsGUI\editFields(), ilAdvancedMDRecordTableGUI\fillRow(), ilPCAMDPageList\findPages(), ilObjBookingPool\getAdvancedMDFields(), ilGlossaryAdvMetaDataAdapter\getAllFields(), ilAdvancedMDValues\getDefinitions(), ilLuceneAdvancedSearchFields\getFields(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDValues\queryForRecords(), ilAdvancedMDRecord\toXML(), and ilAdvancedMDSettingsGUI\updateFields().

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  }
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getLastPosition()

ilAdvancedMDFieldDefinition::getLastPosition ( )
protected

Get last position of record.

Returns
int

Definition at line 750 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, and getRecordId().

Referenced by save().

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  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLuceneSearchString()

ilAdvancedMDFieldDefinition::getLuceneSearchString (   $a_value)

Get search string in lucene syntax.

Parameters
mixed$a_value
Returns
string

Definition at line 1133 of file class.ilAdvancedMDFieldDefinition.php.

1134  {
1135  return $a_value;
1136  }

◆ getPosition()

ilAdvancedMDFieldDefinition::getPosition ( )

Get position.

Returns
int

Definition at line 444 of file class.ilAdvancedMDFieldDefinition.php.

References $position.

Referenced by _clone(), getDBProperties(), and toXML().

+ Here is the caller graph for this function:

◆ getRecordId()

ilAdvancedMDFieldDefinition::getRecordId ( )

Get record id.

Returns
int

Definition at line 401 of file class.ilAdvancedMDFieldDefinition.php.

References $record_id.

Referenced by getDBProperties(), and getLastPosition().

+ Here is the caller graph for this function:

◆ getSearchableDefinitionIds()

static ilAdvancedMDFieldDefinition::getSearchableDefinitionIds ( )
static

Get searchable definition ids (performance is key)

Returns
array

Definition at line 181 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, $row, and array.

Referenced by ilAdvancedSearchGUI\setSubTabs().

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  }
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getSearchQueryParserValue()

ilAdvancedMDFieldDefinition::getSearchQueryParserValue ( ilADTSearchBridge  $a_adt_search)

Get value for search query parser.

Parameters
ilADTSearchBridge$a_adt_search
Returns
mixed

Definition at line 1015 of file class.ilAdvancedMDFieldDefinition.php.

1016  {
1017  return '';
1018  }

◆ getSearchValueSerialized()

ilAdvancedMDFieldDefinition::getSearchValueSerialized ( ilADTSearchBridge  $a_adt_search)

Get value for search persistence.

Parameters
ilADTSearchBridge$a_adt_search
Returns
string

Definition at line 1026 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTSearchBridge\getSerializedValue().

1027  {
1028  return $a_adt_search->getSerializedValue();
1029  }
getSerializedValue()
Get current value(s) in serialized form (for easy persisting)
+ Here is the call graph for this function:

◆ getTitle()

ilAdvancedMDFieldDefinition::getTitle ( )

Get title.

Returns
string

Definition at line 467 of file class.ilAdvancedMDFieldDefinition.php.

References $title.

Referenced by _clone(), addToFieldDefinitionForm(), getDBProperties(), and toXML().

+ Here is the caller graph for this function:

◆ getType()

ilAdvancedMDFieldDefinition::getType ( )
abstract

Get type.

Returns
int

Referenced by getDBProperties(), getTypeTitle(), isValidType(), searchObjects(), searchSubObjects(), and toXML().

+ Here is the caller graph for this function:

◆ getTypeString()

static ilAdvancedMDFieldDefinition::getTypeString (   $a_type)
staticprotected

Get type string.

Parameters
string$a_type
Returns
string

Definition at line 280 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and array.

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  }
$a_type
Definition: workflow.php:92
Create styles array
The data for the language used.

◆ getTypeTitle()

ilAdvancedMDFieldDefinition::getTypeTitle ( )

Get type title (lang id)

Returns
string

Definition at line 304 of file class.ilAdvancedMDFieldDefinition.php.

References getType(), and initADTDefinition().

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

305  {
306  // :TODO: reuse udf stuff here ?!
307  return "udf_type_" . strtolower(self::getTypeString($this->getType()));
308  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidTypes()

static ilAdvancedMDFieldDefinition::getValidTypes ( )
static

Get all valid types.

Returns
array

Definition at line 240 of file class.ilAdvancedMDFieldDefinition.php.

References array.

Referenced by ilAdvancedMDSettingsGUI\editFields().

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  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getValueForXML()

ilAdvancedMDFieldDefinition::getValueForXML ( ilADT  $element)
abstract

Parse ADT value for xml (export)

Parameters
ilADT$element
Returns
string

Referenced by importXMLProperty().

+ Here is the caller graph for this function:

◆ import()

ilAdvancedMDFieldDefinition::import ( array  $a_data)
protected

Import from DB.

Parameters
array$a_data

Definition at line 808 of file class.ilAdvancedMDFieldDefinition.php.

References importFieldDefinition(), setDescription(), setFieldId(), setImportId(), setPosition(), setRecordId(), setRequired(), setSearchable(), and setTitle().

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  }
setSearchable($a_status)
Toggle searchable.
importFieldDefinition(array $a_def)
Import (type-specific) field definition from DB.
+ Here is the call graph for this function:

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinition::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

Definition at line 681 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by importDefinitionFormPostValues().

682  {
683  // type-specific
684  }
+ Here is the caller graph for this function:

◆ importDefinitionFormPostValues()

ilAdvancedMDFieldDefinition::importDefinitionFormPostValues ( ilPropertyFormGUI  $a_form,
ilAdvancedMDPermissionHelper  $a_permissions 
)

Import post values from definition form.

Parameters
ilPropertyFormGUI$a_form
ilAdvancedMDPermissionHelper$a_permissions

Definition at line 692 of file class.ilAdvancedMDFieldDefinition.php.

References ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\CONTEXT_FIELD, ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilClaimingPermissionHelper\hasPermission(), importCustomDefinitionFormPostValues(), setDescription(), setSearchable(), setTitle(), and ilAdvancedMDPermissionHelper\SUBACTION_FIELD_PROPERTIES.

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  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
hasPermission($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
Check permission.
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form)
Import custom post values from definition form.
setSearchable($a_status)
Toggle searchable.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ importDefinitionFormPostValuesNeedsConfirmation()

ilAdvancedMDFieldDefinition::importDefinitionFormPostValuesNeedsConfirmation ( )

Definition at line 714 of file class.ilAdvancedMDFieldDefinition.php.

715  {
716  return false;
717  }

◆ importFieldDefinition()

ilAdvancedMDFieldDefinition::importFieldDefinition ( array  $a_def)
protected

Import (type-specific) field definition from DB.

Parameters
array$a_def

Definition at line 569 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import().

570  {
571  }
+ Here is the caller graph for this function:

◆ importFromECS()

ilAdvancedMDFieldDefinition::importFromECS (   $a_ecs_type,
  $a_value,
  $a_sub_id 
)

Import meta data from ECS.

Parameters
int$a_ecs_type
mixed$a_value
string$a_sub_id
Returns
bool

Definition at line 984 of file class.ilAdvancedMDFieldDefinition.php.

985  {
986  return false;
987  }

◆ importValueFromXML()

ilAdvancedMDFieldDefinition::importValueFromXML (   $a_cdata)
abstract

Import value from xml.

Parameters
string$a_cdata

Referenced by importXMLProperty().

+ Here is the caller graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinition::importXMLProperty (   $a_key,
  $a_value 
)

Import property from XML.

Parameters
string$a_key
string$a_value

Definition at line 957 of file class.ilAdvancedMDFieldDefinition.php.

References getValueForXML(), and importValueFromXML().

958  {
959  }
+ Here is the call graph for this function:

◆ init()

ilAdvancedMDFieldDefinition::init ( )
protected

Init properties.

Definition at line 224 of file class.ilAdvancedMDFieldDefinition.php.

References setRequired(), and setSearchable().

Referenced by __construct().

225  {
226  $this->setRequired(false);
227  $this->setSearchable(false);
228  }
setSearchable($a_status)
Toggle searchable.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initADTDefinition()

ilAdvancedMDFieldDefinition::initADTDefinition ( )
abstractprotected

Init adt instance.

Returns
ilADTDefinition

Referenced by getADTDefinition(), and getTypeTitle().

+ Here is the caller graph for this function:

◆ isFilterSupported()

ilAdvancedMDFieldDefinition::isFilterSupported ( )

Is search by filter supported.

Returns
boolean

Definition at line 510 of file class.ilAdvancedMDFieldDefinition.php.

511  {
512  return true;
513  }

◆ isRequired()

ilAdvancedMDFieldDefinition::isRequired ( )

Is required field.

Returns
bool

Definition at line 554 of file class.ilAdvancedMDFieldDefinition.php.

References $required.

Referenced by _clone(), and getDBProperties().

+ Here is the caller graph for this function:

◆ isSearchable()

ilAdvancedMDFieldDefinition::isSearchable ( )

Is searchable.

Returns
bool

Definition at line 534 of file class.ilAdvancedMDFieldDefinition.php.

References $searchable.

Referenced by _clone(), addToFieldDefinitionForm(), getDBProperties(), and toXML().

+ Here is the caller graph for this function:

◆ isSearchSupported()

ilAdvancedMDFieldDefinition::isSearchSupported ( )

Is search supported at all.

Returns
boolean

Definition at line 500 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by addToFieldDefinitionForm(), and setSearchable().

501  {
502  return true;
503  }
+ Here is the caller graph for this function:

◆ isValidType()

static ilAdvancedMDFieldDefinition::isValidType (   $a_type)
static

Is given type valid.

Parameters
int$a_type
Returns
bool

Definition at line 262 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and getType().

263  {
264  return in_array((int) $a_type, self::getValidTypes());
265  }
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:

◆ parseSearchObjects()

ilAdvancedMDFieldDefinition::parseSearchObjects ( array  $a_records,
array  $a_object_types 
)
protected

Add object-data needed for global search to AMD search results.

Parameters
array$a_records
array$a_object_types
Returns
array

Definition at line 1049 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $res, $row, and array.

Referenced by ilAdvancedMDFieldDefinitionInternalLink\searchObjects(), and searchObjects().

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  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ prepareCustomDefinitionFormConfirmation()

ilAdvancedMDFieldDefinition::prepareCustomDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

Definition at line 719 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by prepareDefinitionFormConfirmation().

720  {
721  // type-specific
722  }
+ Here is the caller graph for this function:

◆ prepareDefinitionFormConfirmation()

ilAdvancedMDFieldDefinition::prepareDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

Definition at line 724 of file class.ilAdvancedMDFieldDefinition.php.

References ilPropertyFormGUI\addItem(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), and prepareCustomDefinitionFormConfirmation().

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  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
addItem($a_item)
Add Item (Property, SectionHeader).
prepareCustomDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
This class represents a hidden form property in a property form.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ prepareElementForEditor()

ilAdvancedMDFieldDefinition::prepareElementForEditor ( ilADTFormBridge  $a_bridge)

Prepare editor form elements.

Parameters
ilADTFormBridge$a_bridge

Definition at line 999 of file class.ilAdvancedMDFieldDefinition.php.

1000  {
1001  // type-specific
1002  }

◆ prepareElementForSearch()

ilAdvancedMDFieldDefinition::prepareElementForSearch ( ilADTSearchBridge  $a_bridge)

Prepare search form elements.

Parameters
ilADTSearchBridge$a_bridge

Definition at line 1143 of file class.ilAdvancedMDFieldDefinition.php.

1144  {
1145  // type-specific
1146  }

◆ read()

ilAdvancedMDFieldDefinition::read (   $a_field_id)
protected

Read field definition.

Definition at line 827 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, and $row.

Referenced by __construct().

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  }
global $ilDB
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDFieldDefinition::save (   $a_keep_pos = false)

Create new field entry.

Definition at line 847 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, array, generateImportId(), getDBProperties(), getFieldId(), getImportId(), getLastPosition(), setFieldId(), setImportId(), setPosition(), and update().

Referenced by update().

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  }
getDBProperties()
Get all definition properties for DB.
generateImportId($a_field_id)
Generate unique record id.
getLastPosition()
Get last position of record.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ searchObjects()

ilAdvancedMDFieldDefinition::searchObjects ( ilADTSearchBridge  $a_adt_search,
ilQueryParser  $a_parser,
array  $a_object_types,
  $a_locate,
  $a_search_type 
)

Search objects.

Parameters
ilADTSearchBridge$a_adt_search
ilQueryParser$a_parser
array$a_object_types
string$a_locate
string$a_search_type
Returns
array

Definition at line 1112 of file class.ilAdvancedMDFieldDefinition.php.

References array, ilADTActiveRecordByType\find(), getADT(), getFieldId(), ilADTSearchBridge\getSQLCondition(), getType(), parseSearchObjects(), and ilADTActiveRecordByType\SINGLE_COLUMN_NAME.

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  }
parseSearchObjects(array $a_records, array $a_object_types)
Add object-data needed for global search to AMD search results.
static find($a_table, $a_type, $a_field_id, $a_condition, $a_additional_fields=null)
Find entries.
Create styles array
The data for the language used.
getSQLCondition($a_element_id)
Get SQL condition for current value(s)
+ Here is the call graph for this function:

◆ searchSubObjects()

ilAdvancedMDFieldDefinition::searchSubObjects ( ilADTSearchBridge  $a_adt_search,
  $a_obj_id,
  $sub_obj_type 
)

Definition at line 1074 of file class.ilAdvancedMDFieldDefinition.php.

References $res, array, ilADTActiveRecordByType\find(), getADT(), getFieldId(), ilADTSearchBridge\getSQLCondition(), getType(), and ilADTActiveRecordByType\SINGLE_COLUMN_NAME.

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  }
static find($a_table, $a_type, $a_field_id, $a_condition, $a_additional_fields=null)
Find entries.
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
getSQLCondition($a_element_id)
Get SQL condition for current value(s)
+ Here is the call graph for this function:

◆ setADT()

ilAdvancedMDFieldDefinition::setADT ( ilADT  $a_adt)
protected

Set ADT instance.

See also
self::getADTGroupForDefinitions()
Parameters
ilADT$a_adt

Definition at line 355 of file class.ilAdvancedMDFieldDefinition.php.

356  {
357  if (!$this->adt instanceof ilADT) {
358  $this->adt = $a_adt;
359  }
360  }
ADT base class.
Definition: class.ilADT.php:11

◆ setDescription()

ilAdvancedMDFieldDefinition::setDescription (   $a_desc)

Set description.

Parameters
string$a_desc

Definition at line 477 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and importDefinitionFormPostValues().

478  {
479  if ($a_desc !== null) {
480  $a_desc = trim($a_desc);
481  }
482  $this->description = $a_desc;
483  }
+ Here is the caller graph for this function:

◆ setFieldId()

ilAdvancedMDFieldDefinition::setFieldId (   $a_id)
protected

Set field_id.

Parameters
int$a_id

Definition at line 371 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and save().

372  {
373  $this->field_id = (int) $a_id;
374  }
+ Here is the caller graph for this function:

◆ setImportId()

ilAdvancedMDFieldDefinition::setImportId (   $a_id_string)

Set import id.

Parameters
string$a_id_string

Definition at line 411 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and save().

412  {
413  if ($a_id_string !== null) {
414  $a_id_string = trim($a_id_string);
415  }
416  $this->import_id = $a_id_string;
417  }
+ Here is the caller graph for this function:

◆ setPosition()

ilAdvancedMDFieldDefinition::setPosition (   $a_pos)

Set position.

Parameters
int$a_pos

Definition at line 434 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and save().

435  {
436  $this->position = (int) $a_pos;
437  }
+ Here is the caller graph for this function:

◆ setRecordId()

ilAdvancedMDFieldDefinition::setRecordId (   $a_id)

Set record id.

Parameters
int$a_id

Definition at line 391 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import().

392  {
393  $this->record_id = (int) $a_id;
394  }
+ Here is the caller graph for this function:

◆ setRequired()

ilAdvancedMDFieldDefinition::setRequired (   $a_status)

Toggle required.

Parameters
bool$a_status

Definition at line 544 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and init().

545  {
546  $this->required = (bool) $a_status;
547  }
+ Here is the caller graph for this function:

◆ setSearchable()

ilAdvancedMDFieldDefinition::setSearchable (   $a_status)

Toggle searchable.

Parameters
boolsearchable

Definition at line 520 of file class.ilAdvancedMDFieldDefinition.php.

References isSearchSupported().

Referenced by import(), importDefinitionFormPostValues(), and init().

521  {
522  // see above
523  if (!$this->isSearchSupported()) {
524  $a_status = false;
525  }
526  $this->searchable = (bool) $a_status;
527  }
isSearchSupported()
Is search supported at all.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSearchValueSerialized()

ilAdvancedMDFieldDefinition::setSearchValueSerialized ( ilADTSearchBridge  $a_adt_search,
  $a_value 
)

Set value from search persistence.

Parameters
ilADTSearchBridge$a_adt_search
string$a_value

Definition at line 1037 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTSearchBridge\setSerializedValue().

1038  {
1039  return $a_adt_search->setSerializedValue($a_value);
1040  }
setSerializedValue($a_value)
Set current value(s) in serialized form (for easy persisting)
+ Here is the call graph for this function:

◆ setTitle()

ilAdvancedMDFieldDefinition::setTitle (   $a_title)

Get title.

Parameters
string$a_title

Definition at line 454 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and importDefinitionFormPostValues().

455  {
456  if ($a_title !== null) {
457  $a_title = trim($a_title);
458  }
459  $this->title = $a_title;
460  }
+ Here is the caller graph for this function:

◆ toXML()

ilAdvancedMDFieldDefinition::toXML ( ilXmlWriter  $a_writer)

To Xml.

This method writes only the subset Field Use class.ilAdvancedMDRecordXMLWriter to generate a complete xml presentation.

Parameters
ilXmlWriter$a_writer

Definition at line 925 of file class.ilAdvancedMDFieldDefinition.php.

References addPropertiesToXML(), array, generateImportId(), getDescription(), getFieldId(), getPosition(), getTitle(), getType(), isSearchable(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

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  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
generateImportId($a_field_id)
Generate unique record id.
Create styles array
The data for the language used.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
addPropertiesToXML(ilXmlWriter $a_writer)
Add (type-specific) properties to xml export.
+ Here is the call graph for this function:

◆ update()

ilAdvancedMDFieldDefinition::update ( )

Update field entry.

Definition at line 878 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, array, getDBProperties(), getFieldId(), and save().

Referenced by save().

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  }
save($a_keep_pos=false)
Create new field entry.
getDBProperties()
Get all definition properties for DB.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $adt

◆ $adt_def

ilAdvancedMDFieldDefinition::$adt_def
protected

Definition at line 24 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getADTDefinition().

◆ $description

ilAdvancedMDFieldDefinition::$description
protected

Definition at line 21 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getDescription().

◆ $field_id

ilAdvancedMDFieldDefinition::$field_id
protected

Definition at line 16 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getFieldId().

◆ $import_id

ilAdvancedMDFieldDefinition::$import_id
protected

Definition at line 18 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getImportId().

◆ $position

ilAdvancedMDFieldDefinition::$position
protected

Definition at line 19 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getPosition().

◆ $record_id

ilAdvancedMDFieldDefinition::$record_id
protected

Definition at line 17 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getRecordId().

◆ $required

ilAdvancedMDFieldDefinition::$required
protected

Definition at line 23 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by isRequired().

◆ $searchable

ilAdvancedMDFieldDefinition::$searchable
protected

Definition at line 22 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by isSearchable().

◆ $title

ilAdvancedMDFieldDefinition::$title
protected

◆ TYPE_DATE

◆ TYPE_DATETIME

const ilAdvancedMDFieldDefinition::TYPE_DATETIME = 4

Definition at line 30 of file class.ilAdvancedMDFieldDefinition.php.

◆ TYPE_EXTERNAL_LINK

const ilAdvancedMDFieldDefinition::TYPE_EXTERNAL_LINK = 9

Definition at line 35 of file class.ilAdvancedMDFieldDefinition.php.

◆ TYPE_FLOAT

const ilAdvancedMDFieldDefinition::TYPE_FLOAT = 6

Definition at line 32 of file class.ilAdvancedMDFieldDefinition.php.

◆ TYPE_INTEGER

const ilAdvancedMDFieldDefinition::TYPE_INTEGER = 5

Definition at line 31 of file class.ilAdvancedMDFieldDefinition.php.

◆ TYPE_INTERNAL_LINK

const ilAdvancedMDFieldDefinition::TYPE_INTERNAL_LINK = 10

Definition at line 36 of file class.ilAdvancedMDFieldDefinition.php.

◆ TYPE_LOCATION

const ilAdvancedMDFieldDefinition::TYPE_LOCATION = 7

Definition at line 33 of file class.ilAdvancedMDFieldDefinition.php.

◆ TYPE_SELECT

const ilAdvancedMDFieldDefinition::TYPE_SELECT = 1

◆ TYPE_SELECT_MULTI

const ilAdvancedMDFieldDefinition::TYPE_SELECT_MULTI = 8

Definition at line 34 of file class.ilAdvancedMDFieldDefinition.php.

◆ TYPE_TEXT

const ilAdvancedMDFieldDefinition::TYPE_TEXT = 2

The documentation for this class was generated from the following file: