jCoordinator

the main class of the jelix core

this is the "chief orchestra" of the framework. Its goal is to load the configuration, to get the request parameters used to instancie the correspondant controllers and to run the right method.

package

jelix

subpackage

core

Methods

__construct

__construct( $configFile = '', boolean $enableErrorHandler = true) 

Arguments

$configFile

$enableErrorHandler

boolean

enable the error handler of jelix. keep it to true, unless you have something to debug and really have to use the default handler or an other handler

load the plugins and their configuration file

_loadPlugins() 

Error handler using a response object to return the error.

errorHandler(integer $errno, string $errmsg, string $filename, integer $linenum, array $errcontext) 

Replace the default PHP error handler.

since 1.4

Arguments

$errno

integer

error code

$errmsg

string

error message

$filename

string

filename where the error appears

$linenum

integer

line number where the error appears

$errcontext

array

Exception handler using a response object to return the error Replace the default PHP Exception handler

exceptionHandler(\Exception $e) 
since 1.4

Arguments

$e

\Exception

the exception object

says if the currently executed action is the original one

execOriginalAction() : boolean

Response

boolean

true if yes

get the controller corresponding to the selector

getController(\jSelectorAct $selector) : \jController
Throws
\jException

Arguments

$selector

\jSelectorAct

Response

\jController

the controller corresponding to the selector

getErrorMessage

getErrorMessage() : \jLogErrorMessage
since 1.3a1

Response

\jLogErrorMessage

the current error

return the generic error message (errorMessage in the configuration).

getGenericErrorMessage() : string

Replaced the %code% pattern in the message by the current error code

Response

string

gets a given coordinator plugin if registered

getPlugin(string $pluginName, boolean $required = true) : \jICoordPlugin
Throws
\jException

Arguments

$pluginName

string

the name of the plugin

$required

boolean

says if the plugin is required or not. If true, will generate an exception if the plugin is not registered.

Response

\jICoordPlugin

Handle an error event. Called by error handler and exception handler.

handleError(string $type, integer $code, string $message, string $file, integer $line, array $trace) 
since 1.1

Arguments

$type

string

error type : 'error', 'warning', 'notice'

$code

integer

error code

$message

string

error message

$file

string

the file name where the error appear

$line

integer

the line number where the error appear

$trace

array

the stack trace

Says if the given coordinator plugin $name is enabled

isPluginEnabled(string $pluginName) : boolean

Arguments

$pluginName

string

Response

boolean

true : plugin is ok

main method : launch the execution of the action.

process(\jRequest $request = null) 

This method should be called in a entry point.

Throws
\jException

Arguments

$request

\jRequest

the request object. It is required if a descendant of jCoordinator did not called setRequest before

initialize the given request and some properties of the coordinator

setRequest(\jRequest $request) 

It extracts information for the request to set the module name and the action name. It doesn't verify if the corresponding controller does exist or not. It enables also the error handler of Jelix, if needed. Does not call this method directly in entry points. Prefer to call process() instead (that will call setRequest). setRequest is mostly used for tests or specific contexts.

see \jCoordinator::process()
Throws
\jException
\jException

if the module is unknown or the action name format is not valid

Arguments

$request

\jRequest

the request object

Properties

plugin list

plugins : array
var

Type(s)

array

current response object

response : \jResponse
var

Type(s)

\jResponse

current request object

request : \jRequest
var

Type(s)

\jRequest

the selector of the current action

action : \jSelectorAct
var

Type(s)

\jSelectorAct

the original action when there is an internal redirection to an action different from the one corresponding to the request

originalAction : \jSelectorAct
var

Type(s)

\jSelectorAct

the current module name

moduleName : string
var

Type(s)

string

the current action name

actionName : string
var

Type(s)

string

the current error message

errorMessage : \jLogErrorMessage
var

Type(s)

\jLogErrorMessage