fixed some typos. removed all tabs
[moodle.git] / mod / scorm / datamodels / sequencinglib.php
CommitLineData
dc383b6f 1<?php \r
2\r
3// Cac ham danh cho viec thuc thi Sequencing\r
4// --------Ket thuc cac ham danh cho viec thuc thi Sequencing ------------\r
5\r
6// Cac ham danh cho viec thuc thi Rollup\r
7\r
8//-----------------------------------------------------\r
9function scorm_rollup_updatestatus($scormid,$scoidchild, $userid)\r
10{\r
11 //$f = "D:\\test.txt";\r
12 //@$ft = fopen($f,"a");\r
13 //fwrite($ft,"\n >>>>> SCO goi Rollup la ".$scoidchild);\r
14 $scochild = get_record("scorm_scoes","id",$scoidchild);\r
15 $scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);\r
16 //Danh sach cac con cua cha\r
17 $scochildren = get_records_select("scorm_scoes","scorm =".$scormid." and parent ='".$scoparent->identifier."'");\r
18 //Lay gia tri last attempt\r
19 //fwrite($ft,"\n >>>>> Bat dau xu ly Rollup SCO cha ".$scoparent->id);\r
20 $attempt = scorm_get_last_attempt($scormid,$userid);\r
21 \r
22 if(!empty($scoparent)){\r
23 $scoid = $scoparent->id;\r
24 $rolluprules = get_record("scorm_sequencing_rolluprules","scormid",$scormid,"scoid",$scoid);\r
25 if (!empty($rolluprules)){\r
26 $idrolluprules = $rolluprules->id;\r
27 $rules = get_records_select('scorm_sequencing_rolluprule','scoid ='.$scoid.' and rolluprulesid ='. $idrolluprules);\r
28 \r
29 foreach ($rules as $rule){\r
30 $ruleid = $rule->id;\r
31 $ruleConditions = get_record("scorm_sequencing_rollupruleconditions","scoid",$scoid,"rollupruleid",$ruleid); \r
32 $idruleConditions = $ruleConditions->id;\r
33 $conditions = get_records_select('scorm_sequencing_rolluprulecondition','scoid ='.$scoid.' and ruleconditionsid ='.$idruleConditions); \r
34 \r
35 //Truong hop 1: childactivitySet = all\r
36 // conditioncombination = any\r
37 if (($rule->childactivityset == 'all') && ($ruleConditions->conditioncombination=='any')){\r
38 foreach($conditions as $condition){\r
39 $conditionOK = false; \r
40 //Condition 1: condition = attempted operator = 'noOp'\r
41 // Thuc hien rollupaction \r
42 if (($condition->condition == 'attempted') && ($condition->operator=='noOp')){\r
43 $conditionOK = true; \r
44 foreach ($scochildren as $sco){\r
45 //fwrite($ft,"\n >>>>> Xu ly Rollup voi dieu kien attempt \n");\r
46 $usertrack = scorm_get_tracks($sco->id,$userid);\r
47 if ($usertrack->attempt_status != 'attempted'){\r
48 //fwrite($ft,"\n >>>>> Co SCO con chua attempted \n");\r
49 $conditionOK = false;\r
50 }\r
51 }\r
52 }\r
53 //Condition 2: condition = attempted operator = 'not'\r
54 // Thuc hien rollupaction \r
55 if (($condition->condition == 'attempted') && ($condition->operator=='not')){\r
56 $conditionOK = true; \r
57 foreach ($scochildren as $sco){\r
58 //fwrite($ft,"\n >>>>> Xu ly Rollup voi dieu kien not attempt \n");\r
59 $usertrack = scorm_get_tracks($sco->id,$userid);\r
60 if ($usertrack->attempt_status != 'notattempted'){\r
61 $conditionOK = false;\r
62 }\r
63 }\r
64 } \r
65 //Condition 3: condition = satisfied operator = 'noOp'\r
66 // Thuc hien rollupaction \r
67 if (($condition->condition == 'satisfied') && ($condition->operator=='noOp')){\r
68 $conditionOK = true; \r
69 foreach ($scochildren as $sco){\r
70 $usertrack = scorm_get_tracks($sco->id,$userid);\r
71 if ($usertrack->satisfied_status != 'satisfied'){\r
72 $conditionOK = false;\r
73 }\r
74 }\r
75 }\r
76 //Condition 4: condition = satisfied operator = 'not'\r
77 // Thuc hien rollupaction \r
78 if (($condition->condition == 'satisfied') && ($condition->operator=='not')){\r
79 $conditionOK = true; \r
80 foreach ($scochildren as $sco){\r
81 $usertrack = scorm_get_tracks($sco->id,$userid);\r
82 if ($usertrack->satisfied_status != 'notSatisfied'){\r
83 $conditionOK = false;\r
84 }\r
85 }\r
86 } \r
87 //Condition 5: condition = completed operator = 'noOp'\r
88 // Thuc hien rollupaction \r
89 if (($condition->condition == 'completed') && ($condition->operator=='noOp')){\r
90 $conditionOK = true; \r
91 foreach ($scochildren as $sco){\r
92 $usertrack = scorm_get_tracks($sco->id,$userid);\r
93 if ($usertrack->attempt_status != 'completed'){\r
94 $conditionOK = false;\r
95 }\r
96 }\r
97 } \r
98 //Condition 6: condition = completed operator = 'not'\r
99 // Thuc hien rollupaction \r
100 if (($condition->condition == 'completed') && ($condition->operator=='not')){\r
101 $conditionOK = true; \r
102 foreach ($scochildren as $sco){\r
103 $usertrack = scorm_get_tracks($sco->id,$userid);\r
104 if ($usertrack->attempt_status != 'notcompleted'){\r
105 $conditionOK = false;\r
106 }\r
107 }\r
108 } \r
109 //Neu dieu kien van dung sau khi xem xet thi thuc hien action\r
110 if ($conditionOK == true){\r
111 if ($ruleConditions->rollupruleaction == 'completed')\r
112 {\r
113 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.completion_status','completed');\r
114 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi completed cho SCO ".$scoid);\r
115 }\r
116 if ($ruleConditions->rollupruleaction == 'satisfied')\r
117 {\r
118 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','passed');\r
119 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi satisfied\n");\r
120 }\r
121 if ($ruleConditions->rollupruleaction == 'notSatisfied')\r
122 {\r
123 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','failed');\r
124 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi notSatisfied\n");\r
125 } \r
126 //echo "<script language='JavaScript'>";\r
127 //echo "alert('Thuc hien rollup. Trang thai ".$scoparent->identifier." la hoan thanh voi userid".$userid."');";\r
128 //echo "<script>";\r
129 \r
130 }\r
131 }\r
132 }\r
133 //Ket thuc truong hop 1\r
134 //Truong hop 2: childactivitySet = any\r
135 // conditioncombination = any\r
136 if (($rule->childactivityset == 'any') && ($ruleConditions->conditioncombination=='any')){\r
137 $conditionOK = false; \r
138 foreach($conditions as $condition){\r
139 //$conditionOK = false; \r
140 //Condition 1: condition = attempted operator = 'noOp'\r
141 // Thuc hien rollupaction \r
142 if (($condition->condition == 'attempted') && ($condition->operator=='noOp')){\r
143 $conditionOK = false; \r
144 foreach ($scochildren as $sco){\r
145 $usertrack = scorm_get_tracks($sco->id,$userid);\r
146 if ($usertrack->attempt_status = 'attempted'){\r
147 $conditionOK = true;\r
148 }\r
149 }\r
150 }\r
151 //Condition 2: condition = attempted operator = 'not'\r
152 // Thuc hien rollupaction \r
153 if (($condition->condition == 'attempted') && ($condition->operator=='not')){\r
154 $conditionOK = false; \r
155 foreach ($scochildren as $sco){\r
156 $usertrack = scorm_get_tracks($sco->id,$userid);\r
157 if ($usertrack->attempt_status = 'notattempted'){\r
158 $conditionOK = true;\r
159 }\r
160 }\r
161 } \r
162 //Condition 3: condition = satisfied operator = 'noOp'\r
163 // Thuc hien rollupaction \r
164 if (($condition->condition == 'satisfied') && ($condition->operator=='noOp')){\r
165 $conditionOK = false; \r
166 foreach ($scochildren as $sco){\r
167 $usertrack = scorm_get_tracks($sco->id,$userid);\r
168 if ($usertrack->satisfied_status = 'satisfied'){\r
169 $conditionOK = true;\r
170 }\r
171 }\r
172 }\r
173 //Condition 4: condition = satisfied operator = 'not'\r
174 // Thuc hien rollupaction \r
175 if (($condition->condition == 'satisfied') && ($condition->operator=='not')){\r
176 $conditionOK = false; \r
177 foreach ($scochildren as $sco){\r
178 $usertrack = scorm_get_tracks($sco->id,$userid);\r
179 if ($usertrack->satisfied_status = 'notSatisfied'){\r
180 //fwrite($ft,"\n >>>>> Xu ly Rollup voi notSatisfied\n");\r
181 $conditionOK = true;\r
182 }\r
183 }\r
184 } \r
185 //Condition 5: condition = completed operator = 'noOp'\r
186 // Thuc hien rollupaction \r
187 if (($condition->condition == 'completed') && ($condition->operator=='noOp')){\r
188 $conditionOK = false; \r
189 foreach ($scochildren as $sco){\r
190 $usertrack = scorm_get_tracks($sco->id,$userid);\r
191 if ($usertrack->attempt_status = 'completed'){\r
192 $conditionOK = true;\r
193 }\r
194 }\r
195 } \r
196 //Condition 6: condition = completed operator = 'not'\r
197 // Thuc hien rollupaction \r
198 if (($condition->condition == 'completed') && ($condition->operator=='not')){\r
199 $conditionOK = false; \r
200 foreach ($scochildren as $sco){\r
201 $usertrack = scorm_get_tracks($sco->id,$userid);\r
202 if ($usertrack->attempt_status = 'notcompleted'){\r
203 $conditionOK = true;\r
204 }\r
205 }\r
206 } \r
207 //Neu dieu kien van dung sau khi xem xet thi thuc hien action\r
208 if ($conditionOK == true){\r
209 if ($ruleConditions->rollupruleaction == 'completed')\r
210 {\r
211 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.completion_status','completed');\r
212 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi completed\n");\r
213 }\r
214 if ($ruleConditions->rollupruleaction == 'satisfied')\r
215 {\r
216 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','passed');\r
217 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi satisfied\n");\r
218 }\r
219 if ($ruleConditions->rollupruleaction == 'notSatisfied')\r
220 {\r
221 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','failed');\r
222 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi notSatisfied\n");\r
223 } \r
224 //echo "<script language='JavaScript'>";\r
225 //echo "alert('Thuc hien rollup. Trang thai ".$scoparent->identifier." la hoan thanh voi userid".$userid."');";\r
226 //echo "<script>";\r
227 \r
228 }\r
229 }\r
230 }\r
231 //Ket thuc truong hop 2\r
232 //Truong hop 3: childactivitySet = any\r
233 // conditioncombination = all\r
234 if (($rule->childactivityset == 'any') && ($ruleConditions->conditioncombination=='all')){\r
235 foreach ($scochildren as $sco){\r
236 $usertrack = scorm_get_tracks($sco->id,$userid);\r
237 $conditionOK = true; \r
238 foreach($conditions as $condition){\r
239 //Condition 1: condition = attempted operator = 'noOp'\r
240 // Thuc hien rollupaction \r
241 if (($condition->condition == 'attempted') && ($condition->operator=='noOp')){\r
242 if ($usertrack->attempt_status != 'attempted'){\r
243 $conditionOK = false;\r
244 }\r
245 }\r
246 //Condition 2: condition = attempted operator = 'not'\r
247 // Thuc hien rollupaction \r
248 if (($condition->condition == 'attempted') && ($condition->operator=='not')){\r
249 if ($usertrack->attempt_status != 'notattempted'){\r
250 $conditionOK = false;\r
251 }\r
252 } \r
253 //Condition 3: condition = satisfied operator = 'noOp'\r
254 // Thuc hien rollupaction \r
255 if (($condition->condition == 'satisfied') && ($condition->operator=='noOp')){\r
256 if ($usertrack->attempt_status != 'satisfied'){\r
257 $conditionOK = false;\r
258 }\r
259 }\r
260 //Condition 4: condition = satisfied operator = 'not'\r
261 // Thuc hien rollupaction \r
262 if (($condition->condition == 'satisfied') && ($condition->operator=='not')){\r
263 if ($usertrack->attempt_status != 'notSatisfied'){\r
264 $conditionOK = false;\r
265 }\r
266 } \r
267 //Condition 5: condition = completed operator = 'noOp'\r
268 // Thuc hien rollupaction \r
269 if (($condition->condition == 'completed') && ($condition->operator=='noOp')){\r
270 if ($usertrack->attempt_status != 'completed'){\r
271 $conditionOK = false;\r
272 }\r
273 } \r
274 //Condition 6: condition = completed operator = 'not'\r
275 // Thuc hien rollupaction \r
276 if (($condition->condition == 'completed') && ($condition->operator=='not')){\r
277 if ($usertrack->attempt_status != 'notcompleted'){\r
278 $conditionOK = false;\r
279 }\r
280 } \r
281 //Neu dieu kien van dung sau khi xem xet thi thuc hien action\r
282 }\r
283 }\r
284 if ($conditionOK == true){\r
285 if ($ruleConditions->rollupruleaction == 'completed')\r
286 {\r
287 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.completion_status','completed');\r
288 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi completed\n");\r
289 }\r
290 if ($ruleConditions->rollupruleaction == 'satisfied')\r
291 {\r
292 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','passed');\r
293 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi satisfied\n");\r
294 }\r
295 if ($ruleConditions->rollupruleaction == 'notSatisfied')\r
296 {\r
297 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','failed');\r
298 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi notSatisfied\n");\r
299 } \r
300 //echo "<script language='JavaScript'>";\r
301 //echo "alert('Thuc hien rollup. Trang thai ".$scoparent->identifier." la hoan thanh voi userid".$userid."');";\r
302 //echo "<script>";\r
303 \r
304 } \r
305 }\r
306 //Ket thuc truong hop 3\r
307 //Truong hop 4: childactivitySet = all\r
308 // conditioncombination = all\r
309 if (($rule->childactivityset == 'all') && ($ruleConditions->conditioncombination=='all')){\r
310 $conditionOK = true; \r
311 foreach ($scochildren as $sco){\r
312 $usertrack = scorm_get_tracks($sco->id,$userid);\r
313 foreach($conditions as $condition){\r
314 //Condition 1: condition = attempted operator = 'noOp'\r
315 // Thuc hien rollupaction \r
316 if (($condition->condition == 'attempted') && ($condition->operator=='noOp')){\r
317 if ($usertrack->attempt_status != 'attempted'){\r
318 $conditionOK = false;\r
319 }\r
320 }\r
321 //Condition 2: condition = attempted operator = 'not'\r
322 // Thuc hien rollupaction \r
323 if (($condition->condition == 'attempted') && ($condition->operator=='not')){\r
324 if ($usertrack->attempt_status != 'notattempted'){\r
325 $conditionOK = false;\r
326 }\r
327 } \r
328 //Condition 3: condition = satisfied operator = 'noOp'\r
329 // Thuc hien rollupaction \r
330 if (($condition->condition == 'satisfied') && ($condition->operator=='noOp')){\r
331 if ($usertrack->attempt_status != 'satisfied'){\r
332 $conditionOK = false;\r
333 }\r
334 }\r
335 //Condition 4: condition = satisfied operator = 'not'\r
336 // Thuc hien rollupaction \r
337 if (($condition->condition == 'satisfied') && ($condition->operator=='not')){\r
338 if ($usertrack->attempt_status != 'notSatisfied'){\r
339 $conditionOK = false;\r
340 }\r
341 } \r
342 //Condition 5: condition = completed operator = 'noOp'\r
343 // Thuc hien rollupaction \r
344 if (($condition->condition == 'completed') && ($condition->operator=='noOp')){\r
345 if ($usertrack->attempt_status != 'completed'){\r
346 $conditionOK = false;\r
347 }\r
348 } \r
349 //Condition 6: condition = completed operator = 'not'\r
350 // Thuc hien rollupaction \r
351 if (($condition->condition == 'completed') && ($condition->operator=='not')){\r
352 if ($usertrack->attempt_status != 'notcompleted'){\r
353 $conditionOK = false;\r
354 }\r
355 } \r
356 //Neu dieu kien van dung sau khi xem xet thi thuc hien action\r
357 }\r
358 }\r
359 if ($conditionOK == true){\r
360 if ($ruleConditions->rollupruleaction == 'completed')\r
361 {\r
362 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.completion_status','completed');\r
363 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi completed\n");\r
364 }\r
365 if ($ruleConditions->rollupruleaction == 'satisfied')\r
366 {\r
367 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','passed');\r
368 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi satisfied\n");\r
369 }\r
370 if ($ruleConditions->rollupruleaction == 'notSatisfied')\r
371 {\r
372 scorm_insert_track($userid,$scormid,$scoid,$attempt,'cmi.success_status','failed');\r
373 //fwrite($ft,"\n >>>>> Xu ly Rollup thanh cong voi notSatisfied\n");\r
374 } \r
375 //echo "<script language='JavaScript'>";\r
376 //echo "alert('Thuc hien rollup. Trang thai ".$scoparent->identifier." la hoan thanh voi userid".$userid."');";\r
377 //echo "<script>";\r
378 \r
379 } \r
380 }\r
381 //Ket thuc truong hop 4 \r
382 } \r
383 }\r
384 \r
385 //Thuc hien de qui cho Rollup voi cac muc cha\r
386 $scograndparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scoparent->parent);\r
387 if (!empty($scograndparent)){\r
388 //fwrite($ft,"\n >>>>> Quay lui Rollup SCO ".$scoparent->id);\r
389 scorm_rollup_updatestatus($scormid,$scoparent->id, $userid);\r
390 }\r
391 }\r
392}\r
393\r
394// --------Ket thuc cac ham danh cho viec thuc thi Rollup -------\r
395\r
396//---------Thuc hien sequencing rule -----------------\r
397function scorm_sequecingrule_implement($scormid,$scoidchild, $userid)\r
398{\r
399 $sequencingResult->rule = ''; //Rule co 3 truong hop exit, pre va post\r
400 $sequencingResult->action = '';\r
401 \r
402 \r
403 $f = "D:\\test.txt";\r
404 @$ft = fopen($f,"a");\r
405 //fwrite($ft,"\n >>>>> Kiem tra Sequencing \n");\r
406\r
407 $scochild = get_record("scorm_scoes","id",$scoidchild);\r
408 $scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);\r
409 //Danh sach cac con cua cha\r
410 $scochildren = get_records_select("scorm_scoes","scorm =".$scormid." and parent ='".$scoparent->identifier."'");\r
411 //Lay gia tri last attempt\r
412 \r
413 $attempt = scorm_get_last_attempt($scormid,$userid);\r
414 \r
415 if(!empty($scoparent)){\r
416 //fwrite($ft,"\n >>>>> Kiem tra Sequencing : Co Parent\n");\r
417 \r
418 $scoid = $scoparent->id;\r
419 //Lay trang thai cua SCO cha\r
420 $usertrack = scorm_get_tracks($scoid,$userid);\r
421 //fwrite($ft,"\n >>>>> Kiem tra Sequencing : id Parent ".$scoid); \r
422 //fwrite($ft,"\n >>>>> Kiem tra Sequencing : usertrack ".$usertrack->status); \r
423 $sequencingrules = get_records_select("scorm_sequencing_ruleconditions","scormid=".$scormid." and scoid=".$scoid);\r
424 if (!empty($sequencingrules)){\r
425 foreach($sequencingrules as $sequencingrule){\r
426 //fwrite($ft,"\n >>>>> Kiem tra Sequencing : Co Sequencing o SCO".$sequencingrule->scoid); \r
427 \r
428 $idsequencingrule = $sequencingrule->id;\r
429 $ruleconditions = get_records_select('scorm_sequencing_rulecondition','scoid ='.$scoid.' and ruleconditionsid ='. $idsequencingrule);\r
430 \r
431 $conditionOK = true;\r
432 //Truong hop 1: conditioncombination = all \r
433 if ($sequencingrule->conditioncombination =='all'){\r
434 //fwrite($ft,"\n >>>>> Kiem tra Sequencing :conditioncombination la all \n"); \r
435 $conditionOK = true;\r
436 //fwrite($ft,"\n >>>>> Usertrack->status la: ".$usertrack->status);\r
437 foreach ($ruleconditions as $rulecondition){\r
438 //Neu co mot dieu kien khong thoa man thi se khong dung\r
439 if (($rulecondition->condition != $usertrack->status)&&($rulecondition->condition != $usertrack->success_status)&&($rulecondition->condition != $usertrack->satisfied_status)){\r
440 $conditionOK = false; \r
441 }\r
442 } \r
443 }\r
444 //Truong hop 2: conditioncombination = any \r
445 if ($sequencingrule->conditioncombination =='any'){\r
446 $conditionOK = false; \r
447 foreach ($ruleconditions as $rulecondition){\r
448 //Neu co mot dieu kien thoa man thi se dung\r
449 if (($rulecondition->condition == $usertrack->status) || ($rulecondition->condition == $usertrack->success_status) || ($rulecondition->condition == $usertrack->satisfied_status) ){\r
450 $conditionOK = true; \r
451 }\r
452 } \r
453 }\r
454 \r
455 //fwrite($ft,"\n >>>>> Gia tri conditionOK sau khi kiem tra dk la: ".$conditionOK);\r
456 //Neu dieu kien van dung thi thuc hien Action \r
457 if ($conditionOK == true){\r
458 //fwrite($ft,"\n >>>>> Dieu kien Sequencing OK..Thuc hien Action \n"); \r
459 //Truong hop 1: ExitAction la Exit\r
460 if ($sequencingrule->exitconditionruleaction=='exit')\r
461 {\r
462 //fwrite($ft,"\n >>>>> Xu ly Sequencing thanh cong -- Thuc hien su kien exit \n");\r
32f0b38a 463 echo "<script type=\"text/javascript\">";\r
dc383b6f 464 echo "alert('Thuc hien sequen. Do Trang thai ".$scoparent->identifier." la hoan thanh. Tien hanh EXIT');";\r
465 echo "</script>";\r
466 $sequencingResult->rule = 'exit';\r
467 $sequencingResult->action = 'exit'; \r
468 }\r
469 if ($sequencingrule->preconditionruleaction=='disabled')\r
470 {\r
471 //fwrite($ft,"\n >>>>> Xu ly Sequencing thanh cong -- Thuc hien su kien disable \n");\r
32f0b38a 472 echo "<script type=\"text/javascript\">";\r
dc383b6f 473 echo "alert('Thuc hien sequen. Do Trang thai ".$scoparent->identifier." la hoan thanh. Tien hanh Disable');";\r
474 echo "</script>"; \r
475 $sequencingResult->rule = 'pre';\r
476 $sequencingResult->action = 'disable'; \r
477 \r
478 } \r
479 \r
480 }\r
481 }\r
482 }\r
483 }\r
484 return $sequencingResult;\r
485}\r
486function get_sco_after_exit($scoid,$scormid){\r
487 $scochild = get_record("scorm_scoes","id",$scoid);\r
488 $scoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$scochild->parent);\r
489 $exitscoid = $scoid++;\r
490 $exitscochild = get_record("scorm_scoes","id",$exitscoid,"scorm",$scormid);\r
491 if (empty($exitscochild)){\r
492 //Da ra ngoai vung scoid. Hay day chinh la sco cuoi cung\r
493 return 0;\r
494 }\r
495 else{\r
496 $exitscoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$exitscochild->parent);\r
497 //Neu chua ra khoi activity do thi tiep tuc\r
498 while ($exitscoparent->id == $scoparent->id){\r
499 $exitscoid++;\r
500 $exitscochild = get_record("scorm_scoes","id",$exitscoid);\r
501 if (empty($exitscochild)){\r
502 //Da ra ngoai vung scoid. Hay day chinh la sco cuoi cung\r
503 return 0;\r
504 }\r
505 else{\r
506 $exitscoparent = get_record("scorm_scoes","scorm",$scormid,"identifier",$exitscochild->parent);\r
507 }\r
508 }\r
509 }\r
510 return $exitscoid; \r
511}\r
512\r
513?>\r