eZPublish  3.8
eZModule Class Reference

Allows execution of modules and functions. More...

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)
 
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, $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

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

Private Member Functions

 initialize ($path, $file, $moduleName)
 

Private 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. More...
 
 $UIComponentMatch
 Controls at which level UI component matching is done, either 'module' which uses module name or 'view' which uses view name. More...
 
 $UIContext
 The current UI context, by default 'navigation' but can be changed depending on module or PHP code. More...
 
 $UserParameters
 
 $ViewActions
 
 $ViewParameters
 
 $ViewResult
 

Detailed Description

Allows execution of modules and functions.

Member Function Documentation

eZModule::actionParameter (   $parameterName,
  $view = '' 
)
eZModule::activeModuleRepositories (   $useExtensions = true)
static
Returns
a path list of currently active modules

Referenced by eZScript\initialize().

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
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.
& eZModule::attribute (   $attr)
Returns
the attribute value for attribute $attr if it is available, otherwise null.
eZModule::attributes ( )
Returns
an array with the available attributes.

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

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
eZModule::currentRedirectionURI ( )
Returns
The URI of the currently run view in the current module with the current parameters.

Referenced by redirectCurrent().

eZModule::errorCode ( )
Returns
the error code if the function failed to run or 0 if no error code.
See Also
setErrorCode
eZModule::errorModule ( )
Returns
the name of the module which will be run on errors. The default name is 'error'.
See Also
handleError

Referenced by handleError().

& eZModule::exists (   $moduleName,
  $pathList = null 
)
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

Referenced by eZPolicyLimitation\allValuesAsArrayWithNames(), fetchModule(), redirect(), and redirectionURI().

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

Referenced by handleError().

eZModule::eZModule (   $path,
  $file,
  $moduleName 
)

Referenced by findModule().

& eZModule::findModule (   $moduleName,
$module,
  $pathList = null 
)
static

Tries to locate the module named $moduleName and sets the $module parameter with the eZModule object, if $module is already a module object it's 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
$pathListIs either an array with path strings or a single path string

Referenced by exists(), and handleError().

& eZModule::forward ( $module,
  $functionName,
  $parameters = false 
)
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
& eZModule::getNamedParameters ( )
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

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.

eZModule::hasActionParameter (   $parameterName,
  $view = '' 
)
eZModule::hasAttribute (   $attr)
Returns
true if the attribute $attr is available.
eZModule::hasViewResult (   $view = '')

Referenced by run().

eZModule::initialize (   $path,
  $file,
  $moduleName 
)
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.

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
& 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
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
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.
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
eZModule::redirectionURIForModule ( $module,
  $viewName,
  $parameters = array(),
  $unorderedParameters = null,
  $userParameters = false,
  $anchor = false 
)

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

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.

Referenced by redirect(), and redirectToView().

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

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

See Also
setRedirectURI, setExitStatus

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.

eZModule::redirectURI ( )
Returns
the URI which will be redirected to when the function exits.
& eZModule::run (   $functionName,
  $parameters,
  $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.
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.

eZModule::setActionParameter (   $parameterName,
  $parameterValue,
  $view = '' 
)
eZModule::setCurrentAction (   $actionName,
  $view = '' 
)

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

See Also
currentAction, isCurrentAction
eZModule::setCurrentName (   $name)

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

eZModule::setCurrentView (   $name)

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

eZModule::setErrorCode (   $errorCode)

Sets the current error code.

Note
You need to set the exit status to EZ_MODULE_STATUS_FAILED for the error code to be used.
See Also
setExitStatus, errorCode

Referenced by handleError().

eZModule::setErrorModule (   $moduleName,
  $viewName 
)

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

See Also
handleError
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.

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

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

Referenced by eZScript\initialize().

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.
eZModule::setRedirectURI (   $uri)

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

eZModule::setTitle (   $title)

Sets the current view for the module to $title.

eZModule::setUIComponentName (   $component)

Sets the current component string to $component.

eZModule::setUIContextName (   $context)

Sets the current context string to $context.

eZModule::setViewResult ( $result,
  $view = '' 
)
eZModule::singleFunction ( )
Returns
true if the module acts a single view.

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.
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().

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

Change the context with setUIContextName().

& 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
eZModule::uri ( )
Returns
the URI of the module.
See Also
functionURI

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

Referenced by parameters(), and unorderedParameters().

& eZModule::viewResult (   $view = '')

Referenced by run().

Member Data Documentation

eZModule::$ErrorCode
private

Referenced by errorCode().

eZModule::$ExitStatus
private

Referenced by exitStatus().

eZModule::$Functions
private

Referenced by attribute().

eZModule::$HookList
private
eZModule::$Module
private

Referenced by attribute(), and initialize().

eZModule::$Name
private

Referenced by attribute(), run(), and uri().

eZModule::$NamedParameters
private

Referenced by getNamedParameters().

eZModule::$OriginalParameters
private
eZModule::$OriginalUnorderedParameters
private

Referenced by currentRedirectionURI(), and forward().

eZModule::$OriginalViewParameters
private

Referenced by currentRedirectionURI().

eZModule::$Path
private

Referenced by attribute().

eZModule::$RedirectStatus
private

Referenced by redirectStatus().

eZModule::$RedirectURI
private

Referenced by redirectURI().

eZModule::$Title
private

Referenced by title().

eZModule::$UIComponent
private

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

Referenced by uiComponentName().

eZModule::$UIComponentMatch
private

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

eZModule::$UIContext
private

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

Referenced by uiContextName().

eZModule::$UserParameters
private

Referenced by currentRedirectionURI(), and forward().

eZModule::$ViewActions
private
eZModule::$ViewParameters
private
eZModule::$ViewResult
private

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