This class represents one state in an Ismo application.
Each state has one or more action methods and the one that will be called depends on the request.
Additional documentation is available in the IsmoWiki at http://ismo.sourceforge.net/wiki/IsmoState
Located in /State/HTTP.php (line 42)
| Class | Description |
|---|---|
| Ismo_Core_State_HTTP_Pages | |
| Ismo_Core_State_XMLRPC | The XML-RPC base state class. |
The current action being or about to be executed.
The clients preferred locale.
This is the class used by the log method to log things. It's set by the Ismo_Core_Application class to be the same as its $_logger attribute when a state instance is created.
The template engine or class or whatever that's used to generate the page.
The Ismo_Core_Request instance that represents this request.
The Ismo_Core_Response instance that represents this request's response.
The Ismo_Core_Session instance that represents the current session.
The name of the current state being executed.
The URL style to use when determining the state and action and also when generating new URLs.
The constructor.
The default action handler method.
This action method will be called if no action was given in the request. The default implementation in the Ismo_Core_State_HTTP class just prints "hello from ismo". You will probably want to override this method in your state classes.
Handles the request.
This is the method that the Ismo_Core_Application class calls. It figures out the action, checks if the request is authorized, expose the default variables and then calls the action method.
This method should never be called manually.
Post action method execution hook.
This method is called after the action method is called.
Note If a method named postExecactionName exists it will be called before this method but after the action method (execactionName) is called.
Post show method execution hook.
This method is called after the show method is called.
Note If a method named postShowshowMethodName exists it will be called before this method but after the show method (showshowMethodName) is called.
Pre action method execution hook.
This method is called before the action method is called, so it can e.g. be used for caching or similar things.
Note If a method named preExecactionName exists it will be called after this method but before the action method (execactionName) is called.
Pre show method execution hook.
This method is called before the show method is called, so it can e.g. be used for caching or similar things.
Note If a method named preShowshowMethodName exists it will be called after this method but before the show method (showshowMethodName) is called.
Set the configuration.
This method is used by the Ismo_Core_Application class to set global configuration parameters. You have to override this yourself to do anything usefull.
This sets the log class being used.
The Ismo_Core_Application class uses this method to set the log class used by the state. There is no need to call this method manually.
Sets the request instance to use.
This is usually an instance of the Ismo_Core_Request class but it might also be an instance of some other class that implements the same methods.
This is no need to call this method manually.
Sets the response instance to use.
This is usually an instance of the Ismo_Core_Response class but it might also be an instance of some other class that implements the same methods.
This is no need to call this method manually.
Sets the session used by this class.
This is usually an instance of the Ismo_Core_Session class but it might also be an instance of some other class that implements the same methods.
These is no need to call this method manually.
Sets the state name.
This method is used by the Ismo_Core_Application class to set the name of the state as it has determined. The name is usually the same as the name of the state class but it might differ if the Ismo_Core_Application class has been extended and modified.
There is no need to call this method manually.
Sets the Url style used.
This method is used by the Ismo_Core_Application class to inform the state about the currently used url style.
There is no need to call this method manually.
Missing action method saver.
This method is called whenever an action which doesn't have a corresponding exec... method is requested. This implementation just calls the execDefault (i.e. the default action) method.
Override if you want some other behaviour.
Decides if the request is allow to access this action method or not.
This method is automatically called by the execute method before the action method is called.
If true is returned execution is handed onwards to the action method (i.e. exec<action name>). If false is returned execution will be stopped. So if false is returned make sure that an appropriate response has been sent to the client, for example a redirect to a login page.
The default implementation always return true so this method should be overridden in state classes which should have some kind of access checks.
The name of the current action is available in the _actionName property of this object. And the name of the current state name (usually the same as the name of this class but it might be different if the Ismo_Core_Application class has been extended and modified) is available in the _stateName property of this object. The request and session properties are also available.
It is possible to change which action method that will be called after this method has returned by changing the _actionName property of this object.
Constructs the action method name.
Override this method if you want to change the default execXXX naming scheme.
Creates a new session.
This method just calls the create method on the Ismo_Core_Session instance.
Constructs the show method name.
Override this method if you want to change the default showXXX
Figures out which action method that should be called.
If the ISMO_CORE_QUERY_STYLE URL style is used the action is gotten from the action query parameter. If the ISMO_CORE_PATHINFO_STYLE URL style is used the action is gotten from the second path-info parameter. See HowToConfigureURLStyleAndGetURLsToStates in the wiki for more details about the different URL styles.
If no action can be determined the action is set to "default" which means that the execDefault() will later be called.
When the action has been determined $this->_actionName is set accordingly.
Note that only the a-z, A-Z, 0-9 and _ characters are allowed in action names.
You might want to override this method if you want change how the current action is decided.
There is no need to call this method manually.
Deduces the clients preferred locale.
This method just calls the getLocale() method on the Ismo_Core_Request instance and sets the _locale attribute accordingly.
Exposes the default variables to the template engine.
This method can be overridden to make sure that certain top-level template variables get exposed to the template engine. This current implemention doesn't expose any.
This method is called by the execute() method before it is calling the action method. So this is a good place to put things that should be exposed to the template engine for every action method. Like maybe a menu or something.
Returns a URL to the given action on the given state.
This method honours the URLStyle setting and returns an IsmoURL instance to the given action-state combination. If no state is given the current one is used.
Convenient wrapper to check if a session is available or not.
This just calls the hasSession() method on the Ismo_Core_Session instance which checks if the current request has a session associated with it or not.
Logs the given message.
Logs the message with the given priority using the configured logger. The logger class to use is set on the Ismo_Core_Application instance with the setLogger() method.
This method adds the name of the current state to the beginning of the message and then calls the log method on the current active logger.
Example:
- // ...
- funciton execFoo()
- {
- $this->_log('Entering execFoo()', PEAR_LOG_DEBUG);
- // do stuff
- $this->_log('Leaving execFoo()', PEAR_LOG_DEBUG);
- }
Handles error conditions that occur during execution of the action method.
Here you can do fancy error recovering if you like.
Please keep in mind that you are responsive for die():ing the script if the execution shouldn't continue. If you don't do anything the execution will continue on the line after which the error happened on.
You should probably override this method in your subclass. The default implementation just calls the system error handler (Ismo_Core_systemErrorHandler). Which just prints a generic error message. If ISMO_CORE_DEBUG is defined it will also print the file, lineno, error messsage and a variable dump, then it will die the script.
Handles showMethod calls recursively
This method takes the result value of an execute action method call. If the result is a string value that matches an appropriate show method the show method is called. In turn, each resulting return value is handled recursively to allow a 'layered' view.
Missing show method saver.
This method is called whenever a show method which doesn't exist is requested. The default implementation just prints a message about a show method for show value X is missing.
Override if you want some other behaviour.
Documentation generated on Mon, 14 Jun 2004 11:59:23 +0200 by phpDocumentor 1.3.0RC3