◆ __construct()
ilObjFilePreviewRendererGUI::__construct |
( |
private readonly ?int |
$object_id = null | ) |
|
Definition at line 99 of file class.ilObjFilePreviewRendererGUI.php.
References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), null, ILIAS\Repository\refinery(), and resolveRidString().
105 $this->activated = $settings->isPreviewEnabled();
107 $this->db = $DIC->database();
108 $this->
ctrl = $DIC->ctrl();
110 $this->ui_factory = $DIC->ui()->factory();
111 $this->ui_renderer = $DIC->ui()->renderer();
112 $this->irss = $DIC->resourceStorage();
113 $this->
http = $DIC->http();
114 $this->http_wrapper = $DIC->http()->wrapper();
116 $this->
access = $DIC->access();
118 $this->
language->loadLanguageModule(
'file');
122 $this->rid = $this->irss->manage()->find($rid_string);
124 $settings->isPersisting(),
125 $settings->getImageSize(),
126 $settings->getMaximumPreviews()
128 $this->fallback_flavour_definition =
new FitToSquare(
129 $settings->isPersisting(),
130 $settings->getImageSize()
133 if ($this->rid !==
null) {
134 $this->file_name = $this->irss->manage()->getCurrentRevision($this->rid)->getTitle();
resolveRidString(?int $object_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
language()
description: > Example for rendring a language glyph.
◆ executeCommand()
ilObjFilePreviewRendererGUI::executeCommand |
( |
| ) |
|
◆ getAsyncModal()
ilObjFilePreviewRendererGUI::getAsyncModal |
( |
| ) |
|
|
private |
Definition at line 248 of file class.ilObjFilePreviewRendererGUI.php.
References $file_name, $response, $url, ILIAS\FileDelivery\http(), isAccessGranted(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and null.
255 $flavour = $this->irss->flavours()->get($this->rid, $this->flavour_definition);
256 $flavour_urls = $this->irss->consume()->flavourUrls($flavour)->getURLsAsArray();
257 if ($flavour_urls === []) {
258 $flavour = $this->irss->flavours()->get($this->rid, $this->fallback_flavour_definition);
259 $flavour_urls = $this->irss->consume()->flavourUrls($flavour)->getURLsAsArray();
262 $page_title =
function (?
int $index):
string {
263 $index_string = $index !==
null ? (($index + 1) .
' ') :
'';
265 $this->
language->txt(
'preview_caption'),
273 $title = $page_title($i);
274 return $this->ui_factory->modal()->lightboxImagePage(
275 $this->ui_factory->image()->responsive(
281 }, $flavour_urls, count($flavour_urls) > 1 ? array_keys($flavour_urls) : []);
285 $pages = $this->ui_factory->modal()->lightboxTextPage(
287 $this->
language->txt(
'preview_not_possible'),
288 'components/ILIAS/File/classes/Preview/README.md' 293 $modal = $this->ui_factory->modal()->lightbox($pages);
296 $response = $this->
http->response()->withBody(Streams::ofString($this->ui_renderer->renderAsync($modal)));
298 $this->
http->sendResponse();
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
A lightbox Image page represents a page displaying a media element, such as image, video.
language()
description: > Example for rendring a language glyph.
◆ getRenderedTriggerComponents()
ilObjFilePreviewRendererGUI::getRenderedTriggerComponents |
( |
bool |
$as_button = false | ) |
|
◆ getTriggerComponents()
ilObjFilePreviewRendererGUI::getTriggerComponents |
( |
bool |
$as_button = false | ) |
|
◆ has()
ilObjFilePreviewRendererGUI::has |
( |
| ) |
|
Definition at line 138 of file class.ilObjFilePreviewRendererGUI.php.
References isAccessGranted(), and null.
140 if (!$this->activated) {
143 if ($this->rid ===
null) {
147 !$this->irss->flavours()->possible(
149 $this->flavour_definition
151 && !$this->irss->flavours()->possible(
153 $this->fallback_flavour_definition
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ isAccessGranted()
ilObjFilePreviewRendererGUI::isAccessGranted |
( |
| ) |
|
|
protected |
◆ resolveRidString()
ilObjFilePreviewRendererGUI::resolveRidString |
( |
?int |
$object_id | ) |
|
|
protected |
- Returns
- mixed
Definition at line 209 of file class.ilObjFilePreviewRendererGUI.php.
References null, and ILIAS\Repository\refinery().
Referenced by __construct().
211 if ($object_id !==
null) {
212 return $this->db->fetchObject(
214 'SELECT rid FROM file_data WHERE file_id = %s',
220 return $this->http_wrapper->query()->has(self::P_RID)
221 ? $this->http_wrapper->query()->retrieve(
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ $access
◆ $activated
bool ilObjFilePreviewRendererGUI::$activated = false |
|
private |
◆ $ctrl
◆ $db
◆ $fallback_flavour_definition
◆ $file_name
string ilObjFilePreviewRendererGUI::$file_name = '' |
|
private |
◆ $flavour_definition
◆ $http
◆ $http_wrapper
◆ $irss
Services ilObjFilePreviewRendererGUI::$irss |
|
private |
◆ $language
◆ $pages_to_extract
int ilObjFilePreviewRendererGUI::$pages_to_extract |
|
private |
◆ $preview_size
int ilObjFilePreviewRendererGUI::$preview_size |
|
private |
◆ $refinery
ILIAS Refinery Factory ilObjFilePreviewRendererGUI::$refinery |
|
private |
◆ $rid
◆ $ui_factory
Factory ilObjFilePreviewRendererGUI::$ui_factory |
|
private |
◆ $ui_renderer
Renderer ilObjFilePreviewRendererGUI::$ui_renderer |
|
private |
◆ CMD_GET_ASYNC_MODAL
const ilObjFilePreviewRendererGUI::CMD_GET_ASYNC_MODAL = 'getAsyncModal' |
◆ P_RID
const ilObjFilePreviewRendererGUI::P_RID = "rid" |
The documentation for this class was generated from the following file: