• Модуль: timeman
  • Путь к файлу: ~/bitrix/modules/timeman/lib/rest.php
  • Класс: BitrixTimemanRest
  • Вызов: Rest::networkRangeSet
static function networkRangeSet($query, $n, CRestServer $server)
{
	if (!self::isAdmin())
	{
		throw new BitrixRestRestException("You don't have access to user this method", "ACCESS_ERROR", CRestServer::STATUS_WRONG_REQUEST);
	}

	$query = static::prepareQuery($query);

	if (is_string($query['RANGES']))
	{
		$query['RANGES'] = CUtil::JsObjectToPhp($query['RANGES']);
	}
	$result = BitrixTimemanCommon::checkOptionNetworkRange($query['RANGES']);
	if (!$result)
	{
		throw new BitrixRestRestException("A wrong format for the RANGES field is passed", "INVALID_FORMAT", CRestServer::STATUS_WRONG_REQUEST);
	}
	if (count($result['ERROR']) > 0)
	{
		$result = Array(
			'result' => false,
			'error_ranges' =>  $result['ERROR'],
		);
	}
	else
	{
		$result = Array(
			'result' => BitrixTimemanCommon::setOptionNetworkRange($result['CORRECT'])
		);
	}


	return $result;
}