[ Index ] |
|
Code source de LifeType 1.2.4 |
[Code source] [Imprimer] [Statistiques]
\defgroup Controller The controller is the central piece of the MVC pattern, and the object that takes care of transferrign the process flow to the right action class based on a certain value in the incoming request.
Poids: | 382 lignes (16 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 6 fois |
Nécessite: | 0 fichiers |
Controller:: (8 méthodes):
Controller()
setActionFolderPath()
registerAction()
_getActionClassName()
setForwardAction()
loadActionClass()
setCannotPerformAction()
process()
Classe: Controller - X-Ref
\ingroup ControllerController( $actionMap, $actionParam = DEFAULT_ACTION_PARAM ) X-Ref |
$ActionsMap is an associative array of the form: ( $actionName, $actionClassName ) Where for every different possible value of the 'action' parameter in the request, there is an object inheriting form the Action class that will take care of that requested action. param: actionMap is the associative array with the mappings param: actionParam is the name of the parameter in the request that will be used param: loadActionClasses By default set to 'true', enables dynamic loading of the |
setActionFolderPath( $newActionFolderPath ) X-Ref |
sets the folder where action classes can be dynamically loaded param: newActionFolderPath absolute or relative path to the folder |
registerAction( $actionKey, $actionClass ) X-Ref |
_getActionClassName( $actionName ) X-Ref |
Add function info here |
setForwardAction( $forwardAction, $previousActionObject = null ) X-Ref |
Sets the action to which we will forward the process param: forwardAction Name of the action to which we will forward the current param: previousActionObject |
loadActionClass( $actionClass ) X-Ref |
Loads an action class from disk. I have refactored it and put this little bit in its own method because doing so, applications that want to load the action classes from somewhere else than PLOG_CLASS_PATH/class/action/, or have a different naming scheme can extend this class and reimplement this method at will. param: actionClass The name of the action class that is to be loaded. return: Always true. |
setCannotPerformAction( $actionClass ) X-Ref |
Specific controllers should use this method to set a class that will be used in case Action::canPerform() return false. The controller will then load this class and execute it as if it was a normal action. This feature can be used to display a view with an error message in case our controller and actions are working together to provide permission-based access: each action checks whether the credentials of the current user allow him to execute the current action or not in the Action::canPeform() method and if it returns true, then the action specified in this method call takes over and displays whatever error message needs to be displayed (or does some cleanup, etc, whatever needed) param: actionClass A string with the name of the class that should be loaded when |
process( $httpRequest ) X-Ref |
Processess the HTTP request sent by the client param: httpRequest HTTP request sent by the client |
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |