ZenMagick 0.9.8


org.zenmagick.mvc.controller.ZMController
\mvc\controller\ZMController.php at line 31

Class ZMController

ZMObject
└─ZMController

public class ZMController
extends ZMObject

Request controller base class.

Author:
DerManoMann
Version:
$Id: ZMController.php 2776 2009-12-23 01:26:36Z dermanomann $

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

ZMController(string id)

Create new instance.

Method Summary
ZMView

findView(string id, array data, array parameter)

Lookup the appropriate view for the given name.

ZMObject

getFormData(ZMRequest request)

Get the form data object (if any) for this request.

string

getId()

Get the controller id.

ZMView

getView()

Get the current view.

boolean

isFormSubmit(ZMRequest request)

Check if this request is a form submit.

void

preProcess(ZMRequest request)

Convenience method for request processing shared by request methods.

ZMView

process(ZMRequest request)

Process a HTTP request.

ZMView

processGet(ZMRequest request)

Process a HTTP GET request.

ZMView

processPost(ZMRequest request)

Process a HTTP POST request.

void

setContentType(string type, string charset)

Set the response content type.

void

setId(string id)

Set the controller id.

void

setView(ZMView view)

Set the current view.

boolean

validate(ZMRequest request, string formId, mixed formData)

Validate the current request using the given rule id.

protected ZMView

validateFormData(ZMRequest request, mixed formData)

Validate the given form bean.

protected ZMView

validateSession(ZMRequest request)

Validate session token.

Methods inherited from org.zenmagick.core.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Constructor Detail

\mvc\controller\ZMController.php at line 42

ZMController

public ZMController(string id)

Create new instance.

Parameters:
id - Optional id; default is null to use the request id.

Method Detail

\mvc\controller\ZMController.php at line 220

findView

public ZMView findView(string id, array data, array parameter)

Lookup the appropriate view for the given name.

Parameters:
id - The controller id or null to return to the current page.
data - Optional model data; default is an empty array.
parameter - Optional map of name/value pairs to further configure the view; default is null.
Returns:
The actual view to be used to render the response.

\mvc\controller\ZMController.php at line 244

getFormData

public ZMObject getFormData(ZMRequest request)

Get the form data object (if any) for this request.

Parameters:
request - The request to process.
Returns:
An object instance or null

\mvc\controller\ZMController.php at line 348

getId

public string getId()

Get the controller id.

Returns:
The id (page name).

\mvc\controller\ZMController.php at line 323

getView

public ZMView getView()

Get the current view.

Returns:
The view or null.

\mvc\controller\ZMController.php at line 172

isFormSubmit

public boolean isFormSubmit(ZMRequest request)

Check if this request is a form submit.

This default implementation will return true for all POST requests.

Parameters:
request - The request to process.
Returns:
true if this is a form submit request.

\mvc\controller\ZMController.php at line 160

preProcess

public void preProcess(ZMRequest request)

Convenience method for request processing shared by request methods.

Despite the name this is called as part of the controllers process($request) method. That ensures that all processing is within the boundaries of a single transaction (if enabled).

Parameters:
request - The request to process.

\mvc\controller\ZMController.php at line 66

process

public ZMView process(ZMRequest request)

Process a HTTP request.

Supported request methods are GET and POST.

This method should not be overridded!.

Parameters:
request - The request to process.
Returns:
A ZMView instance or null.

\mvc\controller\ZMController.php at line 183

processGet

public ZMView processGet(ZMRequest request)

Process a HTTP GET request.

Parameters:
request - The request to process.
Returns:
A ZMView that handles presentation or null if the controller generates the contents itself.

\mvc\controller\ZMController.php at line 195

processPost

public ZMView processPost(ZMRequest request)

Process a HTTP POST request.

Parameters:
request - The request to process.
Returns:
A ZMView that handles presentation or null if the controller generates the contents itself.

\mvc\controller\ZMController.php at line 204

setContentType

public void setContentType(string type, string charset)

Set the response content type.

Parameters:
type - The content type.
charset - Optional charset; default is utf-8; null will omit the charset part.

\mvc\controller\ZMController.php at line 341

setId

public void setId(string id)

Set the controller id.

Parameters:
id - The id (page name).

\mvc\controller\ZMController.php at line 332

setView

public void setView(ZMView view)

Set the current view.

Parameters:
view - The view or null.

\mvc\controller\ZMController.php at line 297

validate

public boolean validate(ZMRequest request, string formId, mixed formData)

Validate the current request using the given rule id.

Parameters:
request - The request to process.
formId - The ZMRuleSet id.
formData - A map, (bean) object instance or null for all current request parameter.
Returns:
true if the validation was successful, false if not.

\mvc\controller\ZMController.php at line 276

validateFormData

protected ZMView validateFormData(ZMRequest request, mixed formData)

Validate the given form bean.

Parameters:
request - The request to process.
formData - An object.
Returns:
Either the error view (in case of validation errors), or null for success.

\mvc\controller\ZMController.php at line 265

validateSession

protected ZMView validateSession(ZMRequest request)

Validate session token.

Parameters:
request - The request to process.
Returns:
Either the error view (in case of validation errors), or null for success.

ZenMagick 0.9.8