- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/classes/general/checklistitem.php
- Класс: CTaskCheckListItem
- Вызов: CTaskCheckListItem::runRestMethod
static function runRestMethod($executiveUserId, $methodName, $args,
/** @noinspection PhpUnusedParameterInspection */ $navigation)
{
static $manifest = null;
static $methodsMetaInfo = null;
if ($manifest === null)
{
/** @noinspection PhpDeprecationInspection */
$manifest = self::getManifest();
$methodsMetaInfo = $manifest['REST: available methods'];
}
// Check and parse params
CTaskAssert::assert(isset($methodsMetaInfo[$methodName]));
$currentMethodMetaInfo = $methodsMetaInfo[$methodName];
$parsedArguments = CTaskRestService::_parseRestParams('ctaskchecklistitem', $methodName, $args);
$returnValue = null;
if (isset($currentMethodMetaInfo['staticMethod']) && $currentMethodMetaInfo['staticMethod'])
{
if ($methodName === 'add')
{
list($taskId, $fields) = $parsedArguments;
$task = CTaskItem::getInstance($taskId, $executiveUserId);
/** @noinspection PhpDeprecationInspection */
$checkListItem = self::add($task, $fields);
$returnValue = $checkListItem->getId();
}
elseif ($methodName === 'getlist')
{
list($taskId, $order) = $parsedArguments;
$task = CTaskItem::getInstance($taskId, $executiveUserId);
/** @noinspection PhpDeprecationInspection */
/** @noinspection PhpUnusedLocalVariableInspection */
list($checkListItems, $checkListItemsResult) = self::fetchList($task, $order);
$returnValue = [];
foreach ($checkListItems as $checkListItem)
{
/** @var self $checkListItem */
$returnValue[] = $checkListItem->getData(false);
}
}
else
{
$returnValue = call_user_func_array(['self', $methodName], $parsedArguments);
}
}
else
{
$taskId = array_shift($parsedArguments);
$checkListId = array_shift($parsedArguments);
$task = CTaskItem::getInstance($taskId, $executiveUserId);
/** @noinspection PhpDeprecationInspection */
$checkListItem = new self($task, $checkListId);
if ($methodName === 'get')
{
$returnValue = $checkListItem->getData();
$returnValue['TITLE'] = htmlspecialcharsback($returnValue['TITLE']);
}
else
{
$returnValue = call_user_func_array([$checkListItem, $methodName], $parsedArguments);
}
}
return ([$returnValue, null]);
}