• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/mysql/user_relations.php
  • Класс: CSocNetUserRelations
  • Вызов: CSocNetUserRelations::GetRelationsTop
static function GetRelationsTop($userID, $number = 100)
{
	global $DB;

	$userID = intval($userID);
	$number = intval($number);

	$strSql =
		"SELECT UR.RELATION, UR.FIRST_USER_ID, UR.SECOND_USER_ID ".
		"FROM b_sonet_user_relations UR ".
		"WHERE UR.FIRST_USER_ID = ".$userID." ".
		"UNION ".
		"SELECT UR.RELATION, UR.FIRST_USER_ID, UR.SECOND_USER_ID ".
		"FROM b_sonet_user_relations UR ".
		"WHERE UR.SECOND_USER_ID = ".$userID." ".
		($number > 0 ? "LIMIT 0, ".$number : "");
		
	return $DB->Query($strSql);
}