ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
Handler.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 use ILIAS\Export\ExportHandler\I\Consumer\ExportWriter\HandlerInterface as ilExportHandlerConsumerExportWriterInterface;
27 use ILIAS\Export\ExportHandler\I\Consumer\HandlerInterface as ilExportHandlerConsumerInterface;
28 use ILIAS\Export\ExportHandler\I\FactoryInterface as ilExportHandlerFactoryInterface;
29 use ILIAS\Export\ExportHandler\I\PublicAccess\HandlerInterface as ilExportHandlerPublicAccessInterface;
30 use ILIAS\Export\ExportHandler\I\Repository\Element\HandlerInterface as ilExportHandlerRepositoryElementInterface;
31 use ILIAS\Export\ExportHandler\I\Repository\Stakeholder\HandlerInterface as ExportRepositoryStakeholderInterface;
32 use ilObject;
33 
34 class Handler implements ilExportHandlerConsumerInterface
35 {
36  protected ilExportHandlerFactoryInterface $export_handler;
37 
38  public function __construct(
39  ilExportHandlerFactoryInterface $export_handler
40  ) {
41  $this->export_handler = $export_handler;
42  }
43 
44  public function publicAccess(): ilExportHandlerPublicAccessInterface
45  {
46  return $this->export_handler->publicAccess()->handler();
47  }
48 
49  public function exportConfig(): ExportConfigFactoryInterface
50  {
51  return $this->export_handler->consumer()->exportConfig();
52  }
53 
54  public function createStandardExport(
55  int $user_id,
56  ObjectId $object_id,
57  ExportConfigCollectionInterface $export_configs = null
58  ): ilExportHandlerRepositoryElementInterface {
59  $manager = $this->export_handler->manager()->handler();
60  if (is_null($export_configs)) {
61  $export_configs = $this->export_handler->consumer()->exportConfig()->allExportConfigs();
62  }
63  return $manager->createExport(
64  $user_id,
65  $manager->getExportInfo($object_id, time(), $export_configs),
66  ""
67  );
68  }
69 
71  int $user_id,
72  ilObject $object,
73  ExportConfigCollectionInterface $export_configs = null
74  ): ilExportHandlerRepositoryElementInterface {
75  $manager = $this->export_handler->manager()->handler();
76  if (is_null($export_configs)) {
77  $export_configs = $this->export_handler->consumer()->exportConfig()->allExportConfigs();
78  }
79  return $manager->createExport(
80  $user_id,
81  $manager->getExportInfoWithObject($object, time(), $export_configs),
82  ""
83  );
84  }
85 
86  public function exportWriter(
87  ilExportHandlerRepositoryElementInterface $element
88  ): ilExportHandlerConsumerExportWriterInterface {
89  return $this->export_handler->consumer()->exportWriter()->handler()
90  ->withObjectId($element->getKey()->getObjectId())
91  ->withResourceIdSerialized($element->getKey()->getResourceIdSerialized());
92  }
93 
94  public function exportStakeholderHandler(): ExportRepositoryStakeholderInterface
95  {
96  return $this->export_handler->repository()->stakeholder()->handler();
97  }
98 }
__construct(ilExportHandlerFactoryInterface $export_handler)
Definition: Handler.php:38
createStandardExportByObject(int $user_id, ilObject $object, ExportConfigCollectionInterface $export_configs=null)
Definition: Handler.php:70
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilExportHandlerFactoryInterface $export_handler
Definition: Handler.php:36
exportWriter(ilExportHandlerRepositoryElementInterface $element)
Definition: Handler.php:86
createStandardExport(int $user_id, ObjectId $object_id, ExportConfigCollectionInterface $export_configs=null)
Definition: Handler.php:54