Overview

Namespaces

  • Alpha
    • Controller
      • Front
    • Exception
    • Model
      • Type
    • Task
    • Util
      • Backup
      • Cache
      • Code
        • Highlight
        • Metric
      • Config
      • Convertor
      • Email
      • Extension
      • Feed
      • File
      • Graph
      • Helper
      • Http
        • Filter
        • Session
      • Image
      • Logging
      • Search
      • Security
    • View
      • Renderer
        • Html
        • Json
      • Widget

Classes

  • ActiveRecordController
  • ArticleController
  • AttachmentController
  • CacheController
  • Controller
  • DEnumController
  • ExcelController
  • FeedController
  • GenSecureQueryStringController
  • ImageController
  • IndexController
  • InstallController
  • ListActiveRecordsController
  • LogController
  • LoginController
  • LogoutController
  • MetricController
  • PhpinfoController
  • RecordSelectorController
  • SearchController
  • SequenceController
  • TagController

Interfaces

  • ControllerInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class Controller

The master controller class for the Alpha Framework.

Direct known subclasses

Alpha\Controller\ActiveRecordController, Alpha\Controller\AttachmentController, Alpha\Controller\LogController, Alpha\Controller\LoginController, Alpha\Controller\LogoutController, Alpha\Controller\MetricController, Alpha\Controller\PhpinfoController, Alpha\Controller\RecordSelectorController, Alpha\Controller\SearchController, Alpha\Controller\CacheController, Alpha\Controller\ExcelController, Alpha\Controller\FeedController, Alpha\Controller\GenSecureQueryStringController, Alpha\Controller\ImageController, Alpha\Controller\IndexController, Alpha\Controller\InstallController, Alpha\Controller\ListActiveRecordsController

Indirect known subclasses

Alpha\Controller\ArticleController, Alpha\Controller\DEnumController, Alpha\Controller\SequenceController, Alpha\Controller\TagController
Abstract
Namespace: Alpha\Controller
Copyright: Copyright (c) 2016, John Collins (founder of Alpha Framework). All rights reserved. <pre> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Alpha Framework nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </pre>
License: The BSD License
Author: John Collins <dev@alphaframework.org>
Since: 1.0
Located at Controller/Controller.php
Methods summary
public
# __construct( string $visibility = 'Public' )

Constructor for the Controller that starts a new session if required, and handles the population of new/dirty objects from the session when available. Accepts the name of the rights group that has access to this controller, 'Public' by default.

Constructor for the Controller that starts a new session if required, and handles the population of new/dirty objects from the session when available. Accepts the name of the rights group that has access to this controller, 'Public' by default.

Parameters

$visibility
string $visibility The name of the rights group that can access this controller.

Since

1.0
public mixed
# getRecord( )

Get the record for this controller (if any).

Get the record for this controller (if any).

Returns

mixed
mixed

Since

1.0
public
# setRecord( Alpha\Model\ActiveRecord $record )

Setter for the record for this controller.

Setter for the record for this controller.

Parameters

$record
Alpha\Model\ActiveRecord $record

Since

1.0
public string
# getName( )

Get the name of the unit of work job.

Get the name of the unit of work job.

Returns

string
string

Since

1.0
public
# setName( string $name )

Setter for the unit of work job name.

Setter for the unit of work job name.

Parameters

$name
string $name The fully-qualified controller class name, or an absolute URL.

Since

1.0
public string
# getVisibility( )

Get the name of the rights group that has access to this controller.

Get the name of the rights group that has access to this controller.

Returns

string
string

Since

1.0
public
# setVisibility( string $visibility )

Setter for the name of the rights group that has access to this controller.

Setter for the name of the rights group that has access to this controller.

Parameters

$visibility
string $visibility

Since

1.0
public string
# getFirstJob( )

Gets the name of the first job in this unit of work.

Gets the name of the first job in this unit of work.

Returns

string
The fully-qualified controller class name, or an absolute URL.

Since

1.0
public string
# getNextJob( )

Gets the name of the next job in this unit of work.

Gets the name of the next job in this unit of work.

Returns

