ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAdvancedMDFieldDefinition Class Reference

AMD field abstract base class. More...

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

Public Member Functions

 __construct (GenericData $generic_data, string $language='')
 
 getType ()
 Get type. More...
 
 useDefaultLanguageMode (string $language)
 Check if default language mode has to be used: no language given or language equals default language. More...
 
 getTypeTitle ()
 
 getADTDefinition ()
 Get ADT definition instance. More...
 
 getADT ()
 
 getFieldId ()
 Get field_id. More...
 
 setRecordId (int $a_id)
 Set record id. More...
 
 getRecordId ()
 Get record id. More...
 
 setImportId (string $a_id_string)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setPosition (int $a_pos)
 Set position. More...
 
 getPosition ()
 Get position. More...
 
 setTitle (string $a_title)
 Get title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 isSearchSupported ()
 Is search supported at all. More...
 
 isFilterSupported ()
 Is search by filter supported. More...
 
 setSearchable (bool $a_status)
 Toggle searchable. More...
 
 isSearchable ()
 Is searchable. More...
 
 setRequired (bool $a_status)
 Toggle required. More...
 
 isRequired ()
 Is required field. More...
 
 getFieldDefinitionForTableGUI (string $content_language)
 Parse properties for table gui. More...
 
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $language='')
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $active_language)
 Import post values from definition form. More...
 
 importDefinitionFormPostValuesNeedsConfirmation ()
 
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 generateImportId (int $a_field_id)
 Generate unique record id. More...
 
 save (bool $keep_pos_and_import_id=false, bool $keep_import_id=false)
 Create new field entry. More...
 
 update ()
 Update field entry. More...
 
 delete ()
 Delete field entry. More...
 
 toXML (ilXmlWriter $a_writer)
 To Xml. More...
 
 importXMLProperty (string $a_key, string $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML (string $a_cdata)
 Import value from xml. More...
 
 importFromECS (string $a_ecs_type, $a_value, string $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)
 
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence. More...
 
 searchSubObjects (ilADTSearchBridge $a_adt_search, int $a_obj_id, string $sub_obj_type)
 
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, string $a_locate, string $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 (int $a_new_record_id)
 Clone field definition. More...
 
 hasComplexOptions ()
 
 getComplexOptionsOverview (object $a_parent_gui, string $parent_cmd)
 

Static Public Member Functions

static getInstance (?int $a_field_id, ?int $a_type=null, string $language='')
 
static exists (int $a_field_id)
 
static getInstanceByTypeString (string $a_type)
 Get instance by type string (used by import) More...
 
static getInstancesByRecordId ( $a_record_id, $a_only_searchable=false, string $language='')
 Get definitions by record id. More...
 
static getInstancesByObjType ($a_obj_type, $a_active_only=true)
 
static getInstanceByImportId (string $a_import_id)
 
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 (int $a_type)
 

Data Fields

const TYPE_SELECT = 1
 TODO: put this in when minimum php version is set to 8.2. More...
 
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_ADDRESS = 99
 
const TYPE_EXTERNAL_LINK = 9
 
const TYPE_INTERNAL_LINK = 10
 

Protected Member Functions

 initADTDefinition ()
 Init adt instance. More...
 
 setADT (ilADT $a_adt)
 Set ADT instance. More...
 
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB. More...
 
 getFieldDefinition ()
 Get (type-specific) field definition. More...
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 Add custom input elements to definition form. 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 getInstanceWithData (GenericData $generic_data, string $language='')
 
static getTypeString (int $a_type)
 Get type as string. More...
 

Protected Attributes

GenericData $generic_data
 
ilADTDefinition $adt_def = null
 
ilADT $adt = null
 
string $language = ''
 
ilDBInterface $db
 
ilLanguage $lng
 
ilLogger $logger
 
GlobalHttpState $http
 
RefineryFactory $refinery
 

Private Attributes

DBGateway $db_gateway
 

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDFieldDefinition::__construct ( GenericData  $generic_data,
string  $language = '' 
)

PhpUndefinedMethodInspection

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

References $DIC, $generic_data, $language, ILIAS\MetaData\Elements\Data\Data\FieldDefinition\GenericData\GenericData\getFieldValues(), ILIAS\FileDelivery\http(), importFieldDefinition(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), and ILIAS\Repository\refinery().

79  {
80  global $DIC;
81 
82  $this->lng = $DIC->language();
83  $this->language = $DIC->language()->getLangKey();
84  $this->refinery = $DIC->refinery();
85  $this->http = $DIC->http();
86 
87 
88  if ($language) {
89  $this->language = $language;
90  }
92  $this->logger = $DIC->logger()->amet();
93  $this->db = $DIC->database();
94  $this->db_gateway = new DatabaseGatewayImplementation($this->db);
95 
96  $this->generic_data = $generic_data;
97  if (!empty($generic_data->getFieldValues())) {
98  $this->importFieldDefinition($generic_data->getFieldValues());
99  }
100  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
importFieldDefinition(array $a_def)
Import (type-specific) field definition from DB.
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:

Member Function Documentation

◆ _clone()

ilAdvancedMDFieldDefinition::_clone ( int  $a_new_record_id)

Clone field definition.

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

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

Referenced by ilAdvancedMDFieldDefinitionSelect\readOptions().

1002  : self
1003  {
1004  $class = get_class($this);
1005  $obj = new $class();
1006  $obj->setRecordId($a_new_record_id);
1007  $obj->setTitle($this->getTitle());
1008  $obj->setDescription($this->getDescription());
1009  $obj->setRequired($this->isRequired());
1010  $obj->setPosition($this->getPosition());
1011  $obj->setSearchable($this->isSearchable());
1012  $obj->importFieldDefinition($this->getFieldDefinition());
1013  $obj->save(true);
1014 
1015  return $obj;
1016  }
getFieldDefinition()
Get (type-specific) field definition.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCustomFieldToDefinitionForm()

ilAdvancedMDFieldDefinition::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
bool  $a_disabled = false,
string  $language = '' 
)
protected

Add custom input elements to definition form.

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

Referenced by addToFieldDefinitionForm().

560  : void {
561  }
+ Here is the caller graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinition::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Add (type-specific) properties to xml export.

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

Referenced by toXML().

835  : void
836  {
837  // type-specific properties
838  }
+ Here is the caller graph for this function:

◆ addToFieldDefinitionForm()

ilAdvancedMDFieldDefinition::addToFieldDefinitionForm ( ilPropertyFormGUI  $a_form,
ilAdvancedMDPermissionHelper  $a_permissions,
string  $language = '' 
)

Add input elements to definition form.

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

References $check, $DIC, ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, addCustomFieldToDefinitionForm(), ilPropertyFormGUI\addItem(), ilAdvancedMDPermissionHelper\CONTEXT_FIELD, getDescription(), getFieldId(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), getRecordId(), getTitle(), ilClaimingPermissionHelper\hasPermissions(), isSearchable(), isSearchSupported(), ilTextAreaInputGUI\setValue(), ilAdvancedMDPermissionHelper\SUBACTION_FIELD_DESCRIPTION, ilAdvancedMDPermissionHelper\SUBACTION_FIELD_PROPERTIES, ilAdvancedMDPermissionHelper\SUBACTION_FIELD_SEARCHABLE, ilAdvancedMDPermissionHelper\SUBACTION_FIELD_TITLE, and ilLanguage\txt().

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

570  : void {
571  global $DIC;
572  $lng = $DIC['lng'];
573 
574  $perm = $a_permissions->hasPermissions(
576  (string) $this->getFieldId(),
577  array(
580  )
581  ,
584  )
585  ,
588  )
589  ,
592  )
593  )
594  );
595 
596  // title
598 
599  $title = new ilTextInputGUI($lng->txt('title'), 'title');
600  $title->setValue($this->getTitle());
601  $title->setSize(20);
602  $title->setMaxLength(70);
603  $title->setRequired(true);
604  if ($this->getFieldId()) {
605  $translations->modifyTranslationInfoForTitle($this->getFieldId(), $a_form, $title, $language);
606  } else {
607  $title->setValue($this->getTitle());
608  }
609 
610  $a_form->addItem($title);
611 
613  $title->setDisabled(true);
614  }
615 
616  // desc
617  $desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
618  $desc->setValue($this->getDescription());
619  $desc->setRows(3);
620  $desc->setCols(50);
621  if ($this->getFieldId()) {
622  $translations->modifyTranslationInfoForDescription($this->getFieldId(), $a_form, $desc, $language);
623  } else {
624  $desc->setValue($this->getDescription());
625  }
626 
627  $a_form->addItem($desc);
628 
630  $desc->setDisabled(true);
631  }
632 
633  // searchable
634  $check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
635  $check->setChecked($this->isSearchable());
636  $check->setValue("1");
637  $a_form->addItem($check);
638 
640  !$this->isSearchSupported()) {
641  $check->setDisabled(true);
642  }
643 
644  /* required
645  $check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
646  $check->setChecked($this->isRequired());
647  $check->setValue(1);
648  $a_form->addItem($check);
649  */
650 
652  $a_form,
654  $language
655  );
656  }
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
Add custom input elements to definition form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
hasPermissions(int $a_context_type, string $a_context_id, array $a_action_ids)
Check permissions.
global $DIC
Definition: shib_login.php:22
This class represents a text area property in a property form.
$check
Definition: buildRTE.php:81
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 780 of file class.ilAdvancedMDFieldDefinition.php.

