1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
File.php
См. документацию.
1<?php
2
4
13
14class File extends BaseController
15{
16 public function configureActions(): array
17 {
18 return [
19 'save' => [
20 '+prefilters' => [
22 ]
23 ]
24 ];
25 }
26
28 {
29 return new ExactParameter(
30 FileCollection::class,
31 'files',
32 function ($className, array $ids) {
33 return $this->getFilesByIds($ids);
34 }
35 );
36 }
37
38 public function saveAction(FileCollection $files, CurrentUser $currentUser): ?array
39 {
40 $userId = $currentUser->getId();
41 if (!isset($userId))
42 {
43 $this->addError(new UserError(UserError::NOT_FOUND));
44 return null;
45 }
46
47 if (!Loader::includeModule('disk'))
48 {
49 $this->addError(new FileError(FileError::DISK_NOT_INSTALLED));
50 return null;
51 }
52
53 $result = $files->copyToOwnSavedFiles();
54 if (!$result->hasResult())
55 {
56 $this->addErrors($result->getErrors());
57 return null;
58 }
59
60 return ['result' => true];
61 }
62
63 protected function getFilesByIds(array $ids): FileCollection
64 {
65 $result = [];
66
67 foreach ($ids as $id)
68 {
69 if (is_numeric($id) && (int)$id > 0)
70 {
71 $id = (int)$id;
72 $result[$id] = $id;
73 }
74 }
75
76 return FileCollection::initByDiskFilesIds(array_values($result));
77 }
78}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
getPrimaryAutoWiredParameter()
Определения File.php:27
saveAction(FileCollection $files, CurrentUser $currentUser)
Определения File.php:38
configureActions()
Определения File.php:16
getFilesByIds(array $ids)
Определения File.php:63
static initByDiskFilesIds(array $diskFilesIds, ?int $chatId=null)
Определения FileCollection.php:57
const DISK_NOT_INSTALLED
Определения FileError.php:10
Определения loader.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$files
Определения mysql_to_pgsql.php:30