AttachmentController
        
        extends Controller
    
    
            
            in package
            
        
    
            
            implements
                            ControllerInterface                    
    
    
Controller used to view (download) an attachment file on an Article.
Tags
Table of Contents
Interfaces
- ControllerInterface
- The interface for all page controllers.
Properties
- $description : string
- Meta description for the controller page.
- $dirtyObjects : array<string|int, mixed>
- An array for storing dirty record objects in a session (i.e. persistent business objects that have not been updated in the database yet).
- $firstJob : string
- The name of the first controller that is used in this unit of work.
- $keywords : string
- Meta keywords for the controller page, generally populated from tags.
- $lastJob : string
- The name of the last controller that is used in this unit of work.
- $name : string
- The name of the controller.
- $newObjects : array<string|int, mixed>
- An array for storing new reord objects in a session (transient business objects that have no ID yet).
- $nextJob : string
- The name of the next controller that is used in this unit of work.
- $previousJob : string
- The name of the previous controller that is used in this unit of work.
- $record : ActiveRecord
- Optionally, the main record object that this controller is currently working with.
- $request : Request
- The request that has been passed to this controller for processing.
- $statusMessage : string
- Used to set status update messages to display to the user (messages stored between requests in session). Useful for when you want to display a message to a user after POSTing a request, or when moving from one page to the next.
- $title : string
- The title to be displayed on the controller page.
- $unitEndTime : Timestamp
- Stores the end time of a unit of work transaction.
- $unitOfWork : string
- Used to determine if the controller is part of a unit of work sequence (either empty or the name of the unit).
- $unitStartTime : Timestamp
- Stores the start time of a unit of work transaction.
- $visibility : string
- Used to set access privileages for the controller to the name of the rights group allowed to access it. 'Public' by default.
- $logger : Logger
- Trace logger.
Methods
- __construct() : mixed
- The constructor.
- abort() : void
- Method to clearup a cancelled unit of work.
- accessError() : Response
- Method to return an access error for trespassing users. HTTP response header code will be 403.
- afterDisplayPageHead() : string
- Use this callback to inject in the admin menu template fragment.
- checkControllerDefExists() : bool
- Checks that the definition for the controller classname provided exists. Will also return true if you pass "/" for the root of the web application.
- checkIfAccessingFromSecureURL() : bool
- Method for determining if the current request URL is a secure one (has a tk string or not).
- checkRights() : bool
- Checks the user rights of the currently logged-in person against the page visibility set for this controller. Will return false if the user has not got the correct rights.
- checkSecurityFields() : bool
- Method to check the validity of the two hidden form security fields which aim to ensure that a post to the controller is being sent from the same server that is hosting it.
- clearUnitOfWorkAttributes() : void
- Clears the session and object attributes related to unit of work sessions.
- commit() : void
- Commits (saves) all of the new and modified (dirty) objects in the unit of work to the database.
- doDELETE() : Response
- {@inheritdoc}
- doGET() : Response
- Handle GET requests.
- doHEAD() : Response
- {@inheritdoc}
- doOPTIONS() : Response
- {@inheritdoc}
- doPATCH() : Response
- {@inheritdoc}
- doPOST() : Response
- {@inheritdoc}
- doPUT() : Response
- Handle PUT requests.
- doTRACE() : Response
- {@inheritdoc}
- generateSecurityFields() : array<string|int, mixed>
- Generates the two security fields to prevent remote form processing, returned as an array.
- generateURLSlug() : string
- Converts the supplied string to a "slug" that is URL safe and suitable for SEO.
- getCustomControllerName() : string|null
- Returns the name of a custom controller if one is found, otherwise returns null.
- getDescription() : string|null
- Getter for the page description.
- getDirtyObjects() : array<string|int, mixed>
- Getter for the dirty objects array.
- getEndTime() : Timestamp
- Getter for the unit end time.
- getFirstJob() : string|null
- Gets the name of the first job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
- getKeywords() : string|null
- Getter for the page keywords.
- getLastJob() : string|null
- Gets the name of the last job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
- getName() : string
- Get the name of the unit of work job.
- getNewObjects() : array<string|int, mixed>
- Getter for the new objects array.
- getNextJob() : string|null
- Gets the name of the next job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
- getPreviousJob() : string|null
- Gets the name of the previous job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
- getRecord() : ActiveRecord|null
- Get the record for this controller (if any).
- getRequest() : Request
- Get the request this controller is processing (if any).
- getStartTime() : Timestamp
- Getter for the unit start time.
- getStatusMessage() : string|null
- Gets the current status message for this controller. Note that by getting the current status message, you clear out the value stored in the session so this method can only be used to get the status message once for display purposes.
- getTitle() : string
- Getter for the page title.
- getUnitDuration() : int
- Calculates and returns the unit of work current duration in seconds.
- getVisibility() : string
- Get the name of the rights group that has access to this controller.
- loadControllerDef() : void
- Loads the definition for the controller classname provided.
- markDirty() : void
- Adds the supplied business object to the dirtyObjects array in the session.
- markNew() : void
- Adds a newly created business object to the newObjects array in the session.
- process() : Response
- Maps the supplied request with the appropiate method to run on this controller, for example GET to doGET(), POST to doPOST() etc. Returns the response generated by the method called.
- setDescription() : void
- Setter for the page description.
- setKeywords() : void
- Setter for the page keywords, should pass a comma-seperated list as a string.
- setName() : void
- Setter for the unit of work job name.
- setRecord() : void
- Setter for the record for this controller.
- setRequest() : void
- Set the request this controller is processing.
- setStatusMessage() : void
- Set the status message in the session to the value provided.
- setTitle() : void
- Setter for the page title.
- setUnitEndTime() : void
- Setter for the unit end time (value will be stored in the session as key unitEndTime).
- setUnitOfWork() : void
- Sets the name of the controller job sequence to the values in the supplied array (and stores the array in the session).
- setUnitStartTime() : void
- Setter for the unit start time (value will be stored in the session as key unitStartTime).
- setVisibility() : void
- Setter for the name of the rights group that has access to this controller.
- decryptFieldNames() : array<string|int, mixed>
- Descrypts the HTTP param fieldnames in the array provided and returns the plain version.
Properties
$description
Meta description for the controller page.
    protected
        string
    $description
    
    
    
    
    Tags
