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