SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class FileAdminController

Handles most of the processing for files

Variables

NameVisibilityDescription
$add_defaults 
$category_archive 
$controller_name 
$friendly_name 
$main_delete 

Functions

NameVisibilityDescription
__constructpublicConstructor
_addPreRenderprotectedHook called by _getAddForm() just before the view is rendered
_addSavepublicNot used.
_deleteSavepublicDeletes an item and logs the deleted data
_editPreRenderpublicPre-render hook
_editSavepublicSaves the provided POST data into this file in the database
_extraCleanupInvalidpublicProvides a UI for doing a 'cleanup' - removes invalid files
_extraFindUsagepublicFind usage of a given file
_extraRedoSizespublicList of links to redo the sizes
_getContentsViewpublicReturn HTML for a resultset of items
_getContentsViewThumbprivateThumbnail view for files
_getEditSubActionspublicReturn the sub-actions for editing; for spec AdminController::renderSubActions
_getToolspublicReturn the list of sidebar tools
_getVisibilityFieldspublicReturn the fields to show in the sidebar when adding or editing a record.
_isAddSavedpublicIs the "add" action saved?
ajaxAuthorLookuppublicMatches user input against a list of possible authors for files
ajaxDragdropCancelpublicCancel an upload - delete temporary files.
ajaxDragdropChunkpublicSave a single chunk of a multi-part file upload
ajaxDragdropDonepublicStitch together uploaded chunks into an actual file
ajaxDragdropFormpublicReturns the form for updating a file which has been uploaded
ajaxDragdropSavepublicHandles the drag-and-drop upload form
ajaxErrprivateUsed by some AJAX stuff to return a JSON error
cleanupInvalidActionpublicDoes file cleanup - wrapper (admin)
cleanupInvalidActionInnerprivateRemove invalid files, such as:
cronCleanupInvalidpublicDoes file cleanup - wrapper (cron)
doUploadprivateUsed by the quick upload tool
downloadTemppublicProvide the contents of a temporarily uploaded file, for e.g. listening to uploaded audio
frontEndSearchpublicProcess the results of a search.
previewFocalCroppublicRenders a HTML subset containing a focal crop image
previewTransformpublicOn the fly image resizing
quickUploadpublicDoes a quick upload (from the fileselector)
redoSizesActionpublicFixes files which don't have the sizes they should
reindexAllpublicDoes a complete re-index of all files
reindexItemprivateDoes a re-index for a file
selectorPopuppublicOutputs the file selector HTML
selectorPopupSearchpublicDoes the backend selector search
stitchChunksprivateStitch together the uploaded file from multiple chunks

public __construct

void $FileAdminController->__construct ( );

Constructor

protected _addPreRender

void $FileAdminController->_addPreRender ( mixed $view );

Hook called by _getAddForm() just before the view is rendered

public _addSave

unknown $FileAdminController->_addSave ( mixed &$item_id );

Not used.

public _deleteSave

bool $FileAdminController->_deleteSave ( int $item_id );

Deletes an item and logs the deleted data

This method DOES NOT remove files from disk, in case the deleted DB record needs to be restored.
They are removed later, when the deletion log is cleared; see ActionLogAdminController::cronCleanup.
If lack of disk space is an issue, the log should be cleared more often, or alternate file backends should be
used; see FilesBackend.

public _editPreRender

void $FileAdminController->_editPreRender ( mixed $view , mixed $item_id );

Pre-render hook

public _editSave

unknown $FileAdminController->_editSave ( int $item_id );

Saves the provided POST data into this file in the database

public _extraCleanupInvalid

unknown $FileAdminController->_extraCleanupInvalid ( );

Provides a UI for doing a 'cleanup' - removes invalid files

public _extraFindUsage

array $FileAdminController->_extraFindUsage ( int $file_id );

Find usage of a given file

public _extraRedoSizes

unknown $FileAdminController->_extraRedoSizes ( );

List of links to redo the sizes

public _getContentsView

unknown $FileAdminController->_getContentsView ( Traversable $items , string $mode , StdClass $category );

Return HTML for a resultset of items
The returned HTML will be sandwiched between the refinebar and the pagination bar.

private _getContentsViewThumb

unknown $FileAdminController->_getContentsViewThumb ( mixed $items , mixed $category );

Thumbnail view for files

public _getEditSubActions

array $FileAdminController->_getEditSubActions ( mixed $item_id );

Return the sub-actions for editing; for spec AdminController::renderSubActions

public _getTools

unknown $FileAdminController->_getTools ( );

Return the list of sidebar tools

public _getVisibilityFields

array $FileAdminController->_getVisibilityFields ( );

Return the fields to show in the sidebar when adding or editing a record.
These fields are shown under a heading of "Visibility"

Key is the field name, value is the field label

public _isAddSaved

bool $FileAdminController->_isAddSaved ( );

Is the "add" action saved?
These may be false if the UI provides its own save mechanism (e.g. multi-add)

public ajaxAuthorLookup

void $FileAdminController->ajaxAuthorLookup ( );

Matches user input against a list of possible authors for files

public ajaxDragdropCancel

void $FileAdminController->ajaxDragdropCancel ( );

Cancel an upload - delete temporary files.

May receive two different variations on the provided POST data:
   [result][tmp_file]       Whole file was uploaded
   [partial_upload][code]   Only some chunks of the file have been uploaded

public ajaxDragdropChunk

void $FileAdminController->ajaxDragdropChunk ( );

Save a single chunk of a multi-part file upload

public ajaxDragdropDone

void $FileAdminController->ajaxDragdropDone ( );

Stitch together uploaded chunks into an actual file

Outputs a JSON response.
The field "success" will be checked (= 1) to determine success.
On error, the field "message" will be used as an error message.
Other keys provided are passed to the ajaxDragdropForm method.

public ajaxDragdropForm

void $FileAdminController->ajaxDragdropForm ( );

Returns the form for updating a file which has been uploaded

public ajaxDragdropSave

void $FileAdminController->ajaxDragdropSave ( );

Handles the drag-and-drop upload form

Output JSON should be:
   success   1 or 0
   message   Error message, if success is 0
   html      Confirmation HTML, if success is 1

private ajaxErr

unknown $FileAdminController->ajaxErr ( mixed $message );

Used by some AJAX stuff to return a JSON error

public cleanupInvalidAction

void $FileAdminController->cleanupInvalidAction ( );

Does file cleanup - wrapper (admin)

private cleanupInvalidActionInner

void $FileAdminController->cleanupInvalidActionInner ( );

Remove invalid files, such as:
 - Files without a name
 - Files without a type
 - Files which don't actually exist

public cronCleanupInvalid

void $FileAdminController->cronCleanupInvalid ( );

Does file cleanup - wrapper (cron)

private doUpload

unknown $FileAdminController->doUpload ( int $category_id );

Used by the quick upload tool

public downloadTemp

void $FileAdminController->downloadTemp ( mixed $filename );

Provide the contents of a temporarily uploaded file, for e.g. listening to uploaded audio

public frontEndSearch

string $FileAdminController->frontEndSearch ( array $item_id , mixed $relevancy , mixed $keywords );

Process the results of a search.

public previewFocalCrop

void $FileAdminController->previewFocalCrop ( string $size , string $filename , string $focal_point_data );

Renders a HTML subset containing a focal crop image

public previewTransform

void $FileAdminController->previewTransform ( mixed $transform , mixed $filename );

On the fly image resizing

The size parameter is the new size.
The first character is taken to be the resize type, accepts 'r' or 'c'.
The width and height is specified width . 'x' . height (e.g. 200x100)

public quickUpload

void $FileAdminController->quickUpload ( );

Does a quick upload (from the fileselector)
Returns JSON.

public redoSizesAction

void $FileAdminController->redoSizesAction ( );

Fixes files which don't have the sizes they should

public reindexAll

void $FileAdminController->reindexAll ( );

Does a complete re-index of all files

private reindexItem

bool $FileAdminController->reindexItem ( int $item_id , string $name , string $plaintext [, bool $enabled ] );

Does a re-index for a file

public selectorPopup

void $FileAdminController->selectorPopup ( );

Outputs the file selector HTML

public selectorPopupSearch

void $FileAdminController->selectorPopupSearch ( );

Does the backend selector search

private stitchChunks

void $FileAdminController->stitchChunks ( string $dest_filename , string $code , string $num_chunks );

Stitch together the uploaded file from multiple chunks