$dirtyObjects
An array for storing dirty record objects in a session (i.e. persistent business objects that have not been updated in the database yet).
    protected
        array<string|int, mixed>
    $dirtyObjects
     = array()
    
    
    
    Tags
$firstJob
The name of the first controller that is used in this unit of work.
    protected
        string
    $firstJob
    
    
    
    
    Tags
$keywords
Meta keywords for the controller page, generally populated from tags.
    protected
        string
    $keywords
    
    
    
    
    Tags
$lastJob
The name of the last controller that is used in this unit of work.
    protected
        string
    $lastJob
    
    
    
    
    Tags
$name
The name of the controller.
    protected
        string
    $name
    
    
    
    
    Tags
$newObjects
An array for storing new reord objects in a session (transient business objects that have no ID yet).
    protected
        array<string|int, mixed>
    $newObjects
     = array()
    
    
    
    Tags
$nextJob
The name of the next controller that is used in this unit of work.
    protected
        string
    $nextJob
    
    
    
    
    Tags
$previousJob
The name of the previous controller that is used in this unit of work.
    protected
        string
    $previousJob
    
    
    
    
    Tags
$record
Optionally, the main record object that this controller is currently working with.
    protected
        ActiveRecord
    $record
     = null
    
    
    
    Tags
$request
The request that has been passed to this controller for processing.
    protected
        Request
    $request
    
    
    
    
    Tags
$statusMessage
Used to set status update messages to display to the user (messages stored between requests in session). Useful for when you want to display a message to a user after POSTing a request, or when moving from one page to the next.
    protected
        string
    $statusMessage
    
    
    
    
    Tags
$title
The title to be displayed on the controller page.
    protected
        string
    $title
    
    
    
    
    Tags
$unitEndTime
Stores the end time of a unit of work transaction.
    protected
        Timestamp
    $unitEndTime
    
    
    
    
    Tags
$unitOfWork
Used to determine if the controller is part of a unit of work sequence (either empty or the name of the unit).
    protected
        string
    $unitOfWork
    
    
    
    
    Tags
$unitStartTime
Stores the start time of a unit of work transaction.
    protected
        Timestamp
    $unitStartTime
    
    
    
    
    Tags
$visibility
Used to set access privileages for the controller to the name of the rights group allowed to access it. 'Public' by default.
    protected
        string
    $visibility
     = 'Public'
    
    
    
    Tags
$logger
Trace logger.
    private
    static    Logger
    $logger
     = null
    
    
    
    Tags
Methods
__construct()
The constructor.
    public
                    __construct() : mixed
    Tags
