Gollem_Api
extends Horde_Registry_Api
in package
Gollem external API interface.
This file defines Gollem's external API interface. Other applications can interact with Gollem through this API.
Copyright 2010-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Tags
Table of Contents
- browse() : array<string|int, mixed>
- Browses through the VFS tree.
- getViewLink() : Horde_Url
- Returns a link to the gollem file preview interface
- mkcol() : mixed
- Creates a directory ("collection" in WebDAV-speak) within the VFS
- move() : mixed
- Renames a file or directory
- path_delete() : mixed
- Removes a file or folder from the VFS
- put() : mixed
- Accepts a file for storage into the VFS.
- returnFromSelectlist() : string
- Returns the data for a given selection ID and index.
- selectlistLink() : string
- Creates a link to the gollem file selection window.
- selectlistResults() : mixed
- Returns the list of files selected by the user for a given selection ID.
- setSelectlist() : string
- Sets the files selected for a given selection ID.
- _getBackend() : mixed
Methods
browse()
Browses through the VFS tree.
public
browse([string $path = '' ][, array<string|int, mixed> $properties = array('name', 'icon', 'browseable') ]) : array<string|int, mixed>
Each VFS backend is listed as a directory at the top level. No modify operations are allowed outside any VFS area.
Parameters
- $path : string = ''
-
The level of the tree to browse.
- $properties : array<string|int, mixed> = array('name', 'icon', 'browseable')
-
The item properties to return. Defaults to 'name', 'icon', and 'browseable'.
Tags
Return values
array<string|int, mixed> —The contents of $path.
getViewLink()
Returns a link to the gollem file preview interface
public
getViewLink(string $dir, string $file[, string $backend_key = '' ]) : Horde_Url
Parameters
- $dir : string
-
File absolute path
- $file : string
-
File basename
- $backend_key : string = ''
-
Backend key. Defaults to Gollem_Auth::getPreferredBackend().
Return values
Horde_Url —The URL object.
mkcol()
Creates a directory ("collection" in WebDAV-speak) within the VFS
public
mkcol(string $path) : mixed
Parameters
- $path : string
-
Path of directory to create
Tags
Return values
mixed —move()
Renames a file or directory
public
move(string $path, string $dest) : mixed
Parameters
- $path : string
-
Path to source object to be renamed
- $dest : string
-
Path to new name
Return values
mixed —path_delete()
Removes a file or folder from the VFS
public
path_delete(string $path) : mixed
Parameters
- $path : string
-
Path of file or folder to delete
Return values
mixed —put()
Accepts a file for storage into the VFS.
public
put(string $path, string $content, string $content_type) : mixed
Parameters
- $path : string
-
Path to store file.
- $content : string
-
Contents of file.
- $content_type : string
-
MIME type of file.
Tags
Return values
mixed —returnFromSelectlist()
Returns the data for a given selection ID and index.
public
returnFromSelectlist(string $selectid, int $index) : string
Parameters
- $selectid : string
-
The selection ID.
- $index : int
-
The index of the file data to return.
Return values
string —The file data.
selectlistLink()
Creates a link to the gollem file selection window.
public
selectlistLink(string $link_text, string $link_style, string $formid[, bool $icon = false ][, string $selectid = '' ]) : string
The file section window will return a cache ID value which should be used (along with the selectListResults and returnFromSelectList functions below) to obtain the data from a list of selected files.
There MUST be a form field named 'selectlist_selectid' in the calling form. This field will be populated with the selection ID when the user completes file selection.
There MUST be a form parameter named 'actionID' in the calling form. This form will be populated with the value 'selectlist_process' when the user completes file selection. The calling form will be submitted after the window closes (i.e. the calling form must process the 'selectlist_process' actionID).
Parameters
- $link_text : string
-
The text to use in the link.
- $link_style : string
-
The style to use for the link.
- $formid : string
-
The formid of the calling script.
- $icon : bool = false
-
Create the link with an icon instead of text?
- $selectid : string = ''
-
Selection ID.
Return values
string —The URL string.
selectlistResults()
Returns the list of files selected by the user for a given selection ID.
public
selectlistResults(string $selectid) : mixed
Parameters
- $selectid : string
-
The selection ID.
Return values
mixed —setSelectlist()
Sets the files selected for a given selection ID.
public
setSelectlist([string $selectid = '' ][, array<string|int, mixed> $files = array() ]) : string
Parameters
- $selectid : string = ''
-
The selection ID to use.
- $files : array<string|int, mixed> = array()
-
An array with each file entry stored in its own array, with the key as the directory name and the value as the filename.
Return values
string —The selection ID.
_getBackend()
protected
_getBackend(mixed $path) : mixed
Parameters
- $path : mixed