eZ Publish  [4.2]
eZModule Class Reference

Allows execution of modules and functions. More...

List of all members.

Public Member Functions

 actionParameter ($parameterName, $view= '')
 addHook ($hookName, $function, $priority=1, $expandParameters=true, $append=false)
 attribute ($attr)
 attributes ()
 currentAction ($view= '')
 currentRedirectionURI ()
 errorCode ()
 errorModule ()
 exitStatus ()
 eZModule ($path, $file, $moduleName, $checkFileExistence=true)
 forward ($module, $functionName, $parameters=false)
 functionURI ($function)
 getNamedParameters ()
 handleError ($errorCode, $errorType=false, $parameters=array(), $userParameters=false)
 hasActionParameter ($parameterName, $view= '')
 hasAttribute ($attr)
 hasViewResult ($view= '')
 isCurrentAction ($actionName, $view= '')
 parameters ($viewName= '')
 redirect ($moduleName, $viewName, $parameters=array(), $unorderedParameters=null, $userParameters=false, $anchor=false)
 redirectCurrent ()
 redirectionURI ($moduleName, $viewName, $parameters=array(), $unorderedParameters=null, $userParameters=false, $anchor=false)
 redirectionURIForModule ($module, $viewName, $parameters=array(), $unorderedParameters=null, $userParameters=false, $anchor=false)
 redirectModule ($module, $viewName, $parameters=array(), $unorderedParameters=null, $userParameters=false, $anchor=false)
 redirectStatus ()
 redirectTo ($uri)
 redirectToView ($viewName= '', $parameters=array(), $unorderedParameters=null, $userParameters=false, $anchor=false)
 redirectURI ()
 run ($functionName, $parameters=array(), $overrideParameters=false, $userParameters=false)
 runHooks ($hookName, $parameters=null)
 setActionParameter ($parameterName, $parameterValue, $view= '')
 setCurrentAction ($actionName, $view= '')
 setCurrentName ($name)
 setCurrentView ($name)
 setErrorCode ($errorCode)
 setErrorModule ($moduleName, $viewName)
 setExitStatus ($stat)
 setRedirectStatus ($status)
 setRedirectURI ($uri)
 setTitle ($title)
 setUIComponentName ($component)
 setUIContextName ($context)
 setViewResult ($result, $view= '')
 singleFunction ()
 title ()
 uiComponentName ()
 uiContextName ()
 unorderedParameters ($viewName= '')
 uri ()
 viewData ($viewName= '')
 viewResult ($view= '')

Static Public Member Functions

static activeModuleRepositories ($useExtensions=true)
static addGlobalPathList ($pathList)
 currentModule ()
 currentView ()
static exists ($moduleName, $pathList=null, $showError=false)
static findModule ($moduleName, $module=null, $pathList=null, $showError=false)
static globalPathList ()
static setGlobalPathList ($pathList)

Public Attributes

 $ErrorCode
 $ExitStatus
 $Functions
 $HookList
 $Module
 $Name
 $NamedParameters
 $OriginalParameters
 $OriginalUnorderedParameters
 $OriginalViewParameters
 $Path
 $RedirectStatus
 $RedirectURI
 $Title
 $UIComponent
 The current UI context, by default the current module but can be changed depending on module or PHP code.
 $UIComponentMatch
 Controls at which level UI component matching is done, either 'module' which uses module name or 'view' which uses view name.
 $UIContext
 The current UI context, by default 'navigation' but can be changed depending on module or PHP code.
 $UserParameters
 $ViewActions
 $ViewParameters
 $ViewResult
const HOOK_STATUS_CANCEL_RUN = 1
const HOOK_STATUS_FAILED = 2
const HOOK_STATUS_OK = 0
const STATUS_FAILED = 2
const STATUS_IDLE = 0
const STATUS_OK = 1
const STATUS_REDIRECT = 3
const STATUS_RERUN = 4

Private Member Functions

 initialize ($path, $file, $moduleName, $checkFileExistence=true)

Detailed Description

Allows execution of modules and functions.

Definition at line 38 of file ezmodule.php.


Member Function Documentation