References ilAdvancedMDValues\_deleteByFieldId(), getADT(), and getFieldId().

780  : void
781  {
782  if (!$this->getFieldId()) {
783  return;
784  }
785 
786  // delete all values
788 
789  $this->db_gateway->delete($this->getFieldId());
790  }
static _deleteByFieldId(int $a_field_id, ilADT $a_adt)
Delete values by field_id.
+ Here is the call graph for this function:

◆ exists()

static ilAdvancedMDFieldDefinition::exists ( int  $a_field_id)
static

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

References $DIC, ilDBInterface\fetchAssoc(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilContainerFilterFieldData\getFilterSetForRefId().

146  : bool
147  {
148  global $DIC;
149 
150  $db = $DIC['ilDB'];
151  $set = $db->query("SELECT field_type" .
152  " FROM adv_mdf_definition" .
153  " WHERE field_id = " . $db->quote($a_field_id, "integer"));
154  if ($db->fetchAssoc($set)) {
155  return true;
156  }
157  return false;
158  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generateImportId()

ilAdvancedMDFieldDefinition::generateImportId ( int  $a_field_id)

Generate unique record id.

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

References IL_INST_ID.

724  : string
725  {
726  return 'il_' . IL_INST_ID . '_adv_md_field_' . $a_field_id;
727  }
const IL_INST_ID
Definition: constants.php:40

◆ getADT()

ilAdvancedMDFieldDefinition::getADT ( )

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

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

Referenced by delete(), ilAdvancedMDFieldDefinitionDate\importFromECS(), ilAdvancedMDFieldDefinitionDateTime\importFromECS(), ilAdvancedMDFieldDefinitionText\importFromECS(), ilAdvancedMDFieldDefinitionExternalLink\importValueFromXML(), ilAdvancedMDFieldDefinitionInternalLink\importValueFromXML(), ilAdvancedMDFieldDefinitionLocation\importValueFromXML(), ilAdvancedMDFieldDefinitionDate\importValueFromXML(), ilAdvancedMDFieldDefinitionDateTime\importValueFromXML(), ilAdvancedMDFieldDefinitionSelectMulti\importValueFromXML(), ilAdvancedMDFieldDefinitionGroupBased\importValueFromXML(), ilAdvancedMDFieldDefinitionInteger\importValueFromXML(), ilAdvancedMDFieldDefinitionText\importValueFromXML(), ilAdvancedMDFieldDefinitionSelect\importValueFromXML(), ILIAS\Cache\Services\SubObjectModes\Filter\Supplier\initFilterInput(), ilAdvancedMDFieldDefinitionInternalLink\searchObjects(), ilAdvancedMDFieldDefinitionText\searchObjects(), searchObjects(), and searchSubObjects().

371  : ilADT
372  {
373  if (!$this->adt instanceof ilADT) {
374  $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTDefinition());
375  }
376  return $this->adt;
377  }
getADTDefinition()
Get ADT definition instance.
ADT base class.
Definition: class.ilADT.php:25
+ 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 363 of file class.ilAdvancedMDFieldDefinition.php.

References $adt_def, and initADTDefinition().

Referenced by getADT(), ilAdvancedMDFieldDefinitionText\getADTGroup(), ilAdvancedMDFieldDefinitionSelect\importNewSelectOptions(), ILIAS\Cache\Services\SubObjectModes\DataTable\Supplier\initColumn(), ILIAS\Cache\Services\SubObjectModes\Filter\Supplier\initFilterInput(), and ilAdvancedMDFieldDefinitionSelect\update().

364  {
365  if (!$this->adt_def instanceof ilADTDefinition) {
366  $this->adt_def = $this->initADTDefinition();
367  }
368  return $this->adt_def;
369  }
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<int,ilADTDefinition>
Returns
ilADTGroup
Todo:
check return type array<string, ilADTDefinition> or array<string, ilADTDefinition>

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

References ilADTFactory\getInstance().

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

286  : ilADT
287  {
288  $factory = ilADTFactory::getInstance();
289  $group_def = $factory->getDefinitionInstanceByType("Group");
290  foreach ($a_defs as $def) {
291  $group_def->addElement($def->getFieldId(), $def->getADTDefinition());
292  }
293  $group = $factory->getInstanceByDefinition($group_def);
294 
295  // bind adt instances to definition
296  foreach ($group->getElements() as $element_id => $element) {
297  $a_defs[$element_id]->setADT($element);
298  }
299  return $group;
300  }
ADT base class.
Definition: class.ilADT.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComplexOptionsOverview()

ilAdvancedMDFieldDefinition::getComplexOptionsOverview ( object  $a_parent_gui,
string  $parent_cmd 
)
Parameters
object$a_parent_gui
string$parent_cmd
Returns
null

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

References null.

1031  : ?string
1032  {
1033  return null;
1034  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getDescription()

ilAdvancedMDFieldDefinition::getDescription ( )

Get description.

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

Referenced by _clone(), addToFieldDefinitionForm(), ilAdvancedMDSettingsGUI\initFieldForm(), and toXML().

473  : string
474  {
475  return $this->generic_data->getDescription();
476  }
+ Here is the caller graph for this function:

◆ getFieldDefinition()

ilAdvancedMDFieldDefinition::getFieldDefinition ( )
protected

Get (type-specific) field definition.

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

Referenced by _clone(), save(), and update().

540  : array
541  {
542  return [];
543  }
+ Here is the caller graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinition::getFieldDefinitionForTableGUI ( string  $content_language)

Parse properties for table gui.

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

548  : array
549  {
550  return [];
551  }

◆ getFieldId()

◆ getImportId()

ilAdvancedMDFieldDefinition::getImportId ( )

Get import id.

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

Referenced by toXML().

425  : string
426  {
427  return $this->generic_data->getImportID();
428  }
+ Here is the caller graph for this function:

◆ getInstance()

static ilAdvancedMDFieldDefinition::getInstance ( ?int  $a_field_id,
?int  $a_type = null,
string  $language = '' 
)
static

TODO: In the future, this should probably be supplied by the repo.

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

References $DIC, and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

Referenced by ILIAS\UI\Component\Legacy\Content\Filter\FilterManager\apply(), ilAdvancedMDSettingsGUI\confirmDeleteFields(), ilAdvancedMDSettingsGUI\createField(), ilAdvancedMDSettingsGUI\deleteFields(), ilAdvancedMDSettingsGUI\editComplexOption(), ilAdvancedMDSettingsGUI\editField(), ilAdvancedMDSettingsGUI\editFields(), ilPresentationTableGUI\getADTSearchBridges(), ilContainerFilterAdvMDAdapter\getAdvType(), ilContainerFilterUtil\getContainerFieldTitle(), ilLuceneAdvancedSearchFields\getFormElement(), ilContainerFilterAdvMDAdapter\getOptions(), ilContainerFilterAdvMDAdapter\getTitle(), ilLuceneAdvancedSearchFields\parseFieldQuery(), ilLuceneAdvancedSearchFields\readSections(), ilAdvancedMDSettingsGUI\saveField(), ilAdvancedSearchGUI\searchAdvancedMD(), ilAdvancedMDSettingsGUI\updateComplexOption(), and ilAdvancedMDSettingsGUI\updateField().

107  global $DIC;
108 
109  $db_gateway = new DatabaseGatewayImplementation($DIC->database());
110 
111  if (self::isValidType((int) $a_type)) {
116  Type::from($a_type),
117  0,
118  '',
119  '',
120  '',
121  0,
122  false,
123  false,
124  []
125  );
126  }
127 
128  if ($a_field_id) {
129  $generic_data = $db_gateway->readByID($a_field_id);
130  }
131 
132  if (isset($generic_data)) {
133  return self::getInstanceWithData($generic_data);
134  }
135  throw new ilException("unknown type " . $a_type);
136  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByImportId()

static ilAdvancedMDFieldDefinition::getInstanceByImportId ( string  $a_import_id)
static

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

References $data, $DIC, and null.

Referenced by ilAdvancedMDParser\initValue().

246  {
247  global $DIC;
248 
249  $db_gateway = new DatabaseGatewayImplementation($DIC->database());
250 
251  if (is_null($data = $db_gateway->readByImportID($a_import_id))) {
252  return null;
253  }
254  return self::getInstanceWithData($data);
255  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getInstanceByTypeString()

static ilAdvancedMDFieldDefinition::getInstanceByTypeString ( string  $a_type)
static

Get instance by type string (used by import)

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

References null.

Referenced by ilAdvancedMDRecordParser\initFieldObject().

164  {
165  // see self::getTypeString()
166  $map = array(
167  self::TYPE_TEXT => "Text",
168  self::TYPE_SELECT => "Select",
169  self::TYPE_DATE => "Date",
170  self::TYPE_DATETIME => "DateTime",
171  self::TYPE_FLOAT => "Float",
172  self::TYPE_LOCATION => "Location",
173  self::TYPE_INTEGER => "Integer",
174  self::TYPE_SELECT_MULTI => "SelectMulti",
175  self::TYPE_EXTERNAL_LINK => 'ExternalLink',
176  self::TYPE_INTERNAL_LINK => 'InternalLink',
177  self::TYPE_ADDRESS => "Address"
178  );
179  $map = array_flip($map);
180  if (array_key_exists($a_type, $map)) {
181  return self::getInstance(null, $map[$a_type]);
182  }
183  return null;
184  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getInstancesByObjType()

static ilAdvancedMDFieldDefinition::getInstancesByObjType (   $a_obj_type,
  $a_active_only = true 
)
static
Parameters
string$a_obj_type
bool$a_active_only
Returns
array<int, ilAdvancedMDFieldDefinition>

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

References $data, $DIC, $ilDB, $res, and ILIAS\Repository\int().

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

214  : array
215  {
216  global $DIC;
217 
218  $ilDB = $DIC->database();
220 
221  $query = "SELECT amf.* FROM adv_md_record_objs aro" .
222  " JOIN adv_md_record amr ON aro.record_id = amr.record_id" .
223  " JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id" .
224  " WHERE obj_type = " . $ilDB->quote($a_obj_type, 'text');
225  if ($a_active_only) {
226  $query .= " AND active = " . $ilDB->quote(1, "integer");
227  }
228  $query .= " ORDER BY aro.record_id,position";
229 
230  $res = $ilDB->query($query);
231  $ids = [];
232  while ($row = $ilDB->fetchAssoc($res)) {
233  $ids[] = (int) $row["field_id"];
234  }
235  $data = $db_gateway->readByIDs(...$ids);
236 
237  $defs = [];
238  foreach ($data as $datum) {
239  $defs[$datum->id()] = self::getInstanceWithData($datum);
240  }
241 
242  return $defs;
243  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstancesByRecordId()

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

Get definitions by record id.

Parameters
int$a_record_id
bool$a_only_searchable
string$language
Returns
array<int, ilAdvancedMDFieldDefinition>

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

References $data, and $DIC.

Referenced by ilAdvancedMDRecord\_clone(), ilGlossaryTerm\_copyTerm(), ilAdvancedMDRecord\_delete(), ilAdvancedMDSettingsGUI\editFields(), ilAdvancedMDRecordTableGUI\fillRow(), ilObjBookingPool\getAdvancedMDFields(), ilGlossaryAdvMetaDataAdapter\getAllFields(), ilContainerFilterAdvMDAdapter\getAvailableRecordSets(), ILIAS\Cache\Services\SubObjectModes\DataTable\Supplier\getData(), ilAdvancedMDValues\getDefinitions(), ilLuceneAdvancedSearchFields\getFields(), ilPCAMDPageList\handleCopiedContent(), ILIAS\Cache\Services\SubObjectModes\DataTable\Supplier\initColumns(), ILIAS\Cache\Services\SubObjectModes\Filter\Supplier\initFilterInputs(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDRecordGUI\parseTableCells(), ilAdvancedMDRecordGUI\parseTableHead(), ilAdvancedMDValues\queryForRecords(), ilAdvancedMDFieldTranslations\read(), ilAdvancedMDRecord\toXML(), and ilAdvancedMDSettingsGUI\updateFields().

197  : array {
198  global $DIC;
199 
200  $db_gateway = new DatabaseGatewayImplementation($DIC->database());
201 
202  $defs = [];
203  foreach ($db_gateway->readByRecords($a_only_searchable, $a_record_id) as $data) {
204  $defs[$data->id()] = self::getInstanceWithData($data);
205  }
206  return $defs;
207  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getInstanceWithData()

static ilAdvancedMDFieldDefinition::getInstanceWithData ( GenericData  $generic_data,
string  $language = '' 
)
staticprotected

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

References ILIAS\MetaData\Elements\Data\Data\FieldDefinition\GenericData\GenericData\type().

142  $class = "ilAdvancedMDFieldDefinition" . $generic_data->type()->stringValue();
143  return new $class($generic_data, $language);
144  }
+ Here is the call graph for this function:

◆ getLuceneSearchString()

ilAdvancedMDFieldDefinition::getLuceneSearchString (   $a_value)

Get search string in lucene syntax.

Parameters
string| array
Returns
Todo:
with php 8 support change parameter to union type

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

988  {
989  return $a_value;
990  }

◆ getPosition()

ilAdvancedMDFieldDefinition::getPosition ( )

Get position.

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

Referenced by _clone(), and toXML().

441  : int
442  {
443  return $this->generic_data->getPosition();
444  }
+ Here is the caller graph for this function:

◆ getRecordId()

◆ getSearchableDefinitionIds()

static ilAdvancedMDFieldDefinition::getSearchableDefinitionIds ( )
static

Get searchable definition ids (performance is key)

Returns
int[]

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

References $DIC, $ilDB, and ILIAS\Repository\int().

Referenced by ilAdvancedSearchGUI\setSubTabs().

262  {
263  global $DIC;
264 
265  $ilDB = $DIC['ilDB'];
266 
267  $field_ids = array();
268 
269  $query = "SELECT field_id FROM adv_md_record amr" .
270  " JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)" .
271  " WHERE active = " . $ilDB->quote(1, "integer") .
272  " AND searchable = " . $ilDB->quote(1, "integer");
273  $set = $ilDB->query($query);
274  while ($row = $ilDB->fetchAssoc($set)) {
275  $field_ids[] = (int) $row["field_id"];
276  }
277  return $field_ids;
278  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ 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
string
Todo:
check if string type is applicable

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

880  : string
881  {
882  return '';
883  }

◆ getSearchValueSerialized()

ilAdvancedMDFieldDefinition::getSearchValueSerialized ( ilADTSearchBridge  $a_adt_search)

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

References ilADTSearchBridge\getSerializedValue().

885  : string
886  {
887  return $a_adt_search->getSerializedValue();
888  }
getSerializedValue()
Get current value(s) in serialized form (for easy persisting)
+ Here is the call graph for this function:

◆ getTitle()

ilAdvancedMDFieldDefinition::getTitle ( )

Get title.

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

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

457  : string
458  {
459  return $this->generic_data->getTitle();
460  }
+ Here is the caller graph for this function:

◆ getType()

◆ getTypeString()

static ilAdvancedMDFieldDefinition::getTypeString ( int  $a_type)
staticprotected

Get type as string.

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

329  : string
330  {
331  return (string) (Type::tryFrom($a_type)?->stringValue());
332  }

◆ getTypeTitle()

ilAdvancedMDFieldDefinition::getTypeTitle ( )
Todo:
check udf usage

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

References getType(), and initADTDefinition().

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

349  : string
350  {
351  return "udf_type_" . strtolower(self::getTypeString($this->getType()));
352  }
+ 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
int[]

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

Referenced by ilAdvancedMDSettingsGUI\editFields().

306  : array
307  {
308  $types = Type::cases();
309  $values = [];
310  foreach ($types as $type) {
311  $values[] = $type->value;
312  }
313  return $values;
314  }
+ Here is the caller graph for this function:

◆ getValueForXML()

ilAdvancedMDFieldDefinition::getValueForXML ( ilADT  $element)
abstract

Parse ADT value for xml (export)

Referenced by importXMLProperty().

+ Here is the caller graph for this function:

◆ hasComplexOptions()

ilAdvancedMDFieldDefinition::hasComplexOptions ( )

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

1021  : bool
1022  {
1023  return false;
1024  }

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinition::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form,
string  $language = '' 
)

Import custom post values from definition form.

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

Referenced by importDefinitionFormPostValues().

661  : void
662  {
663  // type-specific
664  }
+ Here is the caller graph for this function:

◆ importDefinitionFormPostValues()

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

Import post values from definition form.

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

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

673  : void {
674  $record = ilAdvancedMDRecord::_getInstanceByRecordId($this->getRecordID());
675  $is_translation = (($active_language !== '') && ($active_language != $record->getDefaultLanguage()));
676  if (!$a_form->getItemByPostVar("title")->getDisabled() && !$is_translation) {
677  $this->setTitle($a_form->getInput("title"));
678  }
679  if (!$a_form->getItemByPostVar("description")->getDisabled() && !$is_translation) {
680  $this->setDescription($a_form->getInput("description"));
681  }
682  if (!$a_form->getItemByPostVar("searchable")->getDisabled()) {
683  $this->setSearchable((bool) $a_form->getInput("searchable"));
684  }
685 
686  if ($a_permissions->hasPermission(
688  (string) $this->getFieldId(),
691  )) {
692  $this->importCustomDefinitionFormPostValues($a_form, $active_language);
693  }
694  }
getItemByPostVar(string $a_post_var)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language='')
Import custom post values from definition form.
static _getInstanceByRecordId(int $a_record_id)
hasPermission(int $a_context_type, string $a_context_id, int $a_action_id, ?int $a_action_sub_id=null)
Check permission.
setDescription(string $a_desc)
Set description.
setSearchable(bool $a_status)
Toggle searchable.
+ Here is the call graph for this function:

◆ importDefinitionFormPostValuesNeedsConfirmation()

ilAdvancedMDFieldDefinition::importDefinitionFormPostValuesNeedsConfirmation ( )

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

696  : bool
697  {
698  return false;
699  }

◆ importFieldDefinition()

ilAdvancedMDFieldDefinition::importFieldDefinition ( array  $a_def)
protected

Import (type-specific) field definition from DB.

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

Referenced by __construct().

533  : void
534  {
535  }
+ Here is the caller graph for this function:

◆ importFromECS()

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

Import meta data from ECS.

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

861  : bool
862  {
863  return false;
864  }

◆ importValueFromXML()

ilAdvancedMDFieldDefinition::importValueFromXML ( string  $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 ( string  $a_key,
string  $a_value 
)

Import property from XML.

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

References getValueForXML(), and importValueFromXML().

843  : void
844  {
845  }
+ Here is the call graph for this function:

◆ initADTDefinition()

ilAdvancedMDFieldDefinition::initADTDefinition ( )
abstractprotected

Init adt instance.

Referenced by getADTDefinition(), and getTypeTitle().

+ Here is the caller graph for this function:

◆ isFilterSupported()

ilAdvancedMDFieldDefinition::isFilterSupported ( )

Is search by filter supported.

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

489  : bool
490  {
491  return true;
492  }

◆ isRequired()

ilAdvancedMDFieldDefinition::isRequired ( )

Is required field.

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

Referenced by _clone().

525  : bool
526  {
527  return $this->generic_data->isRequired();
528  }
+ Here is the caller graph for this function:

◆ isSearchable()

ilAdvancedMDFieldDefinition::isSearchable ( )

Is searchable.

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

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

509  : bool
510  {
511  return $this->generic_data->isSearchable();
512  }
+ Here is the caller graph for this function:

◆ isSearchSupported()

ilAdvancedMDFieldDefinition::isSearchSupported ( )

Is search supported at all.

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

Referenced by addToFieldDefinitionForm(), and setSearchable().

481  : bool
482  {
483  return true;
484  }
+ Here is the caller graph for this function:

◆ isValidType()

static ilAdvancedMDFieldDefinition::isValidType ( int  $a_type)
static

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

References getType(), and ILIAS\Repository\int().

Referenced by ilAdvancedMDClaimingPlugin\createDBField().

316  : bool
317  {
318  return !is_null(Type::tryFrom($a_type));
319  }
+ Here is the call graph for this function:
+ Here is the caller 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.

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

References $res.

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

901  : array
902  {
903  $res = [];
904  $obj_ids = [];
905  foreach ($a_records as $record) {
906  if ($record["sub_type"] == "-") {
907  $obj_ids[] = $record["obj_id"];
908  }
909  }
910 
911  $sql = "SELECT obj_id,type" .
912  " FROM object_data" .
913  " WHERE " . $this->db->in("obj_id", $obj_ids, false, "integer") .
914  " AND " . $this->db->in("type", $a_object_types, false, "text");
915  $set = $this->db->query($sql);
916  while ($row = $this->db->fetchAssoc($set)) {
917  $res[] = $row;
918  }
919  return $res;
920  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ prepareCustomDefinitionFormConfirmation()

ilAdvancedMDFieldDefinition::prepareCustomDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

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

Referenced by prepareDefinitionFormConfirmation().

701  : void
702  {
703  }
+ Here is the caller graph for this function:

◆ prepareDefinitionFormConfirmation()

ilAdvancedMDFieldDefinition::prepareDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

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

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

705  : void
706  {
707  $a_form->getItemByPostVar("title")->setDisabled(true);
708  $a_form->getItemByPostVar("description")->setDisabled(true);
709  $a_form->getItemByPostVar("searchable")->setDisabled(true);
710 
711  // checkboxes have no hidden on disabled
712  if ($a_form->getInput("searchable")) {
713  $hidden = new ilHiddenInputGUI("searchable");
714  $hidden->setValue("1");
715  $a_form->addItem($hidden);
716  }
717 
719  }
getItemByPostVar(string $a_post_var)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
prepareCustomDefinitionFormConfirmation(ilPropertyFormGUI $a_form)
This class represents a hidden form property in a property form.
+ Here is the call graph for this function:

◆ prepareElementForEditor()

ilAdvancedMDFieldDefinition::prepareElementForEditor ( ilADTFormBridge  $a_bridge)

Prepare editor form elements.

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

869  : void
870  {
871  // type-specific
872  }

◆ prepareElementForSearch()

ilAdvancedMDFieldDefinition::prepareElementForSearch ( ilADTSearchBridge  $a_bridge)

Prepare search form elements.

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

995  : void
996  {
997  }

◆ save()

ilAdvancedMDFieldDefinition::save ( bool  $keep_pos_and_import_id = false,
bool  $keep_import_id = false 
)

Create new field entry.

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

References getFieldDefinition(), getFieldId(), and update().

Referenced by update().

732  : void
733  {
734  if ($this->getFieldId()) {
735  $this->update();
736  return;
737  }
738 
739  /*
740  * This has to be set before update and creation here, the alternative
741  * would be to set this in all children of this class, everywhere
742  * where type-specific settings are set.
743  */
744  $this->generic_data->setFieldValues($this->getFieldDefinition());
745 
746  if ($keep_pos_and_import_id) {
747  $field_id = $this->db_gateway->create($this->generic_data);
748  } elseif ($keep_import_id) {
749  $field_id = $this->db_gateway->createWithNewPosition($this->generic_data);
750  } else {
751  $field_id = $this->db_gateway->createFromScratch($this->generic_data);
752  }
753 
754  $this->generic_data = $this->db_gateway->readByID($field_id);
755  }
getFieldDefinition()
Get (type-specific) field definition.
+ 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,
string  $a_locate,
string  $a_search_type 
)

Search objects.

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

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

963  : array {
964  // search type only supported/needed for text
966  if ($condition) {
968  "adv_md_values",
969  $this->getADT()->getType(),
970  $this->getFieldId(),
971  $condition,
972  $a_locate
973  );
974  if (sizeof($objects)) {
975  return $this->parseSearchObjects($objects, $a_object_types);
976  }
977  }
978  return [];
979  }
parseSearchObjects(array $a_records, array $a_object_types)
Add object-data needed for global search to AMD search results.
getSQLCondition(string $a_element_id, int $mode=self::SQL_LIKE, array $quotedWords=[])
Get SQL condition for current value(s)
static find(string $a_table, string $a_type, int $a_field_id, string $a_condition, ?string $a_additional_fields=null)
Find entries.
+ Here is the call graph for this function:

◆ searchSubObjects()

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

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

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

922  : array
923  {
925 
926  // :TODO:
927  if ($a_adt_search instanceof ilADTLocationSearchBridgeSingle) {
928  $element_id = "loc";
929  }
930 
931  $condition = $a_adt_search->getSQLCondition($element_id);
932  if ($condition) {
934  "adv_md_values",
935  $this->getADT()->getType(),
936  $this->getFieldId(),
937  $condition
938  );
939  if (sizeof($objects)) {
940  $res = array();
941  foreach ($objects as $item) {
942  if ($item["obj_id"] == $a_obj_id &&
943  $item["sub_type"] == $sub_obj_type) {
944  $res[] = $item["sub_id"];
945  }
946  }
947  return $res;
948  }
949  }
950 
951  return array();
952  }
$res
Definition: ltiservices.php:66
getSQLCondition(string $a_element_id, int $mode=self::SQL_LIKE, array $quotedWords=[])
Get SQL condition for current value(s)
static find(string $a_table, string $a_type, int $a_field_id, string $a_condition, ?string $a_additional_fields=null)
Find entries.
+ Here is the call graph for this function:

◆ setADT()

ilAdvancedMDFieldDefinition::setADT ( ilADT  $a_adt)
protected

Set ADT instance.

See also
self::getADTGroupForDefinitions()

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

383  : void
384  {
385  if (!$this->adt instanceof ilADT) {
386  $this->adt = $a_adt;
387  }
388  }
ADT base class.
Definition: class.ilADT.php:25

◆ setDescription()

ilAdvancedMDFieldDefinition::setDescription ( string  $a_desc)

Set description.

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

Referenced by importDefinitionFormPostValues().

465  : void
466  {
467  $this->generic_data->setDescription(trim($a_desc));
468  }
+ Here is the caller graph for this function:

◆ setImportId()

ilAdvancedMDFieldDefinition::setImportId ( string  $a_id_string)

Set import id.

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

417  : void
418  {
419  $this->generic_data->setImportID(trim($a_id_string));
420  }

◆ setPosition()

ilAdvancedMDFieldDefinition::setPosition ( int  $a_pos)

Set position.

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

433  : void
434  {
435  $this->generic_data->setPosition($a_pos);
436  }

◆ setRecordId()

ilAdvancedMDFieldDefinition::setRecordId ( int  $a_id)

Set record id.

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

401  : void
402  {
403  $this->generic_data->setRecordID($a_id);
404  }

◆ setRequired()

ilAdvancedMDFieldDefinition::setRequired ( bool  $a_status)

Toggle required.

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

517  : void
518  {
519  $this->generic_data->setRequired($a_status);
520  }

◆ setSearchable()

ilAdvancedMDFieldDefinition::setSearchable ( bool  $a_status)

Toggle searchable.

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

References isSearchSupported().

Referenced by importDefinitionFormPostValues().

497  : void
498  {
499  // see above
500  if (!$this->isSearchSupported()) {
501  $a_status = false;
502  }
503  $this->generic_data->setSearchable($a_status);
504  }
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.

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

References ilADTSearchBridge\setSerializedValue().

893  : void
894  {
895  $a_adt_search->setSerializedValue($a_value);
896  }
setSerializedValue(string $a_value)
Set current value(s) in serialized form (for easy persisting)
+ Here is the call graph for this function:

◆ setTitle()

ilAdvancedMDFieldDefinition::setTitle ( string  $a_title)

Get title.

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

Referenced by importDefinitionFormPostValues().

449  : void
450  {
451  $this->generic_data->setTitle(trim($a_title));
452  }
+ 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.

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

References addPropertiesToXML(), getDescription(), getImportId(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), getPosition(), getRecordId(), getTitle(), getType(), isSearchable(), null, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

797  : void
798  {
799  $a_writer->xmlStartTag('Field', array(
800  'id' => $this->getImportId(),
801  'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
802  'fieldType' => self::getTypeString($this->getType())
803  ));
804 
805  $a_writer->xmlElement('FieldTitle', null, $this->getTitle());
806  $a_writer->xmlElement('FieldDescription', null, $this->getDescription());
807 
809  $a_writer->xmlStartTag('FieldTranslations');
810  foreach ($translations->getTranslations($this->getFieldId()) as $translation) {
811  $a_writer->xmlStartTag('FieldTranslation', ['language' => $translation->getLangKey()]);
812  $a_writer->xmlElement(
813  'FieldTranslationTitle',
814  [],
815  $translation->getTitle()
816  );
817  $a_writer->xmlElement(
818  'FieldTranslationDescription',
819  [],
820  $translation->getDescription()
821  );
822  $a_writer->xmlEndTag('FieldTranslation');
823  }
824  $a_writer->xmlEndTag('FieldTranslations');
825  $a_writer->xmlElement('FieldPosition', null, $this->getPosition());
826 
827  $this->addPropertiesToXML($a_writer);
828 
829  $a_writer->xmlEndTag('Field');
830  }
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addPropertiesToXML(ilXmlWriter $a_writer)
Add (type-specific) properties to xml export.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ update()

ilAdvancedMDFieldDefinition::update ( )

Update field entry.

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

References getFieldDefinition(), getFieldId(), and save().

Referenced by save().

760  : void
761  {
762  if (!$this->getFieldId()) {
763  $this->save();
764  return;
765  }
766 
767  /*
768  * This has to be set before update and creation here, the alternative
769  * would be to set this in all children of this class, everywhere
770  * where type-specific settings are set.
771  */
772  $this->generic_data->setFieldValues($this->getFieldDefinition());
773 
774  $this->db_gateway->update($this->generic_data);
775  }
save(bool $keep_pos_and_import_id=false, bool $keep_import_id=false)
Create new field entry.
getFieldDefinition()
Get (type-specific) field definition.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ useDefaultLanguageMode()

ilAdvancedMDFieldDefinition::useDefaultLanguageMode ( string  $language)

Check if default language mode has to be used: no language given or language equals default language.

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

References $language, and ilAdvancedMDRecord\_getInstanceByRecordId().

Referenced by ilAdvancedMDFieldDefinitionSelect\addCustomFieldToDefinitionForm(), ilAdvancedMDFieldDefinitionInteger\addCustomFieldToDefinitionForm(), ilAdvancedMDFieldDefinitionInteger\getFieldDefinitionForTableGUI(), ilAdvancedMDFieldDefinitionInteger\importCustomDefinitionFormPostValues(), and ilAdvancedMDFieldDefinitionSelect\importNewSelectOptions().

337  : bool
338  {
339  if (!strlen($language)) {
340  return true;
341  }
342  $record = ilAdvancedMDRecord::_getInstanceByRecordId($this->getRecordID());
343  return strcmp($record->getDefaultLanguage(), $language) === 0;
344  }
static _getInstanceByRecordId(int $a_record_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $adt

◆ $adt_def

ilADTDefinition ilAdvancedMDFieldDefinition::$adt_def = null
protected

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

Referenced by getADTDefinition().

◆ $db

ilDBInterface ilAdvancedMDFieldDefinition::$db
protected

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

◆ $db_gateway

DBGateway ilAdvancedMDFieldDefinition::$db_gateway
private

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

◆ $generic_data

GenericData ilAdvancedMDFieldDefinition::$generic_data
protected

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

Referenced by __construct().

◆ $http

GlobalHttpState ilAdvancedMDFieldDefinition::$http
protected

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

◆ $language

◆ $lng

◆ $logger

ilLogger ilAdvancedMDFieldDefinition::$logger
protected

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

◆ $refinery

RefineryFactory ilAdvancedMDFieldDefinition::$refinery
protected

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

◆ TYPE_ADDRESS

const ilAdvancedMDFieldDefinition::TYPE_ADDRESS = 99

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

◆ TYPE_DATE

const ilAdvancedMDFieldDefinition::TYPE_DATE = 3

◆ TYPE_DATETIME

const ilAdvancedMDFieldDefinition::TYPE_DATETIME = 4

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

◆ TYPE_EXTERNAL_LINK

const ilAdvancedMDFieldDefinition::TYPE_EXTERNAL_LINK = 9

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

◆ TYPE_FLOAT

const ilAdvancedMDFieldDefinition::TYPE_FLOAT = 6

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

◆ TYPE_INTEGER

const ilAdvancedMDFieldDefinition::TYPE_INTEGER = 5

◆ TYPE_INTERNAL_LINK

const ilAdvancedMDFieldDefinition::TYPE_INTERNAL_LINK = 10

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

◆ TYPE_LOCATION

const ilAdvancedMDFieldDefinition::TYPE_LOCATION = 7

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

◆ TYPE_SELECT

const ilAdvancedMDFieldDefinition::TYPE_SELECT = 1

TODO: put this in when minimum php version is set to 8.2.

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

Referenced by ilAdvancedMDClaimingPlugin\createDBField(), and ilContainerFilterUtil\getContainerRecordTitle().

◆ TYPE_SELECT_MULTI

const ilAdvancedMDFieldDefinition::TYPE_SELECT_MULTI = 8

◆ TYPE_TEXT

const ilAdvancedMDFieldDefinition::TYPE_TEXT = 2

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