ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
r
s
t
w
+
Functions
_
a
b
c
f
g
h
i
r
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
AccessQuestionImage.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Modules\Test
;
22
23
use
ILIAS\Data\Result
;
24
use
ILIAS\Data\Result\Ok
;
25
use
ILIAS\Data\Result\Error
;
26
use
ILIAS\DI\Container
;
27
use
Closure
;
28
29
class
AccessQuestionImage
implements
SimpleAccess
30
{
32
private
$readable
;
33
34
public
function
__construct
(
Readable
$readable
)
35
{
36
$this->readable =
$readable
;
37
}
38
39
public
function
isPermitted
(
string
$path):
Result
40
{
41
$object_id = $this->
objectId
($path);
42
if
(!$object_id) {
43
return
new
Error
(
'Not a question image path of test questions.'
);
44
}
45
46
return
new
Ok
($this->readable->objectId($object_id));
47
}
48
49
private
function
objectId
(
string
$path): ?int
50
{
51
$results
= [];
52
if
(!preg_match(
':/assessment/(\d+)/(\d+)/images/([^/]+)$:'
, $path,
$results
)) {
53
return
null;
54
}
55
56
return
(
int
)
$results
[1];
57
}
58
}
ILIAS\Modules\Test\SimpleAccess
Definition:
SimpleAccess.php:25
ILIAS\Data\Result
Definition:
Error.php:4
Error
ILIAS\Modules\Test
Definition:
AccessFileUploadAnswer.php:21
ILIAS\Data\Result
A result encapsulates a value or an error and simplifies the handling of those.
Definition:
Result.php:11
Closure
ILIAS\Modules\Test\AccessQuestionImage\__construct
__construct(Readable $readable)
Definition:
AccessQuestionImage.php:34
Container
ILIAS\Modules\Test\Readable
Definition:
Readable.php:27
ILIAS\Data\Result\Ok
A result encapsulates a value or an error and simplifies the handling of those.
Definition:
Ok.php:13
$results
$results
Definition:
save_question_post_data.php:7
ILIAS\Modules\Test\AccessQuestionImage\objectId
objectId(string $path)
Definition:
AccessQuestionImage.php:49
Ok
ILIAS\Modules\Test\AccessQuestionImage\$readable
$readable
Definition:
AccessQuestionImage.php:32
ILIAS\Data\Result\Error
A result encapsulates a value or an error and simplifies the handling of those.
Definition:
Error.php:13
ILIAS\Modules\Test\AccessQuestionImage
Definition:
AccessQuestionImage.php:29
ILIAS\Modules\Test\AccessQuestionImage\isPermitted
isPermitted(string $path)
Definition:
AccessQuestionImage.php:39
Modules
Test
classes
AccessQuestionImage.php
Generated on Mon Apr 7 2025 21:01:09 for ILIAS by
1.8.13 (using
Doxyfile
)