ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MediaObjects\MediaObjectRepository Class Reference
+ Collaboration diagram for ILIAS\MediaObjects\MediaObjectRepository:

Public Member Functions

 __construct (protected ilDBInterface $db, protected IRSSWrapper $irss)
 
 create (int $id, string $title, \ilMobStakeholder $stakeholder, int $from_mob_id=0)
 
 getById (int $id)
 
 delete (int $id)
 
 addFileFromLegacyUpload (int $mob_id, string $tmp_name, string $target_path="")
 
 addFileFromUpload (int $mob_id, UploadResult $result, string $path="/")
 
 addFileFromLocal (int $mob_id, string $tmp_name, string $path)
 
 addLocalDirectory (int $mob_id, string $dir)
 
 getLocalSrc (int $mob_id, string $location)
 
 hasLocalFile (int $mob_id, string $location)
 
 getLocationStream (int $mob_id, string $location)
 
 getInfoOfEntry (int $mob_id, string $path)
 
 deliverEntry (int $mob_id, string $path)
 
 getContainerPath (int $mob_id)
 
 addStream (int $mob_id, string $location, FileStream $stream)
 
 addString (int $mob_id, string $location, string $content)
 
 getContainerResource (int $mob_id)
 
 getContainerResourceId (int $mob_id)
 
 removeLocation (int $mob_id, string $location)
 
 getFilesOfPath (int $mob_id, string $dir_path)
 

Protected Member Functions

 getRidForMobId (int $mob_id)
 

Detailed Description

Definition at line 31 of file MediaObjectRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MediaObjects\MediaObjectRepository::__construct ( protected ilDBInterface  $db,
protected IRSSWrapper  $irss 
)

Definition at line 33 of file MediaObjectRepository.php.

36 {
37 }

Member Function Documentation

◆ addFileFromLegacyUpload()

ILIAS\MediaObjects\MediaObjectRepository::addFileFromLegacyUpload ( int  $mob_id,
string  $tmp_name,
string  $target_path = "" 
)

Definition at line 102 of file MediaObjectRepository.php.

102 : void
103 {
104 if ($rid = $this->getRidForMobId($mob_id)) {
105 if ($target_path === "") {
106 $target_path = "/";
107 }
108 $this->irss->importFileFromLegacyUploadToContainer(
109 $rid,
110 $tmp_name,
111 $target_path
112 );
113 }
114 }

◆ addFileFromLocal()

ILIAS\MediaObjects\MediaObjectRepository::addFileFromLocal ( int  $mob_id,
string  $tmp_name,
string  $path 
)

Definition at line 130 of file MediaObjectRepository.php.

130 : void
131 {
132 if ($rid = $this->getRidForMobId($mob_id)) {
133 $this->irss->addLocalFileToContainer(
134 $rid,
135 $tmp_name,
136 $path
137 );
138 }
139 }
$path
Definition: ltiservices.php:30

References $path.

◆ addFileFromUpload()

ILIAS\MediaObjects\MediaObjectRepository::addFileFromUpload ( int  $mob_id,
UploadResult  $result,
string  $path = "/" 
)

Definition at line 116 of file MediaObjectRepository.php.

120 : void {
121 if ($rid = $this->getRidForMobId($mob_id)) {
122 $this->irss->importFileFromUploadResultToContainer(
123 $rid,
124 $result,
125 $path
126 );
127 }
128 }

References $path.

◆ addLocalDirectory()

ILIAS\MediaObjects\MediaObjectRepository::addLocalDirectory ( int  $mob_id,
string  $dir 
)

Definition at line 141 of file MediaObjectRepository.php.

141 : void
142 {
143 if ($rid = $this->getRidForMobId($mob_id)) {
144 $this->irss->addDirectoryToContainer(
145 $rid,
146 $dir
147 );
148 }
149 }

◆ addStream()

ILIAS\MediaObjects\MediaObjectRepository::addStream ( int  $mob_id,
string  $location,
FileStream  $stream 
)

Definition at line 197 of file MediaObjectRepository.php.

201 : void {
202 $this->irss->addStreamToContainer(
203 $this->getRidForMobId($mob_id),
204 $stream,
206 );
207 }
$location
Definition: buildRTE.php:22

◆ addString()

ILIAS\MediaObjects\MediaObjectRepository::addString ( int  $mob_id,
string  $location,
string  $content 
)

Definition at line 209 of file MediaObjectRepository.php.

213 : void {
214 $this->irss->addStringToContainer(
215 $this->getRidForMobId($mob_id),
216 $content,
218 );
219 }

◆ create()

ILIAS\MediaObjects\MediaObjectRepository::create ( int  $id,
string  $title,
\ilMobStakeholder  $stakeholder,
int  $from_mob_id = 0 
)

Definition at line 39 of file MediaObjectRepository.php.

