ILIAS  release_8 Revision v8.24
ilAdvancedMDValues Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilAdvancedMDValues:

Public Member Functions

 __construct ($a_record_id, $a_obj_id, $a_sub_type="-", $a_sub_id=0)
 
 setActiveRecordPrimary (int $a_obj_id, string $a_sub_type="-", int $a_sub_id=0)
 
 getDefinitions ()
 Get record field definitions. More...
 
 getADTGroup ()
 
 isDisabled (string $a_element_id)
 
 read ()
 Get record values. More...
 
 write (array $a_additional_data=null)
 Write record values. More...
 

Static Public Member Functions

static getInstancesForObjectId (int $a_obj_id, ?string $a_obj_type=null, string $a_sub_type="-", int $a_sub_id=0)
 
static findByObjectId (int $a_obj_id)
 Find all entries for object (regardless of sub-type/sub-id) More...
 
static _deleteByFieldId (int $a_field_id, ilADT $a_adt)
 Delete values by field_id. More...
 
static _deleteByObjId (int $a_obj_id)
 Delete by objekt id. More...
 
static preloadByObjIds (array $a_obj_ids)
 Preload list gui data. More...
 
static preloadedRead (string $a_type, int $a_obj_id)
 
static _cloneValues (int $copy_id, int $a_source_id, int $a_target_id, ?string $a_sub_type=null, ?int $a_source_sub_id=null, ?int $a_target_sub_id=null)
 Clone Advanced Meta Data. More...
 
static _appendXMLByObjId (ilXmlWriter $a_xml_writer, int $a_obj_id)
 Get xml of object values. More...
 
static queryForRecords (int $adv_rec_obj_ref_id, string $adv_rec_obj_type, string $adv_rec_obj_subtype, array $a_obj_id, string $a_subtype, array $a_records, string $a_obj_id_key, string $a_obj_subid_key, array $a_amet_filter=null)
 

Protected Member Functions

 getActiveRecord ()
 Init ADT DB Bridge (aka active record helper class) More...
 

Static Protected Member Functions

static getParentMapping (int $copy_id, string $target)
 

Protected Attributes

int $record_id
 
int $obj_id
 
int $sub_id
 
string $sub_type
 
array $defs = null
 
ilADTGroup $adt_group = null
 
ilADTActiveRecordByType $active_record = null
 
array $disabled = []
 

Static Protected Attributes

static array $preload_obj_records = []
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$ @ilCtrl_Calls

Definition at line 27 of file class.ilAdvancedMDValues.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDValues::__construct (   $a_record_id,
  $a_obj_id,
  $a_sub_type = "-",
  $a_sub_id = 0 
)

Definition at line 42 of file class.ilAdvancedMDValues.php.

