• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/item.php
  • Класс: BitrixTasksItem
  • Вызов: Item::getCount
static function getCount(array $dcParams = array(), $settings = null)
{
	if(!is_array($settings))
	{
		$settings = array();
	}

	if(!intval($settings['USER_ID']))
	{
		$settings['USER_ID'] = User::getId();
	}

	$dc = static::getDataSourceClass();

	// todo: filter select key carefully here!!! DO NOT query fields that have DB_READABLE == false, and also
	// todo: care about SOURCE == Scalar::SOURCE_CUSTOM here!

	// todo: this is the default access controller, we could specify our own in $settings and use here
	$ac = static::getAccessControllerDefault();

	$parameters = $ac->addDataBaseAccessCheck(
		$dcParams,
		array(
			'USER_ID' => $settings['USER_ID'],
		)
	);

	// catch some exceptions came from orm, and wrap it into a error
	try
	{
		$count = $dc::getCount($parameters);
	}
	catch(SystemException $e) // orm throws common SystemException, which is not good, but we cant do anything
	{
		throw $e;
	}

	return $count;
}