1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Group.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Controller\Notify;
4
5
use Bitrix\Im\V2\Controller\BaseController;
6
use Bitrix\Im\V2\Controller\Filter\CheckNotifyGroupAccess;
7
use Bitrix\Im\V2\Notification\Group\UserGroup\Dto\UpdateGroupDto;
8
use Bitrix\Im\V2\Notification\Group\UserGroup\Dto\UserGroupDto;
9
use Bitrix\Im\V2\Notification\Group\GroupItemFactory;
10
use Bitrix\Im\V2\Notification\Group\UserGroup\Dto\CreateGroupDto;
11
use Bitrix\Im\V2\Notification\Group\UserGroup\GroupRepository;
12
use Bitrix\Main\Engine\AutoWire\BinderArgumentException;
13
use Bitrix\Main\Engine\AutoWire\ExactParameter;
14
use Bitrix\Main\Engine\CurrentUser;
15
use Bitrix\Main\Request;
16
17
class
Group
extends
BaseController
18
{
19
private
readonly
GroupRepository
$groupRepository;
20
21
public
function
__construct
(
Request
$request
=
null
)
22
{
23
parent::__construct(
$request
);
24
$this->groupRepository =
new
GroupRepository
();
25
}
26
30
public
function
getAutoWiredParameters
():
array
31
{
32
return
[
33
new
ExactParameter
(
34
UserGroupDto::class,
35
'userGroup'
,
36
function
(
string
$className,
int
$groupId):
UserGroupDto
37
{
38
return
new
UserGroupDto
($groupId, (
int
)CurrentUser::get()?->getId());
39
}
40
),
41
];
42
}
43
44
protected
function
getDefaultPreFilters
():
array
45
{
46
return
array_merge(
47
parent::getDefaultPreFilters(),
48
[
49
new
CheckNotifyGroupAccess
(),
50
]
51
);
52
}
53
54
public
function
addAction
(
string
$title
,
string
$module,
string
$event
): ?
array
55
{
56
$createDto =
new
CreateGroupDto
(
57
title
:
$title
,
58
userId: (
int
)CurrentUser::get()?->getId(),
59
module: $module,
60
event:
$event
,
61
);
62
63
$result
= $this->groupRepository->create($createDto);
64
if
(
$result
->isSuccess())
65
{
66
return
[
67
'id'
=>
$result
->id,
68
];
69
}
70
71
$this->addErrors(
$result
->getErrors());
72
73
return
null
;
74
}
75
76
public
function
listAction
():
array
77
{
78
return
[
79
'items'
=> (
new
GroupItemFactory
())->makeForCurrentContextUser()->toRestFormat(),
80
];
81
}
82
83
public
function
deleteAction
(
UserGroupDto
$userGroup):
array
84
{
85
$this->groupRepository->deleteById($userGroup->groupId);
86
87
return
[
'result'
=>
true
];
88
}
89
90
public
function
updateAction
(
UserGroupDto
$userGroup,
string
$title
): ?
array
91
{
92
$updateDto =
new
UpdateGroupDto
(
93
title
:
$title
,
94
groupId: $userGroup->groupId,
95
);
96
$result
= $this->groupRepository->update($updateDto);
97
if
(
$result
->isSuccess())
98
{
99
return
[
'result'
=>
true
];
100
}
101
102
$this->addErrors(
$result
->getErrors());
103
104
return
null
;
105
}
106
}
$request
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения
catalog_reindex.php:36
Bitrix\Im\V2\Controller\BaseController
Определения
BaseController.php:30
Bitrix\Im\V2\Controller\Filter\CheckNotifyGroupAccess
Определения
CheckNotifyGroupAccess.php:14
Bitrix\Im\V2\Controller\Notify\Group
Определения
Group.php:18
Bitrix\Im\V2\Controller\Notify\Group\addAction
addAction(string $title, string $module, string $event)
Определения
Group.php:54
Bitrix\Im\V2\Controller\Notify\Group\getDefaultPreFilters
getDefaultPreFilters()
Определения
Group.php:44
Bitrix\Im\V2\Controller\Notify\Group\getAutoWiredParameters
getAutoWiredParameters()
Определения
Group.php:30
Bitrix\Im\V2\Controller\Notify\Group\__construct
__construct(Request $request=null)
Определения
Group.php:21
Bitrix\Im\V2\Controller\Notify\Group\listAction
listAction()
Определения
Group.php:76
Bitrix\Im\V2\Controller\Notify\Group\deleteAction
deleteAction(UserGroupDto $userGroup)
Определения
Group.php:83
Bitrix\Im\V2\Controller\Notify\Group\updateAction
updateAction(UserGroupDto $userGroup, string $title)
Определения
Group.php:90
Bitrix\Im\V2\Notification\Group\GroupItemFactory
Определения
GroupItemFactory.php:10
Bitrix\Im\V2\Notification\Group\UserGroup\Dto\CreateGroupDto
Определения
CreateGroupDto.php:9
Bitrix\Im\V2\Notification\Group\UserGroup\Dto\UpdateGroupDto
Определения
UpdateGroupDto.php:9
Bitrix\Im\V2\Notification\Group\UserGroup\Dto\UserGroupDto
Определения
UserGroupDto.php:6
Bitrix\Im\V2\Notification\Group\UserGroup\GroupRepository
Определения
GroupRepository.php:19
Bitrix\Main\Engine\AutoWire\ExactParameter
Определения
exactparameter.php:9
Bitrix\Main\Request
Определения
request.php:10
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$event
$event
Определения
prolog_after.php:141
title
<? endif;?> window document title
Определения
prolog_main_admin.php:76
$title
$title
Определения
pdf.php:123
bitrix
modules
im
lib
V2
Controller
Notify
Group.php
Создано системой
1.14.0