string
The fully-qualified controller class name, or an absolute URL.

Since

1.0
public string
# getPreviousJob( )

Gets the name of the previous job in this unit of work.

Gets the name of the previous job in this unit of work.

Returns

string
The fully-qualified controller class name, or an absolute URL.

Since

1.0
public string
# getLastJob( )

Gets the name of the last job in this unit of work.

Gets the name of the last job in this unit of work.

Returns

string
The fully-qualified controller class name, or an absolute URL.

Since

1.0
public
# setUnitOfWork( array $jobs )

Sets the name of the controller job sequence to the values in the supplied array (and stores the array in the session).

Sets the name of the controller job sequence to the values in the supplied array (and stores the array in the session).

Parameters

$jobs
array $jobs The names of the controllers in this unit of work sequence. Will accept fully-qualified controller class name, or an absolute URL.

Throws

Alpha\Exception\IllegalArguementException
Alpha\Exception\IllegalArguementException

Since

1.0
public Alpha\Model\Type\Timestamp
# getStartTime( )

Getter for the unit start time.

Getter for the unit start time.

Returns

Alpha\Model\Type\Timestamp
Timestamp

Since

1.0
public
# setUnitStartTime( integer $year, integer $month, integer $day, integer $hour, integer $minute, integer $second )

Setter for the unit start time (value will be stored in the session as key unitStartTime).

Setter for the unit start time (value will be stored in the session as key unitStartTime).

Parameters

$year
int $year
$month
int $month
$day
int $day
$hour
int $hour
$minute
int $minute
$second
int $second

Since

1.0
public Alpha\Model\Type\Timestamp
# getEndTime( )

Getter for the unit end time.

Getter for the unit end time.

Returns

Alpha\Model\Type\Timestamp
Alpha\Model\Type\Timestamp

Since

1.0
public
# setUnitEndTime( integer $year, integer $month, integer $day, integer $hour, integer $minute, integer $second )

Setter for the unit end time (value will be stored in the session as key unitEndTime).

Setter for the unit end time (value will be stored in the session as key unitEndTime).

Parameters

$year
int $year
$month
int $month
$day
int $day
$hour
int $hour
$minute
int $minute
$second
int $second

Since

1.0
public integer
# getMAXDuration( )

Getter for the unit of work MAX duration.

Getter for the unit of work MAX duration.

Returns

integer
int

Since

1.0
public
# setUnitMAXDuration( integer $duration )

Setter for the unit MAX duration.

Setter for the unit MAX duration.

Parameters

$duration
int $duration The desired duration in seconds.

Since

1.0
public integer
# getUnitDuration( )

Calculates and returns the unit of work current duration in seconds.

Calculates and returns the unit of work current duration in seconds.

Returns

integer
int

Since

1.0
public
# markDirty( Alpha\Model\ActiveRecord $object )

Adds the supplied business object to the dirtyObjects array in the session.

Adds the supplied business object to the dirtyObjects array in the session.

Parameters

$object
Alpha\Model\ActiveRecord $object

Since

1.0
public array
# getDirtyObjects( )

Getter for the dirty objects array.

Getter for the dirty objects array.

Returns

array
array

Since

1.0
public
# markNew( Alpha\Model\ActiveRecord $object )

Adds a newly created business object to the newObjects array in the session.

Adds a newly created business object to the newObjects array in the session.

Parameters

$object
Alpha\Model\ActiveRecord $object

Since

1.0
public array
# getNewObjects( )

Getter for the new objects array.

Getter for the new objects array.

Returns

array
array

Since

1.0
public
# commit( )

Commits (saves) all of the new and modified (dirty) objects in the unit of work to the database.

Commits (saves) all of the new and modified (dirty) objects in the unit of work to the database.

Throws

Alpha\Exception\FailedUnitCommitException
FailedUnitCommitException

Since

1.0
public
# abort( )

Method to clearup a cancelled unit of work.

Method to clearup a cancelled unit of work.

Throws

Alpha\Exception\AlphaException
Alpha\Exception\AlphaException

Since

1.0
public
# clearUnitOfWorkAttributes( )

