- Модуль: dav
- Путь к файлу: ~/bitrix/modules/dav/classes/general/addressbookcrmbase.php
- Класс: CDavAddressbookCrmBase
- Вызов: CDavAddressbookCrmBase::AttachToEntityImgId
protected function AttachToEntityImgId($entityParams, $fileContent, $fileExtension);
/**
* @param $fields
* @return bool|int
*/
abstract protected function AddEntity($fields);
/**
* @param $id
* @param $fields
* @return bool
*/
abstract protected function UpdateEntity($id, $fields);
/**
* @param $entityParams
* @param $oldEntityParams
* @return array
*/
abstract protected function Merge($entityParams, $oldEntityParams);
/**
* @param $content
* @param $type
* @return bool|int|string
*/
protected function SaveImg($content, $type)
{
$fileContent = base64_decode($content);
if ($fileContent !== false && $fileContent <> '')
{
$fileName = CTempFile::GetFileName(mb_substr(md5(mt_rand()), 0, 3).'.' . $type);
if (CheckDirPath($fileName))
{
file_put_contents($fileName, $fileContent);
$photo = CFile::MakeFileArray($fileName);
$photo['MODULE_ID'] = 'crm';
$photo['del'] = 'Y';
return CFile::SaveFile($photo, 'crm');
}
}
return false;
}