ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
 

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

References init(), and read().

43  {
44  $this->init();
45  $this->read($a_field_id);
46  }
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 1183 of file class.ilAdvancedMDFieldDefinition.php.

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

1184  {
1185  $class = get_class($this);
1186  $obj = new $class();
1187  $obj->setRecordId($a_new_record_id);
1188  $obj->setTitle($this->getTitle());
1189  $obj->setDescription($this->getDescription());
1190  $obj->setRequired($this->isRequired());
1191  $obj->setPosition($this->getPosition());
1192  $obj->setSearchable($this->isSearchable());
1193  $obj->importFieldDefinition($this->getFieldDefinition());
1194  $obj->save(true);
1195 
1196  return $obj;
1197  }
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 604 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by addToFieldDefinitionForm().

605  {
606  // type-specific
607  }
+ 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 964 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by toXML().

965  {
966  // type-specific properties
967  }
+ 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 615 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().

616  {
617  global $lng;
618 
619  $perm = $a_permissions->hasPermissions(
621  $this->getFieldId(),
622  array(
631  ));
632 
633  // title
634  $title = new ilTextInputGUI($lng->txt('title'), 'title');
635  $title->setValue($this->getTitle());
636  $title->setSize(20);
637  $title->setMaxLength(70);
638  $title->setRequired(true);
639  $a_form->addItem($title);
640 
642  {
643  $title->setDisabled(true);
644  }
645 
646  // desc
647  $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
648  $desc->setValue($this->getDescription());
649  $desc->setRows(3);
650  $desc->setCols(50);
651  $a_form->addItem($desc);
652 
654  {
655  $desc->setDisabled(true);
656  }
657 
658  // searchable
659  $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
660  $check->setChecked($this->isSearchable());
661  $check->setValue(1);
662  $a_form->addItem($check);
663 
665  !$this->isSearchSupported())
666  {
667  $check->setDisabled(true);
668  }
669 
670  /* required
671  $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
672  $check->setChecked($this->isRequired());
673  $check->setValue(1);
674  $a_form->addItem($check);
675  */
676 
677  $this->addCustomFieldToDefinitionForm($a_form,
679  }
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 913 of file class.ilAdvancedMDFieldDefinition.php.

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

