ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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)
 
 getLastChangeTimestamp (int $mob_id)
 
 updateLastChangeTimestamp (int $mob_id, int $timestamp)
 
 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 127 of file MediaObjectRepository.php.

127 : void
128 {
129 if ($rid = $this->getRidForMobId($mob_id)) {
130 if ($target_path === "") {
131 $target_path = "/";
132 }
133 $this->irss->importFileFromLegacyUploadToContainer(
134 $rid,
135 $tmp_name,
136 $target_path
137 );
138 }
139 }

◆ addFileFromLocal()

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

Definition at line 155 of file MediaObjectRepository.php.

155 : void
156 {
157 if ($rid = $this->getRidForMobId($mob_id)) {
158 $this->irss->addLocalFileToContainer(
159 $rid,
160 $tmp_name,
161 $path
162 );
163 }
164 }
$path
Definition: ltiservices.php:30

References $path.

◆ addFileFromUpload()

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

Definition at line 141 of file MediaObjectRepository.php.

145 : void {
146 if ($rid = $this->getRidForMobId($mob_id)) {
147 $this->irss->importFileFromUploadResultToContainer(
148 $rid,
149 $result,
150 $path
151 );
152 }
153 }

References $path.

◆ addLocalDirectory()

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

Definition at line 166 of file MediaObjectRepository.php.

166 : void
167 {
168 if ($rid = $this->getRidForMobId($mob_id)) {
169 $this->irss->addDirectoryToContainer(
170 $rid,
171 $dir
172 );
173 }
174 }

◆ addStream()

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

Definition at line 222 of file MediaObjectRepository.php.

226 : void {
227 $this->irss->addStreamToContainer(
228 $this->getRidForMobId($mob_id),
229 $stream,
231 );
232 }
$location
Definition: buildRTE.php:22

◆ addString()

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

Definition at line 234 of file MediaObjectRepository.php.

238 : void {
239 $this->irss->addStringToContainer(
240 $this->getRidForMobId($mob_id),
241 $content,
243 );
244 }

◆ 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 'last_change' => ['integer', time()]
58 ]);
59 }
$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 81 of file MediaObjectRepository.php.

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

References $id.

◆ deliverEntry()

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

Definition at line 206 of file MediaObjectRepository.php.

209 : void {
210 $this->irss->deliverContainerEntry(
211 $this->getRidForMobId($mob_id),
212 $path
213 );
214 }

◆ getById()

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

Definition at line 61 of file MediaObjectRepository.php.

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

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 216 of file MediaObjectRepository.php.

218 : string {
219 return $this->irss->getResourcePath($this->getRidForMobId($mob_id));
220 }

◆ getContainerResource()

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

Definition at line 246 of file MediaObjectRepository.php.

248 : ?StorableResource {
249 return $this->irss->getResource($this->getRidForMobId($mob_id));
250 }

◆ getContainerResourceId()

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

Definition at line 252 of file MediaObjectRepository.php.

254 : ?ResourceIdentification {
255 return $this->irss->getResourceIdForIdString($this->getRidForMobId($mob_id));
256 }

◆ getFilesOfPath()

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

Definition at line 265 of file MediaObjectRepository.php.

268 : array {
269 return $this->irss->getContainerEntriesOfPath(
270 $this->getRidForMobId($mob_id),
271 $dir_path
272 );
273 }

◆ getInfoOfEntry()

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

Definition at line 196 of file MediaObjectRepository.php.

199 : array {
200 return $this->irss->getContainerEntryInfo(
201 $this->getRidForMobId($mob_id),
202 $path
203 );
204 }

◆ getLastChangeTimestamp()

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

Definition at line 104 of file MediaObjectRepository.php.

104 : int
105 {
106 $set = $this->db->queryF(
107 "SELECT last_change FROM mob_data " .
108 " WHERE id = %s ",
109 ["integer"],
110 [$mob_id]
111 );
112 if ($rec = $this->db->fetchAssoc($set)) {
113 return (int) ($rec["last_change"] ?? 0);
114 }
115 return 0;
116 }

◆ getLocalSrc()

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

Definition at line 176 of file MediaObjectRepository.php.

176 : string
177 {
178 return $this->irss->getContainerUri($this->getRidForMobId($mob_id), $location);
179 }

References $location.

◆ getLocationStream()

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

Definition at line 186 of file MediaObjectRepository.php.

189 : ZIPStream {
190 return $this->irss->getStreamOfContainerEntry(
191 $this->getRidForMobId($mob_id),
193 );
194 }

◆ getRidForMobId()

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

Definition at line 90 of file MediaObjectRepository.php.

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

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 181 of file MediaObjectRepository.php.

181 : bool
182 {
183 return $this->irss->hasContainerEntry($this->getRidForMobId($mob_id), $location);
184 }

References $location.

◆ removeLocation()

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

Definition at line 258 of file MediaObjectRepository.php.

261 : void {
262 $this->irss->removePathFromContainer($this->getRidForMobId($mob_id), $location);
263 }

◆ updateLastChangeTimestamp()

ILIAS\MediaObjects\MediaObjectRepository::updateLastChangeTimestamp ( int  $mob_id,
int  $timestamp 
)

Definition at line 118 of file MediaObjectRepository.php.

118 : void
119 {
120 $this->db->update(
121 'mob_data',
122 ['last_change' => ['integer', $timestamp]],
123 ['id' => ['integer', $mob_id]]
124 );
125 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70

References $timestamp.


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