19 declare(strict_types=1);
    49             'il_dcl_field_prop' => [],
    50             'il_dcl_sel_opts' => [],
    51             'il_dcl_record' => [],
    52             'il_dcl_record_field' => [],
    53             'il_dcl_stloc1_value' => [],
    54             'il_dcl_stloc2_value' => [],
    55             'il_dcl_stloc3_value' => [],
    56             'il_dcl_stloc1_default' => [],
    57             'il_dcl_stloc2_default' => [],
    58             'il_dcl_stloc3_default' => [],
    59             'il_dcl_tfield_set' => [],
    60             'il_dcl_tableview' => [],
    61             'il_dcl_tview_set' => [],
    80         $this->db = $DIC->database();
    81         $this->
user = $DIC->user();
    87         return [
'4.5.0', 
'8.13'];
    94     public function getCache(
string $a_entity): array
    96         if (!in_array($a_entity, array_keys($this->caches))) {
    97             throw new ilException(
"Entity '$a_entity' does not exist in Cache");
   100         return $this->caches[$a_entity];
   103     protected function getXmlNamespace(
string $a_entity, 
string $a_schema_version): string
   105         return 'https://www.ilias.de/xml/Modules/DataCollection/' . $a_entity;
   113         string $a_schema_version
   115         foreach ($a_rec as $key => &$value) {
   116             $array = json_decode($value, 
true);
   117             if (is_array($array)) {
   120                 $value = $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform($value);
   125                 if ($new_id = $a_mapping->
getMapping(
'components/ILIAS/Container', 
'objs', $a_rec[
'id'])) {
   129                     $new_obj->create(
true);
   131                 $new_obj->setTitle($a_rec[
'title']);
   132                 $new_obj->setDescription($a_rec[
'description']);
   133                 $new_obj->setApproval($a_rec[
'approval'] === 
'1');
   134                 $new_obj->setPublicNotes($a_rec[
'public_notes'] === 
'1');
   135                 $new_obj->setNotification($a_rec[
'notification'] === 
'1');
   136                 $new_obj->setRating($a_rec[
'rating'] === 
'1');
   138                 $this->import_dc_object = $new_obj;
   139                 $a_mapping->
addMapping(
'components/ILIAS/DataCollection', 
'dcl', $a_rec[
'id'], (
string) $new_obj->getId());
   141                     'components/ILIAS/MetaData',
   143                     $a_rec[
'id'] . 
':0:dcl',
   144                     $new_obj->getId() . 
':0:dcl'   149                 $table->setTitle($a_rec[
'title']);
   150                 $table->setObjId($this->import_dc_object->getId());
   151                 $table->setDescription($a_rec[
'description']);
   152                 $table->setAddPerm($a_rec[
'add_perm'] === 
'1');
   153                 $table->setEditPerm($a_rec[
'edit_perm'] === 
'1');
   154                 $table->setDeletePerm($a_rec[
'delete_perm'] === 
'1');
   155                 $table->setEditByOwner($a_rec[
'edit_by_owner'] === 
'1');
   156                 $table->setLimited($a_rec[
'limited'] === 
'1');
   157                 $table->setLimitStart($a_rec[
'limit_start']);
   158                 $table->setLimitEnd($a_rec[
'limit_end']);
   159                 $table->setIsVisible($a_rec[
'is_visible'] === 
'1');
   160                 $table->setExportEnabled($a_rec[
'export_enabled'] === 
'1');
   161                 $table->setImportEnabled($a_rec[
'import_enabled'] === 
'1');
   162                 $table->setDefaultSortField($a_rec[
'default_sort_field_id']);
   163                 $table->setDefaultSortFieldOrder($a_rec[
'default_sort_field_order']);
   164                 $table->setPublicCommentsEnabled($a_rec[
'public_comments'] === 
'1');
   165                 $table->setViewOwnRecordsPerm($a_rec[
'view_own_records_perm'] === 
'1');
   166                 $table->setDeleteByOwner($a_rec[
'delete_by_owner'] === 
'1');
   167                 $table->setSaveConfirmation($a_rec[
'save_confirmation'] === 
'1');
   168                 $table->setOrder((
int) $a_rec[
'table_order']);
   169                 $table->doCreate(
false, 
false); 
   170                 $a_mapping->
addMapping(
'components/ILIAS/DataCollection', 
'il_dcl_table', $a_rec[
'id'], (
string) $table->getId());
   172             case 'il_dcl_tableview':
   173                 $new_table_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_table', $a_rec[
'table_id']);
   176                     $tableview->setTitle($a_rec[
'title']);
   177                     $tableview->setTableId((
int) $new_table_id);
   178                     $tableview->setDescription($a_rec[
'description']);
   179                     $tableview->setTableviewOrder((
int) $a_rec[
'tableview_order']);
   180                     if (!is_array($a_rec[
'roles'])) {
   181                         $a_rec[
'roles'] = json_decode($a_rec[
'roles']);
   183                     $tableview->setRoles($a_rec[
'roles']);
   184                     $tableview->create(
false);    
   187                         'components/ILIAS/DataCollection',
   190                         (
string) $tableview->getId()
   192                     $a_mapping->
addMapping(
'components/ILIAS/COPage', 
'pg', 
'dclf:' . $a_rec[
'id'], 
'dclf:' . $tableview->getId());
   196                 $new_table_id = (
int) $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_table', $a_rec[
'table_id']);
   197                 if ($new_table_id > 0) {
   198                     $datatype_id = (
int) $a_rec[
'datatype_id'];
   199                     $datatype = $a_rec[
'datatype_title'] ?? null;
   203                         foreach ($datatypes as $dt) {
   204                             if ($dt->getTitle() === $datatype) {
   205                                 $datatype_id = $dt->getId();
   209                     if (in_array($datatype_id, array_keys($datatypes))) {
   211                         $field->setTableId($new_table_id);
   212                         $field->setDatatypeId($datatype_id);
   213                         $field->setTitle($a_rec[
'title']);
   214                         $field->setDescription($a_rec[
'description']);
   215                         $field->setUnique($a_rec[
'is_unique'] === 
'1');
   217                         $a_mapping->
addMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $a_rec[
'id'], $field->getId());
   221             case 'il_dcl_tfield_set':
   222                 $new_table_id = (
int) $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_table', $a_rec[
'table_id']);
   223                 $new_field_id = is_numeric($a_rec[
'field']) ? $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $a_rec[
'field']) : $a_rec[
'field'];
   224                 if ($new_table_id > 0 && (is_string($new_field_id) || $new_field_id > 0)) {
   229                     $setting->setFieldOrder((
int) $a_rec[
'field_order']);
   230                     $setting->setExportable($a_rec[
'exportable'] === 
'1');
   234             case 'il_dcl_tview_set':
   236                     'components/ILIAS/DataCollection',
   238                     $a_rec[
'tableview_id']
   240                 $new_field_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $a_rec[
'field']);
   241                 if ($new_tableview_id) {
   243                     $setting->setTableviewId((
int) $new_tableview_id);
   244                     $setting->setVisible($a_rec[
'visible'] === 
'1');
   245                     $setting->setField($new_field_id ?: $a_rec[
'field']);
   246                     $setting->setInFilter($a_rec[
'in_filter'] === 
'1');
   247                     $setting->setFilterValue($a_rec[
'filter_value']);
   248                     $setting->setFilterChangeable($a_rec[
'filter_changeable'] === 
'1');
   249                     $setting->setRequiredCreate($a_rec[
'required_create'] === 
'1');
   250                     $setting->setLockedCreate($a_rec[
'locked_create'] === 
'1');
   251                     $setting->setVisibleCreate($a_rec[
'visible_create'] === 
'1');
   252                     $setting->setVisibleEdit($a_rec[
'visible_edit'] === 
'1');
   253                     $setting->setRequiredEdit($a_rec[
'required_edit'] === 
'1');
   254                     $setting->setLockedEdit($a_rec[
'locked_edit'] === 
'1');
   255                     $setting->setDefaultValue($a_rec[
'default_value']);
   258                         'components/ILIAS/DataCollection',
   261                         (
string) $setting->getId()
   265             case 'il_dcl_record':
   266                 $new_table_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_table', $a_rec[
'table_id']);
   269                     $record->setTableId((
int) $new_table_id);
   273                     $record->setOwner($this->
user->getId());
   274                     $record->setLastEditBy($this->
user->getId());
   277                         'components/ILIAS/DataCollection',
   280                         (
string) $record->getId()
   285                 $new_table_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_table', $a_rec[
