ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 1178 of file class.ilAdvancedMDFieldDefinition.php.

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

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  }
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 609 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by addToFieldDefinitionForm().

610  {
611  // type-specific
612  }
+ 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 968 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by toXML().

969  {
970  // type-specific properties
971  }
+ 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 620 of file class.ilAdvancedMDFieldDefinition.php.

References $DIC, $lng, $title, ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, addCustomFieldToDefinitionForm(), ilPropertyFormGUI\addItem(), 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().

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  }
hasPermissions($a_context_type, $a_context_id, array $a_action_ids)
Check permissions.
global $DIC
Definition: saml.php:7
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.
$lng
This class represents a text property in a property form.
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 916 of file class.ilAdvancedMDFieldDefinition.php.

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

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  }
global $DIC
Definition: saml.php:7
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 786 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by save(), and toXML().

787  {
788  return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
789  }
+ Here is the caller graph for this function:

◆ getADT()

ilAdvancedMDFieldDefinition::getADT ( )

Get ADT instance.

Returns
ilADT

Definition at line 351 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(), ilAdvancedMDFieldDefinitionSelectMulti\importValueFromXML(), ilAdvancedMDFieldDefinitionText\importValueFromXML(), ilAdvancedMDFieldDefinitionInteger\importValueFromXML(), ilAdvancedMDFieldDefinitionSelect\importValueFromXML(), ilAdvancedMDFieldDefinitionInternalLink\searchObjects(), ilAdvancedMDFieldDefinitionText\searchObjects(), searchObjects(), and searchSubObjects().

352  {
353  if (!$this->adt instanceof ilADT) {
354  $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
355  }
356  return $this->adt;
357  }
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 338 of file class.ilAdvancedMDFieldDefinition.php.

References $adt_def, and initADTDefinition().

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

339  {
340  if (!$this->adt_def instanceof ilADTDefinition) {
341  $this->adt_def = $this->initADTDefinition();
342  }
343  return $this->adt_def;
344  }
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 214 of file class.ilAdvancedMDFieldDefinition.php.

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

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

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  }
$factory
Definition: metadata.php:43
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 796 of file class.ilAdvancedMDFieldDefinition.php.

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

Referenced by save(), and update().

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  }
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 500 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 588 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by _clone(), and getDBProperties().

589  {
590  // type-specific properties
591  }
+ Here is the caller graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinition::getFieldDefinitionForTableGUI ( )

Parse properties for table gui.

Returns
array

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

599  {
600  // type-specific properties
601  }

◆ getFieldId()

◆ getImportId()

ilAdvancedMDFieldDefinition::getImportId ( )

Get import id.

Returns
string

Definition at line 434 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, $DIC, 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 $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  }
global $DIC
Definition: saml.php:7
$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 169 of file class.ilAdvancedMDFieldDefinition.php.

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

Referenced by ilAdvancedMDParser\initValue().

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  }
global $DIC
Definition: saml.php:7
$query
$row
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 86 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and $map.

Referenced by ilAdvancedMDRecordParser\initFieldObject().

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

◆ getInstancesByObjType()

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

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

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
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 114 of file class.ilAdvancedMDFieldDefinition.php.

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

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(), ilAdvancedMDRecordGUI\parseTableCells(), ilAdvancedMDRecordGUI\parseTableHead(), ilAdvancedMDValues\queryForRecords(), ilAdvancedMDRecord\toXML(), and ilAdvancedMDSettingsGUI\updateFields().

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  }
global $DIC
Definition: saml.php:7
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getLastPosition()

ilAdvancedMDFieldDefinition::getLastPosition ( )
protected

Get last position of record.

Returns
int

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

References $DIC, $ilDB, and getRecordId().

Referenced by save().

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  }
global $DIC
Definition: saml.php:7
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 1157 of file class.ilAdvancedMDFieldDefinition.php.

1158  {
1159  return $a_value;
1160  }

