• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/stat/statistics.php
  • Класс: BitrixSenderStatStatistics
  • Вызов: Statistics::getAuthorList
protected function getAuthorList()
{
	$listDb = MailingChainTable::getList(array(
		'select' => ['CREATED_BY', 'MAX_DATE_INSERT'],
		'group' => ['CREATED_BY'],
		'runtime' => [new ExpressionField('MAX_DATE_INSERT', 'MAX(%s)', 'DATE_INSERT'),],
		'limit' => 100,
		'order' => ['MAX_DATE_INSERT' => 'DESC'],
		'cache' => ['ttl' => $this->getCacheTtl(), 'cache_joins' => true]
	));
	$userList = array();
	while ($item = $listDb->fetch())
	{
		if (!$item['CREATED_BY'])
		{
			continue;
		}

		$userList[] = $item['CREATED_BY'];
	}

	$list = array();
	$list[] = array(
		'ID' => 'all',
		'NAME' => Loc::getMessage('SENDER_STAT_STATISTICS_FILTER_AUTHOR_FROM_ALL')
	);

	/** @var CUser */
	global $USER;
	if (is_object($USER) && $USER->getID())
	{
		$list[] = array(
			'ID' => $USER->getID(),
			'NAME' => Loc::getMessage('SENDER_STAT_STATISTICS_FILTER_AUTHOR_FROM_ME')
		);
	}

	$listDb = UserTable::getList(array(
		'select' => array(
			'ID',
			'TITLE',
			'NAME',
			'SECOND_NAME',
			'LAST_NAME',
			'LOGIN',
		),
		'filter' => array('=ID' => $userList),
		'order' => array('NAME' => 'ASC')
	));
	while ($item = $listDb->fetch())
	{
		$name = CUser::formatName(CSite::getNameFormat(true), $item, true, true);
		$list[] = array(
			'ID' => $item['ID'],
			'NAME' => $name,
		);
	}

	return $list;
}