00001 <?php 00002 /* 00003 +-----------------------------------------------------------------------------+ 00004 | ILIAS open source | 00005 +-----------------------------------------------------------------------------+ 00006 | Copyright (c) 1998-2007 ILIAS open source, University of Cologne | 00007 | | 00008 | This program is free software; you can redistribute it and/or | 00009 | modify it under the terms of the GNU General Public License | 00010 | as published by the Free Software Foundation; either version 2 | 00011 | of the License, or (at your option) any later version. | 00012 | | 00013 | This program is distributed in the hope that it will be useful, | 00014 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00015 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00016 | GNU General Public License for more details. | 00017 | | 00018 | You should have received a copy of the GNU General Public License | 00019 | along with this program; if not, write to the Free Software | 00020 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 00021 +-----------------------------------------------------------------------------+ 00022 */ 00023 /* 00024 PHP port of ADL SeqActivity.java 00025 @author Hendrik Holtmann <holtmann@mac.com> 00026 00027 This .php file is GPL licensed (see above) but based on 00028 SeqActivity.java by ADL Co-Lab, which is licensed as: 00029 00030 Advanced Distributed Learning Co-Laboratory (ADL Co-Lab) Hub grants you 00031 ("Licensee") a non-exclusive, royalty free, license to use, modify and 00032 redistribute this software in source and binary code form, provided that 00033 i) this copyright notice and license appear on all copies of the software; 00034 and ii) Licensee does not utilize the software in a manner which is 00035 disparaging to ADL Co-Lab Hub. 00036 00037 This software is provided "AS IS," without a warranty of any kind. ALL 00038 EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING 00039 ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00040 OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. ADL Co-Lab Hub AND ITS LICENSORS 00041 SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF 00042 USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO 00043 EVENT WILL ADL Co-Lab Hub OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, 00044 PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, 00045 INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE 00046 THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE 00047 SOFTWARE, EVEN IF ADL Co-Lab Hub HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 00048 DAMAGES. 00049 */ 00050 00051 00052 require_once("SeqObjective.php"); 00053 require_once("SeqRollupRule.php"); 00054 00055 define("TIMING_ONCE","once"); 00056 define("TIMING_EACHNEW","onEachNewAttempt"); 00057 define("TER_EXITALL","_EXITALL_"); 00058 00059 00060 class SeqActivity{ 00061 00062 00063 //It's quite bad design to declare these variables public (should be private), but for later JSON serialization PHP needs this 00064 //cause json_encode ignores private or protected variables 00065 00066 00067 //SeqRuleset 00068 public $mPreConditionRules = null; 00069 00070 //SeqRuleset 00071 public $mPostConditionRules = null; 00072 00073 //SeqRuleset 00074 public $mExitActionRules = null; 00075 00076 public $mXML = null; 00077 00078 public $mDepth = 0; 00079 00080 public $mCount = -1; 00081 00082 public $mLearnerID = "_NULL_"; 00083 00084 public $mScopeID = null; 00085 00086 public $mActivityID = null; 00087 00088 public $mResourceID = null; 00089 00090 public $mStateID = null; 00091 00092 public $mTitle = null; 00093 00094 public $mIsVisible = true; 00095 00096 public $mOrder = -1; 00097 00098 public $mActiveOrder = -1; 00099 00100 public $mSelected = true; 00101 00102 //SeqActivity converted to array??? 00103 public $mParent = null; 00104 00105 public $mIsActive = false; 00106 00107 public $mIsSuspended = false; 00108 00109 //Vector converted to array 00110 public $mChildren = null; 00111 00112 //Vector converted to array 00113 public $mActiveChildren = null; 00114 00115 public $mDeliveryMode = "normal"; 00116 00117 public $mControl_choice = true; 00118 00119 public $mControl_choiceExit = true; 00120 00121 public $mControl_flow = false; 00122 00123 public $mControl_forwardOnly = false; 00124 00125 public $mConstrainChoice= false; 00126 00127 public $mPreventActivation = false; 00128 00129 public $mUseCurObj = true; 00130 00131 public $mUseCurPro = true; 00132 00133 public $mMaxAttemptControl = false; 00134 00135 public $mMaxAttempt = 0; 00136 00137 public $mAttemptAbDurControl = false; 00138 00139 //ADLDuration 00140 public $mAttemptAbDur = null; 00141 00142 public $mAttemptExDurControl = false; 00143 00144 public $mAttemptExDur = null; 00145 00146 public $mActivityAbDurControl = false; 00147 00148 //ADLDuration 00149 public $mActivityAbDur = null; 00150 00151 public $mActivityExDurControl = false; 00152 00153 //ADLDuration 00154 public $mActivityExDur = null; 00155 00156 public $mBeginTimeControl = false; 00157 00158 public $mBeginTime = null; 00159 00160 public $mEndTimeControl = false; 00161 00162 public $mEndTime = null; 00163 00164 //convert to array? 00165 public $mAuxResources = null; 00166 00167 //SeqRollupRuleset 00168 public $mRollupRules = null; 00169 00170 public $mActiveMeasure = true; 00171 00172 public $mRequiredForSatisfied = ROLLUP_CONSIDER_ALWAYS; 00173 00174 public $mRequiredForNotSatisfied = ROLLUP_CONSIDER_ALWAYS; 00175 00176 public $mRequiredForCompleted = ROLLUP_CONSIDER_ALWAYS; 00177 00178 public $mRequiredForIncomplete = ROLLUP_CONSIDER_ALWAYS; 00179 00180 //convert to array 00181 public $mObjectives = null; 00182 00183 //HashTable convert to assosiative array 00184 public $mObjMaps = null; 00185 00186 public $mIsObjectiveRolledUp = true; 00187 00188 public $mObjMeasureWeight = 1.0; 00189 00190 public $mIsProgressRolledUp = true; 00191 00192 public $mSelectTiming = "never"; 00193 00194 public $mSelectStatus = false; 00195 00196 public $mSelectCount = 0; 00197 00198 public $mSelection = false; 00199 00200 public $mRandomTiming = "never"; 00201 00202 public $mReorder = false; 00203 00204 public $mRandomized = false; 00205 00206 public $mIsTracked = true; 00207 00208 public $mContentSetsCompletion = false; 00209 00210 public $mContentSetsObj = false; 00211 00212 //ADLTracking 00213 public $mCurTracking = null; 00214 00215 //convert to array? 00216 public $mTracking = null; 00217 00218 public $mNumAttempt = 0; 00219 00220 public $mNumSCOAttempt = 0; 00221 00222 //ADLDuration 00223 public $mActivityAbDur_track = null; 00224 00225 //ADLDuration 00226 public $mActivityExDur_track = null; 00227 00228 00229 public function __construct() { 00230 //$this->mActiveChildren = array(); 00231 } 00232 00233 public function addChild($ioChild){ 00234 00235 if ($this->mChildren == null) { 00236 $this->mChildren = array(); 00237 } 00238 if ($this->mActiveChildren == null) { 00239 $this->mActiveChildren = array(); 00240 } 00241 00242 //set class 00243 $c_ioChild['_SeqActivity']=$ioChild; 00244 00245 //keep both in sync 00246 array_push($this->mChildren,$c_ioChild); 00247 //array_push($this->mActiveChildren,$c_ioChild); 00248 00249 //$this->mActiveChildren = $this->mChildren; 00250 00251 $ioChild->setOrder(count($this->mChildren) - 1); 00252 $ioChild->setActiveOrder(count($this->mChildren)- 1); 00253 00254 //set parents on the client 00255 //$ioChild->setParent($this); 00256 } 00257 00258 public function setOrder($iOrder) 00259 { 00260 $this->mOrder = $iOrder; 00261 } 00262 00263 public function setActiveOrder ($iOrder) { 00264 $this->mActiveOrder = $iOrder; 00265 } 00266 00267 public function setParent ($iParent) { 00268 $this->mParent = $iParent; 00269 } 00270 00271 00272 00273 //setters for public vats 00274 public function setID($id){ 00275 $this->mActivityID = $id; 00276 } 00277 00278 function setResourceID($id){ 00279 $this->mResourceID = $id; 00280 } 00281 00282 public function setIsVisible($visible){ 00283 $this->mIsVisible = $visible; 00284 } 00285 00286 public function setControlModeChoice($choice) { 00287 $this->mControl_choice=$choice; 00288 } 00289 00290 public function setControlModeChoiceExit($choiceExit) { 00291 $this->mControl_choiceExit=$choiceExit; 00292 } 00293 00294 public function setControlModeFlow($flow) { 00295 $this->mControl_flow=$flow; 00296 } 00297 00298 public function setControlForwardOnly($forwardOnly) { 00299 $this->mControl_forwardOnly=$forwardOnly; 00300 } 00301 00302 public function setUseCurObjective($useCurObjective) { 00303 $this->mUseCurObj=$useCurObjective; 00304 } 00305 00306 public function setUseCurProgress($useCurProgress) { 00307 $this->mUseCurPro=$useCurProgress; 00308 } 00309 00310 public function setAttemptLimit($value) { 00311 if ( $value >= 0 ) { 00312 $this->mMaxAttemptControl = true; 00313 $this->mMaxAttempt = $value; 00314 } 00315 else { 00316 $this->mMaxAttemptControl = false; 00317 $this->mMaxAttempt = -1; 00318 } 00319 } 00320 00321 public function setAttemptAbDur($iDur) { 00322 if ( $iDur != null ) { 00323 $this->mActivityAbDurControl = true; 00324 //to be implemented 00325 //convert duration 00326 //$this->mActivityAbDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur); 00327 } 00328 else { 00329 $this->mActivityAbDurControl = false; 00330 } 00331 } 00332 00333 public function setAttemptExDur($iDur) { 00334 if ( $iDur != null ) { 00335 $this->mAttemptExDurControl = true; 00336 //to be implemented 00337 // $this->mAttemptExDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur); 00338 } 00339 else 00340 { 00341 $this->mAttemptExDurControl = false; 00342 } 00343 } 00344 00345 public function setActivityAbDur($iDur) { 00346 if ( $iDur != null ) 00347 { 00348 $this->mActivityAbDurControl = true; 00349 //$this->mActivityAbDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur); 00350 } 00351 else 00352 { 00353 $this->mActivityAbDurControl = false; 00354 } 00355 } 00356 00357 public function setActivityExDur($iDur) { 00358 if ( $iDur != null ) 00359 { 00360 $this->mmActivityExDurControl = true; 00361 // $this->mmActivityExDur = new ADLDuration(ADLDuration.FORMAT_SCHEMA, iDur); 00362 } 00363 else 00364 { 00365 $this->mmActivityExDurControl = false; 00366 } 00367 } 00368 00369 public function setBeginTimeLimit($iTime) { 00370 if ( $iTime != null ) 00371 { 00372 $this->mBeginTimeControl = true; 00373 $this->mBeginTime = $iTime; 00374 } 00375 else 00376 { 00377 $this->mBeginTimeControl = false; 00378 } 00379 } 00380 00381 public function setEndTimeLimit($iTime) { 00382 if ( $iTime != null ) 00383 { 00384 $this->mEndTimeControl = true; 00385 $this->mEndTime = $iTime; 00386 } 00387 else 00388 { 00389 $this->mEndTimeControl = false; 00390 } 00391 } 00392 00393 public function setRandomTiming($iTiming) { 00394 // Validate vocabulary 00395 if ( !($this->iTiming == TIMING_NEVER || 00396 $this->iTiming == TIMING_ONCE || 00397 $this->iTiming == TIMING_EACHNEW ) ) 00398 { 00399 $this->mSelectTiming = TIMING_NEVER; 00400 } 00401 else 00402 { 00403 $this->mRandomTiming = $iTiming; 00404 } 00405 } 00406 00407 public function setSelectCount($iCount) { 00408 if ( $iCount >= 0 ) 00409 { 00410 $this->mSelectStatus = true; 00411 $this->mSelectCount = $iCount; 00412 } 00413 else 00414 { 00415 $this->mSelectStatus = false; 00416 } 00417 } 00418 00419 public function setReorderChildren($iReorder) { 00420 00421 $this->mReorder = $iReorder; 00422 } 00423 00424 00425 public function setSelectionTiming($iTiming) { 00426 00427 // Validate vocabulary 00428 if ( !($this->iTiming == TIMING_NEVER || 00429 $this->iTiming == TIMING_ONCE || 00430 $this->iTiming == TIMING_EACHNEW ) ) 00431 { 00432 $this->mSelectTiming = TIMING_NEVER; 00433 } 00434 else 00435 { 00436 $this->mSelectTiming = $iTiming; 00437 } 00438 00439 } 00440 00441 public function setIsTracked($iTracked) { 00442 $this->mIsTracked = $iTracked; 00443 } 00444 00445 public function setSetCompletion($iSet) { 00446 $this->mContentSetsCompletion = $iSet; 00447 } 00448 00449 public function setSetObjective($iSet) { 00450 $this->mContentSetsObj = $iSet; 00451 } 00452 00453 public function setPreventActivation($iPreventActivation) { 00454 $this->mPreventActivation = $iPreventActivation; 00455 } 00456 00457 public function setConstrainChoice($iConstrainChoice) { 00458 $this->mConstrainChoice = $iConstrainChoice; 00459 } 00460 00461 public function setRequiredForSatisfied($iConsider) { 00462 $this->mRequiredForSatisfied = $iConsider; 00463 } 00464 00465 public function setRequiredForNotSatisfied($iConsider) { 00466 $this->mRequiredForNotSatisfied = $iConsider; 00467 } 00468 00469 public function setRequiredForCompleted($iConsider) { 00470 $this->mRequiredForCompleted = $iConsider; 00471 } 00472 00473 public function setRequiredForIncomplete($iConsider) { 00474 $this->mRequiredForIncomplete = $iConsider; 00475 } 00476 00477 public function setSatisfactionIfActive($iActiveMeasure) { 00478 $this->mActiveMeasure = $iActiveMeasure; 00479 } 00480 00481 public function setTitle($title){ 00482 $this->mTitle = $title; 00483 } 00484 00485 public function setPreSeqRules($iRuleSet) { 00486 $this->mPreConditionRules = $iRuleSet; 00487 } 00488 00489 public function setExitSeqRules($iRuleSet) { 00490 $this->mExitActionRules = $iRuleSet; 00491 } 00492 00493 public function setPostSeqRules($iRuleSet) { 00494 $this->mPostConditionRules = $iRuleSet; 00495 } 00496 00497 public function setObjectives($iObjs){ 00498 $this->mObjectives = $iObjs; 00499 for ( $i = 0; $i < count($iObjs); $i++ ) { 00500 $obj = $iObjs[$i]; 00501 if ($obj['_SeqObjective']->mMaps!=null) { 00502 $index=$obj['_SeqObjective']->mObjID; 00503 $this->mObjMaps["$index"]=$obj['_SeqObjective']->mMaps; 00504 } 00505 } 00506 } 00507 00508 public function setIsObjRolledUp($iRolledup) { 00509 $this->mIsObjectiveRolledUp = $iRolledup; 00510 } 00511 00512 public function setObjMeasureWeight($iWeight) { 00513 $this->mObjMeasureWeight = $iWeight; 00514 } 00515 00516 public function setIsProgressRolledUp($iRolledup) { 00517 $this->mIsProgressRolledUp = $iRolledup; 00518 } 00519 00520 public function setRollupRules($iRuleSet) { 00521 $this->mRollupRules = $iRuleSet; 00522 } 00523 00524 public function setAuxResources($iRes) { 00525 $this->mAuxResources = $iRes; 00526 } 00527 00528 00529 00530 00531 function getID() { 00532 00533 return $this->mActivityID; 00534 00535 } 00536 00537 function getIsVisible(){ 00538 00539 return $this->mIsVisible; 00540 00541 } 00542 00543 00544 00545 00546 } 00547 00548 00549 ?>
1.7.1