wcmf logo wemove logo

Controller Class Reference
[Presentation]

Controller is the base class of all controllers. If a Controller has a view it is expected to reside in the directory configured in section smarty.templateDir. Additional smarty directories ('templates_c', 'configs', 'cache') are expected in a subdirectory of the template directory named 'smarty'. More...

Inheritance diagram for Controller:

Inheritance graph
[legend]

Public Member Functions

 Controller (&$delegate)
 initialize (&$request, &$response)
 validate ()
 hasView ()
 execute ()
 executeKernel ()
 getErrorMsg ()
 setErrorMsg ($msg)
 appendErrorMsg ($msg)
getData ()
getView ()
getDelegate ()
 getViewTemplate ($controller, $context, $action)
 getCacheId ()
 assignViewDefaults (&$view)

Data Fields

 $_request = null
 $_response = null
 $_data = array()
 $_errorMsg = ''
 $_view = null
 $_delegate = null

Detailed Description

Controller is the base class of all controllers. If a Controller has a view it is expected to reside in the directory configured in section smarty.templateDir. Additional smarty directories ('templates_c', 'configs', 'cache') are expected in a subdirectory of the template directory named 'smarty'.

wCMF - wemove Content Management Framework Copyright (C) 2005-2009 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id
class.Controller.php 979 2009-03-29 23:57:28Z iherwig

Error Handling:

Parameters:
[out] sid The session id
[out] errorMsg Any message set with setErrorMsg or appendErrorMsg, optional
[out] success True, if errorMsg is empty or does not exist, False else
Author:
ingo herwig <ingo@wemove.com>

Definition at line 51 of file class.Controller.php.


Member Function Documentation

Controller ( &$  delegate  ) 

Constructor.

Parameters:
delegate A ControllerDelegate instance, if one is defined in the configuration (optional, default null does not work in PHP4).

Definition at line 65 of file class.Controller.php.

initialize ( &$  request,
&$  response 
)

Initialize the Controller with request/response data. Which data is required is defined by the Controller. The base class method just stores the parameters in a member variable. Specialized Controllers may overide this behaviour for further initialization.

Attention:
It lies in its responsibility to fail or do some default action if some data is missing.
Parameters:
request A reference to the Request sent to the Controller. The sender attribute of the Request is the last controller's name, the context is the current context and the action is the requested one. All data sent from the last controller are accessible using the Request::getValue method. The request is supposed to be read-only. It will not be used any more after beeing passed to the controller.
response A reference to the Response that will be modified by the Controller. The initial values for context and action are the same as in the request parameter and are meant to be modified according to the performed action. The sender attribute of the response is set to the current controller. Initially there are no data stored in the response.

Reimplemented in AdminController, BackupController, ConfigController, MySQLBackupController, PrincipalController, BatchController, DisplayController, LoginController, LongTaskController, NodeListController, PageExportController, PagingController, ResourceListController, SearchController, UserController, and XMLExportController.

Definition at line 83 of file class.Controller.php.

References appendErrorMsg().

Referenced by SearchController::initialize().

Here is the call graph for this function:

validate (  ) 

Check if the data given by initialize() meet the requirements of the Controller. Subclasses will override this method to validate against their special requirements.

Returns:
True/False whether the data are ok or not. In case of False a detailed description is provided by getErrorMsg().

Reimplemented in AdminController, BackupController, ConfigController, EditRightsController, MySQLBackupController, PrincipalController, AssociateController, ChildrenListController, ConcurrencyController, CopyController, LoginController, MultipleActionController, NodeListController, and SortController.

Definition at line 100 of file class.Controller.php.

Referenced by execute().

hasView (  ) 

execute (  ) 

Execute the Controller resulting in its Action processed and/or its View beeing displayed.

Returns:
True/False wether following Controllers should be executed or not.

Definition at line 122 of file class.Controller.php.

References assignViewDefaults(), Log::debug(), executeKernel(), Message::get(), getErrorMsg(), ObjectFactory::getInstance(), SessionData::getInstance(), hasView(), Log::isDebugEnabled(), Formatter::serialize(), WCMFException::throwEx(), and validate().

Here is the call graph for this function:

executeKernel (  ) 

Do the work in execute(): Load and process model and maybe asign data to view. Subclasses process their Action and assign the Model to the view.

Returns:
False or an an assoziative array with keys 'context' and 'action' describing how to proceed. Return false to break the action processing chain.

Reimplemented in AdminController, ConfigController, EditRightsController, PrincipalController, AssociateController, AsyncPagingController, ChildrenListController, ConcurrencyController, CopyController, DeleteController, DisplayController, ExitController, FailureController, InsertController, ListboxController, LoginController, LongTaskController, MultipleActionController, NodeListController, PageExportController, PagingController, ResourceListController, ResourceTreeController, SaveController, SearchController, SOAPController, SortController, TerminateController, TreeViewController, UserController, and ViewController.

Definition at line 196 of file class.Controller.php.

References WCMFException::throwEx().

Referenced by execute().

Here is the call graph for this function:

getErrorMsg (  ) 

Get a detailed description of the last error.

Returns:
The error message.

Definition at line 204 of file class.Controller.php.

Referenced by execute(), and LoginController::executeKernel().

setErrorMsg ( msg  ) 

appendErrorMsg ( msg  ) 

& getData (  ) 

Get the controller data.

Returns:
A reference to the controller data

Definition at line 230 of file class.Controller.php.

& getView (  ) 

Get the controller view.

Returns:
A reference to the controller view / or null if none is existing

Definition at line 238 of file class.Controller.php.

Referenced by PageExportController::createOutputView().

& getDelegate (  ) 

Get the controller delegate.

Returns:
A reference to the controller view / or null if none is existing

Definition at line 246 of file class.Controller.php.

getViewTemplate ( controller,
context,
action 
)

Get the template filename for the view from the configfile.

Note:
static method
Parameters:
controller The name of the controller
context The name of the context
action The name of the action
Returns:
The filename of the template

Definition at line 258 of file class.Controller.php.

References Log::debug(), WCMFInifileParser::getInstance(), Log::isDebugEnabled(), and WCMFException::throwEx().

Here is the call graph for this function:

getCacheId (  ) 

Get the id which should be used when caching the controllers view. This method will only be called, if the configuration entry smarty.caching is set to 1. The default implementation returns null. Subclasses should return an id that is unique to each different content of the same view.

Returns:
The id or null, if no cache id should be used.

Definition at line 278 of file class.Controller.php.

assignViewDefaults ( &$  view  ) 

Assign default variables to the view. This method is called after Controller execution. This method may be used by derived controller classes for convenient View setup.

Parameters:
view A reference to the View to assign the variables to
Attention:
Internal use only.

Definition at line 288 of file class.Controller.php.

References Obfuscator::getInstance(), RightsManager::getInstance(), and InifileParser::getInstance().

Referenced by PageExportController::createOutputView(), and execute().

Here is the call graph for this function:


Field Documentation

$_request = null

Definition at line 53 of file class.Controller.php.

$_response = null

Definition at line 54 of file class.Controller.php.

$_data = array()

Definition at line 56 of file class.Controller.php.

$_errorMsg = ''

Definition at line 57 of file class.Controller.php.

$_view = null

Definition at line 58 of file class.Controller.php.

$_delegate = null

Definition at line 59 of file class.Controller.php.


The documentation for this class was generated from the following file:

This page generated via doxygen 1.5.8 Mon Mar 30 01:58:43 2009.
Copyright © 2009 wemove digital solutions GmbH.
sourceforge logo