44 : void {
45 if ($from_mob_id > 0) {
46 $from_rid = $this->getRidForMobId($from_mob_id);
47 $rid = $this->irss->cloneContainer($from_rid);
48 } else {
49 $rid = $this->irss->createContainer(
50 $stakeholder,
51 "mob.zip"
52 );
53 }
54 $this->db->insert('mob_data', [
55 'id' => ['integer', $id],
56 'rid' => ['text', $rid]
57 ]);
58 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References ILIAS\MediaObjects\MediaObjectRepository\getRidForMobId().

+ Here is the call graph for this function:

◆ delete()

ILIAS\MediaObjects\MediaObjectRepository::delete ( int  $id)

Definition at line 79 of file MediaObjectRepository.php.

79 : void
80 {
81 $this->db->manipulateF(
82 'DELETE FROM mob_data WHERE id = %s',
83 ['integer'],
84 [$id]
85 );
86 }

References $id.

◆ deliverEntry()

ILIAS\MediaObjects\MediaObjectRepository::deliverEntry ( int  $mob_id,
string  $path 
)

Definition at line 181 of file MediaObjectRepository.php.

184 : void {
185 $this->irss->deliverContainerEntry(
186 $this->getRidForMobId($mob_id),
187 $path
188 );
189 }

◆ getById()

ILIAS\MediaObjects\MediaObjectRepository::getById ( int  $id)

Definition at line 60 of file MediaObjectRepository.php.

60 : ?array
61 {
62 $set = $this->db->queryF(
63 'SELECT * FROM mob_data WHERE id = %s',
64 ['integer'],
65 [$id]
66 );
67
68 $record = $this->db->fetchAssoc($set);
69 if ($record) {
70 return [
71 'id' => (int) $record['id'],
72 'rid' => (string) $record['rid']
73 ];
74 }
75
76 return null;
77 }

References $id, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getContainerPath()

ILIAS\MediaObjects\MediaObjectRepository::getContainerPath ( int  $mob_id)

Definition at line 191 of file MediaObjectRepository.php.

193 : string {
194 return $this->irss->getResourcePath($this->getRidForMobId($mob_id));
195 }

◆ getContainerResource()

ILIAS\MediaObjects\MediaObjectRepository::getContainerResource ( int  $mob_id)

Definition at line 221 of file MediaObjectRepository.php.

223 : ?StorableResource {
224 return $this->irss->getResource($this->getRidForMobId($mob_id));
225 }

◆ getContainerResourceId()

ILIAS\MediaObjects\MediaObjectRepository::getContainerResourceId ( int  $mob_id)

Definition at line 227 of file MediaObjectRepository.php.

229 : ?ResourceIdentification {
230 return $this->irss->getResourceIdForIdString($this->getRidForMobId($mob_id));
231 }

◆ getFilesOfPath()

ILIAS\MediaObjects\MediaObjectRepository::getFilesOfPath ( int  $mob_id,
string  $dir_path 
)

Definition at line 240 of file MediaObjectRepository.php.

243 : array {
244 return $this->irss->getContainerEntriesOfPath(
245 $this->getRidForMobId($mob_id),
246 $dir_path
247 );
248 }

◆ getInfoOfEntry()

ILIAS\MediaObjects\MediaObjectRepository::getInfoOfEntry ( int  $mob_id,
string  $path 
)

Definition at line 171 of file MediaObjectRepository.php.

174 {
175 return $this->irss->getContainerEntryInfo(
176 $this->getRidForMobId($mob_id),
177 $path
178 );
179 }

References $path.

◆ getLocalSrc()

ILIAS\MediaObjects\MediaObjectRepository::getLocalSrc ( int  $mob_id,
string  $location 
)

Definition at line 151 of file MediaObjectRepository.php.

151 : string
152 {
153 return $this->irss->getContainerUri($this->getRidForMobId($mob_id), $location);
154 }

References $location.

◆ getLocationStream()

ILIAS\MediaObjects\MediaObjectRepository::getLocationStream ( int  $mob_id,
string  $location 
)

Definition at line 161 of file MediaObjectRepository.php.

164 : ZIPStream {
165 return $this->irss->getStreamOfContainerEntry(
166 $this->getRidForMobId($mob_id),
168 );
169 }

◆ getRidForMobId()

ILIAS\MediaObjects\MediaObjectRepository::getRidForMobId ( int  $mob_id)
protected

Definition at line 88 of file MediaObjectRepository.php.

88 : string
89 {
90 $set = $this->db->queryF(
91 "SELECT * FROM mob_data " .
92 " WHERE id = %s ",
93 ["integer"],
94 [$mob_id]
95 );
96 if ($rec = $this->db->fetchAssoc($set)) {
97 return $rec["rid"] ?? "";
98 }
99 return "";
100 }

Referenced by ILIAS\MediaObjects\MediaObjectRepository\create().

+ Here is the caller graph for this function:

◆ hasLocalFile()

ILIAS\MediaObjects\MediaObjectRepository::hasLocalFile ( int  $mob_id,
string  $location 
)

Definition at line 156 of file MediaObjectRepository.php.

156 : bool
157 {
158 return $this->irss->hasContainerEntry($this->getRidForMobId($mob_id), $location);
159 }

References $location.

◆ removeLocation()

ILIAS\MediaObjects\MediaObjectRepository::removeLocation ( int  $mob_id,
string  $location 
)

Definition at line 233 of file MediaObjectRepository.php.

236 : void {
237 $this->irss->removePathFromContainer($this->getRidForMobId($mob_id), $location);
238 }

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