- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/folder.php
- Класс: BitrixDiskFolder
- Вызов: Folder::notifySonetGroup
private function notifySonetGroup(File $fileModel)
{
static $folderUrlList = array();
//todo create NotifyManager, which provides notify (not only group)
if(!Loader::includeModule('socialnetwork'))
{
return;
}
$storage = $fileModel->getStorage();
$proxyType = $storage->getProxyType();
if(!$proxyType instanceof Group)
{
return;
}
$groupId = (int)$storage->getEntityId();
if($groupId <= 0)
{
return;
}
$urlManager = Driver::getInstance()->getUrlManager();
$fileUrl = $urlManager->getPathFileDetail($fileModel);
$fileCreatedBy = $fileModel->getCreatedBy();
$fileName = $fileModel->getName();
$storageId = $storage->getId();
$res = ObjectTable::getList(array(
'filter' => array(
'STORAGE_ID' => $storageId,
'CREATED_BY' => $fileCreatedBy,
'>UPDATE_TIME' => DateTime::createFromTimestamp(time() - 600), // for index
'>CREATE_TIME' => DateTime::createFromTimestamp(time() - 600),
'=TYPE' => ObjectTable::TYPE_FILE,
'!=FILE_ID' => $fileModel->getFileId()
),
'select' => array('ID'),
'limit' => 1
));
if (!($res->fetch()))
{
$message = Loc::getMessage('DISK_FOLDER_MODEL_IM_NEW_FILE', array(
'#TITLE#' => ''.$fileName.'',
));
$messageOut = Loc::getMessage('DISK_FOLDER_MODEL_IM_NEW_FILE', array(
'#TITLE#' => $fileName
)).' (#URL#)';
$url = $urlManager->encodeUrn($fileUrl);
}
else
{
$message = Loc::getMessage('DISK_FOLDER_MODEL_IM_NEW_FILE2', array(
'#LINK_FOLDER_START#' => '',
'#LINK_END#' => ''
));
$messageOut = Loc::getMessage('DISK_FOLDER_MODEL_IM_NEW_FILE2', array(
'#LINK_FOLDER_START#' => '',
'#LINK_END#' => ''
)).' (#URL#)';
if (!array_key_exists($storageId, $folderUrlList))
{
$folderUrlList[$storageId] = $proxyType->getBaseUrlFolderList();
}
$url = $folderUrlList[$storageId];
}
CSocNetSubscription::notifyGroup(array(
'LOG_ID' => false,
'GROUP_ID' => array($groupId),
'NOTIFY_MESSAGE' => '',
'NOTIFY_TAG' => 'DISK_GROUP|'.$groupId.'|'.$fileCreatedBy,
'FROM_USER_ID' => $fileCreatedBy,
'URL' => $url,
'MESSAGE' => $message,
'MESSAGE_OUT' => $messageOut,
'EXCLUDE_USERS' => array($fileCreatedBy)
));
}