eZModule::actionParameter ( parameterName,
view = '' 
)

Definition at line 751 of file ezmodule.php.

static eZModule::activeModuleRepositories ( useExtensions = true) [static]
Returns:
a path list of currently active modules

Definition at line 1284 of file ezmodule.php.

Referenced by eZScript\initialize(), and eZSiteAccess\reInitialise().

static eZModule::addGlobalPathList ( pathList) [static]

Adds the pathlist entries $pathList to the global path list which is used for finding modules.

Parameters:
$pathListIs either an array with path strings or a single path string
See also:
setGlobalPathList

Definition at line 1349 of file ezmodule.php.

eZModule::addHook ( hookName,
function,
priority = 1,
expandParameters = true,
append = false 
)

Adds an entry to the hook named $hookName. The entry is placed before all other existing entries unless $append is set to true in which case the entry is placed at the end.

Parameters:
$functionEither the name of the function to be run or an array where the first entry is the object and the second is the method name.

Definition at line 853 of file ezmodule.php.

eZModule::attribute ( attr)
Returns:
the attribute value for attribute $attr if it is available, otherwise null.

Definition at line 612 of file ezmodule.php.

eZModule::attributes ( )
Returns:
an array with the available attributes.

Definition at line 589 of file ezmodule.php.

Referenced by hasAttribute().

eZModule::currentAction ( view = '')
Returns:
the current action for the view $view.

If the current action is not yet determined it will use the definitions in module.php for finding out the current action. It first looks trough the single_post_actions array in the selected view mode, the key to each element is the name of the post-variable to match, if it matches the element value is set as the action.

    'single_post_actions' => array( 'PreviewButton' => 'Preview',
                                    'PublishButton' => 'Publish' )

If none of these matches it will use the elements from the post_actions array to find a match. It uses the element value for each element to match agains a post-variable, if it is found the contents of the post-variable is set as the action.

    'post_actions' => array( 'BrowseActionName' )
See also:
setCurrentAction

Definition at line 675 of file ezmodule.php.

Referenced by actionParameter(), hasActionParameter(), and isCurrentAction().

eZModule::currentModule ( ) [static]
Returns:
the current module which is run or false if no module is active.
See also:
currentModule

Definition at line 1259 of file ezmodule.php.

eZModule::currentRedirectionURI ( )
Returns:
The URI of the currently run view in the current module with the current parameters.

Definition at line 399 of file ezmodule.php.

Referenced by redirectCurrent().

eZModule::currentView ( ) [static]
eZModule::errorCode ( )
Returns:
the error code if the function failed to run or 0 if no error code.
See also:
setErrorCode

Definition at line 259 of file ezmodule.php.

eZModule::errorModule ( )
Returns:
the name of the module which will be run on errors. The default name is 'error'.
See also:
handleError

Definition at line 279 of file ezmodule.php.

Referenced by handleError().

static eZModule::exists ( moduleName,
pathList = null,
showError = false 
) [static]

Tries to locate the module named $moduleName and returns an eZModule object for it. Returns null if no module can be found.

It uses the globalPathList() to search for modules, use $pathList to add additional path.

Parameters:
$moduleNameThe name of the module to find
$pathListIs either an array with path strings or a single path string
$showErrorIf true an error will be shown if the module it not found.

Definition at line 1373 of file ezmodule.php.

Referenced by eZPolicyLimitation\allValuesAsArrayWithNames(), eZUser\generateAccessArray(), redirect(), redirectionURI(), and eZURLAliasML\urlToAction().

eZModule::exitStatus ( )
Returns:
the current status from the module.

Definition at line 241 of file ezmodule.php.

Referenced by handleError().

eZModule::eZModule ( path,
file,
moduleName,
checkFileExistence = true 
)

Definition at line 50 of file ezmodule.php.

Referenced by findModule().

static eZModule::findModule ( moduleName,
module = null,
pathList = null,
showError = false 
) [static]

Tries to locate the module named $moduleName, sets the $module parameter with the eZModule object and returns the eZModule object. If $module is already a module object its contents are overwritten. Returns null if no module can be found.