43 {
44 $this->record_id = (int) $a_record_id;
45 $this->obj_id = (int) $a_obj_id;
46 $this->sub_type = $a_sub_type ?: "-";
47 $this->sub_id = (int) $a_sub_id;
48 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

Member Function Documentation

◆ _appendXMLByObjId()

static ilAdvancedMDValues::_appendXMLByObjId ( ilXmlWriter  $a_xml_writer,
int  $a_obj_id 
)
static

Get xml of object values.

Parameters
ilXmlWriter$a_xml_writer
int$a_obj_id

Definition at line 456 of file class.ilAdvancedMDValues.php.

456 : void
457 {
458 $a_xml_writer->xmlStartTag('AdvancedMetaData');
459
460 self::preloadByObjIds(array($a_obj_id));
461 $values_records = self::preloadedRead(ilObject::_lookupType($a_obj_id), $a_obj_id);
462
463 foreach ($values_records as $values_record) {
464 $defs = $values_record->getDefinitions();
465 foreach ($values_record->getADTGroup()->getElements() as $element_id => $element) {
466 $def = $defs[$element_id];
467
468 $value = null;
469 if (!$element->isNull()) {
470 $value = $def->getValueForXML($element);
471 }
472
473 $a_xml_writer->xmlElement(
474 'Value',
475 array('id' => $def->getImportId()),
476 $value
477 );
478 }
479 }
480 $a_xml_writer->xmlEndTag('AdvancedMetaData');
481 }
static preloadByObjIds(array $a_obj_ids)
Preload list gui data.
static preloadedRead(string $a_type, int $a_obj_id)
static _lookupType(int $id, bool $reference=false)
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References ilObject\_lookupType(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by ilCourseXMLWriter\__buildAdvancedMetaData(), and ilGroupXMLWriter\__buildAdvancedMetaData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _cloneValues()

static ilAdvancedMDValues::_cloneValues ( int  $copy_id,
int  $a_source_id,
int  $a_target_id,
?string  $a_sub_type = null,
?int  $a_source_sub_id = null,
?int  $a_target_sub_id = null 
)
static

Clone Advanced Meta Data.

Definition at line 290 of file class.ilAdvancedMDValues.php.

297 : void {
298 global $DIC;
299
300 $ilLog = $DIC['ilLog'];
301
302 // clone local records
303
304 // new records are created automatically, only if source and target id differs.
305 $new_records = $fields_map = array();
306
307 // if we have a sub object and are in a copy process,
308 // get mapping from parent
309 $parent_mapping = null;
310 if (!is_null($a_source_sub_id) && $copy_id > 0) {
311 $parent_mapping = self::getParentMapping($copy_id, (string) $a_target_id);
312 if (!is_null($parent_mapping)) {
313 $new_records = $parent_mapping["records"];
314 $fields_map = $parent_mapping["fields"];
315 }
316 }
317
318 $record_mapping = [];
319 foreach (ilAdvancedMDRecord::_getRecords() as $record) {
320 if ($record->getParentObject() == $a_source_id && is_null($parent_mapping)) {
321
322 // if we have a sub object and are in a copy process,
323 // the main object must have already copied its records
324 if (!is_null($a_source_sub_id) && $copy_id > 0) {
325 throw new ilException("ilAdvancedMDValues::_cloneValues must be called for parent object first.");
326 }
327
328 $tmp = array();
329 if ($a_source_id != $a_target_id) {
330 $new_records[$record->getRecordId()] = $record->_clone($tmp, $a_target_id);
331 $record_mapping[$record->getRecordId()] = $new_records[$record->getRecordId()]->getRecordId();
332 } else {
333 $new_records[$record->getRecordId()] = $record->getRecordId();
334 }
335 $fields_map[$record->getRecordId()] = $tmp;
336 }
337 }
338
339 // write mapping when not in sub-object
340 if ($copy_id > 0 && is_null($a_source_sub_id)) {
341 $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
342 $cp_options->appendMapping(
343 $a_target_id . '_adv_rec',
344 $record_mapping
345 );
346 $cp_options->appendMapping(
347 $a_target_id . '_adv_rec_fields',
348 $fields_map
349 );
350 $cp_options->read(); // otherwise mapping will not be available for getMappings
351 }
352
353 // object record selection
354
355 $source_sel = ilAdvancedMDRecord::getObjRecSelection($a_source_id, (string) $a_sub_type);
356 if ($source_sel) {
357 $target_sel = array();
358 foreach ($source_sel as $record_id) {
359 // (local) record has been cloned
360 if (array_key_exists($record_id, $new_records)) {
361 $record_id = $new_records[$record_id]->getRecordId();
362 }
363 $target_sel[] = $record_id;
364 }
365 ilAdvancedMDRecord::saveObjRecSelection($a_target_id, (string) $a_sub_type, $target_sel);
366 }
367
368 // clone values
369
370 $source_primary = array("obj_id" => array("integer", $a_source_id));
371 $target_primary = array("obj_id" => array("integer", $a_target_id));
372
373 // sub-type support
374 if ($a_sub_type &&
375 $a_source_sub_id &&
376 $a_target_sub_id) {
377 $source_primary["sub_type"] = array("text", $a_sub_type);
378 $source_primary["sub_id"] = array("integer", $a_source_sub_id);
379 $target_primary["sub_type"] = array("text", $a_sub_type);
380 $target_primary["sub_id"] = array("integer", $a_target_sub_id);
381 }
382
383 ilADTFactory::getInstance()->initActiveRecordByType();
385 "adv_md_values",
386 array(
387 "obj_id" => "integer",
388 "sub_type" => "text",
389 "sub_id" => "integer",
390 "field_id" => "integer"
391 ),
392 $source_primary,
393 $target_primary,
394 array("disabled" => "integer")
395 );
396
397 // move values of local records to newly created fields
398
399 foreach ($fields_map as $source_record_id => $fields) {
400 // just to make sure
401 if (array_key_exists($source_record_id, $new_records)) {
402 foreach ($fields as $source_field_id => $target_field_id) {
403 // delete entry for old field id (was cloned above)
404 $del_target_primary = $target_primary;
405 $del_target_primary["field_id"] = array("integer", $source_field_id);
406 ilADTActiveRecordByType::deleteByPrimary("adv_md_values", $del_target_primary);
407
408 // create entry for new id
409 $fix_source_primary = $source_primary;
410 $fix_source_primary["field_id"] = array("integer", $source_field_id);
411 $fix_target_primary = $target_primary;
412 $fix_target_primary["field_id"] = array("integer", $target_field_id);
414 "adv_md_values",
415 array(
416 "obj_id" => "integer",
417 "sub_type" => "text",
418 "sub_id" => "integer",
419 "field_id" => "integer"
420 ),
421 $fix_source_primary,
422 $fix_target_primary,
423 array("disabled" => "integer")
424 );
425 }
426 }
427 }
428
429 if (!$has_cloned) {
430 $ilLog->write(__METHOD__ . ': No advanced meta data found.');
431 } else {
432 $ilLog->write(__METHOD__ . ': Start cloning advanced meta data.');
433 }
434 }
static cloneByPrimary(string $a_table, array $a_primary_def, array $a_source_primary, array $a_target_primary, array $a_additional=null)
Clone values by (partial) primary key.
static deleteByPrimary(string $a_table, array $a_primary, string $a_type=null)
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
static _getRecords()
Get records @access public.
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.
static getParentMapping(int $copy_id, string $target)
static _getInstance(int $a_copy_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

Referenced by ilObjWiki\cloneObject(), and ilObjEmployeeTalkSeriesGUI\copyTemplateValues().

+ Here is the caller graph for this function:

◆ _deleteByFieldId()

static ilAdvancedMDValues::_deleteByFieldId ( int  $a_field_id,
ilADT  $a_adt 
)
static

Delete values by field_id.

Typically called after deleting a field

Parameters
int$a_field_id
ilADT$a_adt

Definition at line 197 of file class.ilAdvancedMDValues.php.

197 : void
198 {
199 ilADTFactory::getInstance()->initActiveRecordByType();
201 "adv_md_values",
202 array("field_id" => array("integer", $a_field_id)),
203 $a_adt->getType()
204 );
205 }
getType()
Get type (from class/instance)
Definition: class.ilADT.php:50