◆ getPosition()

ilAdvancedMDFieldDefinition::getPosition ( )

Get position.

Returns
int

Definition at line 454 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 411 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 189 of file class.ilAdvancedMDFieldDefinition.php.

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

Referenced by ilAdvancedSearchGUI\setSubTabs().

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  }
global $DIC
Definition: saml.php:7
$query
$row
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 1037 of file class.ilAdvancedMDFieldDefinition.php.

1038  {
1039  return '';
1040  }

◆ getSearchValueSerialized()

ilAdvancedMDFieldDefinition::getSearchValueSerialized ( ilADTSearchBridge  $a_adt_search)

Get value for search persistence.

Parameters
ilADTSearchBridge$a_adt_search
Returns
string

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

References ilADTSearchBridge\getSerializedValue().

1049  {
1050  return $a_adt_search->getSerializedValue();
1051  }
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 477 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 290 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and $map.

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  }
$a_type
Definition: workflow.php:92

◆ getTypeTitle()

ilAdvancedMDFieldDefinition::getTypeTitle ( )

Get type title (lang id)

Returns
string

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

References getType(), and initADTDefinition().

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

315  {
316  // :TODO: reuse udf stuff here ?!
317  return "udf_type_" . strtolower(self::getTypeString($this->getType()));
318  }
+ 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 250 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by ilAdvancedMDSettingsGUI\editFields().

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  }
+ 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 822 of file class.ilAdvancedMDFieldDefinition.php.

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

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  }
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 693 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by importDefinitionFormPostValues().

694  {
695  // type-specific
696  }
+ 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 704 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.

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  }
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 726 of file class.ilAdvancedMDFieldDefinition.php.

727  {
728  return false;
729  }

◆ importFieldDefinition()

ilAdvancedMDFieldDefinition::importFieldDefinition ( array  $a_def)
protected

Import (type-specific) field definition from DB.

Parameters
array$a_def

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

Referenced by import().

580  {
581  }
+ 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 1006 of file class.ilAdvancedMDFieldDefinition.php.

1007  {
1008  return false;
1009  }

◆ 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 979 of file class.ilAdvancedMDFieldDefinition.php.

References getValueForXML(), and importValueFromXML().

980  {
981  }
+ Here is the call graph for this function:

◆ init()

ilAdvancedMDFieldDefinition::init ( )
protected

Init properties.

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

References setRequired(), and setSearchable().

Referenced by __construct().

235  {
236  $this->setRequired(false);
237  $this->setSearchable(false);
238  }
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 520 of file class.ilAdvancedMDFieldDefinition.php.

521  {
522  return true;
523  }

◆ isRequired()

ilAdvancedMDFieldDefinition::isRequired ( )

Is required field.

Returns
bool

Definition at line 564 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 544 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 510 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by addToFieldDefinitionForm(), and setSearchable().

511  {
512  return true;
513  }
+ 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 272 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and getType().

273  {
274  return in_array((int) $a_type, self::getValidTypes());
275  }
$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 1071 of file class.ilAdvancedMDFieldDefinition.php.

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
global $ilDB
+ Here is the caller graph for this function:

◆ prepareCustomDefinitionFormConfirmation()

ilAdvancedMDFieldDefinition::prepareCustomDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

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

Referenced by prepareDefinitionFormConfirmation().

732  {
733  // type-specific
734  }
+ Here is the caller graph for this function:

◆ prepareDefinitionFormConfirmation()

ilAdvancedMDFieldDefinition::prepareDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

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

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

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  }
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 1021 of file class.ilAdvancedMDFieldDefinition.php.

1022  {
1023  // type-specific
1024  }

◆ prepareElementForSearch()

ilAdvancedMDFieldDefinition::prepareElementForSearch ( ilADTSearchBridge  $a_bridge)

Prepare search form elements.

Parameters
ilADTSearchBridge$a_bridge

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

