ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
GetFileInfoResponse.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
30{
54 public function __construct(
55 Revision $revision,
56 int $current_user_id,
57 bool $editable = false,
58 ?bool $user_can_write = null
59 ) {
60 $user_can_write ??= $editable;
61 $URI = new URI(ILIAS_HTTP_PATH);
62 $origin = $URI->getSchema() . '://' . $URI->getHost();
63 $lookup_name = \ilObjUser::_lookupName($current_user_id);
64
65 $title = preg_replace('/\.[^.]*$/', '', $revision->getTitle())
66 . '.' . $revision->getInformation()->getSuffix();
67
69 self::BASE_FILE_NAME => $title,
70 self::VERSION => (string) $revision->getVersionNumber(),
71 // the WOPI specification asks for strings
72 self::OWNER_ID => (string) $revision->getOwnerId(),
73 self::USER_ID => (string) $current_user_id,
74 self::SIZE => $revision->getInformation()->getSize(),
75 self::SUPPORTS_CONTAINERS => false,
76 self::SUPPORTS_DELETE_FILE => false,
77 self::SUPPORTS_UPDATE => $editable,
78 self::READ_ONLY => !$editable,
79 self::USER_CAN_WRITE => $user_can_write,
80 self::USER_FRIENDLY_NAME => $lookup_name['firstname'] . ' ' . $lookup_name['lastname'],
81 self::LAST_MODIFIED_TIME => $revision->getInformation()->getCreationDate()->format(DATE_ATOM),
82 self::USER_CAN_NOT_WRITE_RELATIVE => true,
83 self::POST_MESSAGE_ORIGIN => $origin,
84 self::CLOSE_BUTTON_CLOSES_WINDOW => false,
85 // ILIAS has no handler for the UI_Edit message, so it must not announce one:
86 // clients offer a way into edit mode when EditModePostMessage is true, and
87 // that button would do nothing here.
88 self::EDIT_MODE_POST_MESSAGE => false,
89 self::EDIT_NOTIFICATION_POST_MESSAGE => true,
90 // ILIAS closes the client itself (mode info of the editor page, the modal of the
91 // preview) and has no handler for the UI_Close message. Without CloseUrl and
92 // ClosePostMessage clients do not show a close button of their own.
93 self::CLOSE_POST_MESSAGE => false,
94 self::SUPPORTS_LOCKS => true,
95 self::SUPPORTS_GET_LOCK => true,
96 self::SUPPORTS_EXTENDED_LOCK_LENGTH => true,
97 self::USER_CAN_RENAME => false
98 ]);
99 }
100}
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
__construct(Revision $revision, int $current_user_id, bool $editable=false, ?bool $user_can_write=null)
$editable describes this session - the file was opened through an edit action and may be written back...
static _lookupName(int $a_user_id)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc