Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
UploaderController.php
1
<?php
2
3
namespace
Bitrix\UI\FileUploader
;
4
5
abstract
class
UploaderController
6
{
7
protected
array
$options
= [];
8
9
private
string
$moduleId;
10
private
string
$name;
11
private
?
string
$filePath =
null
;
12
13
protected
function
__construct
(array
$options
)
14
{
15
// You have to validate $options in a derived class constructor
16
$this->options =
$options
;
17
18
$this->moduleId =
getModuleId
($this->
getFilePath
());
19
$this->name =
ControllerResolver::getNameByController
($this);
20
}
21
22
abstract
public
function
isAvailable
(): bool;
23
24
abstract
public
function
getConfiguration
():
Configuration
;
25
31
abstract
public
function
canUpload
();
32
33
abstract
public
function
canView
(): bool;
34
35
abstract
public
function
verifyFileOwner
(
FileOwnershipCollection
$files): void;
36
37
abstract
public
function
canRemove
(): bool;
38
39
// Events
40
public
function
onUploadStart
(
UploadResult
$uploadResult): void {}
41
public function
onUploadComplete
(
UploadResult
$uploadResult): void {}
42
public function
onUploadError
(
UploadResult
$uploadResult): void {}
43
44
public function
getCommitOptions
():
CommitOptions
45
{
46
// Default commit options
47
return
new
CommitOptions
([
48
'moduleId'
=> $this->
getModuleId
(),
49
'savePath'
=> $this->
getModuleId
(),
50
]);
51
}
52
53
final
public
function
getOptions
(): array
54
{
55
return
$this->options
;
56
}
57
58
final
public
function
getOption
(
string
$option, $defaultValue =
null
)
59
{
60
return
array_key_exists($option, $this->options) ? $this->options[$option] : $defaultValue;
61
}
62
63
final
public
function
getName
(): string
64
{
65
return
$this->name;
66
}
67
68
final
public
function
getModuleId
(): string
69
{
70
return
$this->moduleId;
71
}
72
73
final
protected
function
getFilePath
(): string
74
{
75
if
(!$this->filePath)
76
{
77
$reflector = new \ReflectionClass($this);
78
$this->filePath = preg_replace(
'#[\\\/]+#'
,
'/'
, $reflector->getFileName());
79
}
80
81
return
$this->filePath;
82
}
83
}
Bitrix\Main\Config\Configuration
Definition
configuration.php:7
Bitrix\UI\FileUploader\CommitOptions
Definition
CommitOptions.php:6
Bitrix\UI\FileUploader\ControllerResolver\getNameByController
static getNameByController(UploaderController $controller)
Definition
ControllerResolver.php:85
Bitrix\UI\FileUploader\FileOwnershipCollection
Definition
FileOwnershipCollection.php:6
Bitrix\UI\FileUploader\UploadResult
Definition
UploadResult.php:8
Bitrix\UI\FileUploader\UploaderController
Definition
UploaderController.php:6
Bitrix\UI\FileUploader\UploaderController\__construct
__construct(array $options)
Definition
UploaderController.php:13
Bitrix\UI\FileUploader\UploaderController\getFilePath
getFilePath()
Definition
UploaderController.php:73
Bitrix\UI\FileUploader\UploaderController\getOptions
getOptions()
Definition
UploaderController.php:53
Bitrix\UI\FileUploader\UploaderController\getCommitOptions
getCommitOptions()
Definition
UploaderController.php:44
Bitrix\UI\FileUploader\UploaderController\canView
canView()
Bitrix\UI\FileUploader\UploaderController\onUploadError
onUploadError(UploadResult $uploadResult)
Definition
UploaderController.php:42
Bitrix\UI\FileUploader\UploaderController\getName
getName()
Definition
UploaderController.php:63
Bitrix\UI\FileUploader\UploaderController\getOption
getOption(string $option, $defaultValue=null)
Definition
UploaderController.php:58
Bitrix\UI\FileUploader\UploaderController\$options
array $options
Definition
UploaderController.php:7
Bitrix\UI\FileUploader\UploaderController\onUploadComplete
onUploadComplete(UploadResult $uploadResult)
Definition
UploaderController.php:41
Bitrix\UI\FileUploader\UploaderController\canRemove
canRemove()
Bitrix\UI\FileUploader\UploaderController\getModuleId
getModuleId()
Definition
UploaderController.php:68
Bitrix\UI\FileUploader\UploaderController\getConfiguration
getConfiguration()
Bitrix\UI\FileUploader\UploaderController\canUpload
canUpload()
Bitrix\UI\FileUploader\UploaderController\onUploadStart
onUploadStart(UploadResult $uploadResult)
Definition
UploaderController.php:40
Bitrix\UI\FileUploader\UploaderController\isAvailable
isAvailable()
Bitrix\UI\FileUploader\UploaderController\verifyFileOwner
verifyFileOwner(FileOwnershipCollection $files)
Bitrix\UI\FileUploader
Definition
CanUploadResult.php:3
modules
ui
lib
FileUploader
UploaderController.php
Создано системой
1.10.0