ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
5 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordScope.php';
6 
18 {
19  private static $instances = array();
20 
21  protected $record_id;
22  protected $import_id;
23  protected $active;
24  protected $title;
25  protected $description;
26  protected $obj_types = array();
27  protected $db = null;
28  protected $parent_obj; // [int]
29  protected $scope_enabled = false;
30 
34  protected $scopes = [];
35 
36 
46  public function __construct($a_record_id = 0)
47  {
48  global $ilDB;
49 
50  $this->record_id = $a_record_id;
51  $this->db = $ilDB;
52 
53  if ($this->getRecordId()) {
54  $this->read();
55  }
56  }
57 
67  public static function _getInstanceByRecordId($a_record_id)
68  {
69  if (isset(self::$instances[$a_record_id])) {
70  return self::$instances[$a_record_id];
71  }
72  return self::$instances[$a_record_id] = new ilAdvancedMDRecord($a_record_id);
73  }
74 
82  public static function _getActiveSearchableRecords()
83  {
84  global $ilDB;
85 
86  $query = "SELECT DISTINCT(amr.record_id) FROM adv_md_record amr " .
87  "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " .
88  "WHERE searchable = 1 AND active = 1 ";
89 
90  $res = $ilDB->query($query);
91  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
92  $records[] = self::_getInstanceByRecordId($row->record_id);
93  }
94  return $records ? $records : array();
95  }
96 
105  public static function _lookupTitle($a_record_id)
106  {
107  static $title_cache = array();
108 
109  if (isset($title_cache[$a_record_id])) {
110  return $title_cache[$a_record_id];
111  }
112 
113  global $ilDB;
114 
115  $query = "SELECT title FROM adv_md_record " .
116  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
117  $res = $ilDB->query($query);
119 
120  return $title_cache[$a_record_id] = $row->title;
121  }
122 
131  public static function _lookupRecordIdByImportId($a_ilias_id)
132  {
133  global $ilDB;
134 
135  $query = "SELECT record_id FROM adv_md_record " .
136  "WHERE import_id = " . $ilDB->quote($a_ilias_id, 'text') . " ";
137  $res = $ilDB->query($query);
138  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
139  return $row->record_id;
140  }
141  return 0;
142  }
143 
150  public static function _getAssignableObjectTypes($a_include_text = false)
151  {
152  global $objDefinition, $lng;
153 
154  $types = array();
155  $amet_types = $objDefinition->getAdvancedMetaDataTypes();
156 
157  foreach ($amet_types as $at) {
158  if ($a_include_text) {
159  $text = $lng->txt("obj_" . $at["obj_type"]);
160  if ($at["sub_type"] != "") {
161  $lng->loadLanguageModule($at["obj_type"]);
162  $text.= ": " . $lng->txt($at["obj_type"] . "_" . $at["sub_type"]);
163  } else {
164  $at["sub_type"] = "-";
165  }
166  $at["text"] = $text;
167  }
168 
169  $types[] = $at;
170  }
171 
172  sort($types);
173  return $types;
174  }
175 
184  public static function _getActivatedObjTypes()
185  {
186  global $ilDB;
187 
188  $query = "SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo " .
189  "JOIN adv_md_record amr ON amo.record_id = amr.record_id " .
190  "WHERE active = 1 ";
191  $res = $ilDB->query($query);
192  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
193  $obj_types[] = $row->obj_type;
194  }
195  return $obj_types ? $obj_types : array();
196  }
197 
207  public static function _getRecords()
208  {
209  global $ilDB;
210 
211  $query = "SELECT record_id FROM adv_md_record ";
212  $res = $ilDB->query($query);
213  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
215  }
216  return $records ? $records : array();
217  }
218 
227  public static function _getAllRecordsByObjectType()
228  {
229  global $ilDB;
230 
231  $records = array();
232 
233  $query = "SELECT * FROM adv_md_record_objs WHERE sub_type=" . $ilDB->quote("-", "text");
234  $res = $ilDB->query($query);
235  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
236  $records[$row->obj_type][] = self::_getInstanceByRecordId($row->record_id);
237  }
238  return $records;
239  }
240 
250  public static function _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type = "", $a_only_optional = false)
251  {
252  global $ilDB;
253 
254  $records = array();
255 
256  if ($a_sub_type == "") {
257  $a_sub_type = "-";
258  }
259 
260  $query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro " .
261  "JOIN adv_md_record amr ON amr.record_id = amro.record_id " .
262  "WHERE active = 1 " .
263  "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
264  "AND sub_type = " . $ilDB->quote($a_sub_type, 'text');
265 
266  if ($a_only_optional) {
267  $query .= " AND optional =" . $ilDB->quote(1, 'integer');
268  }
269 
270  // #16428
271  $query .= "ORDER by parent_obj DESC, record_id";
272 
273  $res = $ilDB->query($query);
274  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
275  $records[] = self::_getInstanceByRecordId($row->record_id);
276  }
277 
278  return $records;
279  }
280 
288  public static function _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type = "")
289  {
290  $records = array();
291  // ilUtil::printBacktrace(10);
292  // var_dump($a_obj_type."-".$a_ref_id."-".$a_sub_type); exit;
293  if ($a_sub_type == "") {
294  $a_sub_type = "-";
295  }
296 
297  $a_obj_id = ilObject::_lookupObjId($a_ref_id);
298 
299  // object-wide metadata configuration setting
300  include_once 'Services/Container/classes/class.ilContainer.php';
301  include_once 'Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
302  $config_setting = ilContainer::_lookupContainerSetting(
303  $a_obj_id,
305  false
306  );
307 
308  $optional = array();
309  foreach (self::_getActivatedRecordsByObjectType($a_obj_type, $a_sub_type) as $record) {
310  // check scope
311  if (self::isFilteredByScope($a_ref_id, $record->getScopes())) {
312  continue;
313  }
314 
315  foreach ($record->getAssignedObjectTypes() as $item) {
316  if ($record->getParentObject()) {
317  // only matching local records
318  if ($record->getParentObject() != $a_obj_id) {
319  continue;
320  }
321  // if object-wide setting is off, ignore local records
322  elseif (!$config_setting) {
323  continue;
324  }
325  }
326 
327  if ($item['obj_type'] == $a_obj_type &&
328  $item['sub_type'] == $a_sub_type) {
329  if ($item['optional']) {
330  $optional[] = $record->getRecordId();
331  }
332  $records[$record->getRecordId()] = $record;
333  }
334  }
335  }
336 
337  if ($optional) {
338  if (!$config_setting && !in_array($a_sub_type, array("orgu_type", "prg_type"))) { //#16925 + #17777
339  $selected = array();
340  } else {
341  $selected = self::getObjRecSelection($a_obj_id, $a_sub_type);
342  }
343  foreach ($optional as $record_id) {
344  if (!in_array($record_id, $selected)) {
345  unset($records[$record_id]);
346  }
347  }
348  }
349 
350  return $records;
351  }
352 
358  public static function isFilteredByScope($a_ref_id, array $scopes)
359  {
360  $tree = $GLOBALS['DIC']->repositoryTree();
361  $logger = $GLOBALS['DIC']->logger()->amet();
362 
363  if (!count($scopes)) {
364  $logger->debug('No md scope restrictions.');
365  return false;
366  }
367  foreach ($scopes as $scope) {
368  $logger->debug('Comparing: ' . $a_ref_id . ' with: ' . $scope->getRefId());
369  if ($scope->getRefId() == $a_ref_id) {
370  $logger->debug('Elements are equal. No scope restrictions.');
371  return false;
372  }
373  if ($tree->getRelation($scope->getRefId(), $a_ref_id) == ilTree::RELATION_PARENT) {
374  $logger->debug('Node is child node. No scope restrictions.');
375  return false;
376  }
377  }
378  $logger->info('Scope filter matches.');
379 
380  return true;
381  }
382 
383 
392  public static function _delete($a_record_id)
393  {
394  global $ilDB;
395 
396  // Delete fields
397  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($a_record_id) as $field) {
398  $field->delete();
399  }
400 
401  $query = "DELETE FROM adv_md_record " .
402  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
403  $res = $ilDB->manipulate($query);
404 
405  $query = "DELETE FROM adv_md_record_objs " .
406  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
407  $res = $ilDB->manipulate($query);
408  }
409 
410 
417  public function delete()
418  {
421  }
422 
427  public function enabledScope()
428  {
429  return $this->scope_enabled;
430  }
431 
436  public function enableScope($a_stat)
437  {
438  $this->scope_enabled = $a_stat;
439  }
440 
445  public function setScopes(array $a_scopes)
446  {
447  $this->scopes = $a_scopes;
448  }
449 
454  public function getScopes()
455  {
456  return $this->scopes;
457  }
458 
463  public function getScopeRefIds()
464  {
465  $ref_ids = [];
466  foreach ($this->scopes as $scope) {
467  $ref_ids[] = $scope->getRefId();
468  }
469  return $ref_ids;
470  }
471 
478  public function save()
479  {
480  global $ilDB;
481 
482  // Save import id if given
483  $next_id = $ilDB->nextId('adv_md_record');
484 
485  $query = "INSERT INTO adv_md_record (record_id,import_id,active,title,description,parent_obj) " .
486  "VALUES(" .
487  $ilDB->quote($next_id, 'integer') . ", " .
488  $this->db->quote($this->getImportId(), 'text') . ", " .
489  $this->db->quote($this->isActive(), 'integer') . ", " .
490  $this->db->quote($this->getTitle(), 'text') . ", " .
491  $this->db->quote($this->getDescription(), 'text') . ", " .
492  $this->db->quote($this->getParentObject(), 'integer') . " " .
493  ")";
494  $res = $ilDB->manipulate($query);
495  $this->record_id = $next_id;
496 
497  if (!strlen($this->getImportId())) {
498  // set import id to default value
499  $query = "UPDATE adv_md_record " .
500  "SET import_id = " . $this->db->quote($this->generateImportId(), 'text') . " " .
501  "WHERE record_id = " . $this->db->quote($this->record_id, 'integer') . " ";
502  $res = $ilDB->manipulate($query);
503  }
504 
505  foreach ($this->getAssignedObjectTypes() as $type) {
506  global $ilDB;
507 
508  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
509  "VALUES( " .
510  $this->db->quote($this->getRecordId(), 'integer') . ", " .
511  $this->db->quote($type["obj_type"], 'text') . ", " .
512  $this->db->quote($type["sub_type"], 'text') . ", " .
513  $this->db->quote($type["optional"], 'integer') . " " .
514  ")";
515  $res = $ilDB->manipulate($query);
516  }
517 
518  foreach ($this->getScopes() as $scope) {
519  $scope->setRecordId($this->getRecordId());
520  $scope->save();
521  }
522  }
523 
530  public function update()
531  {
532  global $ilDB;
533 
534  $query = "UPDATE adv_md_record " .
535  "SET active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
536  "title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
537  "description = " . $this->db->quote($this->getDescription(), 'text') . " " .
538  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
539  $res = $ilDB->manipulate($query);
540 
541  // Delete assignments
542  $query = "DELETE FROM adv_md_record_objs " .
543  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
544  $res = $ilDB->manipulate($query);
545 
546  // Insert assignments
547  foreach ($this->getAssignedObjectTypes() as $type) {
548  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
549  "VALUES ( " .
550  $this->db->quote($this->getRecordId(), 'integer') . ", " .
551  $this->db->quote($type["obj_type"], 'text') . ", " .
552  $this->db->quote($type["sub_type"], 'text') . ", " .
553  $this->db->quote($type["optional"], 'integer') . " " .
554  ")";
555  $res = $ilDB->manipulate($query);
556  }
558  foreach ($this->getScopes() as $scope) {
559  $scope->setRecordId($this->getRecordId());
560  $scope->save();
561  }
562  }
563 
570  public function validate()
571  {
572  if (!strlen($this->getTitle())) {
573  return false;
574  }
575  return true;
576  }
577 
584  public function getRecordId()
585  {
586  return $this->record_id;
587  }
588 
596  public function setActive($a_active)
597  {
598  $this->active = $a_active;
599  }
600 
607  public function isActive()
608  {
609  return (bool) $this->active;
610  }
611 
619  public function setTitle($a_title)
620  {
621  $this->title = $a_title;
622  }
623 
630  public function getTitle()
631  {
632  return $this->title;
633  }
634 
642  public function setDescription($a_description)
643  {
644  $this->description = $a_description;
645  }
646 
653  public function getDescription()
654  {
655  return $this->description;
656  }
657 
665  public function setImportId($a_id_string)
666  {
667  $this->import_id = $a_id_string;
668  }
669 
676  public function getImportId()
677  {
678  return $this->import_id;
679  }
680 
688  public function setAssignedObjectTypes($a_obj_types)
689  {
690  $this->obj_types = $a_obj_types;
691  }
692 
700  public function appendAssignedObjectType($a_obj_type, $a_sub_type, $a_optional = false)
701  {
702  $this->obj_types[] = array(
703  "obj_type"=>$a_obj_type,
704  "sub_type"=>$a_sub_type,
705  "optional"=>(bool) $a_optional
706  );
707  }
708 
715  public function getAssignedObjectTypes()
716  {
717  return $this->obj_types ? $this->obj_types : array();
718  }
719 
726  public function isAssignedObjectType($a_obj_type, $a_sub_type)
727  {
728  foreach ($this->getAssignedObjectTypes() as $t) {
729  if ($t["obj_type"] == $a_obj_type &&
730  $t["sub_type"] == $a_sub_type) {
731  return true;
732  }
733  }
734  return false;
735  }
736 
737  public function setParentObject($a_obj_id)
738  {
739  $this->parent_obj = $a_obj_id;
740  }
741 
742  public function getParentObject()
743  {
744  return $this->parent_obj;
745  }
746 
756  public function toXML(ilXmlWriter $writer)
757  {
758  $writer->xmlStartTag('Record', array('active' => $this->isActive() ? 1 : 0,
759  'id' => $this->generateImportId()));
760  $writer->xmlElement('Title', null, $this->getTitle());
761  $writer->xmlElement('Description', null, $this->getDescription());
762 
763  foreach ($this->getAssignedObjectTypes() as $obj_type) {
764  $optional = array("optional"=>$obj_type["optional"]);
765  if ($obj_type["sub_type"] == "") {
766  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"]);
767  } else {
768  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"] . ":" . $obj_type["sub_type"]);
769  }
770  }
771 
772  // scopes
773  if (count($this->getScopeRefIds())) {
774  $writer->xmlStartTag('Scope');
775  }
776  foreach ($this->getScopeRefIds() as $ref_id) {
778  $writer->xmlElement('ScopeEntry', ['id' => 'il_' . IL_INST_ID . '_' . $type . '_' . $ref_id]);
779  }
780  if (count($this->getScopeRefIds())) {
781  $writer->xmlEndTag('Scope');
782  }
783 
784 
785  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
786  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
787  $definition->toXML($writer);
788  }
789  $writer->xmlEndTag('Record');
790  }
791 
799  private function read()
800  {
801  global $ilDB;
802 
803  $query = "SELECT * FROM adv_md_record " .
804  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
805  $res = $this->db->query($query);
806  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
807  $this->setImportId($row->import_id);
808  $this->setActive($row->active);
809  $this->setTitle($row->title);
810  $this->setDescription($row->description);
811  $this->setParentObject($row->parent_obj);
812  }
813  $query = "SELECT * FROM adv_md_record_objs " .
814  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
815  $res = $this->db->query($query);
816  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
817  $this->obj_types[] = array(
818  "obj_type" => $row->obj_type,
819  "sub_type" => $row->sub_type,
820  "optional" => (bool) $row->optional
821  );
822  }
823 
824  $query = 'SELECT scope_id FROM adv_md_record_scope ' .
825  'WHERE record_id = ' . $ilDB->quote($this->record_id);
826  $res = $ilDB->query($query);
827  $this->scope_enabled = false;
828  $this->scopes = [];
829  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
830  $this->scope_enabled = true;
831  $this->scopes[] = new ilAdvancedMDRecordScope($row->scope_id);
832  }
833  }
834 
841  protected function generateImportId()
842  {
843  return 'il_' . IL_INST_ID . '_adv_md_record_' . $this->getRecordId();
844  }
845 
852  public function __destruct()
853  {
854  unset(self::$instances[$this->getRecordId()]);
855  }
856 
863  public static function saveObjRecSelection($a_obj_id, $a_sub_type = "", array $a_records = null, $a_delete_before = true)
864  {
865  global $ilDB;
866 
867  if ($a_sub_type == "") {
868  $a_sub_type = "-";
869  }
870 
871  if ((bool) $a_delete_before) {
872  $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE " .
873  " obj_id = " . $ilDB->quote($a_obj_id, "integer") .
874  " AND sub_type = " . $ilDB->quote($a_sub_type, "text"));
875  }
876 
877  if (is_array($a_records)) {
878  foreach ($a_records as $r) {
879  if ($r > 0) {
880  $ilDB->manipulate("INSERT INTO adv_md_obj_rec_select " .
881  "(obj_id, rec_id, sub_type) VALUES (" .
882  $ilDB->quote($a_obj_id, "integer") . "," .
883  $ilDB->quote($r, "integer") . "," .
884  $ilDB->quote($a_sub_type, "text") .
885  ")");
886  }
887  }
888  }
889  }
890 
897  public static function getObjRecSelection($a_obj_id, $a_sub_type = "")
898  {
899  global $ilDB;
900 
901  if ($a_sub_type == "") {
902  $a_sub_type = "-";
903  }
904 
905  $recs = array();
906  $set = $ilDB->query(
907  $r = "SELECT * FROM adv_md_obj_rec_select " .
908  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
909  " AND sub_type = " . $ilDB->quote($a_sub_type, "text")
910  );
911  while ($rec = $ilDB->fetchAssoc($set)) {
912  $recs[] = $rec["rec_id"];
913  }
914  return $recs;
915  }
916 
924  public function _clone(array &$a_fields_map, $a_parent_obj_id = null)
925  {
926  $new_obj = new self();
927  $new_obj->setActive($this->isActive());
928  $new_obj->setTitle($this->getTitle());
929  $new_obj->setDescription($this->getDescription());
930  $new_obj->setParentObject($a_parent_obj_id
931  ? $a_parent_obj_id
932  : $this->getParentObject());
933  $new_obj->setAssignedObjectTypes($this->getAssignedObjectTypes());
934  $new_obj->save();
935 
936  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
937  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
938  $new_def = $definition->_clone($new_obj->getRecordId());
939  $a_fields_map[$definition->getFieldId()] = $new_def->getFieldId();
940  }
941 
942  return $new_obj;
943  }
944 
953  public static function getSharedRecords($a_obj1_id, $a_obj2_id, $a_sub_type = "-")
954  {
955  $obj_type = ilObject::_lookupType($a_obj1_id);
956  $sel = array_intersect(
957  ilAdvancedMDRecord::getObjRecSelection($a_obj1_id, $a_sub_type),
958  ilAdvancedMDRecord::getObjRecSelection($a_obj2_id, $a_sub_type)
959  );
960 
961  $res = array();
962 
963  foreach (self::_getRecords() as $record) {
964  // local records cannot be shared
965  if ($record->getParentObject()) {
966  continue;
967  }
968 
969  // :TODO: inactive records can be ignored?
970  if (!$record->isActive()) {
971  continue;
972  }
973 
974  // parse assigned types
975  foreach ($record->getAssignedObjectTypes() as $item) {
976  if ($item["obj_type"] == $obj_type &&
977  $item["sub_type"] == $a_sub_type) {
978  // mandatory
979  if (!$item["optional"]) {
980  $res[] = $record->getRecordId();
981  }
982  // optional
983  elseif (in_array($record->getRecordId(), $sel)) {
984  $res[] = $record->getRecordId();
985  }
986  }
987  }
988  }
989 
990  return $res;
991  }
992 }
Scope restrictions for advanced md records.
static deleteByRecordI($a_record_id)
delete by record id
setScopes(array $a_scopes)
Set scopes.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
static _getRecords()
Get records.
$type
getScopeRefIds()
Get scope gef_ids.
static getSharedRecords($a_obj1_id, $a_obj2_id, $a_sub_type="-")
Get shared records.
getDescription()
get description
setActive($a_active)
Set active.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
XML writer class.
const RELATION_PARENT
static _getActiveSearchableRecords()
Get active searchable records.
appendAssignedObjectType($a_obj_type, $a_sub_type, $a_optional=false)
append assigned object types
$records
Definition: simple_test.php:22
static isFilteredByScope($a_ref_id, array $scopes)
Check if a given ref id is not filtered by scope restriction.
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
xmlEndTag($tag)
Writes an endtag.
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
isActive()
Check if record is active.
setDescription($a_description)
set description
static _delete($a_record_id)
Delete record and all related data.
$r
Definition: example_031.php:79
toXML(ilXmlWriter $writer)
To Xml.
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
enableScope($a_stat)
Enable scope restrictions.
foreach($_POST as $key=> $value) $res
static _lookupObjId($a_id)
$text
Definition: errorreport.php:18
__construct($a_record_id=0)
Singleton constructor To create an array of new records (without saving them) call the constructor di...
validate()
Validate settings.
getAssignedObjectTypes()
Get assigned object types.
$query
static _getAllRecordsByObjectType()
Get records by obj_type Note: this returns only records with no sub types! public.
setImportId($a_id_string)
set import id
static _lookupTitle($a_record_id)
Lookup title.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
setTitle($a_title)
Set title.
enabledScope()
Is scope enabled.
read()
read record and assiged object types
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
setAssignedObjectTypes($a_obj_types)
Set assigned object types.
global $lng
Definition: privfeed.php:17
global $ilDB
static _getActivatedObjTypes()
get activated obj types
isAssignedObjectType($a_obj_type, $a_sub_type)
Is assigned object type?
_clone(array &$a_fields_map, $a_parent_obj_id=null)
Clone record.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _lookupRecordIdByImportId($a_ilias_id)
Lookup record Id by import id.
generateImportId()
generate unique record id