1<?php
2/*
3    +-----------------------------------------------------------------------------+
4    | ILIAS open source                                                           |
5    +-----------------------------------------------------------------------------+
6    | Copyright (c) 1998-2007 ILIAS open source, University of Cologne            |
7    |                                                                             |
8    | This program is free software; you can redistribute it and/or               |
9    | modify it under the terms of the GNU General Public License                 |
10    | as published by the Free Software Foundation; either version 2              |
11    | of the License, or (at your option) any later version.                      |
12    |                                                                             |
13    | This program is distributed in the hope that it will be useful,             |
14    | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
15    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
16    | GNU General Public License for more details.                                |
17    |                                                                             |
18    | You should have received a copy of the GNU General Public License           |
19    | along with this program; if not, write to the Free Software                 |
20    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
21    +-----------------------------------------------------------------------------+
22*/
23/*
24    PHP port of ADL SeqRollupRule.java
25    @author Hendrik Holtmann <holtmann@mac.com>
26
27    This .php file is GPL licensed (see above) but based on
28    SeqRollupRule.java by ADL Co-Lab, which is licensed as:
29
30    Advanced Distributed Learning Co-Laboratory (ADL Co-Lab) Hub grants you
31    ("Licensee") a non-exclusive, royalty free, license to use, modify and
32    redistribute this software in source and binary code form, provided that
33    i) this copyright notice and license appear on all copies of the software;
34    and ii) Licensee does not utilize the software in a manner which is
35    disparaging to ADL Co-Lab Hub.
36
37    This software is provided "AS IS," without a warranty of any kind.  ALL
38    EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
39    ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
40    OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.  ADL Co-Lab Hub AND ITS LICENSORS
41    SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
42    USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES.  IN NO
43    EVENT WILL ADL Co-Lab Hub OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
44    PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
45    INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
46    THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
47    SOFTWARE, EVEN IF ADL Co-Lab Hub HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
48    DAMAGES.
49*/
50
51
52    define("ROLLUP_ACTION_NOCHANGE", 0);
53    define("ROLLUP_ACTION_SATISFIED", 1);
54    define("ROLLUP_ACTION_NOTSATISFIED", 2);
55    define("ROLLUP_ACTION_COMPLETED", 3);
56    define("ROLLUP_ACTION_INCOMPLETE", 4);
57
58    define("ROLLUP_CONSIDER_ALWAYS", "always");
59    define("ROLLUP_CONSIDER_ATTEMPTED", "ifAttempted");
60    define("ROLLUP_CONSIDER_NOTSKIPPED", "ifNotSkipped");
61    define("ROLLUP_CONSIDER_NOTSUSPENDED", "ifNotSuspended");
62
63    define("ROLLUP_SET_ALL", "all");
64    define("ROLLUP_SET_ANY", "any");
65    define("ROLLUP_SET_NONE", "none");
66    define("ROLLUP_SET_ATLEASTCOUNT", "atLeastCount");
67    define("ROLLUP_SET_ATLEASTPERCENT", "atLeastPercent");
68
69    class SeqRollupRule
70    {
71        public $mAction = ROLLUP_ACTION_SATISFIED;
72
73        public $mChildActivitySet = ROLLUP_SET_ALL;
74
75        public $mMinCount = 0;
76
77        public $mMinPercent = 0.0;
78
79        public $mConditions = null;
80
81        public function __construct()
82        {
83            //$this->mRules=$iRules;
84        }
85
86        public function setRollupAction($iAction)
87        {
88            if ($iAction == "satisfied") {
89                $this->mAction = ROLLUP_ACTION_SATISFIED;
90            } elseif ($iAction == "notSatisfied") {
91                $this->mAction = ROLLUP_ACTION_NOTSATISFIED;
92            } elseif ($iAction == "completed") {
93                $this->mAction = ROLLUP_ACTION_COMPLETED;
94            } elseif ($iAction == "incomplete") {
95                $this->mAction = ROLLUP_ACTION_INCOMPLETE;
96            }
97        }
98    }
99