914  {
915  global $ilDB;
916 
917  if(!$this->getFieldId())
918  {
919  return;
920  }
921 
922  // delete all values
923  include_once("Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
925 
926  $query = "DELETE FROM adv_mdf_definition".
927  " WHERE field_id = ".$ilDB->quote($this->getFieldId(), "integer");
928  $ilDB->manipulate($query);
929  }
static _deleteByFieldId($a_field_id, ilADT $a_adt)
Delete values by field_id.
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 782 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by save(), and toXML().

783  {
784  return 'il_'.IL_INST_ID.'_adv_md_field_'.$a_field_id;
785  }
+ Here is the caller graph for this function:

◆ getADT()

ilAdvancedMDFieldDefinition::getADT ( )

◆ getADTDefinition()

ilAdvancedMDFieldDefinition::getADTDefinition ( )

Get ADT definition instance.

Returns
ilADTDefinition

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

References $adt_def, and initADTDefinition().

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

326  {
327  if(!$this->adt_def instanceof ilADTDefinition)
328  {
329  $this->adt_def = $this->initADTDefinition();
330  }
331  return $this->adt_def;
332  }
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 209 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTFactory\getInstance().

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

210  {
211  $factory = ilADTFactory::getInstance();
212  $group_def = $factory->getDefinitionInstanceByType("Group");
213  foreach($a_defs as $def)
214  {
215  $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
216  }
217  $group = $factory->getInstanceByDefinition($group_def);
218 
219  // bind adt instances to definition
220  foreach($group->getElements() as $element_id => $element)
221  {
222  $a_defs[$element_id]->setADT($element);
223  }
224 
225  return $group;
226  }
static getInstance()
Get singleton.
+ 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 792 of file class.ilAdvancedMDFieldDefinition.php.

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

Referenced by save(), and update().

793  {
794  $fields = array(
795  "field_type" => array("integer", $this->getType()),
796  "record_id" => array("integer", $this->getRecordId()),
797  "import_id" => array("text", $this->getImportId()),
798  "title" => array("text", $this->getTitle()),
799  "description" => array("text", $this->getDescription()),
800  "position" => array("integer", $this->getPosition()),
801  "searchable" => array("integer", $this->isSearchable()),
802  "required" => array("integer", $this->isRequired())
803  );
804 
805  $def = $this->getFieldDefinition();
806  if(is_array($def))
807  {
808  $fields["field_values"] = array("text", serialize($def));
809  }
810 
811  return $fields;
812  }
Create styles array
The data for the language used.
getFieldDefinition()
Get (type-specific) field definition.
+ 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 493 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 583 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by _clone(), and getDBProperties().

584  {
585  // type-specific properties
586  }
+ Here is the caller graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinition::getFieldDefinitionForTableGUI ( )

Parse properties for table gui.

Returns
array

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

594  {
595  // type-specific properties
596  }

◆ getFieldId()

◆ getImportId()

ilAdvancedMDFieldDefinition::getImportId ( )

Get import id.

Returns
string

Definition at line 425 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 55 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().

56  {
57  global $ilDB;
58 
59  if(!$a_type)
60  {
61  $set = $ilDB->query("SELECT field_type".
62  " FROM adv_mdf_definition".
63  " WHERE field_id = ".$ilDB->quote($a_field_id, "integer"));
64  $a_type = $ilDB->fetchAssoc($set);
65  $a_type = $a_type["field_type"];
66  }
67 
68  if(self::isValidType($a_type))
69  {
70  $class = "ilAdvancedMDFieldDefinition".self::getTypeString($a_type);
71  require_once "Services/AdvancedMetaData/classes/Types/class.".$class.".php";
72  return new $class($a_field_id);
73  }
74 
75  throw new ilException("unknown type ".$a_type);
76  }
Base class for ILIAS Exception handling.
$a_type
Definition: workflow.php:93
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 166 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, and $row.

Referenced by ilAdvancedMDParser\initValue().

167  {
168  global $ilDB;
169 
170  $query = "SELECT field_id, field_type FROM adv_mdf_definition".
171  " WHERE import_id = ".$ilDB->quote($a_import_id,'text');
172  $set = $ilDB->query($query);
173  if($ilDB->numRows($set))
174  {
175  $row = $ilDB->fetchAssoc($set);
176  return self::getInstance($row["field_id"], $row["field_type"]);
177  }
178  }
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  );
97  $map = array_flip($map);
98  if(array_key_exists($a_type, $map))
99  {
100  return self::getInstance(null, $map[$a_type]);
101  }
102  }
$a_type
Definition: workflow.php:93
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 135 of file class.ilAdvancedMDFieldDefinition.php.

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

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

136  {
137  global $ilDB;
138 
139  $defs = array();
140 
141  $query = "SELECT amf.* FROM adv_md_record_objs aro".
142  " JOIN adv_md_record amr ON aro.record_id = amr.record_id".
143  " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id".
144  " WHERE obj_type = ".$ilDB->quote($a_obj_type,'text');
145  if((bool)$a_active_only)
146  {
147  $query .= " AND active = ".$ilDB->quote(1, "integer");
148  }
149  $query .= " ORDER BY aro.record_id,position";
150  $res = $ilDB->query($query);
151  while($row = $ilDB->fetchAssoc($res))
152  {
153  $field = self::getInstance(null, $row["field_type"]);
154  $field->import($row);
155  $defs[$row["field_id"]] = $field;
156  }
157  return $defs;
158  }
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 111 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().

112  {
113  global $ilDB;
114 
115  $defs = array();
116 
117  $query = "SELECT * FROM adv_mdf_definition".
118  " WHERE record_id = ".$ilDB->quote($a_record_id, "integer");
119  if($a_only_searchable)
120  {
121  $query .= " AND searchable = ".$ilDB->quote(1, "integer");
122  }
123  $query .= " ORDER BY position";
124  $set = $ilDB->query($query);
125  while($row = $ilDB->fetchAssoc($set))
126  {
127  $field = self::getInstance(null, $row["field_type"]);
128  $field->import($row);
129  $defs[$row["field_id"]] = $field;
130  }
131 
132  return $defs;
133  }
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 759 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, and getRecordId().

Referenced by save().

760  {
761  global $ilDB;
762 
763  $sql = "SELECT max(position) pos".
764  " FROM adv_mdf_definition".
765  " WHERE record_id = ".$ilDB->quote($this->getRecordId(), "integer");
766  $set = $ilDB->query($sql);
767  if($ilDB->numRows($set))
768  {
769  $pos = $ilDB->fetchAssoc($set);
770  return (int)$pos["pos"];
771  }
772 
773  return 0;
774  }
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 1162 of file class.ilAdvancedMDFieldDefinition.php.

