Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
entityselector.php
1
<?
2
3
namespace
Bitrix\UI\Controller
;
4
5
use
Bitrix\Main\Engine\ActionFilter
;
6
use
Bitrix\Main\Engine\JsonController
;
7
use
Bitrix\Main\Engine\JsonPayload
;
8
use
Bitrix\UI\EntitySelector\Dialog
;
9
use
Bitrix\UI\EntitySelector\Item
;
10
use
Bitrix\UI\EntitySelector\SearchQuery
;
11
12
class
EntitySelector
extends
JsonController
13
{
14
protected
function
getDefaultPreFilters
()
15
{
16
return
[
17
new
ActionFilter\Authentication(),
18
new
ActionFilter\HttpMethod([ActionFilter\
HttpMethod::METHOD_POST
]),
19
new
ActionFilter\Csrf(),
20
new
ActionFilter\CloseSession()
21
];
22
}
23
24
public
function
loadAction
(
JsonPayload
$payload)
25
{
26
$request
= $payload->
getData
();
27
$request
= is_array(
$request
) ?
$request
: [];
28
29
$dialog =
new
Dialog
(isset(
$request
[
'dialog'
]) && is_array(
$request
[
'dialog'
]) ?
$request
[
'dialog'
] : []);
30
$dialog->
load
();
31
32
return
[
33
'dialog'
=> $dialog->getAjaxData()
34
];
35
}
36
37
public
function
getChildrenAction
(
JsonPayload
$payload)
38
{
39
$request
= $payload->
getData
();
40
$request
= is_array(
$request
) ?
$request
: [];
41
42
$dialog =
new
Dialog
(isset(
$request
[
'dialog'
]) && is_array(
$request
[
'dialog'
]) ?
$request
[
'dialog'
] : []);
43
44
$parentItem =
new
Item
(
45
isset(
$request
[
'parentItem'
]) && is_array(
$request
[
'parentItem'
]) ?
$request
[
'parentItem'
] : []
46
);
47
48
$dialog->
getChildren
($parentItem);
49
50
return
[
51
'dialog'
=> $dialog->getAjaxData()
52
];
53
}
54
55
public
function
doSearchAction
(
JsonPayload
$payload)
56
{
57
$request
= $payload->
getData
();
58
$request
= is_array(
$request
) ?
$request
: [];
59
60
$dialog =
new
Dialog
(isset(
$request
[
'dialog'
]) && is_array(
$request
[
'dialog'
]) ?
$request
[
'dialog'
] : []);
61
$searchQuery =
new
SearchQuery
(
62
isset(
$request
[
'searchQuery'
]) && is_array(
$request
[
'searchQuery'
]) ?
$request
[
'searchQuery'
] : []
63
);
64
65
$dialog->doSearch($searchQuery);
66
67
return
[
68
'dialog'
=> $dialog->getAjaxData(),
69
'searchQuery'
=> $searchQuery
70
];
71
}
72
73
public
function
saveRecentItemsAction
(
JsonPayload
$payload)
74
{
75
if
(!
$GLOBALS
[
'USER'
]->isAuthorized())
76
{
77
return
;
78
}
79
80
$request
= $payload->
getData
();
81
$request
= is_array(
$request
) ?
$request
: [];
82
83
$dialog =
new
Dialog
(isset(
$request
[
'dialog'
]) && is_array(
$request
[
'dialog'
]) ?
$request
[
'dialog'
] : []);
84
85
if
(isset(
$request
[
'recentItems'
]) && is_array(
$request
[
'recentItems'
]))
86
{
87
$dialog->
saveRecentItems
(
$request
[
'recentItems'
]);
88
}
89
}
90
}
Bitrix\Main\Engine\ActionFilter\HttpMethod\METHOD_POST
const METHOD_POST
Definition
httpmethod.php:15
Bitrix\Main\Engine\Controller\$request
$request
Definition
controller.php:48
Bitrix\Main\Engine\JsonController
Definition
jsoncontroller.php:9
Bitrix\Main\Engine\JsonPayload
Definition
jsonpayload.php:13
Bitrix\Main\Engine\JsonPayload\getData
getData()
Definition
jsonpayload.php:19
Bitrix\UI\Controller\EntitySelector
Definition
entityselector.php:13
Bitrix\UI\Controller\EntitySelector\getDefaultPreFilters
getDefaultPreFilters()
Definition
entityselector.php:14
Bitrix\UI\Controller\EntitySelector\getChildrenAction
getChildrenAction(JsonPayload $payload)
Definition
entityselector.php:37
Bitrix\UI\Controller\EntitySelector\loadAction
loadAction(JsonPayload $payload)
Definition
entityselector.php:24
Bitrix\UI\Controller\EntitySelector\doSearchAction
doSearchAction(JsonPayload $payload)
Definition
entityselector.php:55
Bitrix\UI\Controller\EntitySelector\saveRecentItemsAction
saveRecentItemsAction(JsonPayload $payload)
Definition
entityselector.php:73
Bitrix\UI\EntitySelector\Dialog
Definition
dialog.php:10
Bitrix\UI\EntitySelector\Dialog\load
load()
Definition
dialog.php:285
Bitrix\UI\EntitySelector\Dialog\saveRecentItems
saveRecentItems(array $recentItems)
Definition
dialog.php:496
Bitrix\UI\EntitySelector\Item
Definition
item.php:8
Bitrix\UI\EntitySelector\Item\getChildren
getChildren()
Definition
item.php:455
Bitrix\UI\EntitySelector\SearchQuery
Definition
searchquery.php:5
Bitrix\Main\Engine\ActionFilter
Definition
authentication.php:4
Bitrix\Main\$GLOBALS
$GLOBALS['____1444769544']
Definition
license.php:1
Bitrix\UI\Controller
Definition
entityselector.php:3
modules
ui
lib
controller
entityselector.php
Создано системой
1.10.0