wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.SimpleLongTaskController.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.SimpleLongTaskController.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/application/controller/class.LongTaskController.php");
20 
21 /**
22  * @class SimpleLongTaskController
23  * @ingroup Controller
24  * @brief SimpleLongTaskController is a controller demonstrating the use
25  * of LongTaskController for cutting a long task into a fixed number
26  * of smaller tasks.
27  *
28  * @note This is an example implementation that creates 10 files
29  *
30  * <b>Input actions:</b>
31  * - see LongTaskController
32  *
33  * <b>Output actions:</b>
34  * - see LongTaskController
35  *
36  * @author ingo herwig <ingo@wemove.com>
37  */
39 {
40  // number of total steps
41  var $NUM_STEPS = 10;
42 
43  /**
44  * @see LongTaskController::getNumberOfSteps()
45  */
46  function getNumberOfSteps()
47  {
48  return $this->NUM_STEPS;
49  }
50  /**
51  * @see LongTaskController::getDisplayText()
52  */
53  function getDisplayText($step)
54  {
55  return "Creating file number ".$step." ...";
56  }
57  /**
58  * @see LongTaskController::getSummaryText()
59  * The default implementation returns an empty string
60  */
61  function getSummaryText()
62  {
63  return "";
64  }
65  /**
66  * @see LongTaskController::processPart()
67  */
68  function processPart()
69  {
70  // do some processing depending on state here
71  $curNum = sprintf("%04s",$this->getStepNumber());
72  $fh = fopen("result".$curNum.".txt", "a");
73  fputs($fh, date("F j, Y, g:i a").": SimpleLongTaskController created file #".$curNum."\n");
74  fclose($fh);
75  }
76 }
77 ?>
LongTaskController is a controller that may be used as base class for tasks, that require a long exec...
SimpleLongTaskController is a controller demonstrating the use of LongTaskController for cutting a lo...