• Модуль: learning
  • Путь к файлу: ~/bitrix/modules/learning/classes/general/clearnaccess.php
  • Класс: CLearnAccess
  • Вызов: CLearnAccess::ParseOperationsForSQL
static function ParseOperationsForSQL ($in_operations)
{
	static $determinedCache = array();

	if ( ! (is_int($in_operations) && ($in_operations > 0)) )
		throw new LearnException ('', LearnException::EXC_ERR_ALL_PARAMS | LearnException::EXC_ERR_ALL_ACCESS_DENIED);

	$cacheKey = 'str' . $in_operations;

	if ( ! isset ($determinedCache[$cacheKey]) )
	{
		$arOperations = array();
		foreach (self::$arOperations as $operationName => $operationBitFlag)
		{
			if ($in_operations & $operationBitFlag)
			{
				$arOperations[] = $operationName;
				$in_operations -= $operationBitFlag;
			}
		}

		// Must be zero. If not => not all operations listed in self::$arOperations
		// or wrong requested value in $in_operations
		if ($in_operations !== 0)
			throw new LearnException ('', LearnException::EXC_ERR_ALL_PARAMS | LearnException::EXC_ERR_ALL_ACCESS_DENIED);

		$sql = self::Array2CommaSeparatedListForSQL ($arOperations);
		$determinedCache[$cacheKey] = $sql;
	}

	return ($determinedCache[$cacheKey]);
}