References ilADTActiveRecordByType\deleteByPrimary(), ilADTFactory\getInstance(), and ilADT\getType().

Referenced by ilAdvancedMDFieldDefinition\delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteByObjId()

static ilAdvancedMDValues::_deleteByObjId ( int  $a_obj_id)
static

Delete by objekt id.

Definition at line 210 of file class.ilAdvancedMDValues.php.

211 {
212 ilADTFactory::getInstance()->initActiveRecordByType();
214 "adv_md_values",
215 array("obj_id" => array("integer", $a_obj_id))
216 );
217 }

References ilADTActiveRecordByType\deleteByPrimary(), and ilADTFactory\getInstance().

Referenced by ilObject\delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findByObjectId()

static ilAdvancedMDValues::findByObjectId ( int  $a_obj_id)
static

Find all entries for object (regardless of sub-type/sub-id)

Definition at line 145 of file class.ilAdvancedMDValues.php.

145 : ?array
146 {
148 return ilADTActiveRecordByType::readByPrimary("adv_md_values", array("obj_id" => array("integer", $a_obj_id)));
149 }
static readByPrimary(string $a_table, array $a_primary, ?string $a_type=null)
Read directly.
static initActiveRecordByType()
Init active record by type.

References ilADTFactory\initActiveRecordByType(), and ilADTActiveRecordByType\readByPrimary().

Referenced by ilAdvancedMetaDataExporter\getXmlRepresentation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveRecord()

ilAdvancedMDValues::getActiveRecord ( )
protected

Init ADT DB Bridge (aka active record helper class)

Definition at line 113 of file class.ilAdvancedMDValues.php.