Clears the session and object attributes related to unit of work sessions.

Clears the session and object attributes related to unit of work sessions.

Since

1.0
public string
# getTitle( )

Getter for the page title.

Getter for the page title.

Returns

string
string

Since

1.0
public
# setTitle( string $title )

Setter for the page title.

Setter for the page title.

Parameters

$title
string $title

Since

1.0
public string
# getDescription( )

Getter for the page description.

Getter for the page description.

Returns

string
string

Since

1.0
public
# setDescription( string $description )

Setter for the page description.

Setter for the page description.

Parameters

$description
string $description

Since

1.0
public string
# getKeywords( )

Getter for the page keywords.

Getter for the page keywords.

Returns

string
string

Since

1.0
public
# setKeywords( string $keywords )

Setter for the page keywords, should pass a comma-seperated list as a string.

Setter for the page keywords, should pass a comma-seperated list as a string.

Parameters

$keywords
string $keywords

Since

1.0
public Alpha\Util\Http\Response
# accessError( )

Method to return an access error for trespassing users. HTTP response header code will be 403.

Method to return an access error for trespassing users. HTTP response header code will be 403.

Returns

Alpha\Util\Http\Response
Alpha\Util\Http\Response

Since

1.0
public boolean
# 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.

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.

Returns

boolean
bool

Since

1.0
public boolean
# 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.

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.

Returns

boolean
bool

Since

1.0
public static array
# generateSecurityFields( )

Generates the two security fields to prevent remote form processing.

Generates the two security fields to prevent remote form processing.

Returns

array
An array containing the two fields

Since

1.0
public static string
# getCustomControllerName( string $ActiveRecordType )

Returns the name of a custom controller if one is found, otherwise returns null.

Returns the name of a custom controller if one is found, otherwise returns null.

Parameters

$ActiveRecordType
string $ActiveRecordType The classname of the active record

Returns

string
string

Since

1.0
public
# setStatusMessage( string $message )

Set the status message in the session to the value provided.

Set the status message in the session to the value provided.

Parameters

$message
string $message

Since

1.0
public string
# 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.

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.

Returns

string
string

Since

1.0
public static
# loadControllerDef( string $controllerName )

Loads the definition for the controller classname provided.

Loads the definition for the controller classname provided.

Parameters

$controllerName
string $controllerName

Throws

Alpha\Exception\IllegalArguementException
Alpha\Exception\IllegalArguementException

Since

1.0
public boolean
# checkIfAccessingFromSecureURL( )

Method for determining if the current request URL is a secure one (has a tk string or not).

Method for determining if the current request URL is a secure one (has a tk string or not).

Returns

boolean
True if the current URL contains a tk value, false otherwise

Since

1.0
public static string
# generateURLSlug( string $URLPart, string $seperator = '-', array $filter = array(), boolean $crc32Prefix = false )

Converts the supplied string to a "slug" that is URL safe and suitable for SEO.

Converts the supplied string to a "slug" that is URL safe and suitable for SEO.

Parameters

$URLPart
string $URLPart The part of the URL to use as the slug
$seperator
string $seperator The URL seperator to use (default is -)
$filter
array $filter An optional array of charactors to filter out
$crc32Prefix
bool $crc32Prefix Set to true if you want to prefix the slug with the CRC32 hash of the URLPart supplied

Returns

string
A URL slug

Since

1.2.4
public
# doHEAD( mixed $request )

Throws

Alpha\Exception\NotImplementedException
Alpha\Exception\NotImplementedException

Since

2.0
public
# doGET( mixed $request )

Throws

Alpha\Exception\NotImplementedException
Alpha\Exception\NotImplementedException

Since

2.0
public
# doPOST( mixed $request )

Throws

Alpha\Exception\NotImplementedException
Alpha\Exception\NotImplementedException

Since

2.0
public
# doPUT( mixed $request )

Throws

Alpha\Exception\NotImplementedException
Alpha\Exception\NotImplementedException

Since

2.0
public
# doPATCH( mixed $request )

Throws

Alpha\Exception\NotImplementedException
Alpha\Exception\NotImplementedException

Since