It uses the globalPathList() to search for modules, use $pathList to add additional path.

Parameters:
$moduleNameThe name of the module to find
$module
$pathListIs either an array with path strings or a single path string
$showErrorIf true an error will be shown if the module it not found.

Definition at line 1392 of file ezmodule.php.

Referenced by exists(), and handleError().

eZModule::forward ( module,
functionName,
parameters = false 
)

Definition at line 1000 of file ezmodule.php.

eZModule::functionURI ( function)
Returns:
the URI to the view $function. If the view is empty or the module is a singleView type it will return the result of uri(). If the view does not exist the null is returned.
See also:
uri

Definition at line 146 of file ezmodule.php.

eZModule::getNamedParameters ( )

Definition at line 1448 of file ezmodule.php.

static eZModule::globalPathList ( ) [static]
Returns:
the global path list which is used for finding modules. Returns null if no list is available.
See also:
setGlobalPathList, addGlobalPathList

Definition at line 1273 of file ezmodule.php.

Referenced by eZModuleManager\availableModules(), findModule(), eZModuleFunctionInfo\loadDefinition(), and eZModuleOperationInfo\loadDefinition().

eZModule::handleError ( errorCode,
errorType = false,
parameters = array(),
userParameters = false 
)

Tries to run the error module with the error code $errorCode. Sets the state of the module object to failed and sets the error code.

Definition at line 301 of file ezmodule.php.

eZModule::hasActionParameter ( parameterName,
view = '' 
)

Definition at line 792 of file ezmodule.php.

eZModule::hasAttribute ( attr)
Returns:
true if the attribute $attr is available.

Definition at line 604 of file ezmodule.php.

eZModule::hasViewResult ( view = '')

Definition at line 982 of file ezmodule.php.

Referenced by run().

eZModule::initialize ( path,
file,
moduleName,
checkFileExistence = true 
) [private]

Initializes the module object with the path and file and name. It will look for a file called $file and include the contents of that file, it will then assume that some variables were set which defines the module and it's view/functions.

Definition at line 62 of file ezmodule.php.

Referenced by eZModule().

eZModule::isCurrentAction ( actionName,
view = '' 
)
Returns:
true if the current action matches the action name $actionName in view $view. Always returns false if either $view or $actionName is empty.
See also:
currentAction, setCurrentAction

Definition at line 836 of file ezmodule.php.

eZModule::parameters ( viewName = '')
Returns:
the parameter definition for the view $viewName. If $viewName is empty the current view is used.
See also:
unorderedParameters, viewData, currentView, currentModule

Definition at line 493 of file ezmodule.php.

eZModule::redirect ( moduleName,
viewName,
parameters = array(),
unorderedParameters = null,
userParameters = false,
anchor = false 
)

Redirects the page to the module $moduleName and view $viewName with parameters $parameters and unorderedParameters $unorderedParameters. If you already have the module object use redirectModule instead or if you need to redirect to a view in the current module use redirectToView.

Returns:
false if the view could not redirected to.
See also:
redirectionURI

Definition at line 335 of file ezmodule.php.

eZModule::redirectCurrent ( )

Redirects to the current module and view, it will use currentRedirectionURI() to figure out the URL.

Note:
By changing using setCurrentName() and setCurrentView() first it is possible to redirect to another module or view with the same parameters.

Definition at line 416 of file ezmodule.php.

eZModule::redirectionURI ( moduleName,
viewName,
parameters = array(),
unorderedParameters = null,
userParameters = false,
anchor = false 
)
Returns:
the URI for the module $moduleName and view $viewName using parameters $parameters and unordered parameters $unorderedParameters.
See also:
redirect

Definition at line 381 of file ezmodule.php.

eZModule::redirectionURIForModule ( module,
viewName,
parameters = array(),
unorderedParameters = null,
userParameters = false,
anchor = false 
)

Sames as redirectionURI but takes a module object instead of the name.

Definition at line 424 of file ezmodule.php.

Referenced by currentRedirectionURI(), redirectionURI(), and redirectModule().

eZModule::redirectModule ( module,
viewName,
parameters = array(),
unorderedParameters = null,
userParameters = false,
anchor = false 
)

