PublicAction::ajaxProcessing

  1. Bitrix24 API (v. 23.675.0)
  2. landing
  3. PublicAction
  4. ajaxProcessing
  • Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/publicaction.php
  • Класс: BitrixLandingPublicAction
  • Вызов: PublicAction::ajaxProcessing
static function ajaxProcessing()
{
	$context = BitrixMainApplication::getInstance()->getContext();
	$request = $context->getRequest();
	$files = $request->getFileList();
	$postlist = $context->getRequest()->getPostList();

	Type::setScope($request->get('type'));

	// multiple commands
	if (
		$request->offsetExists('batch') &&
		is_array($request->get('batch'))
	)
	{
		$result = array();
		// additional site id detect
		if ($request->offsetExists('site_id'))
		{
			$siteId = $request->get('site_id');
		}
		foreach ($request->get('batch') as $key => $batchItem)
		{
			if (
				isset($batchItem['action']) &&
				isset($batchItem['data'])
			)
			{
				$batchItem['data'] = (array)$batchItem['data'];
				if (isset($siteId))
				{
					$batchItem['data']['siteId'] = $siteId;
				}
				if ($files)
				{
					foreach ($files as $code => $file)
					{
						$batchItem['data'][$code] = $file;
					}
				}
				$rawData = $postlist->getRaw('batch');
				if (isset($rawData[$key]['data']))
				{
					self::$rawData = $rawData[$key]['data'];
				}
				$result[$key] = self::actionProcessing(
					$batchItem['action'],
					$batchItem['data']
				);
			}
		}

		return $result;
	}
	// or single command
	else if (
		$request->offsetExists('action') &&
		$request->offsetExists('data') &&
		is_array($request->get('data'))
	)
	{
		$data = $request->get('data');
		// additional site id detect
		if ($request->offsetExists('site_id'))
		{
			$data['siteId'] = $request->get('site_id');
		}
		if ($files)
		{
			foreach ($files as $code => $file)
			{
				$data[$code] = $file;
			}
		}
		$rawData = $postlist->getRaw('data');
		if (isset($rawData['data']))
		{
			self::$rawData = $rawData['data'];
		}
		return self::actionProcessing(
			$request->get('action'),
			$data
		);
	}

	return null;
}

Добавить комментарий