• Модуль: mobile
  • Путь к файлу: ~/bitrix/modules/mobile/lib/rest/intranet.php
  • Класс: BitrixMobileRestIntranet
  • Вызов: Intranet::getStressShareData
static function getStressShareData($params = null, $offset, CRestServer $server)
{
	Loader::includeModule("intranet");
	$stressLevelInstance = new BitrixIntranetComponentUserProfileStressLevelImg();
	$image = $stressLevelInstance->getImage([
		'factor' => 4,
		'checkSSL'=>false
	]);

	if($image)
	{
		$entityCodes = [
			"groups"=>"SG",
			"users"=>"U",
			"departments"=>"DR",
		];

		$params["recipients"] = array_reduce(array_keys($params["recipients"]), function($res, $type) use ($params, $entityCodes){

			$prefix = $entityCodes[$type];
			if($prefix && is_array($params["recipients"][$type]))
			{
				$res = array_merge($res, array_map(function($item) use ($prefix){
					return "{$prefix}{$item}";
				}, $params["recipients"][$type]));
			}

			return $res;

		}, []);

		$params["files"] = [["stress.png", base64_encode($image->getImageBlob())]];
	}
	else
	{
		throw new SystemException("Can't create image", 0);
	}


	return $params;
}