ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\Poll\Image\Handler Class Reference
+ Inheritance diagram for ILIAS\Poll\Image\Handler:
+ Collaboration diagram for ILIAS\Poll\Image\Handler:

Public Member Functions

 __construct (ilResourceStorageServices $irss, ilPollImageRepositoryFactoryInterface $repository)
 
 uploadImage (ObjectId $object_id, string $file_path, string $file_name, int $user_id)
 
 cloneImage (ObjectId $original_object_id, ObjectId $clone_object_id, int $user_id)
 
 deleteImage (ObjectId $object_id, int $user_id)
 
 getThumbnailImageURL (ObjectId $object_id)
 
 getProcessedImageURL (ObjectId $object_id)
 
 getUnprocessedImageURL (ObjectId $object_id)
 
 getRessource (ObjectId $object_id)
 

Protected Attributes

ilResourceStorageServices $irss
 
ilPollImageRepositoryFactoryInterface $repository
 

Detailed Description

Definition at line 30 of file Handler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Poll\Image\Handler::__construct ( ilResourceStorageServices  $irss,
ilPollImageRepositoryFactoryInterface  $repository 
)

Definition at line 35 of file Handler.php.

References ILIAS\Poll\Image\Handler\$irss, ILIAS\Poll\Image\Handler\$repository, and ILIAS\UI\examples\Deck\repository().

38  {
39  $this->irss = $irss;
40  $this->repository = $repository;
41  }
ilResourceStorageServices $irss
Definition: Handler.php:32
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
ilPollImageRepositoryFactoryInterface $repository
Definition: Handler.php:33
+ Here is the call graph for this function:

Member Function Documentation

◆ cloneImage()

ILIAS\Poll\Image\Handler::cloneImage ( ObjectId  $original_object_id,
ObjectId  $clone_object_id,
int  $user_id 
)

Implements ILIAS\Poll\Image\I\HandlerInterface.

Definition at line 65 of file Handler.php.

References ILIAS\Poll\Image\Handler\deleteImage(), null, and ILIAS\UI\examples\Deck\repository().

69  : void {
70  $this->deleteImage(
71  $clone_object_id,
72  $user_id
73  );
74  $key_clone = $this->repository->key()->handler()
75  ->withObjectId($clone_object_id);
76  $key_original = $this->repository->key()->handler()
77  ->withObjectId($original_object_id);
78  $element_original = $this->repository->handler()->getElement($key_original);
79 
80  if ($element_original === null) {
81  return;
82  }
83 
84  $rid_original = $element_original->getIRSS()->getResourceIdentification();
85  $rid_clone = $this->irss->manage()->clone($rid_original);
86  $values_clone = $this->repository->values()->handler()
87  ->withResourceIdSerialized($rid_clone->serialize());
88  $this->repository->handler()->store($key_clone, $values_clone);
89  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
deleteImage(ObjectId $object_id, int $user_id)
Definition: Handler.php:91
+ Here is the call graph for this function:

◆ deleteImage()

ILIAS\Poll\Image\Handler::deleteImage ( ObjectId  $object_id,
int  $user_id 
)

Implements ILIAS\Poll\Image\I\HandlerInterface.

Definition at line 91 of file Handler.php.

References ILIAS\UI\examples\Deck\repository().

Referenced by ILIAS\Poll\Image\Handler\cloneImage(), and ILIAS\Poll\Image\Handler\uploadImage().

94  : void {
95  $key = $this->repository->key()->handler()
96  ->withObjectId($object_id);
97  $existing_element = $this->repository->handler()->getElement($key);
98  if (!is_null($existing_element)) {
99  $existing_element->getIRSS()->delete($user_id);
100  $this->repository->handler()->deleteElement($existing_element->getKey());
101  }
102  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProcessedImageURL()

ILIAS\Poll\Image\Handler::getProcessedImageURL ( ObjectId  $object_id)

Implements ILIAS\Poll\Image\I\HandlerInterface.

Definition at line 116 of file Handler.php.

References null, and ILIAS\UI\examples\Deck\repository().

118  : null|string {
119  $key = $this->repository->key()->handler()
120  ->withObjectId($object_id);
121  $element = $this->repository->handler()->getElement($key);
122  if (is_null($element)) {
123  return null;
124  }
125  return $element->getIRSS()->getProcessedImageURL();
126  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getRessource()

ILIAS\Poll\Image\Handler::getRessource ( ObjectId  $object_id)

Implements ILIAS\Poll\Image\I\HandlerInterface.

Definition at line 140 of file Handler.php.

References null, and ILIAS\UI\examples\Deck\repository().

142  : null|Revision {
143  $key = $this->repository->key()->handler()
144  ->withObjectId($object_id);
145  $element = $this->repository->handler()->getElement($key);
146  if (is_null($element)) {
147  return null;
148  }
149  return $element->getIRSS()->getResource();
150  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getThumbnailImageURL()

ILIAS\Poll\Image\Handler::getThumbnailImageURL ( ObjectId  $object_id)

Implements ILIAS\Poll\Image\I\HandlerInterface.

Definition at line 104 of file Handler.php.

References null, and ILIAS\UI\examples\Deck\repository().

106  : null|string {
107  $key = $this->repository->key()->handler()
108  ->withObjectId($object_id);
109  $element = $this->repository->handler()->getElement($key);
110  if (is_null($element)) {
111  return null;
112  }
113  return $element->getIRSS()->getThumbnailImageURL();
114  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getUnprocessedImageURL()

ILIAS\Poll\Image\Handler::getUnprocessedImageURL ( ObjectId  $object_id)

Implements ILIAS\Poll\Image\I\HandlerInterface.

Definition at line 128 of file Handler.php.

References null, and ILIAS\UI\examples\Deck\repository().

130  : null|string {
131  $key = $this->repository->key()->handler()
132  ->withObjectId($object_id);
133  $element = $this->repository->handler()->getElement($key);
134  if (is_null($element)) {
135  return null;
136  }
137  return $element->getIRSS()->getUnprocessedImageURL();
138  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ uploadImage()

ILIAS\Poll\Image\Handler::uploadImage ( ObjectId  $object_id,
string  $file_path,
string  $file_name,
int  $user_id 
)

Implements ILIAS\Poll\Image\I\HandlerInterface.

Definition at line 43 of file Handler.php.

References ILIAS\Poll\Image\Handler\deleteImage(), and ILIAS\UI\examples\Deck\repository().

48  : void {
49  $this->deleteImage(
50  $object_id,
51  $user_id
52  );
53  $rid = $this->irss->manage()->stream(
54  Streams::ofResource(fopen($file_path, 'r')),
55  $this->repository->stakeholder()->handler()->withUserId($user_id),
56  $file_name
57  );
58  $key = $this->repository->key()->handler()
59  ->withObjectId($object_id);
60  $values = $this->repository->values()->handler()
61  ->withResourceIdSerialized($rid->serialize());
62  $this->repository->handler()->store($key, $values);
63  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
deleteImage(ObjectId $object_id, int $user_id)
Definition: Handler.php:91
+ Here is the call graph for this function:

Field Documentation

◆ $irss

ilResourceStorageServices ILIAS\Poll\Image\Handler::$irss
protected

Definition at line 32 of file Handler.php.

Referenced by ILIAS\Poll\Image\Handler\__construct().

◆ $repository

ilPollImageRepositoryFactoryInterface ILIAS\Poll\Image\Handler::$repository
protected

Definition at line 33 of file Handler.php.

Referenced by ILIAS\Poll\Image\Handler\__construct().


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