ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAdvancedMDRecord.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordScope.php';
6
18{
19 private static $instances = array();
20
21 protected $record_id;
22
27
28 protected $import_id;
29 protected $active;
30 protected $title;
31 protected $description;
32 protected $obj_types = array();
33 protected $db = null;
34 protected $parent_obj; // [int]
35 protected $scope_enabled = false;
36
40 protected $scopes = [];
41
42
52 public function __construct($a_record_id = 0)
53 {
54 global $DIC;
55
56 $ilDB = $DIC['ilDB'];
57
58 $this->record_id = $a_record_id;
59 $this->db = $ilDB;
60
61 if ($this->getRecordId()) {
62 $this->read();
63 }
64 }
65
75 public static function _getInstanceByRecordId($a_record_id)
76 {
77 if (isset(self::$instances[$a_record_id])) {
78 return self::$instances[$a_record_id];
79 }
80 return self::$instances[$a_record_id] = new ilAdvancedMDRecord($a_record_id);
81 }
82
90 public static function _getActiveSearchableRecords()
91 {
92 global $DIC;
93
94 $ilDB = $DIC['ilDB'];
95
96 $query = "SELECT DISTINCT(amr.record_id) FROM adv_md_record amr " .
97 "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " .
98 "WHERE searchable = 1 AND active = 1 ";
99
100 $res = $ilDB->query($query);
101 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
103 }
104 return $records ? $records : array();
105 }
106
115 public static function _lookupTitle($a_record_id)
116 {
117 static $title_cache = array();
118
119 if (isset($title_cache[$a_record_id])) {
120 return $title_cache[$a_record_id];
121 }
122
123 global $DIC;
124
125 $ilDB = $DIC['ilDB'];
126
127 $query = "SELECT title FROM adv_md_record " .
128 "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
129 $res = $ilDB->query($query);
131
132 return $title_cache[$a_record_id] = $row->title;
133 }
134
143 public static function _lookupRecordIdByImportId($a_ilias_id)
144 {
145 global $DIC;
146
147 $ilDB = $DIC['ilDB'];
148
149 $query = "SELECT record_id FROM adv_md_record " .
150 "WHERE import_id = " . $ilDB->quote($a_ilias_id, 'text') . " ";
151 $res = $ilDB->query($query);
152 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
153 return $row->record_id;
154 }
155 return 0;
156 }
157
164 public static function _getAssignableObjectTypes($a_include_text = false)
165 {
166 global $DIC;
167
168 $objDefinition = $DIC['objDefinition'];
169 $lng = $DIC['lng'];
170
171 $types = array();
172 $filter = array();
173 $amet_types = $objDefinition->getAdvancedMetaDataTypes();
174
176 $filter = array_merge($filter, ilECSUtils::getPossibleRemoteTypes(false));
177 $filter[] = 'rtst';
178 }
179
180 foreach ($amet_types as $at) {
181 if (in_array($at["obj_type"], $filter)) {
182 continue;
183 }
184
185 if ($a_include_text) {
186 $text = $lng->txt("obj_" . $at["obj_type"]);
187 if ($at["sub_type"] != "") {
188 $lng->loadLanguageModule($at["obj_type"]);
189 $text .= ": " . $lng->txt($at["obj_type"] . "_" . $at["sub_type"]);
190 } else {
191 $at["sub_type"] = "-";
192 }
193 $at["text"] = $text;
194 }
195
196 $types[] = $at;
197 }
198
199 sort($types);
200 return $types;
201 }
202
211 public static function _getActivatedObjTypes()
212 {
213 global $DIC;
214
215 $ilDB = $DIC['ilDB'];
216
217 $query = "SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo " .
218 "JOIN adv_md_record amr ON amo.record_id = amr.record_id " .
219 "WHERE active = 1 ";
220 $res = $ilDB->query($query);
221 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
222 $obj_types[] = $row->obj_type;
223 }
224 return $obj_types ? $obj_types : array();
225 }
226
236 public static function _getRecords()
237 {
238 global $DIC;
239
240 $ilDB = $DIC['ilDB'];
241
242 $query = "SELECT record_id FROM adv_md_record ORDER BY gpos ";
243 $res = $ilDB->query($query);
244 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
246 }
247 return $records ? $records : array();
248 }
249
258 public static function _getAllRecordsByObjectType()
259 {
260 global $DIC;
261
262 $ilDB = $DIC['ilDB'];
263
264 $records = array();
265
266 $query = "SELECT * FROM adv_md_record_objs WHERE sub_type=" . $ilDB->quote("-", "text");
267 $res = $ilDB->query($query);
268 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
269 $records[$row->obj_type][] = self::_getInstanceByRecordId($row->record_id);
270 }
271 // #13359 hide ecs if not configured
273 $filter = ilECSUtils::getPossibleRemoteTypes(false);
274 $filter[] = 'rtst';
275 $records = array_diff_key($records, array_flip($filter));
276 }
277
278 return $records;
279 }
280
290 public static function _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type = "", $a_only_optional = false)
291 {
292 global $DIC;
293
294 $ilDB = $DIC['ilDB'];
295
296 $records = array();
297
298 if ($a_sub_type == "") {
299 $a_sub_type = "-";
300 }
301
302 $query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro " .
303 "JOIN adv_md_record amr ON amr.record_id = amro.record_id " .
304 "WHERE active = 1 " .
305 "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
306 "AND sub_type = " . $ilDB->quote($a_sub_type, 'text');
307
308 if ($a_only_optional) {
309 $query .= " AND optional =" . $ilDB->quote(1, 'integer');
310 }
311
312 // #16428
313 $query .= "ORDER by parent_obj DESC, record_id";
314
315 $res = $ilDB->query($query);
316 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
318 }
319
320 return $records;
321 }
322
330 public static function _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type = "")
331 {
332 $records = array();
333 // ilUtil::printBacktrace(10);
334 // var_dump($a_obj_type."-".$a_ref_id."-".$a_sub_type); exit;
335 if ($a_sub_type == "") {
336 $a_sub_type = "-";
337 }
338
339 $a_obj_id = ilObject::_lookupObjId($a_ref_id);
340
341 // object-wide metadata configuration setting
342 include_once 'Services/Container/classes/class.ilContainer.php';
343 include_once 'Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
344 $config_setting = ilContainer::_lookupContainerSetting(
345 $a_obj_id,
347 false
348 );
349
350 $optional = array();
351 foreach (self::_getActivatedRecordsByObjectType($a_obj_type, $a_sub_type) as $record) {
352 // check scope
353 if (self::isFilteredByScope($a_ref_id, $record->getScopes())) {
354 continue;
355 }
356
357 foreach ($record->getAssignedObjectTypes() as $item) {
358 if ($record->getParentObject()) {
359 // only matching local records
360 if ($record->getParentObject() != $a_obj_id) {
361 continue;
362 }
363 // if object-wide setting is off, ignore local records
364 elseif (!$config_setting) {
365 continue;
366 }
367 }
368
369 if ($item['obj_type'] == $a_obj_type &&
370 $item['sub_type'] == $a_sub_type) {
371 if ($item['optional']) {
372 $optional[] = $record->getRecordId();
373 }
374 $records[$record->getRecordId()] = $record;
375 }
376 }
377 }
378
379 if ($optional) {
380 if (!$config_setting && !in_array($a_sub_type, array("orgu_type", "prg_type"))) { //#16925 + #17777
381 $selected = array();
382 } else {
383 $selected = self::getObjRecSelection($a_obj_id, $a_sub_type);
384 }
385 foreach ($optional as $record_id) {
386 if (!in_array($record_id, $selected)) {
387 unset($records[$record_id]);
388 }
389 }
390 }
391
392
393 $orderings = new ilAdvancedMDRecordObjectOrderings();
394 $records = $orderings->sortRecords($records, $a_obj_id);
395
396 return $records;
397 }
398
404 public static function isFilteredByScope($a_ref_id, array $scopes)
405 {
406 $tree = $GLOBALS['DIC']->repositoryTree();
407 $logger = $GLOBALS['DIC']->logger()->amet();
408
409 if (!count($scopes)) {
410 $logger->debug('No md scope restrictions.');
411 return false;
412 }
413 foreach ($scopes as $scope) {
414 $logger->debug('Comparing: ' . $a_ref_id . ' with: ' . $scope->getRefId());
415 if ($scope->getRefId() == $a_ref_id) {
416 $logger->debug('Elements are equal. No scope restrictions.');
417 return false;
418 }
419 if ($tree->getRelation($scope->getRefId(), $a_ref_id) == ilTree::RELATION_PARENT) {
420 $logger->debug('Node is child node. No scope restrictions.');
421 return false;
422 }
423 }
424 $logger->info('Scope filter matches.');
425
426 return true;
427 }
428
429
438 public static function _delete($a_record_id)
439 {
440 global $DIC;
441
442 $ilDB = $DIC['ilDB'];
443
444 // Delete fields
445 foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($a_record_id) as $field) {
446 $field->delete();
447 }
448
449 $query = "DELETE FROM adv_md_record " .
450 "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
451 $res = $ilDB->manipulate($query);
452
453 $query = "DELETE FROM adv_md_record_objs " .
454 "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
455 $res = $ilDB->manipulate($query);
456 }
457
458
465 public function delete()
466 {
469 }
470
475 public function enabledScope()
476 {
478 }
479
484 public function enableScope($a_stat)
485 {
486 $this->scope_enabled = $a_stat;
487 }
488
493 public function setScopes(array $a_scopes)
494 {
495 $this->scopes = $a_scopes;
496 }
497
502 public function getScopes()
503 {
504 return $this->scopes;
505 }
506
511 public function getScopeRefIds()
512 {
513 $ref_ids = [];
514 foreach ($this->scopes as $scope) {
515 $ref_ids[] = $scope->getRefId();
516 }
517 return $ref_ids;
518 }
519
526 public function save()
527 {
528 global $DIC;
529
530 $ilDB = $DIC['ilDB'];
531
532 // Save import id if given
533 $next_id = $ilDB->nextId('adv_md_record');
534
535 $query = "INSERT INTO adv_md_record (record_id,import_id,active,title,description,parent_obj) " .
536 "VALUES(" .
537 $ilDB->quote($next_id, 'integer') . ", " .
538 $this->db->quote($this->getImportId(), 'text') . ", " .
539 $this->db->quote($this->isActive(), 'integer') . ", " .
540 $this->db->quote($this->getTitle(), 'text') . ", " .
541 $this->db->quote($this->getDescription(), 'text') . ", " .
542 $this->db->quote($this->getParentObject(), 'integer') . " " .
543 ")";
544 $res = $ilDB->manipulate($query);
545 $this->record_id = $next_id;
546
547 if (!strlen($this->getImportId())) {
548 // set import id to default value
549 $query = "UPDATE adv_md_record " .
550 "SET import_id = " . $this->db->quote($this->generateImportId(), 'text') . " " .
551 "WHERE record_id = " . $this->db->quote($this->record_id, 'integer') . " ";
552 $res = $ilDB->manipulate($query);
553 }
554
555 foreach ($this->getAssignedObjectTypes() as $type) {
556 global $DIC;
557
558 $ilDB = $DIC['ilDB'];
559
560 $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
561 "VALUES( " .
562 $this->db->quote($this->getRecordId(), 'integer') . ", " .
563 $this->db->quote($type["obj_type"], 'text') . ", " .
564 $this->db->quote($type["sub_type"], 'text') . ", " .
565 $this->db->quote($type["optional"], 'integer') . " " .
566 ")";
567 $res = $ilDB->manipulate($query);
568 }
569
570 foreach ($this->getScopes() as $scope) {
571 $scope->setRecordId($this->getRecordId());
572 $scope->save();
573 }
574 }
575
582 public function update()
583 {
584 global $DIC;
585
586 $ilDB = $DIC['ilDB'];
587
588 $query = "UPDATE adv_md_record " .
589 "SET active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
590 "title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
591 "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
592 'gpos = ' . $this->db->quote($this->getGlobalPosition(), 'integer') . ' ' .
593 "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
594 $res = $ilDB->manipulate($query);
595
596 // Delete assignments
597 $query = "DELETE FROM adv_md_record_objs " .
598 "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
599 $res = $ilDB->manipulate($query);
600
601 // Insert assignments
602 foreach ($this->getAssignedObjectTypes() as $type) {
603 $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
604 "VALUES ( " .
605 $this->db->quote($this->getRecordId(), 'integer') . ", " .
606 $this->db->quote($type["obj_type"], 'text') . ", " .
607 $this->db->quote($type["sub_type"], 'text') . ", " .
608 $this->db->quote($type["optional"], 'integer') . " " .
609 ")";
610 $res = $ilDB->manipulate($query);
611 }
613 foreach ($this->getScopes() as $scope) {
614 $scope->setRecordId($this->getRecordId());
615 $scope->save();
616 }
617 }
618
625 public function validate()
626 {
627 if (!strlen($this->getTitle())) {
628 return false;
629 }
630 return true;
631 }
632
637 public function setGlobalPosition(int $position)
638 {
639 $this->global_position = $position;
640 }
641
645 public function getGlobalPosition() : int
646 {
648 }
649
650
657 public function getRecordId()
658 {
659 return $this->record_id;
660 }
661
669 public function setActive($a_active)
670 {
671 $this->active = $a_active;
672 }
673
680 public function isActive()
681 {
682 return (bool) $this->active;
683 }
684
692 public function setTitle($a_title)
693 {
694 $this->title = $a_title;
695 }
696
703 public function getTitle()
704 {
705 return $this->title;
706 }
707
715 public function setDescription($a_description)
716 {
717 $this->description = $a_description;
718 }
719
726 public function getDescription()
727 {
728 return $this->description;
729 }
730
738 public function setImportId($a_id_string)
739 {
740 $this->import_id = $a_id_string;
741 }
742
749 public function getImportId()
750 {
751 return $this->import_id;
752 }
753
761 public function setAssignedObjectTypes($a_obj_types)
762 {
763 $this->obj_types = $a_obj_types;
764 }
765
773 public function appendAssignedObjectType($a_obj_type, $a_sub_type, $a_optional = false)
774 {
775 $this->obj_types[] = array(
776 "obj_type" => $a_obj_type,
777 "sub_type" => $a_sub_type,
778 "optional" => (bool) $a_optional
779 );
780 }
781
788 public function getAssignedObjectTypes()
789 {
790 return $this->obj_types ? $this->obj_types : array();
791 }
792
799 public function isAssignedObjectType($a_obj_type, $a_sub_type)
800 {
801 foreach ($this->getAssignedObjectTypes() as $t) {
802 if ($t["obj_type"] == $a_obj_type &&
803 $t["sub_type"] == $a_sub_type) {
804 return true;
805 }
806 }
807 return false;
808 }
809
810 public function setParentObject($a_obj_id)
811 {
812 $this->parent_obj = $a_obj_id;
813 }
814
815 public function getParentObject()
816 {
817 return $this->parent_obj;
818 }
819
829 public function toXML(ilXmlWriter $writer)
830 {
831 $writer->xmlStartTag('Record', array('active' => $this->isActive() ? 1 : 0,
832 'id' => $this->generateImportId()));
833 $writer->xmlElement('Title', null, $this->getTitle());
834 $writer->xmlElement('Description', null, $this->getDescription());
835
836 foreach ($this->getAssignedObjectTypes() as $obj_type) {
837 $optional = array("optional" => $obj_type["optional"]);
838 if ($obj_type["sub_type"] == "") {
839 $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"]);
840 } else {
841 $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"] . ":" . $obj_type["sub_type"]);
842 }
843 }
844
845 // scopes
846 if (count($this->getScopeRefIds())) {
847 $writer->xmlStartTag('Scope');
848 }
849 foreach ($this->getScopeRefIds() as $ref_id) {
851 $writer->xmlElement('ScopeEntry', ['id' => 'il_' . IL_INST_ID . '_' . $type . '_' . $ref_id]);
852 }
853 if (count($this->getScopeRefIds())) {
854 $writer->xmlEndTag('Scope');
855 }
856
857
858 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
859 foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
860 $definition->toXML($writer);
861 }
862 $writer->xmlEndTag('Record');
863 }
864
872 private function read()
873 {
874 global $DIC;
875
876 $ilDB = $DIC['ilDB'];
877
878 $query = "SELECT * FROM adv_md_record " .
879 "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
880 $res = $this->db->query($query);
881 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
882 $this->setImportId($row->import_id);
883 $this->setActive($row->active);
884 $this->setTitle($row->title);
885 $this->setDescription($row->description);
886 $this->setParentObject($row->parent_obj);
887 $this->setGlobalPosition((int) $row->gpos);
888 }
889 $query = "SELECT * FROM adv_md_record_objs " .
890 "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
891 $res = $this->db->query($query);
892 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
893 $this->obj_types[] = array(
894 "obj_type" => $row->obj_type,
895 "sub_type" => $row->sub_type,
896 "optional" => (bool) $row->optional
897 );
898 }
899
900 $query = 'SELECT scope_id FROM adv_md_record_scope ' .
901 'WHERE record_id = ' . $ilDB->quote($this->record_id);
902 $res = $ilDB->query($query);
903 $this->scope_enabled = false;
904 $this->scopes = [];
905 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
906 $this->scope_enabled = true;
907 $this->scopes[] = new ilAdvancedMDRecordScope($row->scope_id);
908 }
909 }
910
917 protected function generateImportId()
918 {
919 return 'il_' . IL_INST_ID . '_adv_md_record_' . $this->getRecordId();
920 }
921
928 public function __destruct()
929 {
930 unset(self::$instances[$this->getRecordId()]);
931 }
932
942 public static function saveObjRecSelection($a_obj_id, $a_sub_type = "", array $a_records = null, $a_delete_before = true)
943 {
944 global $DIC;
945
946 $ilDB = $DIC['ilDB'];
947
948 if ($a_sub_type == "") {
949 $a_sub_type = "-";
950 }
951
952 if ((bool) $a_delete_before) {
953 $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE " .
954 " obj_id = " . $ilDB->quote($a_obj_id, "integer") .
955 " AND sub_type = " . $ilDB->quote($a_sub_type, "text"));
956 }
957
958 if (is_array($a_records)) {
959 foreach ($a_records as $r) {
960 if ($r > 0) {
961 $ilDB->manipulate("INSERT INTO adv_md_obj_rec_select " .
962 "(obj_id, rec_id, sub_type) VALUES (" .
963 $ilDB->quote($a_obj_id, "integer") . "," .
964 $ilDB->quote($r, "integer") . "," .
965 $ilDB->quote($a_sub_type, "text") .
966 ")");
967 }
968 }
969 }
970 }
971
978 public static function getObjRecSelection($a_obj_id, $a_sub_type = "")
979 {
980 global $DIC;
981
982 $ilDB = $DIC['ilDB'];
983
984 if ($a_sub_type == "") {
985 $a_sub_type = "-";
986 }
987
988 $recs = array();
989 $set = $ilDB->query(
990 $r = "SELECT * FROM adv_md_obj_rec_select " .
991 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
992 " AND sub_type = " . $ilDB->quote($a_sub_type, "text")
993 );
994 while ($rec = $ilDB->fetchAssoc($set)) {
995 $recs[] = $rec["rec_id"];
996 }
997 return $recs;
998 }
999
1007 public function _clone(array &$a_fields_map, $a_parent_obj_id = null)
1008 {
1009 $new_obj = new self();
1010 $new_obj->setActive($this->isActive());
1011 $new_obj->setTitle($this->getTitle());
1012 $new_obj->setDescription($this->getDescription());
1013 $new_obj->setParentObject($a_parent_obj_id
1014 ? $a_parent_obj_id
1015 : $this->getParentObject());
1016 $new_obj->setAssignedObjectTypes($this->getAssignedObjectTypes());
1017 $new_obj->save();
1018
1019 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1020 foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
1021 $new_def = $definition->_clone($new_obj->getRecordId());
1022 $a_fields_map[$definition->getFieldId()] = $new_def->getFieldId();
1023 }
1024
1025 return $new_obj;
1026 }
1027
1036 public static function getSharedRecords($a_obj1_id, $a_obj2_id, $a_sub_type = "-")
1037 {
1038 $obj_type = ilObject::_lookupType($a_obj1_id);
1039 $sel = array_intersect(
1040 ilAdvancedMDRecord::getObjRecSelection($a_obj1_id, $a_sub_type),
1041 ilAdvancedMDRecord::getObjRecSelection($a_obj2_id, $a_sub_type)
1042 );
1043
1044 $res = array();
1045
1046 foreach (self::_getRecords() as $record) {
1047 // local records cannot be shared
1048 if ($record->getParentObject()) {
1049 continue;
1050 }
1051
1052 // :TODO: inactive records can be ignored?
1053 if (!$record->isActive()) {
1054 continue;
1055 }
1056
1057 // parse assigned types
1058 foreach ($record->getAssignedObjectTypes() as $item) {
1059 if ($item["obj_type"] == $obj_type &&
1060 $item["sub_type"] == $a_sub_type) {
1061 // mandatory
1062 if (!$item["optional"]) {
1063 $res[] = $record->getRecordId();
1064 }
1065 // optional
1066 elseif (in_array($record->getRecordId(), $sel)) {
1067 $res[] = $record->getRecordId();
1068 }
1069 }
1070 }
1071 }
1072
1073 return $res;
1074 }
1075}
An exception for terminatinating execution or to throw for unit testing.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
Scope restrictions for advanced md records.
static deleteByRecordI($a_record_id)
delete by record id
static _lookupTitle($a_record_id)
Lookup title.
isAssignedObjectType($a_obj_type, $a_sub_type)
Is assigned object type?
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
setTitle($a_title)
Set title.
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
setDescription($a_description)
set description
static getSharedRecords($a_obj1_id, $a_obj2_id, $a_sub_type="-")
Get shared records.
appendAssignedObjectType($a_obj_type, $a_sub_type, $a_optional=false)
append assigned object types
isActive()
Check if record is active.
toXML(ilXmlWriter $writer)
To Xml.
generateImportId()
generate unique record id
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
static _getAllRecordsByObjectType()
Get records by obj_type Note: this returns only records with no sub types! @access public.
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
static _getActivatedObjTypes()
get activated obj types
setActive($a_active)
Set active.
read()
read record and assiged object types
static _delete($a_record_id)
Delete record and all related data.
validate()
Validate settings.
getScopeRefIds()
Get scope gef_ids.
static _getRecords()
Get records.
setGlobalPosition(int $position)
Set global position.
enabledScope()
Is scope enabled.
setImportId($a_id_string)
set import id
getAssignedObjectTypes()
Get assigned object types.
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
enableScope($a_stat)
Enable scope restrictions.
_clone(array &$a_fields_map, $a_parent_obj_id=null)
Clone record.
__construct($a_record_id=0)
Singleton constructor To create an array of new records (without saving them) call the constructor di...
static isFilteredByScope($a_ref_id, array $scopes)
Check if a given ref id is not filtered by scope restriction.
setAssignedObjectTypes($a_obj_types)
Set assigned object types.
setScopes(array $a_scopes)
Set scopes.
static _lookupRecordIdByImportId($a_ilias_id)
Lookup record Id by import id.
static _getActiveSearchableRecords()
Get active searchable records.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static ecsConfigured()
Checks if an ecs server is configured.
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
const RELATION_PARENT
XML writer class.
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
$r
Definition: example_031.php:79
$row
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
$query
$type
global $DIC
Definition: saml.php:7
$lng
foreach($_POST as $key=> $value) $res
$records
Definition: simple_test.php:22
global $ilDB
$text
Definition: errorreport.php:18