19declare(strict_types=1);
32 protected \ilDBInterface
$db;
44 $new_id = $this->wrapper->createEmptyCollection();
48 "if_rcid" => [
"text", $new_id]
58 $set = $this->db->queryF(
59 "SELECT if_rcid FROM exc_assignment " .
64 $rec = $this->db->fetchAssoc($set);
65 return ($rec[
"if_rcid"] ??
"");
71 return ($rcid !==
"");
78 return $this->wrapper->getCollectionForIdString($rcid);
90 $this->wrapper->importFilesFromLegacyUploadToCollection(
103 $collection = $this->getCollection(
$ass_id);
105 $this->wrapper->importFilesFromDirectoryToCollection(
113 public function deliverFile(
$ass_id, $file): void
116 foreach ($this->getCollectionResourcesInfo(
$ass_id) as
$info) {
117 if ($file ===
$info->getTitle()) {
118 $this->wrapper->deliverFile(
$info->getRid());
121 throw new \ilExerciseException(
"Resource $file not found.");
124 public function getStream(
129 foreach ($this->getCollectionResourcesInfo(
$ass_id) as
$info) {
130 if ($rid ===
$info->getRid()) {
131 return $this->wrapper->stream(
$info->getRid());
140 $collection = $this->getCollection(
$ass_id);
141 return $this->wrapper->getCollectionResourcesInfo($collection);
148 $rcid = $this->getIdStringForAssId(
$ass_id);
152 $this->wrapper->deleteCollectionForIdString(
162 $from_rcid = $this->getIdStringForAssId($from_ass_id);
163 $to_rcid = $this->wrapper->clone($from_rcid);
164 if ($to_rcid !==
"") {
168 "if_rcid" => [
"text", $to_rcid]
171 "id" => [
"integer", $to_ass_id]
getCollectionResourcesInfo(int $ass_id)
importFromLegacyUpload(int $ass_id, array $file_input, ResourceStakeholder $stakeholder)
hasCollection(int $ass_id)
__construct(IRSSWrapper $wrapper, \ilDBInterface $db)
importFromDirectory(int $ass_id, string $dir, ResourceStakeholder $stakeholder)
clone(int $from_ass_id, int $to_ass_id)
getCollection(int $ass_id)
createCollection(int $ass_id)
deleteCollection(int $ass_id, ResourceStakeholder $stakeholder)
getIdStringForAssId(int $ass_id)
Class ResourceCollection.
The base interface for all filesystem streams.
Interface ResourceStakeholder.