2.0
public
# doDELETE( mixed $request )

Throws

Alpha\Exception\NotImplementedException
Alpha\Exception\NotImplementedException

Since

2.0
public
# doOPTIONS( mixed $request )

Since

2.0
public
# doTRACE( mixed $request )

Since

2.0.2
public Alpha\Util\Http\Response
# process( Alpha\Util\Http\Request $request )

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.

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.

Parameters

$request
Alpha\Util\Http\Request $request

Returns

Alpha\Util\Http\Response
Alpha\Util\Http\Response

Since

2.0
public Alpha\Util\Http\Request
# getRequest( )

Get the request this controller is processing (if any).

Get the request this controller is processing (if any).

Returns

Alpha\Util\Http\Request
Alpha\Util\Http\Request

Since

2.0
public
# setRequest( Alpha\Util\Http\Request $request )

Set the request this controller is processing.

Set the request this controller is processing.

Parameters

$request
Alpha\Util\Http\Request $request

Since

2.0
public string
# after_displayPageHead_callback( )

Use this callback to inject in the admin menu template fragment.

Use this callback to inject in the admin menu template fragment.

Returns

string
string

Since

1.2
Properties summary
protected string $name
#

The name of the controller.

The name of the controller.

Since

1.0
protected string $visibility 'Public'
#

Used to set access privileages for the controller to the name of the rights group allowed to access it. 'Public' by default.

Used to set access privileages for the controller to the name of the rights group allowed to access it. 'Public' by default.

Since

1.0
protected Alpha\Model\ActiveRecord $record null
#

Optionally, the main record object that this controller is currently working with.

Optionally, the main record object that this controller is currently working with.

Since

1.0
protected string $unitOfWork
#

Used to determine if the controller is part of a unit of work sequence (either empty or the name of the unit).

Used to determine if the controller is part of a unit of work sequence (either empty or the name of the unit).

Since

1.0
protected Alpha\Model\Type\Timestamp $unitStartTime
#

Stores the start time of a unit of work transaction.

Stores the start time of a unit of work transaction.

Since

1.0
protected Alpha\Model\Type\Timestamp $unitEndTime
#

Stores the end time of a unit of work transaction.

Stores the end time of a unit of work transaction.

Since

1.0
protected Alpha\Model\Type\Integer $unitMAXDuration
#

Stores the maximum allowed time duration (in seconds) of the unit of work.

Stores the maximum allowed time duration (in seconds) of the unit of work.

Since

1.0
protected string $firstJob
#

The name of the first controller that is used in this unit of work.

The name of the first controller that is used in this unit of work.

Since

1.0
protected string $nextJob
#

The name of the next controller that is used in this unit of work.

The name of the next controller that is used in this unit of work.

Since

1.0
protected string $previousJob
#

The name of the previous controller that is used in this unit of work.

The name of the previous controller that is used in this unit of work.

Since

1.0
protected string $lastJob
#

The name of the last controller that is used in this unit of work.

The name of the last controller that is used in this unit of work.

Since

1.0
protected array $dirtyObjects array()
#

An array for storing dirty record objects in a session (i.e. persistent business objects that have not been updated in the database yet).

An array for storing dirty record objects in a session (i.e. persistent business objects that have not been updated in the database yet).

Since

1.0
protected array $newObjects array()
#

An array for storing new reord objects in a session (transient business objects that have no OID yet).

An array for storing new reord objects in a session (transient business objects that have no OID yet).

Since

1.0
protected string $title
#

The title to be displayed on the controller page.

The title to be displayed on the controller page.

Since

1.0
protected string $keywords
#

Meta keywords for the controller page, generally populated from tags.

Meta keywords for the controller page, generally populated from tags.

Since

1.0
protected string $description
#

Meta description for the controller page.

Meta description for the controller page.

Since

1.0
protected string $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.

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.

Since

1.0
protected Alpha\Util\Http\Request $request
#

The request that has been passed to this controller for processing.

The request that has been passed to this controller for processing.

Since

2.0
Alpha Framework 2.0.4 API Documentation API documentation generated by ApiGen 2.8.0