/**
  * @param array $fileData
  * @param string $siteID
  * @param array $params
  * @return int|false
  */
 public static function saveFile(array $fileData, $storageTypeID = 0, $siteID = '', $params = array())
 {
     if (!is_integer($storageTypeID)) {
         $storageTypeID = (int) $storageTypeID;
     }
     if (!StorageType::isDefined($storageTypeID)) {
         $storageTypeID = StorageType::getDefaultTypeID();
     }
     if ($storageTypeID === StorageType::Disk) {
         return DiskManager::saveFile($fileData, $siteID, $params);
     } elseif ($storageTypeID === StorageType::WebDav) {
         return \CCrmWebDavHelper::saveFile($fileData, $siteID, $params);
     }
     throw new Main\NotSupportedException("Storage type: '{$storageTypeID}' is not supported in current context");
 }
Exemple #2
0
 public static function SetDefaultStorageTypeID($storageTypeID)
 {
     $storageTypeID = (int) $storageTypeID;
     if (!StorageType::isDefined($storageTypeID)) {
         $storageTypeID = StorageType::getDefaultTypeID();
     }
     if ($storageTypeID === self::$STORAGE_TYPE_ID) {
         return;
     }
     self::$STORAGE_TYPE_ID = $storageTypeID;
     CUserOptions::SetOption('crm', 'activity_storage_type_id', $storageTypeID);
 }
Exemple #3
0
 public static function GetDefaultStorageTypeID()
 {
     if (self::$STORAGE_TYPE_ID === StorageType::Undefined) {
         self::$STORAGE_TYPE_ID = intval(CUserOptions::GetOption('crm', 'quote_storage_type_id', StorageType::Undefined));
         if (self::$STORAGE_TYPE_ID === StorageType::Undefined || !StorageType::isDefined(self::$STORAGE_TYPE_ID)) {
             self::$STORAGE_TYPE_ID = StorageType::getDefaultTypeID();
         }
     }
     return self::$STORAGE_TYPE_ID;
 }