class Version implements ObjectInterface (View source)

Traits

Constants

UT_REPLACE_FILE

UT_TITLE

UT_DESCRIPTION

UT_TAGS

UT_EXTENDED_ATTRIBUTE

UT_CONTENTS

UT_RENAME

Properties

protected File $file

/* @ORM\Id

protected $fvID
protected $fvFilename
protected $fvPrefix
protected $fvDateAdded
protected $fvActivateDateTime
protected $fvIsApproved
protected $fvAuthorUID
protected $fvSize
protected $fvApproverUID
protected $fvTitle
protected $fvDescription
protected $fvExtension
protected $fvType
protected $fvTags
protected $fvHasListingThumbnail
protected $fvHasDetailThumbnail
private $imagineImage

Methods

getAttributeValueObject($ak, $createIfNotExists = false)

Necessary because getAttribute() returns the Value Value object, and this returns the File Attribute Value object.

getAttribute($ak, $mode = false)

No description

Value
getAttributeValue($ak)

No description

clearAttribute($ak)

No description

Value
setAttribute($ak, mixed $value)

Sets the attribute of a user info object to the specified value, and saves it in the database.

__construct()

No description

static Version
add(File $file, string $filename, string $prefix, array $data = [])

Add a new file version.

static string
cleanTags($tagsStr)

Clean the tags (removing whitespace).

setFilename(string $filename)

Set the filename.

string
getPrefix()

Path prefix for a file.

bool
isApproved()

If the current version is approved.

string[]
getTagsList()

Get the tags as an array of strings.

null|string
getTags()

Get the tags for a file.

getFile()

returns the File object associated with this FileVersion object.

setFile(File $file)

Set the current file.

int
getFileID()

File ID.

int
getFileVersionID()

File Version ID.

delete(bool $deleteFilesAndThumbnails = false)

Removes a version of a file. Note, does NOT remove the file because we don't know where the file might elsewhere be used/referenced.

deleteThumbnail(string|Version $type)

Deletes the thumbnail for the particular thumbnail type.

updateThumbnailStorageLocation(string $type, StorageLocation $location)

Move the thumbnails for the current file version to a new storage location.

File
getFileResource()

Returns an abstracted File object for the resource. NOT a concrete5 file object.

string
getMimeType()

Get the mime type of the file if known.

mixed|string
getSize()

Get the formatted filesize of a file e.g. 123KB.

int
getFullSize()

File size of the file.

string
getAuthorName()

The author of the file (or Unknown).

int
getAuthorUserID()

Return the uID for the author of the file.

string
getDateAdded()

Gets the date a file version was added.

null|string
getExtension()

Get the file extension for a file.

setFileVersionID(int $fvID)

Set the ID for the file version.

duplicate()

Takes the current value of the file version and makes a new one with the same values.

deny()

Deny a file version update.

save(bool $flush = true)

Save changes to a file.

string
getType()

Get the file type name.

string
getDisplayType()

Get the file type display name (localized).

getTypeObject()

No description

string[]
getVersionLogComments()

Returns an array containing human-readable descriptions of everything that happened in this version.

updateTitle(string $title)

Update the Title for a file.

duplicateUnderlyingFile()

Duplicate a file (adds a new version).

logVersionUpdate(int $updateTypeID, int $updateTypeAttributeID = 0)

Log updates to files.

updateTags(string $tags)

Update the tags for a file.

updateDescription(string $descr)

Update the description of a file.

rename(string $filename)

Rename a file.

updateContents(string $contents)

Update the contents of a file.

updateFile(string $filename, string $prefix)

Update the filename and prefix of a file.

approve()

Approve the change to a file version.

string
getFileContents()

Return the contents of a file.

string
getForceDownloadURL()

Returns a url that can be used to download a file, will force the download of all file types, even if your browser can display them.

forceDownload()

Forces the download of a file.

null|string
getFileName()

Return the filename for a file if it exists.

string
getRelativePath()

Return the relative path for a file (may not exist).

getThumbnails()

Get an array of thumbnails.

bool|Image
getImagineImage()

No description

releaseImagineImage()

Unload the loaded image.

bool
rescanThumbnails()

Rescan the thumbnails for a file (images only).

mixed
hasThumbnail($level) deprecated

No description

string
getDetailThumbnailImage()

Return the thumbnail for an image or a generic type icon for a file.

null|string
getThumbnailURL(string|Version $type)

Resolve a path using the default core path resolver.

importThumbnail(Version $version, string $path)

When given a thumbnail type versin object and a full path to a file on the server the file is imported into the system as is as the thumbnail.

null|string
getURL()

Returns a full URL to the file on disk.

string
getDownloadURL()

Returns a URL that can be used to download the file. This passes through the download_file single page.

mixed
getAttributes()

No description

null|int
refreshAttributes(bool $rescanThumbnails = true)

Responsible for taking a particular version of a file and rescanning all its attributes This will run any type-based import routines, and store those attributes, generate thumbnails, etc.

null|string
getTitle()

Title for the file if one exists.

string
getJSONObject()

Return a representation of the current FileVersion object as something easily serializable.

bool
canView()

Checks current viewers for this type and returns true if there is a viewer for this type, false if not.

bool
canEdit()

Checks current viewers for this type and returns true if there is a viewer for this type, false if not.

string
getGenericTypeText()

Get the localized name of the generic category type.

null|string
getDescription()

Returns the description for the file if there is one.

string
getListingThumbnailImage()

Return the thumbnail for an image or a generic type icon for a file.

generateThumbnail(Version $type)

Generate a thumbnail given a type

Details

CategoryInterface getObjectAttributeCategory()

No description

Return Value

CategoryInterface

getAttributeValueObject($ak, $createIfNotExists = false)

Necessary because getAttribute() returns the Value Value object, and this returns the File Attribute Value object.

Parameters

$ak
$createIfNotExists

getAttribute($ak, $mode = false)

No description

Parameters

$ak
$mode

Value getAttributeValue($ak)

No description

Parameters

$ak

Return Value

Value

clearAttribute($ak)

No description

Parameters

$ak

Value setAttribute($ak, mixed $value)

Sets the attribute of a user info object to the specified value, and saves it in the database.

Parameters

$ak
mixed $value

Return Value

Value

__construct()

No description

static Version add(File $file, string $filename, string $prefix, array $data = [])

Add a new file version.

Parameters

File $file
string $filename
string $prefix
array $data

Return Value

Version

static string cleanTags($tagsStr)

Clean the tags (removing whitespace).

Parameters

$tagsStr

string Delimited by '\n'

Return Value

string

setFilename(string $filename)

Set the filename.

Parameters

string $filename

string getPrefix()

Path prefix for a file.

Return Value

string

bool isApproved()

If the current version is approved.

Return Value

bool

string[] getTagsList()

Get the tags as an array of strings.

Return Value

string[]

null|string getTags()

Get the tags for a file.

Return Value

null|string

File getFile()

returns the File object associated with this FileVersion object.

Return Value

File

setFile(File $file)

Set the current file.

Parameters

File $file

int getFileID()

File ID.

Return Value

int

int getFileVersionID()

File Version ID.

Return Value

int

delete(bool $deleteFilesAndThumbnails = false)

Removes a version of a file. Note, does NOT remove the file because we don't know where the file might elsewhere be used/referenced.

Parameters

bool $deleteFilesAndThumbnails

Whether we should delete all file versions and thumbnails

deleteThumbnail(string|Version $type)

Deletes the thumbnail for the particular thumbnail type.

Parameters

string|Version $type

updateThumbnailStorageLocation(string $type, StorageLocation $location)

Move the thumbnails for the current file version to a new storage location.

Parameters

string $type
StorageLocation $location

File getFileResource()

Returns an abstracted File object for the resource. NOT a concrete5 file object.

Return Value

File

string getMimeType()

Get the mime type of the file if known.

Return Value

string

mixed|string getSize()

Get the formatted filesize of a file e.g. 123KB.

Return Value

mixed|string

int getFullSize()

File size of the file.

Return Value

int

string getAuthorName()

The author of the file (or Unknown).

Return Value

string

int getAuthorUserID()

Return the uID for the author of the file.

Return Value

int

string getDateAdded()

Gets the date a file version was added.

Return Value

string

date formated like: 2009-01-01 00:00:00

null|string getExtension()

Get the file extension for a file.

Return Value

null|string

setFileVersionID(int $fvID)

Set the ID for the file version.

Parameters

int $fvID

Version duplicate()

Takes the current value of the file version and makes a new one with the same values.

Return Value

Version

deny()

Deny a file version update.

protected save(bool $flush = true)

Save changes to a file.

Parameters

bool $flush

Flush the EM cache

string getType()

Get the file type name.

Return Value

string

string getDisplayType()

Get the file type display name (localized).

Return Value

string

Type getTypeObject()

No description

Return Value

Type

string[] getVersionLogComments()

Returns an array containing human-readable descriptions of everything that happened in this version.

Return Value

string[]

updateTitle(string $title)

Update the Title for a file.

Parameters

string $title

duplicateUnderlyingFile()

Duplicate a file (adds a new version).

logVersionUpdate(int $updateTypeID, int $updateTypeAttributeID = 0)

Log updates to files.

Parameters

int $updateTypeID

Refers to the constants

int $updateTypeAttributeID

updateTags(string $tags)

Update the tags for a file.

Parameters

string $tags

updateDescription(string $descr)

Update the description of a file.

Parameters

string $descr

rename(string $filename)

Rename a file.

Parameters

string $filename

updateContents(string $contents)

Update the contents of a file.

Parameters

string $contents

updateFile(string $filename, string $prefix)

Update the filename and prefix of a file.

Parameters

string $filename
string $prefix

approve()

Approve the change to a file version.

string getFileContents()

Return the contents of a file.

Return Value

string

string getForceDownloadURL()

Returns a url that can be used to download a file, will force the download of all file types, even if your browser can display them.

Return Value

string

forceDownload()

Forces the download of a file.

null|string getFileName()

Return the filename for a file if it exists.

Return Value

null|string

string getRelativePath()

Return the relative path for a file (may not exist).

Return Value

string

Thumbnail[] getThumbnails()

Get an array of thumbnails.

Return Value

Thumbnail[]

Exceptions

InvalidDimensionException

bool|Image getImagineImage()

No description

Return Value

bool|Image

releaseImagineImage()

Unload the loaded image.

bool rescanThumbnails()

Rescan the thumbnails for a file (images only).

Return Value

bool

False on failure

mixed hasThumbnail($level) deprecated

deprecated

No description

Parameters

$level

Return Value

mixed

string getDetailThumbnailImage()

Return the thumbnail for an image or a generic type icon for a file.

Return Value

string

null|string getThumbnailURL(string|Version $type)

Resolve a path using the default core path resolver.

Avoid using this method when you have access to your a resolver instance.

Parameters

string|Version $type

Return Value

null|string

importThumbnail(Version $version, string $path)

When given a thumbnail type versin object and a full path to a file on the server the file is imported into the system as is as the thumbnail.

Parameters

Version $version
string $path

null|string getURL()

Returns a full URL to the file on disk.

Return Value

null|string

Url to a file

string getDownloadURL()

Returns a URL that can be used to download the file. This passes through the download_file single page.

Return Value

string

download_file url for a file

mixed getAttributes()

No description

Return Value

mixed

null|int refreshAttributes(bool $rescanThumbnails = true)

Responsible for taking a particular version of a file and rescanning all its attributes This will run any type-based import routines, and store those attributes, generate thumbnails, etc.

..

Parameters

bool $rescanThumbnails

Whether or not we should rescan thumbnails as well

Return Value

null|int

null|string getTitle()

Title for the file if one exists.

Return Value

null|string

string getJSONObject()

Return a representation of the current FileVersion object as something easily serializable.

Return Value

string

A JSON object with all the information about a file (including permissions)

bool canView()

Checks current viewers for this type and returns true if there is a viewer for this type, false if not.

Return Value

bool

bool canEdit()

Checks current viewers for this type and returns true if there is a viewer for this type, false if not.

Return Value

bool

string getGenericTypeText()

Get the localized name of the generic category type.

Return Value

string

null|string getDescription()

Returns the description for the file if there is one.

Return Value

null|string

string getListingThumbnailImage()

Return the thumbnail for an image or a generic type icon for a file.

Return Value

string

generateThumbnail(Version $type)

Generate a thumbnail given a type

Parameters

Version $type