abort()
Method to clearup a cancelled unit of work.
    public
                    abort() : void
    Tags
accessError()
Method to return an access error for trespassing users. HTTP response header code will be 403.
    public
                    accessError() : Response
    Tags
Return values
ResponseafterDisplayPageHead()
Use this callback to inject in the admin menu template fragment.
    public
                    afterDisplayPageHead() : string
    Tags
Return values
stringcheckControllerDefExists()
Checks that the definition for the controller classname provided exists. Will also return true if you pass "/" for the root of the web application.
    public
            static        checkControllerDefExists(string $controllerName) : bool
    Parameters
- $controllerName : string
Tags
Return values
boolcheckIfAccessingFromSecureURL()
Method for determining if the current request URL is a secure one (has a tk string or not).
    public
                    checkIfAccessingFromSecureURL() : bool
    Tags
Return values
boolcheckRights()
Checks the user rights of the currently logged-in person against the page visibility set for this controller. Will return false if the user has not got the correct rights.
    public
                    checkRights() : bool
    Tags
Return values
boolcheckSecurityFields()
Method to check the validity of the two hidden form security fields which aim to ensure that a post to the controller is being sent from the same server that is hosting it.
    public
                    checkSecurityFields() : bool
    Tags
Return values
boolclearUnitOfWorkAttributes()
Clears the session and object attributes related to unit of work sessions.
    public
                    clearUnitOfWorkAttributes() : void
    Tags
commit()
Commits (saves) all of the new and modified (dirty) objects in the unit of work to the database.
    public
                    commit() : void
    Tags
