ZMObject
└─ZMController
public class ZMController
extends ZMObject
| Fields inherited from org.zenmagick.core\ZMObject | |
|---|---|
| properties_ | |
| Method Summary | |
|---|---|
| void | __construct(string requestId) Create new instance. |
| 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. |
| array | getViewData(ZMRequest request) Get general page data. |
| boolean | Check if the current request is an Ajax request. |
| 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 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 | 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 | |
|---|---|
| __construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton | |
public void __construct(string requestId)
Create new instance.
null to use the request id.public ZMView findView(string id, array data, array parameter)
Lookup the appropriate view for the given name.
null to return to the current page.null.public ZMObject getFormData(ZMRequest request)
Get the form data object (if any) for this request.
nullpublic string getId()
Get the controller id.
public ZMView getView()
Get the current view.
null.public array getViewData(ZMRequest request)
Get general page data.
Good to override if a custom controller needs to provide some data for both GET and POST requests.
public boolean isAjax(ZMRequest request)
Check if the current request is an Ajax request.
This default implementation will check for a 'X-Requested-With' header. Subclasses are free to extend and override this method for custom Ajax detecting.
true if this request is considered an Ajax request.public boolean isFormSubmit(ZMRequest request)
Check if this request is a form submit.
This default implementation will return true for all POST requests.
true if this is a form submit request.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).
public ZMView process(ZMRequest request)
Process a HTTP request.
Supported request methods are GET and POST.
This method should not be overridded!.
ZMView instance or null.public ZMView processGet(ZMRequest request)
Process a HTTP GET request.
ZMView that handles presentation or null if the controller generates the contents itself.public ZMView processPost(ZMRequest request)
Process a HTTP POST request.
ZMView that handles presentation or null if the controller generates the contents itself.public void setContentType(string type, string charset)
Set the response content type.
null will omit the charset part.public void setId(string id)
Set the controller id.
public void setView(ZMView view)
Set the current view.
null.public boolean validate(ZMRequest request, string formId, mixed formData)
Validate the current request using the given rule id.
ZMRuleSet id.null for all current request parameter.true if the validation was successful, false if not.protected ZMView validateFormData(ZMRequest request, mixed formData)
Validate the given form bean.
null for success.protected ZMView validateSession(ZMRequest request)
Validate session token.
null for success.
Request controller base class.