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

	$currentUserID = intval($currentUserID);
	if ($currentUserID <= 0)
		return false;
	$userID = intval($userID);
	if ($userID <= 0)
		return false;

	$date = "";

	$strSql =
		"SELECT DATE_FORMAT(MAX(DATE_CREATE), '%Y-%m-%d 00:00:00') as DDD ".
		"FROM b_sonet_messages ".
		"WHERE ".
		"	(TO_USER_ID = ".$currentUserID." ".
		"	AND FROM_USER_ID = ".$userID." ".
		"	AND TO_DELETED = 'N' ".
		"	OR FROM_USER_ID = ".$currentUserID." ".
		"	AND TO_USER_ID = ".$userID." ".
		"	AND FROM_DELETED = 'N' ) ".
		"	AND MESSAGE_TYPE = 'P' ";

	$dbResult = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__); if ($arResult = $dbResult->Fetch()) $date = $arResult["DDD"]; $date = Trim($date); if ($date == '') $date = date("Y-m-d 00:00:00"); return $date; }