1168  {
1169  // type-specific
1170  }

◆ read()

ilAdvancedMDFieldDefinition::read (   $a_field_id)
protected

Read field definition.

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

References $DIC, $ilDB, and $row.

Referenced by __construct().

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

◆ save()

ilAdvancedMDFieldDefinition::save (   $a_keep_pos = false)

Create new field entry.

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

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

Referenced by update().

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  }
global $DIC
Definition: saml.php:7
getDBProperties()
Get all definition properties for DB.
generateImportId($a_field_id)
Generate unique record id.
getLastPosition()
Get last position of record.
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 1136 of file class.ilAdvancedMDFieldDefinition.php.

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

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  }
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.
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 1098 of file class.ilAdvancedMDFieldDefinition.php.

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

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  }
static find($a_table, $a_type, $a_field_id, $a_condition, $a_additional_fields=null)
Find entries.
foreach($_POST as $key=> $value) $res
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 365 of file class.ilAdvancedMDFieldDefinition.php.

366  {
367  if (!$this->adt instanceof ilADT) {
368  $this->adt = $a_adt;
369  }
370  }
ADT base class.
Definition: class.ilADT.php:11

◆ setDescription()

ilAdvancedMDFieldDefinition::setDescription (   $a_desc)

Set description.

Parameters
string$a_desc

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

Referenced by import(), and importDefinitionFormPostValues().

488  {
489  if ($a_desc !== null) {
490  $a_desc = trim($a_desc);
491  }
492  $this->description = $a_desc;
493  }
+ Here is the caller graph for this function:

◆ setFieldId()

ilAdvancedMDFieldDefinition::setFieldId (   $a_id)
protected

Set field_id.

Parameters
int$a_id

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

Referenced by import(), and save().

382  {
383  $this->field_id = (int) $a_id;
384  }
+ 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 421 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and save().

422  {
423  if ($a_id_string !== null) {
424  $a_id_string = trim($a_id_string);
425  }
426  $this->import_id = $a_id_string;
427  }
+ Here is the caller graph for this function:

◆ setPosition()

ilAdvancedMDFieldDefinition::setPosition (   $a_pos)

Set position.

Parameters
int$a_pos

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

Referenced by import(), and save().

445  {
446  $this->position = (int) $a_pos;
447  }
+ Here is the caller graph for this function:

◆ setRecordId()

ilAdvancedMDFieldDefinition::setRecordId (   $a_id)

Set record id.

Parameters
int$a_id

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

Referenced by import().

402  {
403  $this->record_id = (int) $a_id;
404  }
+ Here is the caller graph for this function:

◆ setRequired()

ilAdvancedMDFieldDefinition::setRequired (   $a_status)

Toggle required.

Parameters
bool$a_status

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

Referenced by import(), and init().

555  {
556  $this->required = (bool) $a_status;
557  }
+ Here is the caller graph for this function:

◆ setSearchable()

ilAdvancedMDFieldDefinition::setSearchable (   $a_status)

Toggle searchable.

Parameters
boolsearchable

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

References isSearchSupported().

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

531  {
532  // see above
533  if (!$this->isSearchSupported()) {
534  $a_status = false;
535  }
536  $this->searchable = (bool) $a_status;
537  }
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 1059 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTSearchBridge\setSerializedValue().

1060  {
1061  return $a_adt_search->setSerializedValue($a_value);
1062  }
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 464 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and importDefinitionFormPostValues().

465  {
466  if ($a_title !== null) {
467  $a_title = trim($a_title);
468  }
469  $this->title = $a_title;
470  }
+ 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 947 of file class.ilAdvancedMDFieldDefinition.php.

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

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  }
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.
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 896 of file class.ilAdvancedMDFieldDefinition.php.

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

Referenced by save().

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  }
save($a_keep_pos=false)
Create new field entry.
global $DIC
Definition: saml.php:7
getDBProperties()
Get all definition properties for DB.
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: