40     public const DATASET_NS = 
'http://www.ilias.de/Services/DataSet/ds/4_3';
    50     protected \ILIAS\ResourceStorage\Services 
$irss;
    70         $this->db = $DIC->database();
    72         $this->irss = $DIC->resourceStorage();
    87     final public function init(
string $a_entity, 
string $a_schema_version): void
    89         $this->entity = $a_entity;
    90         $this->schema_version = $a_schema_version;
    91         $this->data = array();
   103     abstract protected function getTypes(
string $a_entity, 
string $a_version): array;
   105     abstract protected function getXmlNamespace(
string $a_entity, 
string $a_schema_version): string;
   119         $this->relative_export_dir = $a_relative;
   120         $this->absolute_export_dir = $a_absolute;
   125         $this->import_directory = $a_val;
   135         $this->ds_prefix = $a_val;
   157         bool $a_convert_to_leading_upper = 
true,
   162         $set = 
$ilDB->query($a_query);
   163         $this->data = array();
   165         while ($rec = 
$ilDB->fetchAssoc($set)) {
   166             if ($a_convert_to_leading_upper) {
   168                 foreach ($rec as $k => $v) {
   176                 $this->data[] = $rec;
   188         $a_str = strtoupper(substr($a_str, 0, 1)) . substr($a_str, 1);
   189         while (($pos = strpos($a_str, 
"_")) !== 
false) {
   190             $a_str = substr($a_str, 0, $pos) .
   191                 strtoupper(substr($a_str, $pos + 1, 1)) .
   192                 substr($a_str, $pos + 2);
   221         string $a_schema_version,
   223         string $a_field = 
"",
   224         bool $a_omit_header = 
false,
   225         bool $a_omit_types = 
false   231         if (!$a_omit_header) {
   232             $writer->xmlHeader();
   236         $namespaces = $prefixes = array();
   237         $this->
getNamespaces($namespaces, $a_entity, $a_schema_version);
   239             "InstallationUrl" => ILIAS_HTTP_PATH, 
"TopEntity" => $a_entity);
   241         foreach ($namespaces as $entity => $ns) {
   242             $prefix = 
"ns" . $cnt;
   247         $this->ds_log->debug(
"Start writing Dataset, entity: " . $a_entity . 
", schema version: " . $a_schema_version .
   248             ", ids: " . print_r($a_ids, 
true));
   251             $atts[
'xmlns:' . $this->
getDSPrefix()] = self::DATASET_NS;
   253             $atts[
'xmlns'] = self::DATASET_NS;
   257         if (!$a_omit_types) {
   258             $this->ds_log->debug(
"...write types");
   259             $this->
addTypesXml($writer, $a_entity, $a_schema_version);
   262         $this->ds_log->debug(
"...write records");
   263         $this->
addRecordsXml($writer, $prefixes, $a_entity, $a_schema_version, $a_ids, $a_field);
   267         return $writer->xmlDumpMem(
false);
   275         string $a_schema_version,
   277         ?
string $a_field = 
""   279         $types = $this->
getXmlTypes($a_entity, $a_schema_version);
   281         $this->ds_log->debug(
"...read data");
   282         $this->
readData($a_entity, $a_schema_version, $a_ids);
   283         $this->ds_log->debug(
"...data: " . print_r($this->data, 
true));
   284         foreach ($this->data as 
$d) {
   290             $rec = $this->
getXmlRecord($a_entity, $a_schema_version, $d);
   291             foreach ($rec as 
$f => 
$c) {
   292                 if ($this->absolute_export_dir !== 
"" && $this->relative_export_dir !== 
"") {
   293                     if (($types[
$f] ?? 
"") === 
"directory") {
   295                         $sdir = realpath(
$c);
   296                         $tdir = realpath($this->absolute_export_dir . 
"/dsDir_" . $this->dircnt);
   300                             $this->ds_log->error($e->getMessage());
   305                     if (($types[$f] ?? 
"") === 
"rscollection") {
   306                         $tdir = $this->absolute_export_dir . 
"/dsDir_" . 
$this->dircnt;
   308                         $tdir = realpath($tdir);
   309                         if ($collection = $this->
getCollection($rec, $a_entity, $a_schema_version, $f, 
$c)) {
   310                             foreach ($collection->getResourceIdentifications() as $rid) {
   311                                 $info = $this->irss->manage()->getResource($rid)
   312                                                    ->getCurrentRevision()
   314                                 $stream = $this->irss->consume()->stream($rid);
   315                                 $name = $tdir . 
"/" . $info->getTitle();
   316                                 file_put_contents($name, $stream->getStream()->getContents());
   336             $this->ds_log->debug(
"...get dependencies");
   337             $deps = $this->
getDependencies($a_entity, $a_schema_version, $rec, $a_ids);
   338             $this->ds_log->debug(
"...dependencies: " . print_r($deps, 
true));
   339             foreach ($deps as $dp => $par) {
   340                 $ids = !is_array($par[
"ids"])
   343                 $this->
addRecordsXml($a_writer, $a_prefixes, $dp, $a_schema_version, $ids, $par[
"field"] ?? null);
   351         ?array $a_rec = null,
   365         $types = $this->
getXmlTypes($a_entity, $a_schema_version);
   368         if (count($types) > 0) {
   372                     "SchemaVersion" => $a_schema_version)
   374             foreach ($this->
getXmlTypes($a_entity, $a_schema_version) as 
$f => $t) {
   377                     array(
"Name" => 
$f, 
"Type" => $t)
   384         $deps = $this->
getDependencies($a_entity, $a_schema_version, null, null);
   385         foreach ($deps as $dp => $w) {
   386             $this->
addTypesXml($a_writer, $dp, $a_schema_version);
   391     public function getNamespaces(array &$namespaces, 
string $a_entity, 
string $a_schema_version): void
   395             $namespaces[$a_entity] = $ns;
   398         $deps = $this->
getDependencies($a_entity, $a_schema_version, null, null);
   399         foreach ($deps as $dp => $w) {
   408     public function getXmlRecord(
string $a_entity, 
string $a_version, array $a_set): array
   417     public function getXmlTypes(
string $a_entity, 
string $a_version): array
   419         return $this->
getTypes($a_entity, $a_version);
   441         $this->
import = $a_val;
   451         $this->current_installation_id = $a_val;
   464         return "il_" . 
IL_INST_ID . 
"_" . $a_type . 
"_" . $a_id;
   474         if (strpos($a_id, 
"il_") === 0) {
   475             $parts = explode(
"_", $a_id);
   476             if (count(
$parts) !== 4) {
   477                 throw new ilException(
"Invalid import ID '" . $a_id . 
"'.");
   484             if (($inst_id == 0 || 
IL_INST_ID === 
"0") && !DEVMODE) {
   485                 return array(
"type" => self::EXPORT_NO_INST_ID, 
"id" => $a_fallback_id);
   492                     return array(
"type" => self::EXPORT_ID_ILIAS_LOCAL, 
"id" => 
$id);
   496                     return array(
"type" => self::EXPORT_ID_ILIAS_LOCAL_INVALID, 
"id" => $a_fallback_id);
   504                     return array(
"type" => self::EXPORT_ID_ILIAS_REMOTE, 
"id" => 
$id);
   508                     return array(
"type" => self::EXPORT_ID_ILIAS_REMOTE_INVALID, 
"id" => $a_fallback_id);
   515                 return array(
"type" => self::EXPORT_ID, 
"id" => 
$id);
   517                 return array(
"type" => self::EXPORT_ID_INVALID, 
"id" => $a_fallback_id);
   530         string $a_schema_version
   537         string $schema_version,
   544     protected function stripTags(array $rec, array $omit_keys = []): array
   547         foreach ($rec as $k => $v) {
   548             if (in_array($k, $omit_keys, 
true)) {
 
getXMLEntityName(string $a_entity, string $a_version)
Get entity name for xml (may be overwritten) 
 
readData(string $a_entity, string $a_version, array $a_ids)
Read data from DB. 
 
const EXPORT_ID_ILIAS_REMOTE
 
init(string $a_entity, string $a_schema_version)
Init. 
 
getCollection(array $record, string $entity, string $schema_version, string $field, string $value)
 
convertToLeadingUpper(string $a_str)
Make xyz_abc a XyzAbc string. 
 
getXmlRecord(string $a_entity, string $a_version, array $a_set)
Get xml record for version. 
 
setCurrentInstallationId(string $a_val)
 
static getLogger(string $a_component_id)
Get component logger. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
setImportDirectory(string $a_val)
 
getNamespaces(array &$namespaces, string $a_entity, string $a_schema_version)
 
string $relative_export_dir
 
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
 
Class ChatMainBarProvider . 
 
getXmlNamespace(string $a_entity, string $a_schema_version)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
 
getXmlTypes(string $a_entity, string $a_version)
Get xml types. 
 
const EXPORT_ID_ILIAS_LOCAL_INVALID
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
string $absolute_export_dir
 
parseObjectExportId(string $a_id, ?string $a_fallback_id=null)
Parse export id. 
 
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir. 
 
Class ResourceCollection. 
 
static makeDirParents(string $a_dir)
Create a new directory and all parent directories. 
 
addRecordsXml(ilXmlWriter $a_writer, array $a_prefixes, string $a_entity, string $a_schema_version, array $a_ids, ?string $a_field="")
 
static _getIdForImportId(string $import_id)
 
xmlEndTag(string $tag)
Writes an endtag. 
 
const EXPORT_ID_ILIAS_REMOTE_INVALID
 
setExportDirectories(string $a_relative, string $a_absolute)
 
createObjectExportId(string $a_type, string $a_id)
Build ilias export id. 
 
const EXPORT_ID_ILIAS_LOCAL
 
getXmlRepresentation(string $a_entity, string $a_schema_version, ?array $a_ids, string $a_field="", bool $a_omit_header=false, bool $a_omit_types=false)
Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" versio...
 
ILIAS ResourceStorage Services $irss
 
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. 
 
afterXmlRecordWriting(string $a_entity, string $a_version, array $a_set)
 
getCurrentInstallationId()
 
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
addTypesXml(ilXmlWriter $a_writer, string $a_entity, string $a_schema_version)
 
getXMLEntityTag(string $a_entity, string $a_schema_version)
Get entity tag. 
 
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
 
getTypes(string $a_entity, string $a_version)
Get (abstract) types for (abstract) field names. 
 
setImport(ilSurveyImporter $a_val)
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag. 
 
string $current_installation_id
 
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content) 
 
stripTags(array $rec, array $omit_keys=[])
 
static _lookupType(int $id, bool $reference=false)
 
setDSPrefix(string $a_val)