wCMF
3.6
|
Public Member Functions | |
Controller (&$delegate) | |
initialize (&$request, &$response) | |
validate () | |
hasView () | |
execute () | |
executeKernel () | |
getErrorMsg () | |
setErrorMsg ($msg) | |
appendErrorMsg ($msg) | |
& | getRequest () |
& | getResponse () |
& | getView () |
& | getDelegate () |
getViewTemplate ($controller, $context, $action) | |
getCacheId () | |
assignViewDefaults (&$view) | |
isLocalizedRequest () | |
Public Attributes | |
$_request = null | |
$_response = null | |
$_errorMsg = '' | |
$_view = null | |
$_delegate = null | |
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-2014 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.
Error Handling:
[in] | language | The language of the requested data, optional |
[out] | sid | The session id |
[out] | controller | The name of the controller |
[out] | errorMsg | Any message set with setErrorMsg or appendErrorMsg, optional |
[out] | success | True, if errorMsg is empty or does not exist, False else |
Definition at line 54 of file class.Controller.php.
Controller::Controller | ( | & | $delegate | ) |
Constructor.
delegate | A ControllerDelegate instance, if one is defined in the configuration (optional, default null does not work in PHP4). |
Definition at line 67 of file class.Controller.php.
Controller::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.
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. |
Definition at line 87 of file class.Controller.php.
References appendErrorMsg().
Referenced by PageExportController\initialize().
Controller::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.
Definition at line 104 of file class.Controller.php.
Referenced by execute().
Controller::hasView | ( | ) |
Check if the Controller has a view. Subclasses must implement this method.
Definition at line 116 of file class.Controller.php.
References WCMFException\throwEx().
Referenced by execute().
Controller::execute | ( | ) |
Execute the Controller resulting in its Action processed and/or its View beeing displayed.
Definition at line 126 of file class.Controller.php.
References assignViewDefaults(), Log\debug(), executeKernel(), Message\get(), getErrorMsg(), ObjectFactory\getInstance(), SessionData\getInstance(), getViewTemplate(), hasView(), Log\isDebugEnabled(), MSG_FORMAT_HTML, Formatter\serialize(), WCMFException\throwEx(), and validate().
Controller::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.
Definition at line 211 of file class.Controller.php.
References WCMFException\throwEx().
Referenced by execute().
Controller::getErrorMsg | ( | ) |
Get a detailed description of the last error.
Definition at line 219 of file class.Controller.php.
References $_errorMsg.
Referenced by execute(), and LoginController\executeKernel().
Controller::setErrorMsg | ( | $msg | ) |
Set a detailed description of the last error.
msg | The error message. |
Definition at line 227 of file class.Controller.php.
Referenced by AssociateController\executeKernel(), DisplayController\executeKernel(), LoginController\executeKernel(), TreeViewController\getRootOIDs(), BackupController\restoreFiles(), SortController\sortAll(), CreateInstanceController\validate(), ConcurrencyController\validate(), MySQLBackupController\validate(), AssociateController\validate(), EditRightsController\validate(), ChildrenListController\validate(), BackupController\validate(), AdminController\validate(), NodeListController\validate(), LoginController\validate(), ConfigController\validate(), PrincipalController\validate(), MultipleActionController\validate(), and SortController\validate().
Controller::appendErrorMsg | ( | $msg | ) |
Append a detailed description of the last error to the existing errors.
msg | The error message. |
Definition at line 235 of file class.Controller.php.
Referenced by SaveController\checkFile(), DeleteController\executeKernel(), ConcurrencyController\executeKernel(), SaveController\executeKernel(), InsertController\executeKernel(), AssociateController\executeKernel(), CreateInstanceController\executeKernel(), ConfigController\executeKernel(), initialize(), SaveController\saveUploadFile(), InsertController\validate(), BatchDisplayController\validate(), and CopyController\validate().
& Controller::getRequest | ( | ) |
Get the Request object.
Definition at line 248 of file class.Controller.php.
References $_request.
& Controller::getResponse | ( | ) |
Get the Response object.
Definition at line 256 of file class.Controller.php.
References $_response.
& Controller::getView | ( | ) |
Get the controller view.
Definition at line 264 of file class.Controller.php.
References $_view.
Referenced by PageExportController\createOutputView().
& Controller::getDelegate | ( | ) |
Get the controller delegate.
Definition at line 272 of file class.Controller.php.
References $_delegate.
Controller::getViewTemplate | ( | $controller, | |
$context, | |||
$action | |||
) |
Get the template filename for the view from the configfile.
controller | The name of the controller |
context | The name of the context |
action | The name of the action |
Definition at line 284 of file class.Controller.php.
References Log\debug(), WCMFInifileParser\getInstance(), and Log\isDebugEnabled().
Referenced by execute().
Controller::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.
Definition at line 303 of file class.Controller.php.
Controller::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.
view | A reference to the View to assign the variables to |
Definition at line 313 of file class.Controller.php.
References Obfuscator\getInstance(), InifileParser\getInstance(), and RightsManager\getInstance().
Referenced by PageExportController\createOutputView(), and execute().
Controller::isLocalizedRequest | ( | ) |
Check if the current request is localized. This is true, if it has a language parameter that is not equal to Localization::getDefaultLanguage().
Definition at line 340 of file class.Controller.php.
References Localization\getInstance().
Referenced by ListboxController\executeKernel(), DeleteController\executeKernel(), TreeViewController\executeKernel(), SaveController\executeKernel(), InsertController\executeKernel(), AsyncPagingController\executeKernel(), DisplayController\executeKernel(), and BatchDisplayController\loadNode().
Controller::$_request = null |
Definition at line 56 of file class.Controller.php.
Referenced by getRequest().
Controller::$_response = null |
Definition at line 57 of file class.Controller.php.
Referenced by getResponse().
Controller::$_errorMsg = '' |
Definition at line 59 of file class.Controller.php.
Referenced by getErrorMsg().
Controller::$_view = null |
Definition at line 60 of file class.Controller.php.
Referenced by getView().
Controller::$_delegate = null |
Definition at line 61 of file class.Controller.php.
Referenced by getDelegate().