ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
229  public function __construct() {
230  //$this->mActiveChildren = array();
231  }
232 
233  public function addChild($ioChild){
234 
235  if ($this->mChildren == null) {
236  $this->mChildren = array();
237  }
238  if ($this->mActiveChildren == null) {
239  $this->mActiveChildren = array();
240  }
241 
242  //set class
243  $c_ioChild['_SeqActivity']=$ioChild;
244 
245  //keep both in sync
246  array_push($this->mChildren,$c_ioChild);
247  //array_push($this->mActiveChildren,$c_ioChild);
248 
249  //$this->mActiveChildren = $this->mChildren;
250 
251  $ioChild->setOrder(count($this->mChildren) - 1);
252  $ioChild->setActiveOrder(count($this->mChildren)- 1);
253 
254  //set parents on the client
255  //$ioChild->setParent($this);
256  }
257 
258  public function setOrder($iOrder)
259  {
260  $this->mOrder = $iOrder;
261  }
262 
263  public function setActiveOrder ($iOrder) {
264  $this->mActiveOrder = $iOrder;
265  }
266 
267  public function setParent ($iParent) {
268  $this->mParent = $iParent;
269  }
270 
271 
272 
273  //setters for public vats
274  public function setID($id){
275  $this->mActivityID = $id;
276  }
277 
278  function setResourceID($id){
279  $this->mResourceID = $id;
280  }
281 
282  public function setIsVisible($visible){
283  $this->mIsVisible = $visible;
284  }
285 
286  public function setControlModeChoice($choice) {
287  $this->mControl_choice=$choice;
288  }
289 
290  public function setControlModeChoiceExit($choiceExit) {
291  $this->mControl_choiceExit=$choiceExit;
292  }
293 
294  public function setControlModeFlow($flow) {
295  $this->mControl_flow=$flow;
296  }
297 
298  public function setControlForwardOnly($forwardOnly) {
299  $this->mControl_forwardOnly=$forwardOnly;
300  }
301 
302  public function setUseCurObjective($useCurObjective) {
303  $this->mUseCurObj=$useCurObjective;
304  }
305 
306  public function setUseCurProgress($useCurProgress) {
307  $this->mUseCurPro=$useCurProgress;
308  }
309 
310  public function setAttemptLimit($value) {
311  if ( $value >= 0 ) {
312  $this->mMaxAttemptControl = true;
313  $this->mMaxAttempt = $value;
314  }
315  else {
316  $this->mMaxAttemptControl = false;
317  $this->mMaxAttempt = -1;
318  }
319  }
320 
321  public function setAttemptAbDur($iDur) {
322  if ( $iDur != null ) {
323  $this->mActivityAbDurControl = true;
324  //to be implemented
325  //convert duration
326  //$this->mActivityAbDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
327  }
328  else {
329  $this->mActivityAbDurControl = false;
330  }
331  }
332 
333  public function setAttemptExDur($iDur) {
334  if ( $iDur != null ) {
335  $this->mAttemptExDurControl = true;
336  //to be implemented
337  // $this->mAttemptExDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
338  }
339  else
340  {
341  $this->mAttemptExDurControl = false;
342  }
343  }
344 
345  public function setActivityAbDur($iDur) {
346  if ( $iDur != null )
347  {
348  $this->mActivityAbDurControl = true;
349  //$this->mActivityAbDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
350  }
351  else
352  {
353  $this->mActivityAbDurControl = false;
354  }
355  }
356 
357  public function setActivityExDur($iDur) {
358  if ( $iDur != null )
359  {
360  $this->mmActivityExDurControl = true;
361  // $this->mmActivityExDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur);
362  }
363  else
364  {
365  $this->mmActivityExDurControl = false;
366  }
367  }
368 
369  public function setBeginTimeLimit($iTime) {
370  if ( $iTime != null )
371  {
372  $this->mBeginTimeControl = true;
373  $this->mBeginTime = $iTime;
374  }
375  else
376  {
377  $this->mBeginTimeControl = false;
378  }
379  }
380 
381  public function setEndTimeLimit($iTime) {
382  if ( $iTime != null )
383  {
384  $this->mEndTimeControl = true;
385  $this->mEndTime = $iTime;
386  }
387  else
388  {
389  $this->mEndTimeControl = false;
390  }
391  }
392 
393  public function setRandomTiming($iTiming) {
394  // Validate vocabulary
395  if ( !($this->iTiming == TIMING_NEVER ||
396  $this->iTiming == TIMING_ONCE ||
397  $this->iTiming == TIMING_EACHNEW ) )
398  {
399  $this->mSelectTiming = TIMING_NEVER;
400  }
401  else
402  {
403  $this->mRandomTiming = $iTiming;
404  }
405  }
406 
407  public function setSelectCount($iCount) {
408  if ( $iCount >= 0 )
409  {
410  $this->mSelectStatus = true;
411  $this->mSelectCount = $iCount;
412  }
413  else
414  {
415  $this->mSelectStatus = false;
416  }
417  }
418 
419  public function setReorderChildren($iReorder) {
420 
421  $this->mReorder = $iReorder;
422  }
423 
424 
425  public function setSelectionTiming($iTiming) {
426 
427  // Validate vocabulary
428  if ( !($this->iTiming == TIMING_NEVER ||
429  $this->iTiming == TIMING_ONCE ||
430  $this->iTiming == TIMING_EACHNEW ) )
431  {
432  $this->mSelectTiming = TIMING_NEVER;
433  }
434  else
435  {
436  $this->mSelectTiming = $iTiming;
437  }
438 
439  }
440 
441  public function setIsTracked($iTracked) {
442  $this->mIsTracked = $iTracked;
443  }
444 
445  public function setSetCompletion($iSet) {
446  $this->mContentSetsCompletion = $iSet;
447  }
448 
449  public function setSetObjective($iSet) {
450  $this->mContentSetsObj = $iSet;
451  }
452 
453  public function setPreventActivation($iPreventActivation) {
454  $this->mPreventActivation = $iPreventActivation;
455  }
456 
457  public function setConstrainChoice($iConstrainChoice) {
458  $this->mConstrainChoice = $iConstrainChoice;
459  }
460 
461  public function setRequiredForSatisfied($iConsider) {
462  $this->mRequiredForSatisfied = $iConsider;
463  }
464 
465  public function setRequiredForNotSatisfied($iConsider) {
466  $this->mRequiredForNotSatisfied = $iConsider;
467  }
468 
469  public function setRequiredForCompleted($iConsider) {
470  $this->mRequiredForCompleted = $iConsider;
471  }
472 
473  public function setRequiredForIncomplete($iConsider) {
474  $this->mRequiredForIncomplete = $iConsider;
475  }
476 
477  public function setSatisfactionIfActive($iActiveMeasure) {
478  $this->mActiveMeasure = $iActiveMeasure;
479  }
480 
481  public function setTitle($title){
482  $this->mTitle = $title;
483  }
484 
485  public function setPreSeqRules($iRuleSet) {
486  $this->mPreConditionRules = $iRuleSet;
487  }
488 
489  public function setExitSeqRules($iRuleSet) {
490  $this->mExitActionRules = $iRuleSet;
491  }
492 
493  public function setPostSeqRules($iRuleSet) {
494  $this->mPostConditionRules = $iRuleSet;
495  }
496 
497  public function setObjectives($iObjs){
498  $this->mObjectives = $iObjs;
499  for ( $i = 0; $i < count($iObjs); $i++ ) {
500  $obj = $iObjs[$i];
501  if ($obj['_SeqObjective']->mMaps!=null) {
502  $index=$obj['_SeqObjective']->mObjID;
503  $this->mObjMaps["$index"]=$obj['_SeqObjective']->mMaps;
504  }
505  }
506  }
507 
508  public function setIsObjRolledUp($iRolledup) {
509  $this->mIsObjectiveRolledUp = $iRolledup;
510  }
511 
512  public function setObjMeasureWeight($iWeight) {
513  $this->mObjMeasureWeight = $iWeight;
514  }
515 
516  public function setIsProgressRolledUp($iRolledup) {
517  $this->mIsProgressRolledUp = $iRolledup;
518  }
519 
520  public function setRollupRules($iRuleSet) {
521  $this->mRollupRules = $iRuleSet;
522  }
523 
524  public function setAuxResources($iRes) {
525  $this->mAuxResources = $iRes;
526  }
527 
528 
529 
530 
531  function getID() {
532 
533  return $this->mActivityID;
534 
535  }
536 
537  function getIsVisible(){
538 
539  return $this->mIsVisible;
540 
541  }
542 
543 
544 
545 
546 }
547 
548 
549 ?>