Same as redirect() but takes a module object instead of the name.

Definition at line 366 of file ezmodule.php.

Referenced by redirect(), and redirectToView().

eZModule::redirectStatus ( )
Returns:
the status which will be set when redirecting.

Definition at line 572 of file ezmodule.php.

eZModule::redirectTo ( uri)

Makes sure that the module is redirected to the URI $uri when the function exits.

See also:
setRedirectURI, setExitStatus

Definition at line 542 of file ezmodule.php.

Referenced by redirectCurrent(), and redirectModule().

eZModule::redirectToView ( viewName = '',
parameters = array(),
unorderedParameters = null,
userParameters = false,
anchor = false 
)

Same as redirect() only redirects in the current module.

Definition at line 355 of file ezmodule.php.

eZModule::redirectURI ( )
Returns:
the URI which will be redirected to when the function exits.

Definition at line 556 of file ezmodule.php.

eZModule::run ( functionName,
parameters = array(),
overrideParameters = false,
userParameters = false 
)

Tries to run the function $functionName in the current module.

Parameters:
parametersAn indexed list of parameters, these will be mapped onto real parameter names using the defined parameter names in the module/function definition. If this variable is shorter than the required parameters they will be set to null.
overrideParametersAn associative array of parameters which will override any parameters found using the defined parameters.
Returns:
null if function could not be run or no return value was found.

Definition at line 1050 of file ezmodule.php.

eZModule::runHooks ( hookName,
parameters = null 
)

Runs all hooks found in the hook list named $hookName. The parameter array $parameters will be passed to each hook function.

Definition at line 881 of file ezmodule.php.

eZModule::setActionParameter ( parameterName,
parameterValue,
view = '' 
)

Definition at line 744 of file ezmodule.php.

eZModule::setCurrentAction ( actionName,
view = '' 
)

Sets the current action in view $view to $actionName.

See also:
currentAction, isCurrentAction

Definition at line 645 of file ezmodule.php.

eZModule::setCurrentName ( name)

Sets the name of the currently running module to $name.

Definition at line 177 of file ezmodule.php.

eZModule::setCurrentView ( name)

Sets the name of the currently running view to $name.

Definition at line 189 of file ezmodule.php.

eZModule::setErrorCode ( errorCode)

Sets the current error code.

Note:
You need to set the exit status to eZModule::STATUS_FAILED for the error code to be used.
See also:
setExitStatus, errorCode

Definition at line 269 of file ezmodule.php.

Referenced by handleError().

eZModule::setErrorModule ( moduleName,
viewName 
)

Sets the name of the module which will be run on errors.

See also:
handleError

Definition at line 291 of file ezmodule.php.

eZModule::setExitStatus ( stat)

Sets the current status for the module to $stat, the status can trigger a redirect or tell the client that the view failed.

Definition at line 250 of file ezmodule.php.

Referenced by forward(), handleError(), redirectTo(), and run().

static eZModule::setGlobalPathList ( pathList) [static]

Sets the global path list which is used for finding modules.

Parameters:
$pathListIs either an array with path strings or a single path string
See also:
addGlobalPathList

Definition at line 1336 of file ezmodule.php.

Referenced by eZScript\initialize(), and eZSiteAccess\reInitialise().

eZModule::setRedirectStatus ( status)

Sets the status which will be set when redirecting.

Note:
The status must be a valid HTTP status with number and text.

Definition at line 581 of file ezmodule.php.

eZModule::setRedirectURI ( uri)

Sets the URI which will be redirected to when the function exits.

Definition at line 564 of file ezmodule.php.

eZModule::setTitle ( title)

Sets the current view for the module to $title.

Definition at line 169 of file ezmodule.php.

eZModule::setUIComponentName ( component)

Sets the current component string to $component.

Definition at line 233 of file ezmodule.php.

eZModule::setUIContextName ( context)

Sets the current context string to $context.

Definition at line 225 of file ezmodule.php.

eZModule::setViewResult ( result,
view = '' 
)

Definition at line 975 of file ezmodule.php.

