ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Handler.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ILIAS\Export\ExportHandler\Factory as ExportService;
25 
26 class Handler implements HandlerInterface
27 {
28  protected \ilObjUser $user;
29  protected ExportService $export_service;
31 
32  public function __construct(
33  \ilObjUser $user,
34  ExportService $export_service,
35  DataFactory $data_factory
36  ) {
37  $this->export_service = $export_service;
38  $this->data_factory = $data_factory;
39  $this->user = $user;
40  }
41 
42  public function hasPublicAccessExport(int $obj_id): bool
43  {
44  $obj_id = $this->data_factory->objId($obj_id);
45  return $this->export_service->publicAccess()->handler()->hasPublicAccessFile($obj_id);
46  }
47 
48  public function createPublicAccessExport(int $obj_id): void
49  {
50  if ($this->hasPublicAccessExport($obj_id)) {
51  return;
52  }
53  $obj_id = $this->data_factory->objId($obj_id);
54  $export_result = $this->export_service->consumer()->handler()->createStandardExport(
55  $this->user->getId(),
56  $obj_id
57  );
58  $this->export_service->consumer()->handler()->publicAccess()->setPublicAccessFile(
59  $obj_id,
60  "expxml",
61  $export_result->getIRSS()->getResourceIdSerialized()
62  );
63  }
64 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(\ilObjUser $user, ExportService $export_service, DataFactory $data_factory)
Definition: Handler.php:32