1163  {
1164  return $a_value;
1165  }

◆ getPosition()

ilAdvancedMDFieldDefinition::getPosition ( )

Get position.

Returns
int

Definition at line 445 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 185 of file class.ilAdvancedMDFieldDefinition.php.

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

Referenced by ilAdvancedSearchGUI\setSubTabs().

186  {
187  global $ilDB;
188 
189  $field_ids = array();
190 
191  $query = "SELECT field_id FROM adv_md_record amr".
192  " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)".
193  " WHERE active = ".$ilDB->quote(1, "integer").
194  " AND searchable = ".$ilDB->quote(1, "integer");
195  $set = $ilDB->query($query);
196  while($row = $ilDB->fetchAssoc($set))
197  {
198  $field_ids[] = $row["field_id"];
199  }
200  return $field_ids;
201  }
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 1034 of file class.ilAdvancedMDFieldDefinition.php.

1035  {
1036  return '';
1037  }

◆ getSearchValueSerialized()

ilAdvancedMDFieldDefinition::getSearchValueSerialized ( ilADTSearchBridge  $a_adt_search)

Get value for search persistence.

Parameters
ilADTSearchBridge$a_adt_search
Returns
string

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

References ilADTSearchBridge\getSerializedValue().

1046  {
1047  return $a_adt_search->getSerializedValue();
1048  }
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 469 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 278 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and array.

279  {
280  if(self::isValidType($a_type))
281  {
282  $map = array(
283  self::TYPE_TEXT => "Text",
284  self::TYPE_SELECT => "Select",
285  self::TYPE_DATE => "Date",
286  self::TYPE_DATETIME => "DateTime",
287  self::TYPE_FLOAT => "Float",
288  self::TYPE_LOCATION => "Location",
289  self::TYPE_INTEGER => "Integer",
290  self::TYPE_SELECT_MULTI => "SelectMulti"
291  );
292  return $map[$a_type];
293  }
294  }
$a_type
Definition: workflow.php:93
Create styles array
The data for the language used.

◆ getTypeTitle()

ilAdvancedMDFieldDefinition::getTypeTitle ( )

Get type title (lang id)

Returns
string

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

References getType(), and initADTDefinition().

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

302  {
303  // :TODO: reuse udf stuff here ?!
304  return "udf_type_".strtolower(self::getTypeString($this->getType()));
305  }
+ 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 247 of file class.ilAdvancedMDFieldDefinition.php.

References array.

Referenced by ilAdvancedMDSettingsGUI\editFields().

248  {
249  return array(self::TYPE_TEXT, self::TYPE_DATE, self::TYPE_DATETIME,
250  self::TYPE_SELECT, self::TYPE_INTEGER, self::TYPE_FLOAT,
251  self::TYPE_LOCATION, self::TYPE_SELECT_MULTI);
252  }
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 819 of file class.ilAdvancedMDFieldDefinition.php.

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

820  {
821  $this->setFieldId($a_data["field_id"]);
822 
823  $this->setRecordId($a_data["record_id"]);
824  $this->setImportId($a_data["import_id"]);
825  $this->setTitle($a_data["title"]);
826  $this->setDescription($a_data["description"]);
827  $this->setPosition($a_data["position"]);
828  $this->setSearchable($a_data["searchable"]);
829  $this->setRequired($a_data["required"]);
830 
831  if($a_data["field_values"])
832  {
833  $this->importFieldDefinition(unserialize($a_data["field_values"]));
834  }
835  }
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 686 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by importDefinitionFormPostValues().

687  {
688  // type-specific
689  }
+ 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 697 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.

