wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
LongTaskController Class Reference
+ Inheritance diagram for LongTaskController:

Public Member Functions

 initialize (&$request, &$response)
 
 hasView ()
 
 executeKernel ()
 
 getStepNumber ()
 
 getNumberOfSteps ()
 
 getDisplayText ($step)
 
 getSummaryText ()
 
 initializeTask ()
 
 processPart ()
 
- Public Member Functions inherited from Controller
 Controller (&$delegate)
 
 initialize (&$request, &$response)
 
 validate ()
 
 hasView ()
 
 execute ()
 
 executeKernel ()
 
 getErrorMsg ()
 
 setErrorMsg ($msg)
 
 appendErrorMsg ($msg)
 
getRequest ()
 
getResponse ()
 
getView ()
 
getDelegate ()
 
 getViewTemplate ($controller, $context, $action)
 
 getCacheId ()
 
 assignViewDefaults (&$view)
 
 isLocalizedRequest ()
 

Public Attributes

 $STEP_SESSION_VARNAME = 'LongTaskController.curStep'
 
 $ONE_CALL_SESSION_VARNAME = 'LongTaskController.oneCall'
 
 $_curStep = 1
 
- Public Attributes inherited from Controller
 $_request = null
 
 $_response = null
 
 $_errorMsg = ''
 
 $_view = null
 
 $_delegate = null
 

Detailed Description

LongTaskController is a controller that may be used as base class for tasks, that require a long execution time such as construction of a list of pages.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.LongTaskController.php 1462 2014-02-04 23:52:27Z iherwig

This is accomplished by breaking up the task into n pieces (steps: 1..n) and calling this controller recurringly until all n pieces are finished. The pieces are processed by the processPart() method that must be implemented by subclasses. Information about the the progress is provided by the methods getNumberOfSteps() and getStepNumber().

To do the recurring calls without user interaction the controller needs a view that calls the submitAction('continue') function in the onLoad() event of the HTML page. If the parameter oneCall is set to true, the controller tries to accomplish the task in one call.

A possible configuration could be:

[actionmapping]
??longTask = MyLongTaskController
MyLongTaskController??continue = MyLongTaskController
MyLongTaskController??done = DisplayController
[views]
MyLongTaskController?? = progressbar.tpl

Input actions:

  • continue Continue with the next step
  • unspecified: Initialize the task

Output actions:

  • done If finished
Parameters
[in]oneCallTrue/False wether to accomplish the task in one call (optional, default: false)
[out]stepNumberThe current step starting with 1, ending with numberOfSteps+1
[out]numberOfStepsTotal number of steps
[out]stepsArrayAn arry of dots which size is equal to stepNumber (useful for views to iterate over)
[out]displayTextThe display text for the current step
[out]summaryTextThe summary text (only available in the last step)
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 70 of file class.LongTaskController.php.

Member Function Documentation

LongTaskController::initialize ( $request,
$response 
)
See Also
Controller::initialize()

Definition at line 82 of file class.LongTaskController.php.

References SessionData\getInstance(), initializeTask(), and WCMFException\throwEx().

+ Here is the call graph for this function:

LongTaskController::hasView ( )
See Also
Controller::hasView()

Definition at line 108 of file class.LongTaskController.php.

LongTaskController::executeKernel ( )

Do processing and assign Node data to View.

Returns
Array of given context and action 'done' if finished. False else.
See Also
Controller::executeKernel()

Definition at line 118 of file class.LongTaskController.php.

References getDisplayText(), SessionData\getInstance(), getNumberOfSteps(), getSummaryText(), and processPart().

+ Here is the call graph for this function:

LongTaskController::getStepNumber ( )

Get the number of the current step (1..number of steps).

Returns
The number of the current step

Definition at line 162 of file class.LongTaskController.php.

Referenced by SearchIndexController\index(), SimpleLongTaskController\processPart(), and BatchController\processPart().

LongTaskController::getNumberOfSteps ( )

Get the total number of steps.

Returns
The total number of steps
Note
subclasses must implement this method.

Definition at line 173 of file class.LongTaskController.php.

References WCMFException\throwEx().

Referenced by executeKernel().

+ Here is the call graph for this function:

LongTaskController::getDisplayText (   $step)

Get the display text for a step.

Parameters
stepThe step to get the text for.
Returns
The display text
Note
subclasses must implement this method.

Definition at line 183 of file class.LongTaskController.php.

References WCMFException\throwEx().

Referenced by executeKernel().

+ Here is the call graph for this function:

LongTaskController::getSummaryText ( )

Get the summary text for the last step.

Returns
The summary text
Note
subclasses must implement this method.

Definition at line 192 of file class.LongTaskController.php.

References WCMFException\throwEx().

Referenced by executeKernel().

+ Here is the call graph for this function:

LongTaskController::initializeTask ( )

Initialize the task e.g. store some configuration in the session. This method is called on start up.

Note
subclasses override this method to implement special application requirements.

Definition at line 201 of file class.LongTaskController.php.

Referenced by initialize().

LongTaskController::processPart ( )

Process one part of the task.

Note
subclasses must implement this method.

Definition at line 206 of file class.LongTaskController.php.

References WCMFException\throwEx().

Referenced by executeKernel().

+ Here is the call graph for this function:

Member Data Documentation

LongTaskController::$STEP_SESSION_VARNAME = 'LongTaskController.curStep'

Definition at line 73 of file class.LongTaskController.php.

LongTaskController::$ONE_CALL_SESSION_VARNAME = 'LongTaskController.oneCall'

Definition at line 74 of file class.LongTaskController.php.

LongTaskController::$_curStep = 1

Definition at line 77 of file class.LongTaskController.php.


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