• Модуль: learning
  • Путь к файлу: ~/bitrix/modules/learning/classes/general/clearnlesson.php
  • Класс: CLearnLesson
  • Вызов: CLearnLesson::CountImmediateChilds
static function CountImmediateChilds ($lessonId)
{
	if ( ! self::_EnsureArgsStrictlyCastableToIntegers ($lessonId) )
		throw new LearnException('EA_PARAMS', LearnException::EXC_ERR_ALL_PARAMS);

	global $DB;

	$rc = $DB->Query (
		"SELECT COUNT(TARGET_NODE) AS CHILDS_COUNT
		FROM b_learn_lesson_edges
		WHERE SOURCE_NODE = '" . (int) ($lessonId + 0) . "'",
		true	// ignore errors
		);

	if ($rc === false)
		throw new LearnException ('EA_SQLERROR', LearnException::EXC_ERR_ALL_GIVEUP);

	$arData = $rc->Fetch();
	if ( ($arData === false) || ( ! isset($arData['CHILDS_COUNT']) ) )
		throw new LearnException ('EA_SQLERROR', LearnException::EXC_ERR_ALL_GIVEUP);

	return ( (int) ($arData['CHILDS_COUNT'] + 0) );
}