• Homepage
  • FAQ
  • Modules
    • Workflow Designer
      • Documentation
      • Changelog VT 7
      • Task Updates
      • Knowledge Base
    • Colorizer
      • Changelog
    • CloudFile
    • Coupons
    • VtigerCRM Tools
    • Other Documentations
  • VtigerCRM
  • Tickets
  • Redoo Networks Homepage
  • German
  • Homepage
  • FAQ
  • Modules
    • Workflow Designer
      • Documentation
      • Changelog VT 7
      • Task Updates
      • Knowledge Base
    • Colorizer
      • Changelog
    • CloudFile
    • Coupons
    • VtigerCRM Tools
    • Other Documentations
  • VtigerCRM
  • Tickets
  • Redoo Networks Homepage
  • German
home/Knowledge Base/CloudFile/CloudFile Developers

CloudFile Developers

420 views 1 February 6, 2017 Updated on February 7, 2017 sysadmin

Like any other of our modules, the CloudFile module provide a easy to use Interface.
So you are able to use the module within your own extensions without any major work.

I will guide you step by step to provide Cloud Storage functions:

 

1. You need to get a list of available Connections

$cloudFileModule = new CloudFile_Module_Model();
$connections = $cloudFileModule->getAvailableConnections();

This will return an array of configured connections, in the following format:

array {
  0 => 
    array (size=3)
      'titel' => string 'ConnectionTitle'
      'connectionid' => string 'Connection ID'
      'image_16' => string 'URL to provider Image 16x16'
  1 => 
    array (size=3)
      'titel' => string 'ConnectionTitle'
      'connectionid' => string 'Connection ID'
      'image_16' => string 'URL to provider Imagee 16x16'
  2 => 
    array (size=3)
      'titel' => string 'ConnectionTitle'
      'connectionid' => string 'Connection ID'
      'image_16' => string 'URL to provider Image 16x16' 
...
}

Use this list select connection ID you want to use.

2. Use the Connection

This is the important step, but is not much harder, then the first one.

You only need to understand the two systems:
There are hierarchical and ID based systems.

  1. Hierarchical file systems will with “real” file path, directories, subdirectories, …. Examples are FTP, Dropbox, Filesystem
  2. ID based systems, which use filepaths only to organize visual presentation, but works only with IDs. Every directory and file have a unique ID. A major example is Google Drive.

Because the CloudFile module supports both types, you will get a path and a key everytime you work with files and directories. Use both to be fully compatible to both systems.

2.1 Get Connection Object

$connection = \CloudFile\Connection::getAdapter($connection_id);

That’s all!

Now you have a object from your Adapter, which inherits from \CloudFile\Adapter\Base, and could work with the cloud storage.

Found all available methods here: https://redoonetworks.github.io/VtigerCRM-CloudFile-Developers/output/classes/CloudFile.Adapter.Base.html

Examples

Create a folder:

$connection->mkdir('New Folder Name');

Upload a file:

$connection->upload($localFilename, basename($localFilename));

This uploads the file from $localFilename into the current folder and same filename of the local file.

Was this helpful?

1 Yes  No
Leave A Comment Cancel reply

New title
  • CloudFile 1
  • Coupons 1
  • Colorizer 2
  • Flex Reports 1
  • Workflow Designer 3
    • Developer 14
    • General 13
    • Example Workflows 2
  • VtigerCRM 0
    • General 4
    • VtigerCRM 6 1
    • EventHandlers 4
    • Modifications 1
Popular Articles
  • How to debug VtigerCRM?
  • Coupons
  • [VT6] use custom Product price fields for special modules
  • SMTP Server Konfiguration
  • Workflow Designer Quick Start

  • Impressum

Zum shop

  • Deutsch