ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
SampleSolutionManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
27 {
28  protected \ilExcSampleSolutionStakeholder $stakeholder;
29  protected int $ass_id;
30  protected \ILIAS\FileUpload\FileUpload $upload;
33 
34  public function __construct(
35  int $ass_id,
37  \ilExcSampleSolutionStakeholder $stakeholder,
38  InternalDomainService $domain
39  ) {
40  global $DIC;
41 
42  $this->upload = $DIC->upload();
43 
44  $this->repo = $repo;
45  $this->ass_id = $ass_id;
46  $this->stakeholder = $stakeholder;
47  $this->domain = $domain;
48  }
49 
50  protected function getStakeholder(): ResourceStakeholder
51  {
52  return $this->stakeholder;
53  }
54 
55 
56  public function importFromLegacyUpload(array $file_input): string
57  {
58  if (!isset($file_input["tmp_name"])) {
59  return "";
60  }
61  return $this->repo->importFromLegacyUpload(
62  $this->ass_id,
63  $file_input,
64  $this->stakeholder
65  );
66  }
67 
68  public function deliver(): void
69  {
70  if ($this->repo->hasFile($this->ass_id)) {
71  $this->repo->deliverFile($this->ass_id);
72  }
73  }
74 
75  public function getFilename(): string
76  {
77  return $this->repo->getFilename($this->ass_id);
78  }
79 
80  public function cloneTo(
81  int $to_ass_id
82  ): void {
83  // IRSS
84  if ($this->repo->hasFile($this->ass_id)) {
85  $this->repo->clone($this->ass_id, $to_ass_id);
86  }
87  }
88 
89 }
global $DIC
Definition: shib_login.php:26
__construct(int $ass_id, SampleSolutionRepository $repo, \ilExcSampleSolutionStakeholder $stakeholder, InternalDomainService $domain)