114 {
115 if (!$this->active_record instanceof ilADTActiveRecordByType) {
117
118 $adt_group_db = $factory->getDBBridgeForInstance($this->getADTGroup());
119
120 $primary = array(
121 "obj_id" => array("integer", $this->obj_id),
122 "sub_type" => array("text", $this->sub_type),
123 "sub_id" => array("integer", $this->sub_id)
124 );
125 $adt_group_db->setPrimary($primary);
126 $adt_group_db->setTable("adv_md_values");
127
128 // multi-enum fakes single in adv md
129 foreach ($adt_group_db->getElements() as $element) {
130 if ($element->getADT()->getType() == "MultiEnum") {
131 $element->setFakeSingle(true);
132 }
133 }
134
135 $this->active_record = $factory->getActiveRecordByTypeInstance($adt_group_db);
136 $this->active_record->setElementIdColumn("field_id", "integer");
137 }
138
140 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilADTActiveRecordByType $active_record
$factory
Definition: metadata.php:75

References $factory, and ilADTFactory\getInstance().

+ Here is the call graph for this function:

◆ getADTGroup()

ilAdvancedMDValues::getADTGroup ( )

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

102 : ilADTGroup
103 {
104 if (!$this->adt_group instanceof ilADTGroup) {
106 }
107 return $this->adt_group;
108 }
static getADTGroupForDefinitions(array $a_defs)
Init ADTGroup for definitions.
getDefinitions()
Get record field definitions.

References ilAdvancedMDFieldDefinition\getADTGroupForDefinitions().

+ Here is the call graph for this function:

◆ getDefinitions()

ilAdvancedMDValues::getDefinitions ( )

Get record field definitions.

Returns
ilAdvancedMDFieldDefinition[]

Definition at line 94 of file class.ilAdvancedMDValues.php.

94 : array
95 {
96 if (!is_array($this->defs)) {
97 $this->defs = ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->record_id);
98 }
99 return $this->defs;
100 }
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.

References ilAdvancedMDFieldDefinition\getInstancesByRecordId().

+ Here is the call graph for this function:

◆ getInstancesForObjectId()

static ilAdvancedMDValues::getInstancesForObjectId ( int  $a_obj_id,
?string  $a_obj_type = null,
string  $a_sub_type = "-",
int  $a_sub_id = 0 
)
static

Definition at line 50 of file class.ilAdvancedMDValues.php.

55 : array {
56 $res = array();
57
58 if (!$a_obj_type) {
59 $a_obj_type = ilObject::_lookupType($a_obj_id);
60 }
61
62 // @todo refactor
63 $refs = ilObject::_getAllReferences($a_obj_id);
64 foreach ($refs as $ref_id) {
65 $records = ilAdvancedMDRecord::_getSelectedRecordsByObject($a_obj_type, $ref_id, $a_sub_type);
66 $orderings = new ilAdvancedMDRecordObjectOrderings();
67 $records = $orderings->sortRecords($records, $a_obj_id);
68
69 foreach ($records as $record) {
70 $id = $record->getRecordId();
71
72 if (!isset($res[$id])) {
73 $res[$id] = new self($id, $a_obj_id, $a_sub_type, $a_sub_id);
74 }
75 }
76 }
77 return $res;
78 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:67
$res
Definition: ltiservices.php:69

References ilObject\_lookupType().

Referenced by ilECSUtils\getAdvancedMDValuesForObjId(), ilAdvancedMDValueParser\handlerBeginTag(), ilRemoteObjectBase\importMetadataFromJson(), ilAdvancedMDRecordGUI\parseAppointmentPresentationa(), and ilAdvancedMDRecordGUI\parseInfoPage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentMapping()

static ilAdvancedMDValues::getParentMapping ( int  $copy_id,
string  $target 
)
staticprotected

Definition at line 436 of file class.ilAdvancedMDValues.php.

436 : ?array
437 {
438 $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
439 $mappings = $cp_options->getMappings();
440 $key1 = $target . '_adv_rec';
441 $key2 = $target . '_adv_rec_fields';
442 if (is_array($mappings) && isset($mappings[$key1])) {
443 return [
444 "records" => $mappings[$key1],
445 "fields" => $mappings[$key2] ?? []
446 ];
447 }
448 return null;
449 }

References ilCopyWizardOptions\_getInstance().

+ Here is the call graph for this function:

◆ isDisabled()

ilAdvancedMDValues::isDisabled ( string  $a_element_id)

Definition at line 158 of file class.ilAdvancedMDValues.php.

158 : ?bool
159 {
160 if (is_array($this->disabled)) {
161 return in_array($a_element_id, $this->disabled);
162 }
163 return null;
164 }
disabled()
Example showing how to plug a disabled checkbox into a form.
Definition: disabled.php:10

References ILIAS\UI\examples\Input\Field\Checkbox\disabled().

+ Here is the call graph for this function:

◆ preloadByObjIds()

static ilAdvancedMDValues::preloadByObjIds ( array  $a_obj_ids)
static

Preload list gui data.

Parameters
int[]$a_obj_ids

Definition at line 223 of file class.ilAdvancedMDValues.php.

223 : void
224 {
225 global $DIC;
226
227 $ilDB = $DIC['ilDB'];
228
229 // preload values
230 ilADTFactory::getInstance()->initActiveRecordByType();
232 "adv_md_values",
233 array("obj_id" => array("integer", $a_obj_ids))
234 );
235
236 // preload record ids for object types
237
238 self::$preload_obj_records = array();
239
240 // get active records for object types
241 $query = "SELECT amro.*" .
242 " FROM adv_md_record_objs amro" .
243 " JOIN adv_md_record amr ON (amr.record_id = amro.record_id)" .
244 " WHERE active = " . $ilDB->quote(1, "integer");
245 $set = $ilDB->query($query);
246 while ($row = $ilDB->fetchAssoc($set)) {
247 self::$preload_obj_records[(string) $row["obj_type"]][] = array((int) $row["record_id"],
248 (int) $row["optional"]
249 );
250 }
251 }
static preloadByPrimary(string $a_table, array $a_primary)
$query

