AttachmentController extends Controller implements ControllerInterface
Controller used to view (download) an attachment file on an Article.
Tags
Interfaces, Classes and Traits
- ControllerInterface
- The interface for all page controllers.
Table of Contents
- $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.
- $unitMAXDuration : Integer
- Stores the maximum allowed time duration (in seconds) of the unit of work.
- $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.
- __construct() : mixed
- The constructor.
- abort() : mixed
- 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.
- after_displayPageHead_callback() : 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() : mixed
- Clears the session and object attributes related to unit of work sessions.
- commit() : mixed
- Commits (saves) all of the new and modified (dirty) objects in the unit of work to the database.
- doDELETE() : mixed
- {@inheritdoc}
- doGET() : mixed
- Handle GET requests.
- doHEAD() : mixed
- {@inheritdoc}
- doOPTIONS() : mixed
- {@inheritdoc}
- doPATCH() : mixed
- {@inheritdoc}
- doPOST() : mixed
- {@inheritdoc}
- doPUT() : mixed
- Handle PUT requests.
- doTRACE() : mixed
- {@inheritdoc}
- generateSecurityFields() : array<string|int, string>
- Generates the two security fields to prevent remote form processing.
- generateURLSlug() : string
- Converts the supplied string to a "slug" that is URL safe and suitable for SEO.
- getCustomControllerName() : string
- Returns the name of a custom controller if one is found, otherwise returns null.
- getDescription() : string
- 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
- Gets the name of the first job in this unit of work.
- getKeywords() : string
- Getter for the page keywords.
- getLastJob() : string
- Gets the name of the last job in this unit of work.
- getMAXDuration() : int
- Getter for the unit of work MAX duration.
- getName() : string
- Get the name of the unit of work job.
- getNewObjects() : array<string|int, mixed>
- Getter for the new objects array.
- getNextJob() : string
- Gets the name of the next job in this unit of work.
- getPreviousJob() : string
- Gets the name of the previous job in this unit of work.
- getRecord() : ActiveRecord
- 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
- 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() : mixed
- Loads the definition for the controller classname provided.
- markDirty() : mixed
- Adds the supplied business object to the dirtyObjects array in the session.
- markNew() : mixed
- 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() : mixed
- Setter for the page description.
- setKeywords() : mixed
- Setter for the page keywords, should pass a comma-seperated list as a string.
- setName() : mixed
- Setter for the unit of work job name.
- setRecord() : mixed
- Setter for the record for this controller.
- setRequest() : mixed
- Set the request this controller is processing.
- setStatusMessage() : mixed
- Set the status message in the session to the value provided.
- setTitle() : mixed
- Setter for the page title.
- setUnitEndTime() : mixed
- Setter for the unit end time (value will be stored in the session as key unitEndTime).
- setUnitMAXDuration() : mixed
- Setter for the unit MAX duration.
- setUnitOfWork() : mixed
- Sets the name of the controller job sequence to the values in the supplied array (and stores the array in the session).
- setUnitStartTime() : mixed
- Setter for the unit start time (value will be stored in the session as key unitStartTime).
- setVisibility() : mixed
- 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
$unitMAXDuration
Stores the maximum allowed time duration (in seconds) of the unit of work.
protected
Integer
$unitMAXDuration
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
Return values
mixed —abort()
Method to clearup a cancelled unit of work.
public
abort() : mixed
Tags
Return values
mixed —accessError()
Method to return an access error for trespassing users. HTTP response header code will be 403.
public
accessError() : Response
Tags
Return values
Response —after_displayPageHead_callback()
Use this callback to inject in the admin menu template fragment.
public
after_displayPageHead_callback() : string
Tags
Return values
string —checkControllerDefExists()
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
bool —checkIfAccessingFromSecureURL()
Method for determining if the current request URL is a secure one (has a tk string or not).
public
checkIfAccessingFromSecureURL() : bool
Tags
Return values
bool —True if the current URL contains a tk value, false otherwise
checkRights()
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
bool —checkSecurityFields()
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
bool —clearUnitOfWorkAttributes()
Clears the session and object attributes related to unit of work sessions.
public
clearUnitOfWorkAttributes() : mixed
Tags
Return values
mixed —commit()
Commits (saves) all of the new and modified (dirty) objects in the unit of work to the database.
public
commit() : mixed
Tags
Return values
mixed —doDELETE()
{@inheritdoc}
public
doDELETE(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —doGET()
Handle GET requests.
public
doGET(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —doHEAD()
{@inheritdoc}
public
doHEAD(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —doOPTIONS()
{@inheritdoc}
public
doOPTIONS(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —doPATCH()
{@inheritdoc}
public
doPATCH(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —doPOST()
{@inheritdoc}
public
doPOST(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —doPUT()
Handle PUT requests.
public
doPUT(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —doTRACE()
{@inheritdoc}
public
doTRACE(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —generateSecurityFields()
Generates the two security fields to prevent remote form processing.
public
static generateSecurityFields() : array<string|int, string>
Tags
Return values
array<string|int, string> —An array containing the two fields
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
string —A URL slug
getCustomControllerName()
Returns the name of a custom controller if one is found, otherwise returns null.
public
static getCustomControllerName(string $ActiveRecordType) : string
Parameters
- $ActiveRecordType : string
-
The classname of the active record
Tags
Return values
string —getDescription()
Getter for the page description.
public
getDescription() : string
Tags
Return values
string —getDirtyObjects()
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
Timestamp —getFirstJob()
Gets the name of the first job in this unit of work.
public
getFirstJob() : string
Tags
Return values
string —The fully-qualified controller class name, or an absolute URL.
getKeywords()
Getter for the page keywords.
public
getKeywords() : string
Tags
Return values
string —getLastJob()
Gets the name of the last job in this unit of work.
public
getLastJob() : string
Tags
Return values
string —The fully-qualified controller class name, or an absolute URL.
getMAXDuration()
Getter for the unit of work MAX duration.
public
getMAXDuration() : int
Tags
Return values
int —getName()
Get the name of the unit of work job.
public
getName() : string
Tags
Return values
string —getNewObjects()
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.
public
getNextJob() : string
Tags
Return values
string —The fully-qualified controller class name, or an absolute URL.
getPreviousJob()
Gets the name of the previous job in this unit of work.
public
getPreviousJob() : string
Tags
Return values
string —The fully-qualified controller class name, or an absolute URL.
getRecord()
Get the record for this controller (if any).
public
getRecord() : ActiveRecord
Tags
Return values
ActiveRecord —getRequest()
Get the request this controller is processing (if any).
public
getRequest() : Request
Tags
Return values
Request —getStartTime()
Getter for the unit start time.
public
getStartTime() : Timestamp
Tags
Return values
Timestamp —getStatusMessage()
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
Tags
Return values
string —getTitle()
Getter for the page title.
public
getTitle() : string
Tags
Return values
string —getUnitDuration()
Calculates and returns the unit of work current duration in seconds.
public
getUnitDuration() : int
Tags
Return values
int —getVisibility()
Get the name of the rights group that has access to this controller.
public
getVisibility() : string
Tags
Return values
string —loadControllerDef()
Loads the definition for the controller classname provided.
public
static loadControllerDef(string $controllerName) : mixed
Parameters
- $controllerName : string
Tags
Return values
mixed —markDirty()
Adds the supplied business object to the dirtyObjects array in the session.
public
markDirty(ActiveRecord $object) : mixed
Parameters
- $object : ActiveRecord
Tags
Return values
mixed —markNew()
Adds a newly created business object to the newObjects array in the session.
public
markNew(ActiveRecord $object) : mixed
Parameters
- $object : ActiveRecord
Tags
Return values
mixed —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
Response —setDescription()
Setter for the page description.
public
setDescription(string $description) : mixed
Parameters
- $description : string
Tags
Return values
mixed —setKeywords()
Setter for the page keywords, should pass a comma-seperated list as a string.
public
setKeywords(string $keywords) : mixed
Parameters
- $keywords : string
Tags
Return values
mixed —setName()
Setter for the unit of work job name.
public
setName(string $name) : mixed
Parameters
- $name : string
-
The fully-qualified controller class name, or an absolute URL.
Tags
Return values
mixed —setRecord()
Setter for the record for this controller.
public
setRecord(ActiveRecord $record) : mixed
Parameters
- $record : ActiveRecord
Tags
Return values
mixed —setRequest()
Set the request this controller is processing.
public
setRequest(Request $request) : mixed
Parameters
- $request : Request
Tags
Return values
mixed —setStatusMessage()
Set the status message in the session to the value provided.
public
setStatusMessage(string $message) : mixed
Parameters
- $message : string
Tags
Return values
mixed —setTitle()
Setter for the page title.
public
setTitle(string $title) : mixed
Parameters
- $title : string
Tags
Return values
mixed —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) : mixed
Parameters
- $year : int
- $month : int
- $day : int
- $hour : int
- $minute : int
- $second : int
Tags
Return values
mixed —setUnitMAXDuration()
Setter for the unit MAX duration.
public
setUnitMAXDuration(int $duration) : mixed
Parameters
- $duration : int
-
The desired duration in seconds.
Tags
Return values
mixed —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) : mixed
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
Return values
mixed —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) : mixed
Parameters
- $year : int
- $month : int
- $day : int
- $hour : int
- $minute : int
- $second : int
Tags
Return values
mixed —setVisibility()
Setter for the name of the rights group that has access to this controller.
public
setVisibility(string $visibility) : mixed
Parameters
- $visibility : string
Tags
Return values
mixed —decryptFieldNames()
Descrypts the HTTP param fieldnames in the array provided and returns the plain version.
private
decryptFieldNames( $params) : array<string|int, mixed>