ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilFileDataForum.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
24  private array $posting_cache = [];
27 
28  public function __construct(
29  private readonly int $obj_id = 0,
30  private readonly int $pos_id = 0
31  ) {
32  $this->legacy_implementation = new ilFileDataForumLegacyImplementation(
33  $this->obj_id,
34  $this->pos_id
35  );
36  $this->rc_implementation = new ilFileDataForumRCImplementation(
37  $this->obj_id,
38  $this->pos_id
39  );
40  }
41 
42  private function getCurrentPosting(): ilForumPost
43  {
44  if (isset($this->posting_cache[$this->pos_id])) {
45  return $this->posting_cache[$this->pos_id];
46  }
47 
48  return $this->posting_cache[$this->pos_id] = new ilForumPost($this->pos_id);
49  }
50 
52  {
53  $posting = $this->getCurrentPosting();
54  if ($posting->getRCID() !== ilForumPost::NO_RCID) {
56  }
57 
59  }
60 
61  public function getObjId(): int
62  {
63  return $this->getImplementation()->getObjId();
64  }
65 
66  public function getPosId(): int
67  {
68  return $this->getImplementation()->getPosId();
69  }
70 
71  public function setPosId(int $posting_id): void
72  {
73  $this->getImplementation()->setPosId($posting_id);
74  }
75 
76  public function getForumPath(): string
77  {
78  return $this->getImplementation()->getForumPath();
79  }
80 
84  public function getFilesOfPost(): array
85  {
86  return $this->getImplementation()->getFilesOfPost();
87  }
88 
89  public function moveFilesOfPost(int $new_frm_id = 0): bool
90  {
91  return $this->getImplementation()->moveFilesOfPost($new_frm_id);
92  }
93 
94  public function ilClone(int $new_obj_id, int $new_posting_id): bool
95  {
96  return $this->getImplementation()->ilClone($new_obj_id, $new_posting_id);
97  }
98 
99  public function delete(array $posting_ids_to_delete = null): bool
100  {
101  return $this->getImplementation()->delete($posting_ids_to_delete);
102  }
103 
104  public function storeUploadedFiles(): bool
105  {
106  return $this->rc_implementation->storeUploadedFiles();
107  }
108 
109  public function unlinkFile(string $filename): bool
110  {
111  return $this->getImplementation()->unlinkFile($filename);
112  }
113 
117  public function getFileDataByMD5Filename(string $hashed_filename): ?array
118  {
119  return $this->getImplementation()->getFileDataByMD5Filename($hashed_filename);
120  }
121 
125  public function unlinkFilesByMD5Filenames($hashed_filename_or_filenames): bool
126  {
127  return $this->getImplementation()->unlinkFilesByMD5Filenames($hashed_filename_or_filenames);
128  }
129 
130 
131  public function deliverFile(string $file): void
132  {
133  $this->getImplementation()->deliverFile($file);
134  }
135 
136  public function deliverZipFile(): bool
137  {
138  return $this->getImplementation()->deliverZipFile();
139  }
140 
141  public function importPath(string $path_to_file, int $posting_id): void
142  {
143  // Importing is only possible for IRSS based files
144  $this->setPosId($posting_id);
145  $this->rc_implementation->importFileToCollection($path_to_file, $this->getCurrentPosting());
146  }
147 }
ilClone(int $new_obj_id, int $new_posting_id)
unlinkFilesByMD5Filenames($hashed_filename_or_filenames)
setPosId(int $posting_id)
ilFileDataForumRCImplementation $rc_implementation
unlinkFile(string $filename)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importPath(string $path_to_file, int $posting_id)
$filename
Definition: buildRTE.php:78
getFileDataByMD5Filename(string $hashed_filename)
moveFilesOfPost(int $new_frm_id=0)
ilFileDataForumLegacyImplementation $legacy_implementation
__construct(private readonly int $obj_id=0, private readonly int $pos_id=0)