Class DiFile.
This class wraps asset data, obtained from portalDI and creates DiFile object that holds a lot of useful properties and functions for asset display and management.
Class accepts asset data array, generated by “fileinfo”, “browse” and “search” portalDI actions.
The following example shows how you can create DiFile object from within Elegant 6 plugin:

The following properties are available:
name |
annotationsTotal |
type |
int |
description |
holds total number of file annotations |
name |
canAnnotate |
type |
bool |
description |
determines if asset can be annotated |
name |
canGoToBasket |
type |
bool |
description |
determines if asset can be put to basket |
name |
canVersion |
type |
bool |
description |
determines if asset can have versions |
name |
creator |
type |
string |
description |
holds file creator username |
name |
folder |
type |
string |
description |
holds containing directory name |
name |
folderUrl |
type |
string |
description |
holds containing directory “browse” url (example.com/browse?path=directory/path) |
name |
inBasket |
type |
bool |
description |
determines whether asset is in current user basket or not |
name |
is |
type |
int |
description |
holds asset ID in venture database |
name |
isCad |
type |
bool |
description |
determines if asset is an cad file |
name |
isHtml |
type |
bool |
description |
determines if asset is an html file |
name |
isImage |
type |
bool |
description |
determines if asset is an image file |
name |
isMovie |
type |
bool |
description |
determines if asset is a movie file |
name |
isOffice |
type |
bool |
description |
determines if asset is an office file |
name |
isVenture |
type |
bool |
description |
determines if an asset is registered inside venture database |
name |
isVersion |
type |
bool |
description |
determines if asset is a version of another asset |
name |
length |
type |
int |
description |
holds asset length in bytes |
name |
name |
type |
string |
description |
holds asset name |
name |
parentId |
type |
int |
description |
holds containing folder ID from venture database |
name |
path |
type |
string |
description |
holds asset path |
name |
raw |
type |
bool |
description |
holds array of raw asset data from portalDI |
name |
spreadNum |
type |
int |
description |
holds number of file spreads (pages) for multipage files (pdfs, videos, etc.) |
name |
type |
type |
string |
description |
holds asset file type |
name |
versionsTotal |
type |
int |
description |
holds total amount of versions, available for current asset |
The following methods are available:
function |
getAnnotations |
description |
gets array of asset annotations in portalDI format and sorts them by page revision and id |
parameters |
none |
returns |
array |
function |
getArchiveInfo |
description |
gets array of asset archive info in portalDI format. Ususally it contains date of archiving and archive media title |
parameters |
none |
returns |
array |
function |
getArchiveStatus |
description |
getArchiveStatus |
parameters |
none |
returns |
integer (0 – online, 1 – online & archived, 2 – offline, 3 nearline) |
function |
getAudioParameters |
description |
builds stdClass object, that contains asset audio parameters |
parameters |
none |
returns |
stdClass (stdClass object that contains the following properties: |
|
- language: audio language |
|
- channels: audio channels |
|
- sample_rate: audio sample rate |
|
- codec: audio codec |
function |
getCanComment |
description |
determines if asset can be commented. You can comment assets starting with webnative version 18, also asset commenting has to be enabled in Elegant 6 site configuration |
parameters |
none |
returns |
bool (true – comments can be added, false – comments are not available) |
function |
getCanManipulate |
description |
determines if asset configuration and volume settings allow to manipulate it (copy, move, delete, rename) |
parameters |
none |
returns |
bool (true – asset can be manipulated, false – asset cannot be manipulated) |
function |
getComment |
description |
gets file comment value, if it is allowed by volume settings |
parameters |
none |
returns |
null string (null - comment if not allowed, string – comment value) |
function |
getComments |
description |
gets asset comments array in “portalDI” format. Note: asset comments are available starting with webntative version 18. |
parameters |
none |
returns |
array |
function |
getContainingDocuments |
description |
gets array of asset containing documents. Containing are objects of Elegant 6 “FileLinked” class. This class is similar to “DiFile” with addition of several specific parameters |
parameters |
none |
returns |
array |
function |
getDates |
description |
gets asset creation, modification and access dates in form of an object |
parameters |
none |
returns |
stdClass (stdClass object with the following properties: |
|
- cdate |
|
- mdate |
|
- adate |
function |
getDisabled |
description |
gets asset disabled status, determined by webnative asset timer |
parameters |
none |
returns |
ool (true - disabled, false - available) |
function |
getFileHistory |
description |
gets array of asset file history in “portalDI” format and sorts it by date added |
parameters |
none |
returns |
array |
function |
getFinderColor |
description |
gets current asset finder color |
parameters |
none |
returns |
string (finder color: grey, green, violet, blue, yellow, red, orange) |
function |
getFormattedFileSizes |
description |
builds stdClass object that contains formatted information about file size and dimensions |
parameters |
none |
returns |
stdClass (stdClass object with following properties: |
|
- size: file size (Bytes, KB, MB, GB, etc.), |
|
- inches: file dimensions in inches (N in x M in), |
|
- centimeters: file dimensions in centimeters (N cm x M cm) |
function |
getImage |
description |
creates image tag with asset preview. Note: if preview is not available, a corresponding placeholder image will be returned instead |
parameters |
$params = array(): array of key value pairs that will be added as attributes for “ ” tag; |
returns |
string |
function |
getIsOnline |
description |
gets file online statusv |
parameters |
none |
returns |
bool (true – online, false – not online) |
function |
getKeywords |
description |
gets array of Elegant 6 “Keyword” class objects with corresponding asset keywords values being set |
parameters |
- editableOnly = true: if true, returns keywords editable for current user only |
|
- valueOnly = false: if true, returns keywords with values only (+ all editable) |
|
- browseableOnly = false: if true, returns keywords, available for “browse view” display (the setting is determined by keyword webnative options) |
returns |
array (array of “Keyword” class objects) |
function |
getLargeSpeads |
description |
gets array of asset large spreads in “portalDI” format |
parameters |
none |
returns |
array |
function |
getLinkedFiles |
description |
gets array of asset linked files. Linked files are objects of Elegant 6 “FileLinked” class. This class is similar to “DiFile” with addition of coordinates that allow positioning of linked file inside parent file |
parameters |
none |
returns |
array |
function |
getPreferredSpread |
description |
gets preferred spread index for current asset |
parameters |
none |
returns |
array |
function |
getPreview |
description |
creates asset preview url |
parameters |
- spread = null (int null): index of spread that you want to display |
|
- forcedSideLength = null(int null): if set, method will try to generate preview of a given larger side length in pixels |
|
- clipping = null (null string): possible clipping path value in “portalDI” format |
returns |
string |
function |
getPreviewParams |
description |
builds stdClass object, that contains asset preview parameters |
parameters |
none |
returns |
stdClass (stdClass object that contains the following properties: |
|
- colorSpace: asset color space |
|
- imageType: asset image type |
|
- height: max available preview height (pixels) |
|
- width: max available preview width (pixels) |
|
- heightOriginal: original asset height |
|
- widthOriginal: original asset width |
|
- resolution: preview resolution (DPI) |
|
- originalResolution: original asset resolution (DPI) |
|
- originalResolution_dpcm: original resolution in centimeters (DPCM) |
|
- size: max available preview size (small, large, hires), determined by volume settings (“Small Preview”, “72 DPI Preview”, “Custom Image Order”) |
|
- availableSizes: array that contains preview sizes (hires, large, small) and their availability), determined by volume settings (“Small Preview”, “72 DPI Preview”, “Custom Image Order”) |
function |
getSmallSpreads |
description |
gets array of asset small spreads in “portalDI” format and sorts them by spread number |
parameters |
none |
returns |
array |
function |
getTextRuns |
description |
gets array of asset text runs in “portalDI” format and sorts it by position (topmost first) |
parameters |
none |
returns |
array |
function |
getThumbnail |
description |
creates asset thumbnail url |
parameters |
- spread = null (int null): index of spread that you want to display |
|
- forcedSideLength = null(int null): if set, method will try to generate preview of a given larger side length in pixels |
|
- clipping = null (null string): possible clipping path value in “portalDI” format |
returns |
string |
function |
getVideoParameters |
description |
builds stdClass object, that contains asset video parameters |
parameters |
none |
returns |
stdClass (stdClass object that contains the following properties: |
|
- format: video format |
|
- description: video description |
|
- duration: video duration |
|
- formatted_duration: formatted video duration |
|
- bit_rate: video bit rate |
|
- codec: video codec |
|
- pixel: video pixel value |
|
- frame_rate: video frame rate |
function |
getDownLoadLinks |
description |
gets array of download links, available for current asset. Array is specially formatted to suit YII widgets, but can be used otherwise |
parameters |
none |
returns |
array |
function |
getVersions |
description |
gets array of asset version files. Versions files are objects of Elegant 6 “FileVersion” class. This class is similar to “DiFile” with addition of original version id and path data |
parameters |
none |
returns |
array |
function |
getViewLink |
description |
gets asset view link in Elegant 6 format (example.com/view?path=/path/to/asset.jpg) |
parameters |
none |
returns |
string |
function |
getUserInfo |
description |
gets “USERINFO” array from asset portalDI data, if it is not available, tries to get it from asset volume |
parameters |
none |
returns |
array (array of “USERINFO” in portalDI format) |