ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Exercise\InstructionFile\InstructionFileManager Class Reference
+ Collaboration diagram for ILIAS\Exercise\InstructionFile\InstructionFileManager:

Public Member Functions

 __construct (int $ass_id, InstructionFileRepository $repo, \ilExcInstructionFilesStakeholder $stakeholder)
 
 getStakeholder ()
 
 getCollectionIdString ()
 
 createCollection ()
 
 importFromLegacyUpload (array $file_input)
 
 importFromDirectory (string $dir)
 
 deleteCollection ()
 
 getCollection ()
 
 getFiles ()
 
 deliver (string $full_path, string $file)
 
 cloneTo (int $to_ass_id)
 

Protected Attributes

ilExcInstructionFilesStakeholder $stakeholder
 
ILIAS FileUpload FileUpload $upload
 
int $ass_id
 
InstructionFileRepository $repo
 

Detailed Description

Definition at line 27 of file InstructionFileManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Exercise\InstructionFile\InstructionFileManager::__construct ( int  $ass_id,
InstructionFileRepository  $repo,
\ilExcInstructionFilesStakeholder  $stakeholder 
)

Member Function Documentation

◆ cloneTo()

ILIAS\Exercise\InstructionFile\InstructionFileManager::cloneTo ( int  $to_ass_id)

Definition at line 126 of file InstructionFileManager.php.

128  : void {
129  $this->repo->clone($this->ass_id, $to_ass_id);
130  }

◆ createCollection()

ILIAS\Exercise\InstructionFile\InstructionFileManager::createCollection ( )

Definition at line 58 of file InstructionFileManager.php.

58  : void
59  {
60  $this->repo->createCollection($this->ass_id);
61  }

◆ deleteCollection()

ILIAS\Exercise\InstructionFile\InstructionFileManager::deleteCollection ( )

Definition at line 81 of file InstructionFileManager.php.

81  : void
82  {
83  $this->repo->deleteCollection(
84  $this->ass_id,
85  $this->stakeholder
86  );
87  }

◆ deliver()

ILIAS\Exercise\InstructionFile\InstructionFileManager::deliver ( string  $full_path,
string  $file 
)

Definition at line 115 of file InstructionFileManager.php.

References ilFileDelivery\deliverFileLegacy(), and exit.

115  : void
116  {
117  if ($this->repo->hasCollection($this->ass_id)) {
118  $this->repo->deliverFile($this->ass_id, $file);
119  } else {
120  // deliver file
121  \ilFileDelivery::deliverFileLegacy($full_path, $file);
122  exit();
123  }
124  }
exit
Definition: login.php:29
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
+ Here is the call graph for this function:

◆ getCollection()

ILIAS\Exercise\InstructionFile\InstructionFileManager::getCollection ( )

Definition at line 89 of file InstructionFileManager.php.

89  : ?ResourceCollection
90  {
91  return $this->repo->getCollection($this->ass_id);
92  }

◆ getCollectionIdString()

ILIAS\Exercise\InstructionFile\InstructionFileManager::getCollectionIdString ( )

Definition at line 53 of file InstructionFileManager.php.

53  : string
54  {
55  return $this->repo->getIdStringForAssId($this->ass_id);
56  }

◆ getFiles()

ILIAS\Exercise\InstructionFile\InstructionFileManager::getFiles ( )

Definition at line 94 of file InstructionFileManager.php.

References ILIAS\Exercise\IRSS\ResourceInformation\getCreationTimestamp(), ILIAS\Exercise\IRSS\ResourceInformation\getMimeType(), ILIAS\Exercise\IRSS\ResourceInformation\getRid(), ILIAS\Exercise\IRSS\ResourceInformation\getSize(), ILIAS\Exercise\IRSS\ResourceInformation\getSrc(), ILIAS\Exercise\IRSS\ResourceInformation\getTitle(), and ilExAssignment\lookupExerciseId().

94  : array
95  {
96  if ($this->repo->hasCollection($this->ass_id)) {
97  return array_map(function (ResourceInformation $info): array {
98  return [
99  'rid' => $info->getRid(),
100  'name' => $info->getTitle(),
101  'size' => $info->getSize(),
102  'ctime' => $info->getCreationTimestamp(),
103  'fullpath' => $info->getSrc(),
104  'mime' => $info->getMimeType(), // this is additional to still use the image delivery in class.ilExAssignmentGUI.php:306
105  'order' => 0 // sorting is currently not supported
106  ];
107  }, iterator_to_array($this->repo->getCollectionResourcesInfo($this->ass_id)));
108  } else {
109  $exc_id = \ilExAssignment::lookupExerciseId($this->ass_id);
110  $storage = new \ilFSWebStorageExercise($exc_id, $this->ass_id);
111  return $storage->getFiles();
112  }
113  }
static lookupExerciseId(int $a_ass_id)
+ Here is the call graph for this function:

◆ getStakeholder()

ILIAS\Exercise\InstructionFile\InstructionFileManager::getStakeholder ( )

Definition at line 48 of file InstructionFileManager.php.

References ILIAS\Exercise\InstructionFile\InstructionFileManager\$stakeholder.

48  : ResourceStakeholder
49  {
50  return $this->stakeholder;
51  }

◆ importFromDirectory()

ILIAS\Exercise\InstructionFile\InstructionFileManager::importFromDirectory ( string  $dir)

Definition at line 72 of file InstructionFileManager.php.

72  : void
73  {
74  $this->repo->importFromDirectory(
75  $this->ass_id,
76  $dir,
77  $this->stakeholder
78  );
79  }

◆ importFromLegacyUpload()

ILIAS\Exercise\InstructionFile\InstructionFileManager::importFromLegacyUpload ( array  $file_input)

Definition at line 63 of file InstructionFileManager.php.

63  : void
64  {
65  $this->repo->importFromLegacyUpload(
66  $this->ass_id,
67  $file_input,
68  $this->stakeholder
69  );
70  }

Field Documentation

◆ $ass_id

int ILIAS\Exercise\InstructionFile\InstructionFileManager::$ass_id
protected

◆ $repo

InstructionFileRepository ILIAS\Exercise\InstructionFile\InstructionFileManager::$repo
protected

◆ $stakeholder

ilExcInstructionFilesStakeholder ILIAS\Exercise\InstructionFile\InstructionFileManager::$stakeholder
protected

◆ $upload

ILIAS FileUpload FileUpload ILIAS\Exercise\InstructionFile\InstructionFileManager::$upload
protected

Definition at line 30 of file InstructionFileManager.php.


The documentation for this class was generated from the following file: