SproutCMS

This is the code documentation for the SproutCMS project

class FileAdminController

Handles most of the processing for files

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-09
**/
class NewClassName extends FileAdminController {
    
    /**
    * Find usage of a given file
    **/
    public function _extraFindUsage (int $file_id) {
        // Method code goes here
    }
    
    /**
    * Renders a HTML subset containing a focal crop image
    **/
    public function previewFocalCrop (string $size, string $filename, string $focal_point_data) {
        // Method code goes here
    }
    
    /**
    * Provide the contents of a temporarily uploaded file, for e.g. listening to uploaded audio
    **/
    public function downloadTemp ($filename) {
        // Method code goes here
    }
    
    /**
    * Thumbnail view for files
    **/
    private function _getContentsViewThumb ($items, $category) {
        // Method code goes here
    }
    
    /**
    * 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 function previewTransform ($transform, $filename) {
        // Method code goes here
    }
    
    /**
    * Outputs the file selector HTML
    **/
    public function selectorPopup () {
        // Method code goes here
    }
    
    /**
    * Does the backend selector search
    **/
    public function selectorPopupSearch () {
        // Method code goes here
    }
    
    /**
    * List of links to redo the sizes
    **/
    public function _extraRedoSizes () {
        // Method code goes here
    }
    
    /**
    * Fixes files which don't have the sizes they should
    **/
    public function redoSizesAction () {
        // Method code goes here
    }
    
    /**
    * Return HTML for a resultset of items
    * The returned HTML will be sandwiched between the refinebar and the pagination bar.
    **/
    public function _getContentsView (Traversable $items, string $mode, StdClass $category) {
        // Method code goes here
    }
    
    /**
    * Does file cleanup - wrapper (cron)
    **/
    public function cronCleanupInvalid () {
        // Method code goes here
    }
    
    /**
    * Remove invalid files, such as:
    *  - Files without a name
    *  - Files without a type
    *  - Files which don't actually exist
    **/
    private function cleanupInvalidActionInner () {
        // Method code goes here
    }
    
    /**
    * Does file cleanup - wrapper (admin)
    **/
    public function cleanupInvalidAction () {
        // Method code goes here
    }
    
    /**
    * Provides a UI for doing a 'cleanup' - removes invalid files
    **/
    public function _extraCleanupInvalid () {
        // Method code goes here
    }
    
    /**
    * Return the list of sidebar tools
    **/
    public function _getTools () {
        // Method code goes here
    }
    
    /**
    * Does a re-index for a file
    **/
    private function reindexItem (int $item_id, string $name, string $plaintext, bool $enabled) {
        // Method code goes here
    }
    
    /**
    * Does a complete re-index of all files
    **/
    public function reindexAll () {
        // Method code goes here
    }
    
    /**
    * Process the results of a search.
    **/
    public function frontEndSearch (array $item_id, $relevancy, $keywords) {
        // Method code goes here
    }
    
    /**
    * Does a quick upload (from the fileselector)
    * Returns JSON.
    **/
    public function quickUpload () {
        // Method code goes here
    }
    
    /**
    * Used by the quick upload tool
    **/
    private function doUpload (int $category_id) {
        // Method code goes here
    }
    
    /**
    * Pre-render hook
    **/
    public function _editPreRender ($view, $item_id) {
        // Method code goes here
    }
    
    /**
    * Return the sub-actions for editing; for spec {@see AdminController::renderSubActions}
    **/
    public function _getEditSubActions ($item_id) {
        // Method code goes here
    }
    
    /**
    * 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 {@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 {@see FilesBackend}.
    **/
    public function _deleteSave (int $item_id) {
        // Method code goes here
    }
    
    /**
    * Saves the provided POST data into this file in the database
    **/
    public function _editSave (int $item_id) {
        // Method code goes here
    }
    
    /**
    * 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 function ajaxDragdropCancel () {
        // Method code goes here
    }
    
    /**
    * Matches user input against a list of possible authors for files
    **/
    public function ajaxAuthorLookup () {
        // Method code goes here
    }
    
    /**
    * Not used.
    **/
    public function _addSave ($item_id) {
        // Method code goes here
    }
    
    /**
    * Used by some AJAX stuff to return a JSON error
    **/
    private function ajaxErr ($message) {
        // Method code goes here
    }
    
    /**
    * 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
    **/
    public function ajaxDragdropSave () {
        // Method code goes here
    }
    
    /**
    * Save a single chunk of a multi-part file upload
    **/
    public function ajaxDragdropChunk () {
        // Method code goes here
    }
    
    /**
    * Stitch together uploaded chunks into an actual file
    * 
    * Outputs a JSON response.
    * The field &quot;success&quot; will be checked (= 1) to determine success.
    * On error, the field &quot;message&quot; will be used as an error message.
    * Other keys provided are passed to the ajaxDragdropForm method.
    **/
    public function ajaxDragdropDone () {
        // Method code goes here
    }
    
    /**
    * Returns the form for updating a file which has been uploaded
    **/
    public function ajaxDragdropForm () {
        // Method code goes here
    }
    
    /**
    * Stitch together the uploaded file from multiple chunks
    **/
    private function stitchChunks (string $dest_filename, string $code, string $num_chunks) {
        // Method code goes here
    }
    
    /**
    * Hook called by _getAddForm() just before the view is rendered
    **/
    protected function _addPreRender ($view) {
        // Method code goes here
    }
    
    /**
    * Is the &quot;add&quot; action saved?
    * These may be false if the UI provides its own save mechanism (e.g. multi-add)
    **/
    public function _isAddSaved () {
        // Method code goes here
    }
    
    /**
    * Return the fields to show in the sidebar when adding or editing a record.
    * These fields are shown under a heading of &quot;Visibility&quot;
    * 
    * Key is the field name, value is the field label
    **/
    public function _getVisibilityFields () {
        // Method code goes here
    }
    
    /**
    * Constructor
    **/
    public function __construct () {
        // Method code goes here
    }
    
}
?>