698  {
699  if(!$a_form->getItemByPostVar("title")->getDisabled())
700  {
701  $this->setTitle($a_form->getInput("title"));
702  }
703  if(!$a_form->getItemByPostVar("description")->getDisabled())
704  {
705  $this->setDescription($a_form->getInput("description"));
706  }
707  if(!$a_form->getItemByPostVar("searchable")->getDisabled())
708  {
709  $this->setSearchable($a_form->getInput("searchable"));
710  }
711 
712  if($a_permissions->hasPermission(
714  $this->getFieldId(),
717  {
718  $this->importCustomDefinitionFormPostValues($a_form);
719  }
720  }
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 722 of file class.ilAdvancedMDFieldDefinition.php.

723  {
724  return false;
725  }

◆ importFieldDefinition()

ilAdvancedMDFieldDefinition::importFieldDefinition ( array  $a_def)
protected

Import (type-specific) field definition from DB.

Parameters
array$a_def

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

Referenced by import().

574  {
575 
576  }
+ 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 1003 of file class.ilAdvancedMDFieldDefinition.php.

1004  {
1005  return false;
1006  }

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

References getValueForXML(), and importValueFromXML().

976  {
977 
978  }
+ Here is the call graph for this function:

◆ init()

ilAdvancedMDFieldDefinition::init ( )
protected

Init properties.

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

References setRequired(), and setSearchable().

Referenced by __construct().

232  {
233  $this->setRequired(false);
234  $this->setSearchable(false);
235  }
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 513 of file class.ilAdvancedMDFieldDefinition.php.

514  {
515  return true;
516  }

◆ isRequired()

ilAdvancedMDFieldDefinition::isRequired ( )

Is required field.

Returns
bool

Definition at line 558 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 538 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 503 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by addToFieldDefinitionForm(), and setSearchable().

504  {
505  return true;
506  }
+ 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 260 of file class.ilAdvancedMDFieldDefinition.php.

References $a_type, and getType().

261  {
262  return in_array((int)$a_type, self::getValidTypes());
263  }
$a_type
Definition: workflow.php:93
+ 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 1068 of file class.ilAdvancedMDFieldDefinition.php.

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

Referenced by searchObjects().

1069  {
1070  global $ilDB;
1071 
1072  $res = array();
1073 
1074  $obj_ids = array();
1075  foreach($a_records as $record)
1076  {
1077  if($record["sub_type"] == "-")
1078  {
1079  $obj_ids[] = $record["obj_id"];
1080  }
1081  }
1082 
1083  $sql = "SELECT obj_id,type".
1084  " FROM object_data".
1085  " WHERE ".$ilDB->in("obj_id", $obj_ids, "", "integer").
1086  " AND ".$ilDB->in("type", $a_object_types, "", "text");
1087  $set = $ilDB->query($sql);
1088  while($row = $ilDB->fetchAssoc($set))
1089  {
1090  $res[] = $row;
1091  }
1092 
1093  return $res;
1094  }
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 727 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by prepareDefinitionFormConfirmation().

728  {
729  // type-specific
730  }
+ Here is the caller graph for this function:

◆ prepareDefinitionFormConfirmation()

ilAdvancedMDFieldDefinition::prepareDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

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

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

733  {
734  $a_form->getItemByPostVar("title")->setDisabled(true);
735  $a_form->getItemByPostVar("description")->setDisabled(true);
736  $a_form->getItemByPostVar("searchable")->setDisabled(true);
737 
738  // checkboxes have no hidden on disabled
739  if($a_form->getInput("searchable"))
740  {
741  $hidden = new ilHiddenInputGUI("searchable");
742  $hidden->setValue(1);
743  $a_form->addItem($hidden);
744  }
745 
747  }
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 1018 of file class.ilAdvancedMDFieldDefinition.php.

1019  {
1020  // type-specific
1021  }

◆ prepareElementForSearch()

ilAdvancedMDFieldDefinition::prepareElementForSearch ( ilADTSearchBridge  $a_bridge)

Prepare search form elements.

Parameters
ilADTSearchBridge$a_bridge

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

1173  {
1174  // type-specific
1175  }

◆ read()

ilAdvancedMDFieldDefinition::read (   $a_field_id)
protected

Read field definition.

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

References $ilDB, and $row.

Referenced by __construct().

841  {
842  global $ilDB;
843 
844  if(!(int)$a_field_id)
845  {
846  return;
847  }
848 
849  $sql = "SELECT * FROM adv_mdf_definition".
850  " WHERE field_id = ".$ilDB->quote($a_field_id, "integer");
851  $set = $ilDB->query($sql);
852  if($ilDB->numRows($set))
853  {
854  $row = $ilDB->fetchAssoc($set);
855  $this->import($row);
856  }
857  }
global $ilDB
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDFieldDefinition::save (   $a_keep_pos = false)

Create new field entry.

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

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

Referenced by update().

863  {
864  global $ilDB;
865 
866  if($this->getFieldId())
867  {
868  return $this->update();
869  }
870 
871  $next_id = $ilDB->nextId("adv_mdf_definition");
872 
873  // append
874  if(!$a_keep_pos)
875  {
876  $this->setPosition($this->getLastPosition()+1);
877  }
878 
879  // needs unique import id
880  if(!$this->getImportId())
881  {
882  $this->setImportId($this->generateImportId($next_id));
883  }
884 
885  $fields = $this->getDBProperties();
886  $fields["field_id"] = array("integer", $next_id);
887 
888  $ilDB->insert("adv_mdf_definition", $fields);
889 
890  $this->setFieldId($next_id);
891  }
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 1139 of file class.ilAdvancedMDFieldDefinition.php.

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

1140  {
1141  // search type only supported/needed for text
1142 
1143  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1144  $condition = $a_adt_search->getSQLCondition(ilADTActiveRecordByType::SINGLE_COLUMN_NAME);
1145  if($condition)
1146  {
1147  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
1148  if(sizeof($objects))
1149  {
1150  return $this->parseSearchObjects($objects, $a_object_types);
1151  }
1152  return array();
1153  }
1154  }
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 1096 of file class.ilAdvancedMDFieldDefinition.php.

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

1097  {
1098  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
1100 
1101  // :TODO:
1102  if($a_adt_search instanceof ilADTLocationSearchBridgeSingle)
1103  {
1104  $element_id = "loc";
1105  }
1106 
1107  $condition = $a_adt_search->getSQLCondition($element_id);
1108  if($condition)
1109  {
1110  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition);
1111  if(sizeof($objects))
1112  {
1113  $res = array();
1114  foreach($objects as $item)
1115  {
1116  if($item["obj_id"] == $a_obj_id &&
1117  $item["sub_type"] == $sub_obj_type)
1118  {
1119  $res[] = $item["sub_id"];
1120  }
1121  }
1122  return $res;
1123  }
1124  }
1125 
1126  return array();
1127  }
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:

◆ setADT()

ilAdvancedMDFieldDefinition::setADT ( ilADT  $a_adt)
protected

Set ADT instance.

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

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

355  {
356  if(!$this->adt instanceof ilADT)
357  {
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 479 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and importDefinitionFormPostValues().

480  {
481  if($a_desc !== null)
482  {
483  $a_desc = trim($a_desc);
484  }
485  $this->description = $a_desc;
486  }
+ 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  {
415  $a_id_string = trim($a_id_string);
416  }
417  $this->import_id = $a_id_string;
418  }
+ Here is the caller graph for this function:

◆ setPosition()

ilAdvancedMDFieldDefinition::setPosition (   $a_pos)

Set position.

Parameters
int$a_pos

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

Referenced by import(), and save().

436  {
437  $this->position = (int)$a_pos;
438  }
+ 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 548 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and init().

549  {
550  $this->required = (bool)$a_status;
551  }
+ Here is the caller graph for this function:

◆ setSearchable()

ilAdvancedMDFieldDefinition::setSearchable (   $a_status)

Toggle searchable.

Parameters
boolsearchable

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

References isSearchSupported().

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

524  {
525  // see above
526  if(!$this->isSearchSupported())
527  {
528  $a_status = false;
529  }
530  $this->searchable = (bool)$a_status;
531  }
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 1056 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTSearchBridge\setSerializedValue().

1057  {
1058  return $a_adt_search->setSerializedValue($a_value);
1059  }
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 455 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and importDefinitionFormPostValues().

456  {
457  if($a_title !== null)
458  {
459  $a_title = trim($a_title);
460  }
461  $this->title = $a_title;
462  }
+ 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 943 of file class.ilAdvancedMDFieldDefinition.php.

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

944  {
945  $a_writer->xmlStartTag('Field',array(
946  'id' => $this->generateImportId($this->getFieldId()),
947  'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
948  'fieldType' => self::getTypeString($this->getType())));
949 
950  $a_writer->xmlElement('FieldTitle',null,$this->getTitle());
951  $a_writer->xmlElement('FieldDescription',null,$this->getDescription());
952  $a_writer->xmlElement('FieldPosition',null,$this->getPosition());
953 
954  $this->addPropertiesToXML($a_writer);
955 
956  $a_writer->xmlEndTag('Field');
957  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
xmlEndTag($tag)
Writes an endtag.
generateImportId($a_field_id)
Generate unique record id.
Create styles array
The data for the language used.
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 $ilDB, array, getDBProperties(), getFieldId(), and save().

Referenced by save().

897  {
898  global $ilDB;
899 
900  if(!$this->getFieldId())
901  {
902  return $this->save();
903  }
904 
905  $ilDB->update("adv_mdf_definition",
906  $this->getDBProperties(),
907  array("field_id"=>array("integer", $this->getFieldId())));
908  }
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

ilAdvancedMDFieldDefinition::$adt
protected

◆ $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_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_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: