- Модуль: imopenlines
- Путь к файлу: ~/bitrix/modules/imopenlines/lib/rest.php
- Класс: BitrixImOpenLinesRest
- Вызов: Rest::sessionVoteAsHead
static function sessionVoteAsHead($arParams, $n, CRestServer $server)
{
if (!$arParams['SESSION_ID'])
{
throw new RestException('Session ID can't be empty', 'EMPTY_SESSION_ID', CRestServer::STATUS_WRONG_REQUEST);
}
if (!trim($arParams['RATING']) && !trim($arParams['COMMENT']))
{
throw new RestException('At least one of the parameters RATING or COMMENT must be specified', 'EMPTY_VOTE_PARAMS', CRestServer::STATUS_WRONG_REQUEST);
}
$control = new BitrixImOpenLinesOperator(0);
$result = $control->voteAsHead(
$arParams['SESSION_ID'],
$arParams['RATING'],
$arParams['COMMENT'] ?: ''
);
if (!$result)
{
throw new RestException($control->getError()->msg, $control->getError()->code, CRestServer::STATUS_WRONG_REQUEST);
}
return true;
}