References $DIC, $ilDB, $query, ilADTFactory\getInstance(), ILIAS\Repository\int(), and ilADTActiveRecordByType\preloadByPrimary().

Referenced by ilObjectListGUIPreloader\preload(), and ilPDSelectedItemsBlockViewGUI\preloadItemGroups().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preloadedRead()

static ilAdvancedMDValues::preloadedRead ( string  $a_type,
int  $a_obj_id 
)
static

Definition at line 253 of file class.ilAdvancedMDValues.php.

253 : array
254 {
255 $res = array();
256
257 if (isset(self::$preload_obj_records[$a_type])) {
258 foreach (self::$preload_obj_records[$a_type] as $item) {
259 $record_id = $item[0];
260
261 // record is optional, check activation for object
262 if ($item[1]) {
263 $found = false;
265 $a_type,
266 $a_obj_id,
267 '',
268 false
269 ) as $record) {
270 if ($record->getRecordId() == $item[0]) {
271 $found = true;
272 }
273 }
274 if (!$found) {
275 continue;
276 }
277 }
278
279 $res[$record_id] = new self($record_id, $a_obj_id);
280 $res[$record_id]->read();
281 }
282 }
283
284 return $res;
285 }

References $res, and ilAdvancedMDRecord\_getSelectedRecordsByObject().

Referenced by ilAdvancedMDSubstitution\getParsedSubstitutions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ queryForRecords()

static ilAdvancedMDValues::queryForRecords ( int  $adv_rec_obj_ref_id,
string  $adv_rec_obj_type,
string  $adv_rec_obj_subtype,
array  $a_obj_id,
string  $a_subtype,
array  $a_records,
string  $a_obj_id_key,
string  $a_obj_subid_key,
array  $a_amet_filter = null 
)
static
Todo:
refactor this

Definition at line 486 of file class.ilAdvancedMDValues.php.