eZModule::singleFunction ( )
Returns:
true if the module acts a single view.

Definition at line 197 of file ezmodule.php.

Referenced by forward(), functionURI(), run(), and viewData().

eZModule::title ( )
Returns:
the title of the current view run, it's normally set by the view and display as the title of view pages.

Definition at line 161 of file ezmodule.php.

eZModule::uiComponentName ( )
Returns:
A string describing the current UI component.

The default value is the name of the currently running module, can be changed with setUIComponentName().

Definition at line 217 of file ezmodule.php.

eZModule::uiContextName ( )
Returns:
A string describing the current UI context, the default is 'navigation'

Change the context with setUIContextName().

Definition at line 207 of file ezmodule.php.

eZModule::unorderedParameters ( viewName = '')
Returns:
the unordered parameter definition for the view $viewName. If $viewName is empty the current view is used.
See also:
parameters, viewData, currentView, currentModule

Definition at line 510 of file ezmodule.php.

eZModule::uri ( )
Returns:
the URI of the module.
See also:
functionURI

Definition at line 136 of file ezmodule.php.

Referenced by attribute(), and functionURI().

eZModule::viewData ( viewName = '')
Returns:
the view data for the view $viewName. If $viewName is empty the current view is used.
See also:
parameters, unorderedParameters, currentView, currentModule

Definition at line 527 of file ezmodule.php.

Referenced by parameters(), and unorderedParameters().

eZModule::viewResult ( view = '')

Definition at line 989 of file ezmodule.php.

Referenced by run().


Member Data Documentation

eZModule::$ErrorCode

Definition at line 1459 of file ezmodule.php.

eZModule::$ExitStatus

Definition at line 1458 of file ezmodule.php.

eZModule::$Functions

Definition at line 1454 of file ezmodule.php.

eZModule::$HookList

Definition at line 1463 of file ezmodule.php.

eZModule::$Module

Definition at line 1455 of file ezmodule.php.

Referenced by initialize().

eZModule::$Name

Definition at line 1456 of file ezmodule.php.

eZModule::$NamedParameters

Definition at line 1469 of file ezmodule.php.

eZModule::$OriginalParameters

Definition at line 1467 of file ezmodule.php.

eZModule::$OriginalUnorderedParameters

Definition at line 1470 of file ezmodule.php.

eZModule::$OriginalViewParameters

Definition at line 1468 of file ezmodule.php.

eZModule::$Path

Definition at line 1457 of file ezmodule.php.

eZModule::$RedirectStatus

Definition at line 1461 of file ezmodule.php.

eZModule::$RedirectURI

Definition at line 1460 of file ezmodule.php.

eZModule::$Title

Definition at line 1462 of file ezmodule.php.

eZModule::$UIComponent

The current UI context, by default the current module but can be changed depending on module or PHP code.

Definition at line 1476 of file ezmodule.php.

eZModule::$UIComponentMatch

Controls at which level UI component matching is done, either 'module' which uses module name or 'view' which uses view name.

Definition at line 1478 of file ezmodule.php.

eZModule::$UIContext

The current UI context, by default 'navigation' but can be changed depending on module or PHP code.

Definition at line 1474 of file ezmodule.php.

eZModule::$UserParameters

Definition at line 1471 of file ezmodule.php.

eZModule::$ViewActions

Definition at line 1464 of file ezmodule.php.

eZModule::$ViewParameters

Definition at line 1466 of file ezmodule.php.

eZModule::$ViewResult

Definition at line 1465 of file ezmodule.php.

Definition at line 47 of file ezmodule.php.

Referenced by runHooks().

Definition at line 48 of file ezmodule.php.

Referenced by runHooks().

Definition at line 46 of file ezmodule.php.

Referenced by runHooks().

Definition at line 42 of file ezmodule.php.

Referenced by handleError(), and run().

Definition at line 40 of file ezmodule.php.

Referenced by initialize().

Definition at line 41 of file ezmodule.php.

Referenced by run().

Definition at line 43 of file ezmodule.php.

Referenced by handleError(), and redirectTo().

Definition at line 44 of file ezmodule.php.

Referenced by handleError().


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