doDELETE()
{@inheritdoc}
    public
                    doDELETE(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsedoGET()
Handle GET requests.
    public
                    doGET(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsedoHEAD()
{@inheritdoc}
    public
                    doHEAD(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsedoOPTIONS()
{@inheritdoc}
    public
                    doOPTIONS(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsedoPATCH()
{@inheritdoc}
    public
                    doPATCH(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsedoPOST()
{@inheritdoc}
    public
                    doPOST(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsedoPUT()
Handle PUT requests.
    public
                    doPUT(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsedoTRACE()
{@inheritdoc}
    public
                    doTRACE(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsegenerateSecurityFields()
Generates the two security fields to prevent remote form processing, returned as an array.
    public
            static        generateSecurityFields() : array<string|int, mixed>
    Tags
Return values
array<string|int, mixed>generateURLSlug()
Converts the supplied string to a "slug" that is URL safe and suitable for SEO.
    public
            static        generateURLSlug(string $URLPart[, string $seperator = '-' ][, array<string|int, mixed> $filter = array() ][, bool $crc32Prefix = false ]) : string
    Parameters
- $URLPart : string
- 
                    The part of the URL to use as the slug 
- $seperator : string = '-'
- 
                    The URL seperator to use (default is -) 
- $filter : array<string|int, mixed> = array()
- 
                    An optional array of charactors to filter out 
- $crc32Prefix : bool = false
- 
                    Set to true if you want to prefix the slug with the CRC32 hash of the URLPart supplied 
Tags
Return values
stringgetCustomControllerName()
Returns the name of a custom controller if one is found, otherwise returns null.
    public
            static        getCustomControllerName(string $ActiveRecordType) : string|null
    Parameters
- $ActiveRecordType : string
- 
                    The classname of the active record 
Tags
Return values
string|nullgetDescription()
Getter for the page description.
    public
                    getDescription() : string|null
    Tags
Return values
string|nullgetDirtyObjects()
Getter for the dirty objects array.
    public
                    getDirtyObjects() : array<string|int, mixed>
    Tags
Return values
array<string|int, mixed>getEndTime()
Getter for the unit end time.
    public
                    getEndTime() : Timestamp
    Tags
Return values
TimestampgetFirstJob()
Gets the name of the first job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
    public
                    getFirstJob() : string|null
    Tags
Return values
string|nullgetKeywords()
Getter for the page keywords.
    public
                    getKeywords() : string|null
    Tags
Return values
string|nullgetLastJob()
Gets the name of the last job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
    public
                    getLastJob() : string|null
    Tags
Return values
string|nullgetName()
Get the name of the unit of work job.
    public
                    getName() : string
    Tags
Return values
stringgetNewObjects()
Getter for the new objects array.
    public
                    getNewObjects() : array<string|int, mixed>
    Tags
Return values
array<string|int, mixed>getNextJob()
Gets the name of the next job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
    public
                    getNextJob() : string|null
    Tags
Return values
string|nullgetPreviousJob()
Gets the name of the previous job in this unit of work. Returns the fully-qualified controller class name, or an absolute URL.
    public
                    getPreviousJob() : string|null
    Tags
Return values
string|nullgetRecord()
Get the record for this controller (if any).
    public
                    getRecord() : ActiveRecord|null
    Tags
Return values
ActiveRecord|nullgetRequest()
Get the request this controller is processing (if any).
    public
                    getRequest() : Request
    Tags
Return values
RequestgetStartTime()
Getter for the unit start time.
    public
                    getStartTime() : Timestamp
    Tags
Return values
TimestampgetStatusMessage()
Gets the current status message for this controller. Note that by getting the current status message, you clear out the value stored in the session so this method can only be used to get the status message once for display purposes.
    public
                    getStatusMessage() : string|null
    Tags
Return values
string|nullgetTitle()
Getter for the page title.
    public
                    getTitle() : string
    Tags
Return values
stringgetUnitDuration()
Calculates and returns the unit of work current duration in seconds.
    public
                    getUnitDuration() : int
    Tags
Return values
intgetVisibility()
Get the name of the rights group that has access to this controller.
    public
                    getVisibility() : string
    Tags
Return values
stringloadControllerDef()
Loads the definition for the controller classname provided.
    public
            static        loadControllerDef(string $controllerName) : void
    Parameters
- $controllerName : string
Tags
markDirty()
Adds the supplied business object to the dirtyObjects array in the session.
    public
                    markDirty(ActiveRecord $object) : void
    Parameters
- $object : ActiveRecord
Tags
markNew()
Adds a newly created business object to the newObjects array in the session.
    public
                    markNew(ActiveRecord $object) : void
    Parameters
- $object : ActiveRecord
Tags
process()
Maps the supplied request with the appropiate method to run on this controller, for example GET to doGET(), POST to doPOST() etc. Returns the response generated by the method called.
    public
                    process(Request $request) : Response
    Parameters
- $request : Request
Tags
Return values
ResponsesetDescription()
Setter for the page description.
    public
                    setDescription(string $description) : void
    Parameters
- $description : string
Tags
setKeywords()
Setter for the page keywords, should pass a comma-seperated list as a string.
    public
                    setKeywords(string $keywords) : void
    Parameters
- $keywords : string
Tags
setName()
Setter for the unit of work job name.
    public
                    setName(string $name) : void
    Parameters
- $name : string
- 
                    The fully-qualified controller class name, or an absolute URL. 
Tags
setRecord()
Setter for the record for this controller.
    public
                    setRecord(ActiveRecord $record) : void
    Parameters
- $record : ActiveRecord
Tags
setRequest()
Set the request this controller is processing.
    public
                    setRequest(Request $request) : void
    Parameters
- $request : Request
Tags
setStatusMessage()
Set the status message in the session to the value provided.
    public
                    setStatusMessage(string $message) : void
    Parameters
- $message : string
Tags
setTitle()
Setter for the page title.
    public
                    setTitle(string $title) : void
    Parameters
- $title : string
Tags
setUnitEndTime()
Setter for the unit end time (value will be stored in the session as key unitEndTime).
    public
                    setUnitEndTime(int $year, int $month, int $day, int $hour, int $minute, int $second) : void
    Parameters
- $year : int
- $month : int
- $day : int
- $hour : int
- $minute : int
- $second : int
Tags
setUnitOfWork()
Sets the name of the controller job sequence to the values in the supplied array (and stores the array in the session).
    public
                    setUnitOfWork(array<string|int, mixed> $jobs) : void
    Parameters
- $jobs : array<string|int, mixed>
- 
                    The names of the controllers in this unit of work sequence. Will accept fully-qualified controller class name, or an absolute URL. 
Tags
setUnitStartTime()
Setter for the unit start time (value will be stored in the session as key unitStartTime).
    public
                    setUnitStartTime(int $year, int $month, int $day, int $hour, int $minute, int $second) : void
    Parameters
- $year : int
- $month : int
- $day : int
- $hour : int
- $minute : int
- $second : int
Tags
setVisibility()
Setter for the name of the rights group that has access to this controller.
    public
                    setVisibility(string $visibility) : void
    Parameters
- $visibility : string
Tags
decryptFieldNames()
Descrypts the HTTP param fieldnames in the array provided and returns the plain version.
    private
                    decryptFieldNames( $params) : array<string|int, mixed>