ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Modules\Test\AccessQuestionImage Class Reference
+ Inheritance diagram for ILIAS\Modules\Test\AccessQuestionImage:
+ Collaboration diagram for ILIAS\Modules\Test\AccessQuestionImage:

Public Member Functions

 __construct (Readable $readable)
 
 isPermitted (string $path)
 

Private Member Functions

 objectId (string $path)
 

Private Attributes

Readable $readable
 

Detailed Description

Definition at line 27 of file AccessQuestionImage.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Modules\Test\AccessQuestionImage::__construct ( Readable  $readable)

Definition at line 31 of file AccessQuestionImage.php.

References ILIAS\Modules\Test\AccessQuestionImage\$readable.

32  {
33  $this->readable = $readable;
34  }

Member Function Documentation

◆ isPermitted()

ILIAS\Modules\Test\AccessQuestionImage::isPermitted ( string  $path)
Returns
Result<bool>

Implements ILIAS\Modules\Test\SimpleAccess.

Definition at line 36 of file AccessQuestionImage.php.

References ILIAS\Modules\Test\AccessQuestionImage\objectId().

36  : 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  }
$path
Definition: ltiservices.php:32
+ Here is the call graph for this function:

◆ objectId()

ILIAS\Modules\Test\AccessQuestionImage::objectId ( string  $path)
private

Definition at line 46 of file AccessQuestionImage.php.

References $results.

Referenced by ILIAS\Modules\Test\AccessQuestionImage\isPermitted().

46  : ?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  }
$path
Definition: ltiservices.php:32
$results
+ Here is the caller graph for this function:

Field Documentation

◆ $readable

Readable ILIAS\Modules\Test\AccessQuestionImage::$readable
private

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