1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
changeactivehandler.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Iblock\Grid\Row\Actions\Item\Helpers
;
4
5
use
Bitrix\Iblock\Grid\Access\IblockRightsChecker
;
6
use
Bitrix\Main\AccessDeniedException
;
7
use
Bitrix\Main\Error
;
8
use
Bitrix\Main\HttpRequest
;
9
use
Bitrix\Main\Result
;
10
use CIBlockElement;
11
12
trait
ChangeActiveHandler
13
{
14
abstract
protected
function
getSetActiveValue(): string;
15
16
abstract
protected
function
getIblockRightsChecker
():
IblockRightsChecker
;
17
18
public
function
processRequest
(
HttpRequest
$request
): ?
Result
19
{
20
$id =
$request
->getPost(
'id'
);
21
if
(empty($id) || !is_numeric($id))
22
{
23
return
null
;
24
}
25
$id = (int)$id;
26
27
if
(!$this->
getIblockRightsChecker
()->canEditElement($id))
28
{
29
throw
new
AccessDeniedException
(
'Cant edit element'
);
30
}
31
32
$result
=
new
Result
();
33
34
$entity
=
new
CIBlockElement();
35
$updateResult =
$entity
->Update($id, [
36
'ACTIVE'
=> $this->getSetActiveValue(),
37
]);
38
if
(!$updateResult)
39
{
40
$message
=
$entity
->getLastError() ?:
'Cant update element'
;
41
$result
->addError(
new
Error
(
$message
));
42
}
43
44
return
$result
;
45
}
46
}
$request
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения
catalog_reindex.php:36
Bitrix\Iblock\Grid\Access\IblockRightsChecker
Определения
iblockrightschecker.php:10
Bitrix\Main\AccessDeniedException
Определения
AccessDeniedException.php:9
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\HttpRequest
Определения
httprequest.php:20
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
$result
$result
Определения
get_property_values.php:14
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
Bitrix\Iblock\Grid\Row\Actions\Item\Helpers
Определения
changeactivehandler.php:3
Bitrix\Iblock\Grid\Row\Actions\Item\Helpers\ChangeActiveHandler
trait ChangeActiveHandler
Определения
changeactivehandler.php:13
Bitrix\Iblock\Grid\Row\Actions\Item\Helpers\getIblockRightsChecker
getIblockRightsChecker()
Bitrix\Iblock\Grid\Row\Actions\Item\Helpers\processRequest
processRequest(HttpRequest $request)
Определения
changeactivehandler.php:18
$message
$message
Определения
payment.php:8
bitrix
modules
iblock
lib
grid
row
actions
item
helpers
changeactivehandler.php
Создано системой
1.14.0