code/libraries/koowa/controller/resource.php

Classes
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: resource.php 3232 2011-05-03 11:22:16Z johanjanssens $
Classes
KControllerResource

Description

KControllerResource

Extends from
KControllerPage
author
Johan Janssens <[email protected]>
category
Koowa
package
Koowa_Controller
Methods
__construct
_initialize
loadState
saveState
setView
_actionBrowse
_actionRead
_actionEdit
_actionAdd
_actionDelete
_actionGet
_actionPost
_actionPut

Description

Abstract Bread Controller Class

Methods

__construct

__construct( object $config ) :

Constructor

Arguments
$config
object
An optional KConfig object with configuration options.
Details
visibility
public
final
false
static
false

_actionAdd

_actionAdd( KCommandContext $context ) : KDatabaseRow

Generic add action, saves a new item

Arguments
$context
KCommandContext
A command context object
Output
KDatabaseRow
A row object containing the new data
Details
visibility
protected
final
false
static
false

_actionBrowse

_actionBrowse( KCommandContext $context ) : KDatabaseRowset

Browse a list of items

Arguments
$context
KCommandContext
A command context object
Output
KDatabaseRowset
A rowset object containing the selected rows
Details
visibility
protected
final
false
static
false

_actionDelete

_actionDelete( KCommandContext $context ) : KDatabaseRowset

Generic delete function

Arguments
$context
KCommandContext
A command context object
Output
KDatabaseRowset
A rowset object containing the deleted rows
Details
visibility
protected
final
false
static
false

_actionEdit

_actionEdit( KCommandContext $context ) : KDatabaseRowset

Generic edit action, saves over an existing item

Arguments
$context
KCommandContext
A command context object
Output
KDatabaseRowset
A rowset object containing the updated rows
Details
visibility
protected
final
false
static
false

_actionGet

_actionGet( KCommandContext $context ) : string|false

Get action

This function translates a GET request into a read or browse action. If the view name is singular a read action will be executed, if plural a browse action will be executed.

This function will not render anything the result of the read or browse action is not a row or rowset object

Arguments
$context
KCommandContext
A command context object
Output
string|false
The rendered output of the view or FALSE if something went wrong
Details
visibility
protected
final
false
static
false

_actionPost

_actionPost( KCommandContext $context ) : KDatabaseRow(set)

Post action

This function translated a POST request action into an edit or add action. If the model state is unique a edit action will be executed, if not unique an add action will be executed.

Arguments
$context
KCommandContext
A command context object
Output
KDatabaseRow(set)
A row(set) object containing the modified data
Details
visibility
protected
final
false
static
false

_actionPut

_actionPut( KCommandContext $context ) : KDatabaseRow(set)

Put action

This function translates a PUT request into an edit or add action. Only if the model state is unique and the item exists an edit action will be executed, if the resources doesn't exist an add action will be executed.

If the resource already exists it will be completely replaced based on the data available in the request.

Arguments
$context
KCommandContext
A command context object
Output
KDatabaseRow(set)
A row(set) object containing the modified data
Details
visibility
protected
final
false
static
false
throws
If the model state is not unique

_actionRead

_actionRead( KCommandContext $context ) : KDatabaseRow

Display a single item

Arguments
$context
KCommandContext
A command context object
Output
KDatabaseRow
A row object containing the selected row
Details
visibility
protected
final
false
static
false

_initialize

_initialize( object $config ) : void

Initializes 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

loadState

loadState( KCommandContext $context ) : array

Load the model state from the request

This functions merges the request information with any model state information that was saved in the session and returns the result.

Arguments
$context
KCommandContext
The active command context
Output
array
An associative array of request information
Details
visibility
public
final
false
static
false

saveState

saveState( KCommandContext $context ) : KControllerBread

Saves the model state in the session

Arguments
$context
KCommandContext
The active command context
Output
KControllerBread
Details
visibility
public
final
false
static
false

setView

setView( mixed $view ) : KControllerAbstract

Method to set a view object attached to the controller

Arguments
$view
mixed
An object that implements KObjectIdentifiable, an object that implements KIndentifierInterface or valid identifier string
Details
visibility
public
final
false
static
false
throws
If the identifier is not a view identifier
Documentation was generated by DocBlox 0.10.0.