496 : array {
497 $results = array();
498
499 $sub_obj_ids = array();
500 foreach ($a_records as $rec) {
501 $sub_obj_ids[] = $rec[$a_obj_subid_key];
502 }
503
504 // preload adv data for object id(s)
505 ilADTFactory::getInstance()->initActiveRecordByType();
507 "adv_md_values",
508 array(
509 "obj_id" => array("integer", $a_obj_id),
510 "sub_type" => array("text", $a_subtype),
511 "sub_id" => array("integer", $sub_obj_ids)
512 )
513 );
514
515 $record_groups = array();
516
517 foreach ($a_records as $rec) {
518 $obj_id = (int) ($rec[$a_obj_id_key] ?? 0);
519 $sub_id = $rec[$a_obj_subid_key];
520
521 // get adv records
523 $adv_rec_obj_type,
524 $adv_rec_obj_ref_id,
525 $adv_rec_obj_subtype
526 ) as $adv_record) {
527 $record_id = $adv_record->getRecordId();
528
529 if (!isset($record_groups[$record_id])) {
532 $record_groups[$record_id] = ilADTFactory::getInstance()->getDBBridgeForInstance($record_groups[$record_id]);
533 $record_groups[$record_id]->setTable("adv_md_values");
534 }
535
536 // prepare ADT group for record id
537 $record_groups[$record_id]->setPrimary(array(
538 "obj_id" => array("integer", $obj_id),
539 "sub_type" => array("text", $a_subtype),
540 "sub_id" => array("integer", $sub_id)
541 ));
542 // multi-enum fakes single in adv md
543 foreach ($record_groups[$record_id]->getElements() as $element) {
544 if ($element->getADT()->getType() == "MultiEnum") {
545 $element->setFakeSingle(true);
546 }
547 }
548
549 // read (preloaded) data
551 $active_record->setElementIdColumn("field_id", "integer");
553
554 $adt_group = $record_groups[$record_id]->getADT();
555 // filter against amet values
556 if ($a_amet_filter) {
557 foreach ($a_amet_filter as $field_id => $element) {
558 if ($adt_group->hasElement((string) $field_id)) {
559 if (!$element->isInCondition($adt_group->getElement((string) $field_id))) {
560 continue(3);
561 }
562 }
563 }
564 }
565 // add amet values to glossary term record
566 foreach ($adt_group->getElements() as $element_id => $element) {
567 if (!$element->isNull()) {
568 // we are reusing the ADT group for all $a_records, so we need to clone
569 $pb = ilADTFactory::getInstance()->getPresentationBridgeForInstance(clone $element);
570 $rec["md_" . $element_id] = $pb->getSortable();
571 $rec["md_" . $element_id . "_presentation"] = $pb;
572 } else {
573 $rec["md_" . $element_id] = null;
574 }
575 }
576 }
577
578 $results[] = $rec;
579 }
580
581 return $results;
582 }
read(bool $a_return_additional_data=false)
Read record.
setElementIdColumn(string $a_name, string $a_type)
getElement(string $a_name)
hasElement(string $a_name)
$results

Referenced by ilBookingObjectsTableGUI\getItems(), ilMediaPoolTableGUI\getItems(), and ilBookingReservationsTableGUI\getItems().

+ Here is the caller graph for this function:

◆ read()

ilAdvancedMDValues::read ( )

Get record values.

Definition at line 169 of file class.ilAdvancedMDValues.php.

169 : void
170 {
171 $this->disabled = array();
172
173 $tmp = $this->getActiveRecord()->read(true);
174 if ($tmp) {
175 foreach ($tmp as $element_id => $data) {
176 if ($data["disabled"]) {
177 $this->disabled[] = $element_id;
178 }
179 }
180 }
181 }
getActiveRecord()
Init ADT DB Bridge (aka active record helper class)

References $data, and ILIAS\UI\examples\Input\Field\Checkbox\disabled().

+ Here is the call graph for this function:

◆ setActiveRecordPrimary()

ilAdvancedMDValues::setActiveRecordPrimary ( int  $a_obj_id,
string  $a_sub_type = "-",
int  $a_sub_id = 0 
)

Definition at line 80 of file class.ilAdvancedMDValues.php.

80 : void
81 {
82 $this->obj_id = $a_obj_id;
83 $this->sub_type = $a_sub_type ?: "-";
84 $this->sub_id = $a_sub_id;
85
86 // make sure they get used
87 $this->active_record = null;
88 }

◆ write()

ilAdvancedMDValues::write ( array  $a_additional_data = null)

Write record values.

Definition at line 186 of file class.ilAdvancedMDValues.php.

186 : void
187 {
188 $this->getActiveRecord()->write($a_additional_data);
189 }

Field Documentation

◆ $active_record

ilADTActiveRecordByType ilAdvancedMDValues::$active_record = null
protected

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

◆ $adt_group

ilADTGroup ilAdvancedMDValues::$adt_group = null
protected

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

◆ $defs

array ilAdvancedMDValues::$defs = null
protected

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

◆ $disabled

array ilAdvancedMDValues::$disabled = []
protected

Definition at line 38 of file class.ilAdvancedMDValues.php.

◆ $obj_id

int ilAdvancedMDValues::$obj_id
protected

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

◆ $preload_obj_records

array ilAdvancedMDValues::$preload_obj_records = []
staticprotected

Definition at line 40 of file class.ilAdvancedMDValues.php.

◆ $record_id

int ilAdvancedMDValues::$record_id
protected

Definition at line 29 of file class.ilAdvancedMDValues.php.

◆ $sub_id

int ilAdvancedMDValues::$sub_id
protected

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

◆ $sub_type

string ilAdvancedMDValues::$sub_type
protected

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


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