- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/uf/sonetlogconnector.php
- Класс: BitrixDiskUfSonetLogConnector
- Вызов: SonetLogConnector::addComment
public function addComment($authorId, array $data)
{
if(!Loader::includeModule('socialnetwork'))
{
return;
}
$query = CSocNetLog::getList(
array(),
array(
"ID" => $this->entityId
),
false,
false,
array("ID", "EVENT_ID", "ENTITY_TYPE", "ENTITY_ID")
);
$row = $query->fetch();
if(
!$row
|| !($commentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($row["EVENT_ID"]))
)
{
return;
}
$fieldsForSocnet = array(
"ENTITY_TYPE" => $row["ENTITY_TYPE"],
"ENTITY_ID" => $row["ENTITY_ID"],
"EVENT_ID" => $commentEvent["EVENT_ID"],
"=LOG_DATE" => Application::getInstance()->getConnection()->getSqlHelper()->getCurrentDateTimeFunction(),
"MESSAGE" => $data['text'],
"TEXT_MESSAGE" => $data['text'],
"URL" => "",
"LOG_ID" => $row["ID"],
"USER_ID" => $authorId
);
if(!empty($data['fileId']))
{
$fieldsForSocnet['UF_SONET_COM_DOC'] = array($data['fileId']);
}
elseif(!empty($data['versionId']))
{
$fieldsForSocnet['UF_SONET_COM_VER'] = $data['versionId'];
}
if ($commentId = CSocNetLogComments::add($fieldsForSocnet, false, false, false))
{
CSocNetLogComments::update($commentId, array(
"RATING_TYPE_ID" => "LOG_COMMENT",
"RATING_ENTITY_ID" => $commentId
));
}
}