'table_id']);
   290                     if ($a_rec[
'type'] == 0 && $a_rec[
'formtype'] == 0) { 
   293                             'components/ILIAS/COPage',
   295                             'dclf:' . $a_rec[
'id'],
   296                             'dclf:' . $tableview->getId()
   299                             'components/ILIAS/DataCollection',
   302                             (
string) $tableview->getId()
   306                             'components/ILIAS/DataCollection',
   309                             json_encode([
'type' => $a_rec[
'type'],
   310                                          'table_id' => $new_table_id,
   311                                          'tableview_id' => $tableview->getId()
   317             case 'il_dcl_viewdefinition':
   318                 $map = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_view', $a_rec[
'view_id']);
   319                 $new_field_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $a_rec[
'field']);
   320                 $field = ($new_field_id) ?: $a_rec[
'field'];
   321                 switch ($map[
'type']) {
   324                         $viewfield_setting->setVisible($a_rec[
'is_set']);
   325                         $viewfield_setting->store();
   329                         $viewfield_setting->setInFilter($a_rec[
'is_set']);
   330                         $viewfield_setting->store();
   334                         $tablefield_setting->setExportable($a_rec[
'is_set']);
   335                         $tablefield_setting->setFieldOrder($a_rec[
'field_order']);
   336                         $tablefield_setting->store();
   340             case 'il_dcl_sel_opts':
   341                 $new_field_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $a_rec[
'field_id']);
   344                     $opt->setFieldId((
int) $new_field_id);
   345                     $opt->setOptId((
int) $a_rec[
'opt_id']);
   346                     $opt->setSorting((
int) $a_rec[
'sorting']);
   347                     $opt->setValue($a_rec[
'value']);
   351             case 'il_dcl_field_prop':
   352                 $new_field_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $a_rec[
'field_id']);
   355                     $prop->setFieldId((
int) $new_field_id);
   358                     $name = $a_rec[
'name'];
   359                     if (!isset($name) && isset($a_rec[
'datatype_prop_id'])) {
   365                             5 => 
'reference_link',
   368                             8 => 
'learning_progress',
   369                             9 => 
'ILIAS_reference_link',
   370                             10 => 
'multiple_selection',
   372                             12 => 
'display_action_menu',
   373                             13 => 
'link_detail_page',
   374                             14 => 
'link_detail_page',
   377                         $name = $properties[$a_rec[
'datatype_prop_id']];
   380                     $prop->setName($name);
   381                     $prop->setValue($a_rec[
'value']);
   384                         'components/ILIAS/DataCollection',
   387                         (
string) $prop->getId()
   389                     $this->import_temp_refs_props[$prop->getId()] = $a_rec[
'value'];
   392             case 'il_dcl_record_field':
   393                 $record_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_record', $a_rec[
'record_id']);
   394                 $field_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $a_rec[
'field_id']);
   395                 if ($record_id && $field_id) {
   400                         'components/ILIAS/DataCollection',
   401                         'il_dcl_record_field',
   403                         (
string) $record_field->getId()
   405                     $this->import_record_field_cache[$record_field->getId()] = $record_field;
   408             case 'il_dcl_stloc1_value':
   409             case 'il_dcl_stloc2_value':
   410             case 'il_dcl_stloc3_value':
   411                 $new_record_field_id = $a_mapping->
getMapping(
   412                     'components/ILIAS/DataCollection',
   413                     'il_dcl_record_field',
   414                     $a_rec[
'record_field_id']
   416                 if ($new_record_field_id) {
   418                     $record_field = $this->import_record_field_cache[$new_record_field_id];
   419                     if (is_object($record_field)) {
   422                         switch ($record_field->getField()->getDatatypeId()) {
   425                                 $new_mob_id = $a_mapping->
getMapping(
'components/ILIAS/MediaObjects', 
'mob', $a_rec[
'value']);
   426                                 $value = ($new_mob_id) ? (
int) $new_mob_id : null;
   427                                 $this->import_temp_new_mob_ids[] = $new_mob_id;
   430                                 $new_file_id = $a_mapping->
getMapping(
'components/ILIAS/File', 
'file', $a_rec[
'value']);
   431                                 $value = ($new_file_id) ? (
int) $new_file_id : null;
   435                                 $value = $a_rec[
'value'];
   436                                 $decode = json_decode($a_rec[
'value']);
   437                                 if (is_array($decode)) {
   438                                     foreach ($decode as 
$id) {
   439                                         $this->import_temp_refs[$new_record_field_id][] = 
$id;
   442                                     $this->import_temp_refs[$new_record_field_id] = $value;
   449                                 $value = $a_rec[
'value'];
   450                                 if ($value == 
'0000-00-00 00:00:00') {
   455                                 if (version_compare($a_schema_version, 
"8.13") < 0) {
   456                                     $a_rec[
'value'] = str_replace(
'<br />', 
'', $a_rec[
'value']);
   460                                 $value = $a_rec[
'value'];
   461                                 if ($a_entity == 
'il_dcl_stloc3_value' && empty($value)) {
   465                         $record_field->setValue($value, 
true);
   466                         $record_field->doUpdate();
   470             case 'il_dcl_stloc1_default':
   471             case 'il_dcl_stloc2_default':
   472             case 'il_dcl_stloc3_default':
   475                     'components/ILIAS/DataCollection',
   477                     $a_rec[
'tview_set_id']
   481                     $value = $a_rec[
'value'];
   485                             $value = (
int) $value;
   487                         $stloc_default->setValue($value);
   488                         $stloc_default->setTviewSetId((
int) $tview_set_id);
   489                         $stloc_default->create();
   499         foreach ($array as $key => $value) {
   501             if (is_string($key)) {
   502                 $newkey = $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform($key);
   505             if (is_string($value)) {
   506                 $newvalue = $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform($value);
   508             if (is_array($value)) {
   511             $new[$newkey] = $newvalue;
   522         foreach ($this->import_dc_object->getTables() as $table) {
   523             if (is_numeric($table->getDefaultSortField())) {
   524                 $table->setDefaultSortField(
   525                     $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $table->getDefaultSortField())
   530         foreach ($this->import_temp_new_mob_ids as $new_mob_id) {
   535         foreach ($this->import_temp_refs as $record_field_id => $old_record_id) {
   536             if (is_array($old_record_id)) {
   538                 foreach ($old_record_id as 
$id) {
   539                     $new_record_id[] = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_record', $id);
   541                 $value = $new_record_id;
   543                 $value = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_record', $old_record_id);
   546             $record_field = $this->import_record_field_cache[$record_field_id];
   547             $record_field->setValue($value, 
true);
   548             $record_field->doUpdate();
   550         foreach ($this->import_temp_refs_props as $field_prop_id => $prop_value) {
   551             $new_field_id = $a_mapping->
getMapping(
'components/ILIAS/DataCollection', 
'il_dcl_field', $prop_value);
   552             $value = ($new_field_id) ? (
int) $new_field_id : $prop_value;
   555             $field_prop->setValue($value);
   556             $field_prop->update();
   563     protected function getTypes(
string $a_entity, 
string $a_version): array
   570                     "description" => 
"text",
   571                     'is_online' => 
'integer',
   572                     'rating' => 
'integer',
   573                     'public_notes' => 
'integer',
   574                     'approval' => 
'integer',
   575                     'notification' => 
'integer',
   580                     'obj_id' => 
'integer',
   582                     'add_perm' => 
'integer',
   583                     'edit_perm' => 
'integer',
   584                     'delete_perm' => 
'integer',
   585                     'edit_by_owner' => 
'integer',
   586                     'limited' => 
'integer',
   587                     'limit_start' => 
'text',
   588                     'limit_end' => 
'text',
   589                     'is_visible' => 
'integer',
   590                     'export_enabled' => 
'integer',
   591                     'import_enabled' => 
'integer',
   592                     'default_sort_field_id' => 
'text',
   593                     'default_sort_field_order' => 
'text',
   594                     'description' => 
'text',
   595                     'public_comments' => 
'integer',
   596                     'view_own_records_perm' => 
'integer',
   597                     'delete_by_owner' => 
'integer',
   598                     'save_confirmation' => 
'integer',
   599                     'table_order' => 
'integer',
   601             case 'il_dcl_tableview':
   604                     'table_id' => 
'integer',
   607                     'description' => 
'text',
   608                     'tableview_order' => 
'integer',
   613                     'table_id' => 
'integer',
   615                     'description' => 
'text',
   616                     'datatype_id' => 
'integer',
   617                     'datatype_title' => 
'text',
   618                     'is_unique' => 
'integer',
   620             case 'il_dcl_tview_set':
   623                     'tableview_id' => 
'integer',
   625                     'visible' => 
'integer',
   626                     'in_filter' => 
'integer',
   627                     'filter_value' => 
'text',
   628                     'filter_changeable' => 
'integer',
   629                     'required_create' => 
'integer',
   630                     'required_edit' => 
'integer',
   631                     'locked_create' => 
'integer',
   632                     'locked_edit' => 
'integer',
   633                     'visible_create' => 
'integer',
   634                     'visible_edit' => 
'integer',
   635                     'default_value' => 
'text',
   637             case 'il_dcl_tfield_set':
   640                     'table_id' => 
'integer',
   642                     'field_order' => 
'integer',
   643                     'exportable' => 
'integer',
   645             case 'il_dcl_field_prop':
   648                     'field_id' => 
'integer',
   650                     'value' => 
'integer',
   652             case 'il_dcl_sel_opts':
   655                     'field_id' => 
'integer',
   656                     'opt_id' => 
'integer',
   657                     'sorting' => 
'integer',
   660             case 'il_dcl_record':
   663                     'table_id' => 
'integer',
   665             case 'il_dcl_record_field':
   668                     'record_id' => 
'integer',
   669                     'field_id' => 
'integer',
   671             case 'il_dcl_stloc1_value':
   672             case 'il_dcl_stloc2_value':
   673             case 'il_dcl_stloc3_value':
   676                     'record_field_id' => 
'integer',
   679             case 'il_dcl_stloc1_default':
   680             case 'il_dcl_stloc2_default':
   681             case 'il_dcl_stloc3_default':
   684                     'tview_set_id' => 
'integer',
   703         ?array $a_rec = null,
   706         if (!$a_rec && !$a_ids) {
   711                 $set = $this->db->query(
'SELECT * FROM il_dcl_table WHERE obj_id = ' . $this->db->quote(
   715                 $ids = $this->
buildCache(
'il_dcl_table', $set);
   718                     'il_dcl_table' => [
'ids' => $ids],
   721                 $set = $this->db->query(
'SELECT * FROM il_dcl_record WHERE table_id = ' . $this->db->quote(
   725                 $ids_records = $this->
buildCache(
'il_dcl_record', $set);
   726                 $set = $this->db->query(
'SELECT il_dcl_field.*, il_dcl_datatype.title as datatype_title FROM il_dcl_field INNER JOIN il_dcl_datatype ON il_dcl_field.datatype_id = il_dcl_datatype.id WHERE table_id = ' . $this->db->quote(
   730                 $ids_fields = $this->
buildCache(
'il_dcl_field', $set);
   731                 $set = $this->db->query(
'SELECT * FROM il_dcl_tableview WHERE table_id = ' . $this->db->quote(
   735                 $ids_tableviews = $this->
buildCache(
'il_dcl_tableview', $set);
   736                 $set = $this->db->query(
'SELECT * FROM il_dcl_tfield_set WHERE table_id = ' . $this->db->quote(
   740                 $ids_tablefield_settings = $this->
buildCache(
'il_dcl_tfield_set', $set);
   743                     'il_dcl_field' => [
'ids' => $ids_fields],
   744                     'il_dcl_record' => [
'ids' => $ids_records],
   745                     'il_dcl_tableview' => [
'ids' => $ids_tableviews],
   746                     'il_dcl_tfield_set' => [
'ids' => $ids_tablefield_settings],
   749                 $set = $this->db->query(
'SELECT * FROM il_dcl_field_prop WHERE field_id = ' . $this->db->quote(
   753                 $prop_ids = $this->
buildCache(
'il_dcl_field_prop', $set);
   755                 $set = $this->db->query(
'SELECT * FROM il_dcl_sel_opts WHERE field_id = ' . $this->db->quote(
   759                 $opt_ids = $this->
buildCache(
'il_dcl_sel_opts', $set);
   762                     'il_dcl_field_prop' => [
'ids' => $prop_ids],
   763                     'il_dcl_sel_opts' => [
'ids' => $opt_ids],
   765             case 'il_dcl_record':
   766                 $sql = 
'SELECT rf.*, d.storage_location FROM il_dcl_record_field AS rf' . 
' INNER JOIN il_dcl_field AS f ON (f.id = rf.field_id)'   767                     . 
' INNER JOIN il_dcl_datatype AS d ON (f.datatype_id = d.id) ' . 
' WHERE rf.record_id = '   768                     . $this->db->quote($a_rec[
'id'], 
'integer');
   769                 $set = $this->db->query($sql);
   770                 $ids = $this->
buildCache(
'il_dcl_record_field', $set);
   772                 $set = $this->db->query($sql);
   773                 while ($rec = $this->db->fetchObject($set)) {
   778                     = 
'SELECT rf.id AS record_field_id, st1.value AS value1, st2.value AS value2, st3.value AS value3 FROM il_dcl_record_field AS rf '   779                     . 
'LEFT JOIN il_dcl_stloc1_value AS st1 ON (st1.record_field_id = rf.id) '   780                     . 
'LEFT JOIN il_dcl_stloc2_value AS st2 ON (st2.record_field_id = rf.id) '   781                     . 
'LEFT JOIN il_dcl_stloc3_value AS st3 ON (st3.record_field_id = rf.id) ' . 
'WHERE rf.record_id = '   782                     . $this->db->quote($a_rec[
'id'], 
'integer');
   783                 $set = $this->db->query($sql);
   785                 while ($rec = $this->db->fetchObject($set)) {
   786                     $stloc = $this->record_field_ids_2_storage[$rec->record_field_id];
   789                         $value = 
"value$stloc";
   790                         $value = $rec->{$value};
   793                     $this->caches[
"il_dcl_stloc{$stloc}_value"][$rec->record_field_id] = [
   794                         'record_field_id' => $rec->record_field_id,
   800                     'il_dcl_record_field' => [
'ids' => $ids],
   802             case 'il_dcl_tableview':
   803                 $set = $this->db->query(
'SELECT * FROM il_dcl_tview_set WHERE tableview_id = ' . $this->db->quote(
   807                 $ids = $this->
buildCache(
'il_dcl_tview_set', $set);
   810                     'il_dcl_tview_set' => [
'ids' => $ids],
   812             case 'il_dcl_tview_set':
   814                 if (!(
int) $a_rec[
'field'] > 0) {
   820                         SELECT tview_set.id AS tview_set_id, st1.value AS value1, st2.value AS value2, st3.value AS value3,    821                         st1.id AS id1, st2.id AS id2, st3.id AS id3   822                         FROM il_dcl_tview_set AS tview_set    823                             LEFT JOIN il_dcl_stloc1_default AS st1 ON (st1.tview_set_id = tview_set.id)   824                             LEFT JOIN il_dcl_stloc2_default AS st2 ON (st2.tview_set_id = tview_set.id)   825                             LEFT JOIN il_dcl_stloc3_default AS st3 ON (st3.tview_set_id = tview_set.id)   826                             WHERE tview_set.id = ' . $this->db->quote($a_rec[
'id'], 
'integer');
   827                 $set = $this->db->query($sql);
   829                 while ($rec = $this->db->fetchObject($set)) {
   832                         $value_str = 
"value$stloc";
   833                         $value = $rec->{$value_str};
   834                         $id_str = 
"id$stloc";
   835                         $id = $rec->{$id_str};
   836                         $tview_set_id = $rec->tview_set_id;
   839                         $this->caches[
"il_dcl_stloc" . 
"$stloc" . 
"_default"][$rec->tview_set_id] = [
   841                             'tview_set_id' => $rec->tview_set_id,
   846                             "il_dcl_stloc{$stloc}_default" => [
'ids' => [$tview_set_id]],
   851             case 'il_dcl_record_field':
   852                 $record_field_id = $a_rec[
'id'];
   853                 $storage_loc = $this->record_field_ids_2_storage[$record_field_id];
   856                     "il_dcl_stloc{$storage_loc}_value" => [
'ids' => [$record_field_id]],
   867     public function readData(
string $a_entity, 
string $a_version, array $a_ids): void
   878     protected function _readData(
string $a_entity, array $a_ids): void
   882                 foreach ($a_ids as $dcl_id) {
   887                             'title' => $obj->getTitle(),
   888                             'description' => $obj->getDescription(),
   889                             'is_online' => $obj->getOnline() ? 
'1' : 
'0',
   890                             'rating' => $obj->getRating() ? 
'1' : 
'0',
   891                             'public_notes' => $obj->getPublicNotes() ? 
'1' : 
'0',
   892                             'approval' => $obj->getApproval() ? 
'1' : 
'0',
   893                             'notification' => $obj->getNotification() ? 
'1' : 
'0',
   895                         $this->caches[
'dcl'][$dcl_id] = 
$data;
   896                         $this->data[] = 
$data;
   902                 foreach ($a_ids as 
$id) {
   910         $fields = array_keys($this->
getTypes($a_entity, 
''));
   912         while ($rec = $this->db->fetchObject($set)) {
   914             foreach ($fields as $field) {
   915                 $data[$field] = $rec->{$field};
   918             $this->caches[$a_entity][
$id] = 
$data;
 ILIAS Refinery Factory $refinery
 
getXmlNamespace(string $a_entity, string $a_schema_version)
 
static createOrGetStandardView(int $table_id)
 
getTypes(string $a_entity, string $a_version)
Map XML attributes of entities to datatypes (text, integer...) 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static returnDbTableName()
 
buildCache(string $a_entity, ilDBStatement $set)
 
static getFieldCache(int $field_id=0)
 
const INPUTFORMAT_REFERENCELIST
 
static isPluginDatatype(string $datatype)
 
array $import_record_field_cache
Caches ilDclBaseRecordFieldModel objects. 
 
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
 
static getInstance(int $tableview_id, int $field_id)
 
getMapping(string $a_comp, string $a_entity, string $a_old_id)
 
readData(string $a_entity, string $a_version, array $a_ids)
Read data from Cache for a given entity and ID(s) 
 
static getAllDatatype(bool $force=false)
Get all possible Datatypes. 
 
getCache(string $a_entity)
Get cached data from a given entity. 
 
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
Needs to be overwritten for import use case. 
 
array $import_temp_new_mob_ids
 
const INPUTFORMAT_ILIAS_REF
 
array ilObjDataCollection $import_dc_object
 
_readData(string $a_entity, array $a_ids)
Build data array, data is read from cache except dcl object itself. 
 
static getInstance(int $table_id, string $field)
 
const INPUTFORMAT_REFERENCE
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
static getRecordCache(?int $record_id)
 
const INPUTFORMAT_FILEUPLOAD
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
__construct(Container $dic, ilPlugin $plugin)
 
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
Return dependencies form entities to other entities (in our case these are all the DB relations) ...
 
escapeArray(array $array)
 
array $import_temp_refs_props
 
array $record_field_ids_2_storage
 
static _lookupType(int $id, bool $reference=false)