Overview

Packages

  • alpha::controller
  • alpha::controller::front
  • alpha::exceptions
  • alpha::model
  • alpha::model::types
  • alpha::tasks
  • alpha::tests
  • alpha::util
  • alpha::util::cache
  • alpha::util::codehighlight
  • alpha::util::convertors
  • alpha::util::feeds
  • alpha::util::filters
  • alpha::util::graphs
  • alpha::util::helpers
  • alpha::util::metrics
  • alpha::util::search
  • alpha::view
  • alpha::view::renderers
  • alpha::view::widgets

Classes

  • AlphaController
  • CacheManager
  • Create
  • CreateArticle
  • Detail
  • Edit
  • EditArticle
  • EditDEnum
  • EditTags
  • GenSecureQueryStrings
  • Install
  • ListAll
  • ListBusinessObjects
  • ListDEnums
  • ListSequences
  • Login
  • Logout
  • PreviewArticle
  • Search
  • TagManager
  • ViewArticle
  • ViewArticleFile
  • ViewArticlePDF
  • ViewArticlePrint
  • ViewArticleTitle
  • ViewAttachment
  • ViewExcel
  • ViewFeed
  • ViewImage
  • ViewLog
  • ViewMetrics
  • ViewRecordSelector
  • ViewTestResults

Interfaces

  • AlphaControllerInterface
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class AlphaController

The master controller class for the Alpha Framework.

Direct known subclasses

CacheManager, Create, Login, Logout, PreviewArticle, Search, TagManager, ViewArticle, ViewArticlePDF, ViewAttachment, ViewExcel, ViewFeed, CreateArticle, ViewImage, ViewLog, ViewMetrics, ViewRecordSelector, ViewTestResults, Detail, Edit, EditArticle, GenSecureQueryStrings, Install, ListAll, ListBusinessObjects

Indirect known subclasses

EditDEnum, EditTags, ListDEnums, ListSequences, ViewArticleFile, ViewArticlePrint, ViewArticleTitle
Abstract
Package: alpha::controller
Copyright: Copyright (c) 2014, John Collins (founder of Alpha Framework). All rights reserved.
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.

License: The BSD License
Author: John Collins <dev@alphaframework.org>
Version: $Id: AlphaController.inc 1796 2014-07-20 20:21:24Z alphadevx $
Since: 1.0
Located at controller/AlphaController.inc
Methods summary
public
# __construct( string $visibility = 'Public' )

Constructor for the AlphaController 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 AlphaController 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
# getBO( )

Get the BO for this controller (if any).

Get the BO for this controller (if any).

Returns

mixed

Since

1.0
public
# setBO( AlphaDAO $BO )

Setter for the BO for this controller.

Setter for the BO for this controller.

Parameters

$BO
AlphaDAO
$BO

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

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

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

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

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

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

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

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.

Throws

IllegalArguementException

Since

1.0
public Timestamp
# getStartTime( )

Getter for the unit start time.

Getter for the unit start time.

Returns

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
integer
$year
$month
integer
$month
$day
integer
$day
$hour
integer
$hour
$minute
integer
$minute
$second
integer
$second

Since

1.0
public Timestamp
# getEndTime( )

Getter for the unit end time.

Getter for the unit end time.

Returns

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
integer
$year
$month
integer
$month
$day
integer
$day
$hour
integer
$hour
$minute
integer
$minute
$second
integer
$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

Since

1.0
public
# setUnitMAXDuration( integer $duration )

Setter for the unit MAX duration.

Setter for the unit MAX duration.

Parameters

$duration
integer
$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

Since

1.0
public
# markDirty( AlphaDAO $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
AlphaDAO
$object

Since

1.0
public array
# getDirtyObjects( )

Getter for the dirty objects array.

Getter for the dirty objects array.

Returns

array

Since

1.0
public
# markNew( AlphaDAO $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
AlphaDAO
$object

Since

1.0
public array
# getNewObjects( )

Getter for the new objects array.

Getter for the new objects array.

Returns

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

FailedUnitCommitException

Since

1.0
public
# abort( )

Method to clearup a cancelled unit of work.

Method to clearup a cancelled unit of work.

Throws

AlphaException

Since

1.0
private
# 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

public string
# getTitle( )

Getter for the page title.

Getter for the page title.

Returns

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

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

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
# accessError( )

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

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

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

Since

1.0
public static 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

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 $BOName, string $mode )

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

$BOName
string
$BOName The classname of the business object
$mode
string
$mode The mode of the controller (create, view, edit)

Returns

string

Since

1.0
protected
# loadCustomController( string $BOName, string $mode )

Does a HTTP redirect to a custom controller if one is found.

Does a HTTP redirect to a custom controller if one is found.

Parameters

$BOName
string
$BOName The classname of the business object
$mode
string
$mode The mode of the controller (create, view, edit)

Throws

FileNotFoundException

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 _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 _SESSION so this method can only be used to get the status message once for display purposes.

Returns

string

Since

1.0
public static boolean
# checkControllerDefExists( string $controllerName )

Checks that the definition for the controller classname provided exists. Will also return true if you pass "/" for the root of the web application.

Checks that the definition for the controller classname provided exists. Will also return true if you pass "/" for the root of the web application.

Parameters

$controllerName
string
$controllerName

Returns

boolean

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

IllegalArguementException

Since

1.0
public static boolean
# checkIfAccessingFromSecureURL( )

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

Static function 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
private
# decryptFieldNames( )

Descrypts the POST fieldnames in the global $_REQUEST and $_POST variables

Descrypts the POST fieldnames in the global $_REQUEST and $_POST variables

Since

1.2.2
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
boolean
$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
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 AlphaDAO $BO null
#

Optionally, a BO may be set for the default validation form handling code to load in the displayPageHead() method. The definition of this BO class will need to be included in the child controller.

Optionally, a BO may be set for the default validation form handling code to load in the displayPageHead() method. The definition of this BO class will need to be included in the child controller.

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 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 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 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 objects in a session (i.e. persistent business objects that have not been updated in the database yet).

An array for storing dirty 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 objects in a session (transient business objects that have no OID yet).

An array for storing new 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
private static Logger $logger null
#

Trace logger

Trace logger

Since

1.0
Alpha Framework 1.2.4 API Documentation API documentation generated by ApiGen 2.8.0