ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SeqActivity.php
Go to the documentation of this file.
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 SeqActivity.java
25 @author Hendrik Holtmann <holtmann@mac.com>
26
27 This .php file is GPL licensed (see above) but based on
28 SeqActivity.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 require_once("SeqObjective.php");
53 require_once("SeqRollupRule.php");
54
55 define("TIMING_ONCE", "once");
56 define("TIMING_EACHNEW", "onEachNewAttempt");
57 define("TER_EXITALL", "_EXITALL_");
58
59
61{
62
63
64 //It's quite bad design to declare these variables public (should be private), but for later JSON serialization PHP needs this
65 //cause json_encode ignores private or protected variables
66
67
68 //SeqRuleset
69 public $mPreConditionRules = null;
70
71 //SeqRuleset
72 public $mPostConditionRules = null;
73
74 //SeqRuleset
75 public $mExitActionRules = null;
76
77 public $mXML = null;
78
79 public $mDepth = 0;
80
81 public $mCount = -1;
82
83 public $mLearnerID = "_NULL_";
84
85 public $mScopeID = null;
86
87 public $mActivityID = null;
88
89 public $mResourceID = null;
90
91 public $mStateID = null;
92
93 public $mTitle = null;
94
95 public $mIsVisible = true;
96
97 public $mOrder = -1;
98
99 public $mActiveOrder = -1;
100
101 public $mSelected = true;
102
103 //SeqActivity converted to array???
104 public $mParent = null;
105
106 public $mIsActive = false;
107
108 public $mIsSuspended = false;
109
110 //Vector converted to array
111 public $mChildren = null;
112
113 //Vector converted to array
114 public $mActiveChildren = null;
115
116 public $mDeliveryMode = "normal";
117
118 public $mControl_choice = true;
119
120 public $mControl_choiceExit = true;
121
122 public $mControl_flow = false;
123
124 public $mControl_forwardOnly = false;
125
126 public $mConstrainChoice= false;
127
128 public $mPreventActivation = false;
129
130 public $mUseCurObj = true;
131
132 public $mUseCurPro = true;
133
134 public $mMaxAttemptControl = false;
135
136 public $mMaxAttempt = 0;
137
138 public $mAttemptAbDurControl = false;
139
140 //ADLDuration
141 public $mAttemptAbDur = null;
142
143 public $mAttemptExDurControl = false;
144
145 public $mAttemptExDur = null;
146
148
149 //ADLDuration
150 public $mActivityAbDur = null;
151
153
154 //ADLDuration
155 public $mActivityExDur = null;
156
157 public $mBeginTimeControl = false;
158
159 public $mBeginTime = null;
160
161 public $mEndTimeControl = false;
162
163 public $mEndTime = null;
164
165 //convert to array?
166 public $mAuxResources = null;
167
168 //SeqRollupRuleset
169 public $mRollupRules = null;
170
171 public $mActiveMeasure = true;
172
174
176
178
180
181 //convert to array
182 public $mObjectives = null;
183
184 //HashTable convert to assosiative array
185 public $mObjMaps = null;
186
188
189 public $mObjMeasureWeight = 1.0;
190
191 public $mIsProgressRolledUp = true;
192
193 public $mSelectTiming = "never";
194
195 public $mSelectStatus = false;
196
197 public $mSelectCount = 0;
198
199 public $mSelection = false;
200
201 public $mRandomTiming = "never";
202
203 public $mReorder = false;
204
205 public $mRandomized = false;
206
207 public $mIsTracked = true;
208
210
211 public $mContentSetsObj = false;
212
213 //ADLTracking
214 public $mCurTracking = null;
215
216 //convert to array?
217 public $mTracking = null;
218
219 public $mNumAttempt = 0;
220
221 public $mNumSCOAttempt = 0;
222
223 //ADLDuration
225
226 //ADLDuration
228
230
232
233 public $mProgressWeight = 1.0;
234
235
236 public function __construct()
237 {
238 //$this->mActiveChildren = array();
239 }
240
241 public function addChild($ioChild)
242 {
243 if ($this->mChildren == null) {
244 $this->mChildren = array();
245 }
246 if ($this->mActiveChildren == null) {
247 $this->mActiveChildren = array();
248 }
249
250 //set class
251 $c_ioChild['_SeqActivity']=$ioChild;
252
253 //keep both in sync
254 array_push($this->mChildren, $c_ioChild);
255 //array_push($this->mActiveChildren,$c_ioChild);
256
257 //$this->mActiveChildren = $this->mChildren;
258
259 $ioChild->setOrder(count($this->mChildren) - 1);
260 $ioChild->setActiveOrder(count($this->mChildren)- 1);
261
262 //set parents on the client
263 //$ioChild->setParent($this);
264 }
265
266 public function setOrder($iOrder)
267 {
268 $this->mOrder = $iOrder;
269 }
270
271 public function setActiveOrder($iOrder)
272 {
273 $this->mActiveOrder = $iOrder;
274 }
275
276 public function setParent($iParent)
277 {
278 $this->mParent = $iParent;
279 }
280
281
282
283 //setters for public vats
284 public function setID($id)
285 {
286 $this->mActivityID = $id;
287 }
288
289 public function setResourceID($id)
290 {
291 $this->mResourceID = $id;
292 }
293
294 public function setIsVisible($visible)
295 {
296 $this->mIsVisible = $visible;
297 }
298
299 public function setCompletionThreshold($compThresh)
300 {
301 $this->mProgressThreshold = $compThresh;
302 }
303
304 public function setCompletedByMeasure($compbm)
305 {
306 $this->mProgressDeterminedByMeasure = $compbm;
307 }
308
309 public function setProgressWeight($progweight)
310 {
311 $this->mProgressWeight = $progweight;
312 }
313
314 public function setControlModeChoice($choice)
315 {
316 $this->mControl_choice=$choice;
317 }
318
319 public function setControlModeChoiceExit($choiceExit)
320 {
321 $this->mControl_choiceExit=$choiceExit;
322 }
323
324 public function setControlModeFlow($flow)
325 {
326 $this->mControl_flow=$flow;
327 }
328
329 public function setControlForwardOnly($forwardOnly)
330 {
331 $this->mControl_forwardOnly=$forwardOnly;
332 }
333
334 public function setUseCurObjective($useCurObjective)
335 {
336 $this->mUseCurObj=$useCurObjective;
337 }
338
339 public function setUseCurProgress($useCurProgress)
340 {
341 $this->mUseCurPro=$useCurProgress;
342 }
343
344 public function setAttemptLimit($value)
345 {
346 if ($value >= 0) {
347 $this->mMaxAttemptControl = true;
348 $this->mMaxAttempt = $value;
349 } else {
350 $this->mMaxAttemptControl = false;
351 $this->mMaxAttempt = -1;
352 }
353 }
354
355 public function setAttemptAbDur($iDur)
356 {
357 if ($iDur != null) {
358 $this->mActivityAbDurControl = true;
359 //to be implemented
360 //convert duration
361 //$this->mActivityAbDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
362 } else {
363 $this->mActivityAbDurControl = false;
364 }
365 }
366
367 public function setAttemptExDur($iDur)
368 {
369 if ($iDur != null) {
370 $this->mAttemptExDurControl = true;
371 //to be implemented
372 // $this->mAttemptExDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
373 } else {
374 $this->mAttemptExDurControl = false;
375 }
376 }
377
378 public function setActivityAbDur($iDur)
379 {
380 if ($iDur != null) {
381 $this->mActivityAbDurControl = true;
382 //$this->mActivityAbDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
383 } else {
384 $this->mActivityAbDurControl = false;
385 }
386 }
387
388 public function setActivityExDur($iDur)
389 {
390 if ($iDur != null) {
391 $this->mmActivityExDurControl = true;
392 // $this->mmActivityExDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
393 } else {
394 $this->mmActivityExDurControl = false;
395 }
396 }
397
398 public function setBeginTimeLimit($iTime)
399 {
400 if ($iTime != null) {
401 $this->mBeginTimeControl = true;
402 $this->mBeginTime = $iTime;
403 } else {
404 $this->mBeginTimeControl = false;
405 }
406 }
407
408 public function setEndTimeLimit($iTime)
409 {
410 if ($iTime != null) {
411 $this->mEndTimeControl = true;
412 $this->mEndTime = $iTime;
413 } else {
414 $this->mEndTimeControl = false;
415 }
416 }
417
418 public function setRandomTiming($iTiming)
419 {
420 // Validate vocabulary
421 if (!($this->iTiming == TIMING_NEVER ||
422 $this->iTiming == TIMING_ONCE ||
423 $this->iTiming == TIMING_EACHNEW)) {
424 $this->mSelectTiming = TIMING_NEVER;
425 } else {
426 $this->mRandomTiming = $iTiming;
427 }
428 }
429
430 public function setSelectCount($iCount)
431 {
432 if ($iCount >= 0) {
433 $this->mSelectStatus = true;
434 $this->mSelectCount = $iCount;
435 } else {
436 $this->mSelectStatus = false;
437 }
438 }
439
440 public function setReorderChildren($iReorder)
441 {
442 $this->mReorder = $iReorder;
443 }
444
445
446 public function setSelectionTiming($iTiming)
447 {
448
449 // Validate vocabulary
450 if (!($this->iTiming == TIMING_NEVER ||
451 $this->iTiming == TIMING_ONCE ||
452 $this->iTiming == TIMING_EACHNEW)) {
453 $this->mSelectTiming = TIMING_NEVER;
454 } else {
455 $this->mSelectTiming = $iTiming;
456 }
457 }
458
459 public function setIsTracked($iTracked)
460 {
461 $this->mIsTracked = $iTracked;
462 }
463
464 public function setSetCompletion($iSet)
465 {
466 $this->mContentSetsCompletion = $iSet;
467 }
468
469 public function setSetObjective($iSet)
470 {
471 $this->mContentSetsObj = $iSet;
472 }
473
474 public function setPreventActivation($iPreventActivation)
475 {
476 $this->mPreventActivation = $iPreventActivation;
477 }
478
479 public function setConstrainChoice($iConstrainChoice)
480 {
481 $this->mConstrainChoice = $iConstrainChoice;
482 }
483
484 public function setRequiredForSatisfied($iConsider)
485 {
486 $this->mRequiredForSatisfied = $iConsider;
487 }
488
489 public function setRequiredForNotSatisfied($iConsider)
490 {
491 $this->mRequiredForNotSatisfied = $iConsider;
492 }
493
494 public function setRequiredForCompleted($iConsider)
495 {
496 $this->mRequiredForCompleted = $iConsider;
497 }
498
499 public function setRequiredForIncomplete($iConsider)
500 {
501 $this->mRequiredForIncomplete = $iConsider;
502 }
503
504 public function setSatisfactionIfActive($iActiveMeasure)
505 {
506 $this->mActiveMeasure = $iActiveMeasure;
507 }
508
509 public function setTitle($title)
510 {
511 $this->mTitle = $title;
512 }
513
514 public function setPreSeqRules($iRuleSet)
515 {
516 $this->mPreConditionRules = $iRuleSet;
517 }
518
519 public function setExitSeqRules($iRuleSet)
520 {
521 $this->mExitActionRules = $iRuleSet;
522 }
523
524 public function setPostSeqRules($iRuleSet)
525 {
526 $this->mPostConditionRules = $iRuleSet;
527 }
528
529 public function setObjectives($iObjs)
530 {
531 $this->mObjectives = $iObjs;
532 for ($i = 0; $i < count($iObjs); $i++) {
533 $obj = $iObjs[$i];
534 if ($obj['_SeqObjective']->mMaps!=null) {
535 $index=$obj['_SeqObjective']->mObjID;
536 $this->mObjMaps["$index"]=$obj['_SeqObjective']->mMaps;
537 }
538 }
539 }
540
541 public function setIsObjRolledUp($iRolledup)
542 {
543 $this->mIsObjectiveRolledUp = $iRolledup;
544 }
545
546 public function setObjMeasureWeight($iWeight)
547 {
548 $this->mObjMeasureWeight = $iWeight;
549 }
550
551 public function setIsProgressRolledUp($iRolledup)
552 {
553 $this->mIsProgressRolledUp = $iRolledup;
554 }
555
556 public function setRollupRules($iRuleSet)
557 {
558 $this->mRollupRules = $iRuleSet;
559 }
560
561 public function setAuxResources($iRes)
562 {
563 $this->mAuxResources = $iRes;
564 }
565
566
567
568
569 public function getID()
570 {
571 return $this->mActivityID;
572 }
573
574 public function getIsVisible()
575 {
576 return $this->mIsVisible;
577 }
578}
const TIMING_ONCE
Definition: SeqActivity.php:55
const TIMING_EACHNEW
Definition: SeqActivity.php:56
const ROLLUP_CONSIDER_ALWAYS
An exception for terminatinating execution or to throw for unit testing.
setActivityAbDur($iDur)
setControlForwardOnly($forwardOnly)
setRequiredForSatisfied($iConsider)
setAuxResources($iRes)
setUseCurObjective($useCurObjective)
setOrder($iOrder)
addChild($ioChild)
setSelectCount($iCount)
setRequiredForCompleted($iConsider)
setBeginTimeLimit($iTime)
setReorderChildren($iReorder)
setIsTracked($iTracked)
setIsVisible($visible)
setSetObjective($iSet)
setExitSeqRules($iRuleSet)
setRollupRules($iRuleSet)
setObjectives($iObjs)
setSetCompletion($iSet)
setActiveOrder($iOrder)
setObjMeasureWeight($iWeight)
setControlModeFlow($flow)
setControlModeChoiceExit($choiceExit)
$mProgressDeterminedByMeasure
setSelectionTiming($iTiming)
setIsObjRolledUp($iRolledup)
setProgressWeight($progweight)
setRequiredForNotSatisfied($iConsider)
setPreventActivation($iPreventActivation)
setRequiredForIncomplete($iConsider)
setCompletedByMeasure($compbm)
setConstrainChoice($iConstrainChoice)
setAttemptAbDur($iDur)
setAttemptLimit($value)
setIsProgressRolledUp($iRolledup)
setActivityExDur($iDur)
setPostSeqRules($iRuleSet)
setCompletionThreshold($compThresh)
setRandomTiming($iTiming)
setTitle($title)
setSatisfactionIfActive($iActiveMeasure)
setPreSeqRules($iRuleSet)
setParent($iParent)
setAttemptExDur($iDur)
setUseCurProgress($useCurProgress)
setResourceID($id)
setControlModeChoice($choice)
setEndTimeLimit($iTime)
$i
Definition: disco.tpl.php:19
if(!array_key_exists('StateId', $_REQUEST)) $id
$index
Definition: metadata.php:60