ConversionHandlers::onGetRateTypes

  1. Bitrix24 API (v. 23.675.0)
  2. blog
  3. ConversionHandlers
  4. onGetRateTypes
  • Модуль: blog
  • Путь к файлу: ~/bitrix/modules/blog/lib/internals/conversionhandlers.php
  • Класс: BitrixBlogInternalsConversionHandlers
  • Вызов: ConversionHandlers::onGetRateTypes
static function onGetRateTypes()
{
	$scale = array(0.5, 1, 1.5, 2, 5);

	return array(
		'blog_post' => array(
			'NAME'      => Loc::getMessage('BLOG_CONVERSION_RATE_POST_TITLE'),
			'SCALE'     => $scale,
			'MODULE'    => 'blog',
			'SORT'      => 4000,
			'COUNTERS'  => array('conversion_visit_day', 'blog_post_add_day'),
			'CALCULATE' => function(array $counters)
			{
				$denominator = $counters['conversion_visit_day'] ?: 0;
				$numerator   = $counters['blog_post_add_day'] ?: 0;

				return array(
					'DENOMINATOR' => $denominator,
					'NUMERATOR'   => $numerator,
					'RATE'        => $denominator ? $numerator / $denominator : 0,
				);
			},
		),
	);
}

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