ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Handler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\Export\ExportHandler\Factory as ExportService;
24use ILIAS\Data\Factory as DataFactory;
25
26class Handler implements HandlerInterface
27{
28 protected \ilObjUser $user;
29 protected ExportService $export_service;
30 protected DataFactory $data_factory;
31
32 public function __construct(
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}
Builds data types.
Definition: Factory.php:36
__construct(\ilObjUser $user, ExportService $export_service, DataFactory $data_factory)
Definition: Handler.php:32
User class.