ILIAS  release_8 Revision v8.23
class.ilGroupExporter.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
5 
6 
7 
18 {
19  private ilLogger $logger;
20 
21  public function __construct()
22  {
23  global $DIC;
24 
25  $this->logger = $DIC->logger()->grp();
26  }
27 
31  public function init(): void
32  {
33  }
34 
38  public function getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids): array
39  {
40  // always trigger container because of co-page(s)
41  return array(
42  array(
43  'component' => 'Services/Container',
44  'entity' => 'struct',
45  'ids' => $a_ids
46  )
47  );
48  }
49 
50 
54  public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
55  {
56  $refs = ilObject::_getAllReferences((int) $a_id);
57  $group_ref_id = end($refs);
58  $group = ilObjectFactory::getInstanceByRefId($group_ref_id, false);
59 
60  if (!$group instanceof ilObjGroup) {
61  $this->logger->warning($a_id . ' is not instance of type group');
62  return '';
63  }
64 
65  $writer = new ilGroupXMLWriter($group);
66  $writer->setMode(ilGroupXMLWriter::MODE_EXPORT);
67  $writer->start();
68  return $writer->getXML();
69  }
70 
74  public function getValidSchemaVersions(string $a_entity): array
75  {
76  return array(
77  "4.1.0" => array(
78  "namespace" => "http://www.ilias.de/Modules/Group/grp/4_1",
79  "xsd_file" => "ilias_grp_4_1.xsd",
80  "uses_dataset" => false,
81  "min" => "4.1.0",
82  "max" => "4.4.999"),
83  "5.0.0" => array(
84  "namespace" => "http://www.ilias.de/Modules/Group/grp/5_0",
85  "xsd_file" => "ilias_grp_5_0.xsd",
86  "uses_dataset" => false,
87  "min" => "5.0.0",
88  "max" => "")
89  );
90  }
91 }
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
static _getAllReferences(int $id)
get all reference ids for object ID
getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
getValidSchemaVersions(string $a_entity)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjGroup.