ILIAS
release_8 Revision v8.19
◀ 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
n
o
p
r
s
t
u
v
w
x
+
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
j
l
m
p
s
t
u
+
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
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
g
h
i
m
n
p
r
s
t
u
v
x
+
Variables
$
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
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
27
class
AccessQuestionImage
implements
SimpleAccess
28
{
29
private
Readable
$readable
;
30
31
public
function
__construct
(
Readable
$readable)
32
{
33
$this->readable =
$readable
;
34
}
35
36
public
function
isPermitted
(
string
$path
):
Result
37
{
38
$object_id = $this->
objectId
($path);
39
if
(!$object_id) {
40
return
new
Error
(
'Not a question image path of test questions.'
);
41
}
42
43
return
new
Ok
($this->readable->objectId($object_id));
44
}
45
46
private
function
objectId
(
string
$path
): ?
int
47
{
48
$results
= [];
49
if
(!preg_match(
':/assessment/(\d+)/(\d+)/images/([^/]+)$:'
, $path,
$results
)) {
50
return
null;
51
}
52
53
return
(
int
)
$results
[1];
54
}
55
}
ILIAS\Modules\Test\SimpleAccess
Definition:
SimpleAccess.php:25
ILIAS\Data\Result
Definition:
Error.php:7
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:14
ILIAS\Modules\Test\AccessQuestionImage\__construct
__construct(Readable $readable)
Definition:
AccessQuestionImage.php:31
$path
$path
Definition:
ltiservices.php:32
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:16
$results
$results
Definition:
save_question_post_data.php:8
ILIAS\Modules\Test\AccessQuestionImage\objectId
objectId(string $path)
Definition:
AccessQuestionImage.php:46
Ok
ILIAS\Modules\Test\AccessQuestionImage\$readable
Readable $readable
Definition:
AccessQuestionImage.php:29
Error
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
ILIAS\Modules\Test\AccessQuestionImage
Definition:
AccessQuestionImage.php:27
ILIAS\Modules\Test\AccessQuestionImage\isPermitted
isPermitted(string $path)
Definition:
AccessQuestionImage.php:36
Modules
Test
classes
AccessQuestionImage.php
Generated on Sun Apr 13 2025 22:01:43 for ILIAS by
1.8.13 (using
Doxyfile
)