code/libraries/koowa/controller/abstract.php
- category
- Koowa
- copyright
- Copyright (C) 2007 - 2010 Johan Janssens. All rights reserved.
- license
- GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
- link
- http://www.nooku.org
- package
- Koowa_Controller
- version
- $Id: abstract.php 3234 2011-05-03 11:25:50Z johanjanssens $
- Classes
- KControllerAbstract
Description
KControllerAbstract
- Extends from
- KObject
- Implements
- KObjectIdentifiable
- author
- Johan Janssens <[email protected]>
- category
- Koowa
- package
- Koowa_Controller
- uses
- KMixinClass
- uses
- KCommandChain
- uses
- KObject
- uses
- KFactory
- Properties
- $_action_map
- $_actions
- $_dispatched
- $_request
- $_behaviors
- Methods
- __construct
- _initialize
- getIdentifier
- isDispatched
- execute
- getActions
- getRequest
- setRequest
- addBehavior
- getBehavior
- getBehaviors
- registerActionAlias
- __set
- __get
- __call
Description
Abstract Controller Class
Note: Concrete controllers must have a singular name
Properties
$_action_map
array $_action_map = 'array'Array of class methods to call for a given action.
Details
- $_action_map
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
$_actions
array $_actions = ''The class actions
Details
- $_actions
- array
- visibility
- protected
- default
- final
- false
- static
- false
$_behaviors
array $_behaviors = 'array'List of behaviors
Associative array of behaviors, where key holds the behavior identifier string and the value is an identifier object.
Details
- $_behaviors
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
$_dispatched
boolean $_dispatched = ''Has the controller been dispatched
Details
- $_dispatched
- boolean
- visibility
- protected
- default
- final
- false
- static
- false
$_request
array $_request = 'null'The request information
Details
- $_request
- array
- visibility
- protected
- default
- null
- final
- false
- static
- false
Methods
__call
__call(
string $method, array $args
)
:
Execute a controller action by it's name.
Function is also capable of checking is a behavior has been mixed succesfully using is[Behavior] function. If the behavior exists the function will return TRUE, otherwise FALSE.
Arguments
- $method
- string
Method name - $args
- array
Array containing all the arguments for the original call
Details
- visibility
- public
- final
- false
- static
- false
- see
- execute()
__construct
__construct(
object $config
=
null
)
:
Constructor.
Arguments
- $config
- object
An optional KConfig object with configuration options.
Details
- visibility
- public
- final
- false
- static
- false
__get
__get(
string $property
)
:
stringGet a request property
Arguments
- $property
- string
The property name.
Output
- string
- The property value.
Details
- visibility
- public
- final
- false
- static
- false
__set
__set(
string $property, mixed $value
)
:
Set a request properties
Arguments
- $property
- string
The property name. - $value
- mixed
The property value.
Details
- visibility
- public
- final
- false
- static
- false
_initialize
_initialize(
object $config
)
:
voidInitializes the default configuration for the object
Called from {@link __construct()} as a first step of object instantiation.
Arguments
- $config
- object
An optional KConfig object with configuration options.
Details
- visibility
- protected
- final
- false
- static
- false
addBehavior
addBehavior(
array $behaviors
)
:
KControllerAbstractRegister one or more behaviors to the controller
Arguments
- $behaviors
- array
Array of one or more behaviors to add.
Output
Details
- visibility
- public
- final
- false
- static
- false
execute
execute(
string $action, object $context
)
:
mixed|falseExecute an action by triggering a method in the derived class.
Arguments
- $action
- string
The action to execute - $context
- object
A command context object
Output
- mixed|false
- The value returned by the called method, false in error case.
Details
- visibility
- public
- final
- false
- static
- false
- throws
getActions
getActions(
$reload
=
false
)
:
arrayGets the available actions in the controller.
Arguments
- $reload
Output
- array
- Array[i] of action names.
Details
- visibility
- public
- final
- false
- static
- false
getBehavior
getBehavior(
$behavior, $config
=
array
)
:
KControllerBehaviorAbstractGet a behavior by identifier
Arguments
- $behavior
- $config
Output
Details
- visibility
- public
- final
- false
- static
- false
getBehaviors
getBehaviors(
)
:
arrayGets the behaviors of the table
Output
- array
- An asscociate array of table behaviors, keys are the behavior names
Details
- visibility
- public
- final
- false
- static
- false
getIdentifier
getIdentifier(
)
:
KIdentifierGet the object identifier
Output
Details
- visibility
- public
- final
- false
- static
- false
- see
- KObjectIdentifiable
getRequest
getRequest(
)
:
KConfigGet the request information
Output
- KConfig
- A KConfig object with request information
Details
- visibility
- public
- final
- false
- static
- false
isDispatched
isDispatched(
)
:
booleanHas the controller been dispatched
Output
- boolean
- Returns true if the controller has been dispatched
Details
- visibility
- public
- final
- false
- static
- false
- see
- KObjectIdentifiable
registerActionAlias
registerActionAlias(
string $alias, string $action
)
:
KControllerAbstractRegister (map) an action to a method in the class.
Arguments
- $alias
- string
The action. - $action
- string
The name of the method in the derived class to perform for this action.
Output
Details
- visibility
- public
- final
- false
- static
- false
setRequest
setRequest(
array $request
)
:
KControllerBreadSet the request information
Arguments
- $request
- array
An associative array of request information
Output
- KControllerBread
Details
- visibility
- public
- final
- false
- static
- false