⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sequencinglib.php

📁 很棒的在线教学系统
💻 PHP
📖 第 1 页 / 共 5 页
字号:
				 if($b === false){					 return false;				 }			 }			 else{                $val = false;				 				if($b == 'unknown'){					 $unk = true;				}				if($b === true){					return true;				}			 }		}	}	if ($unk){		return 'unknown';	}	return $val;}function scorm_evaluate_condition ($rolluprulecond,$sco,$userid){		        $res = false;            switch ($rolluprulecond->cond){								case 'satisfied':					 if($r=get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','objectivesatisfiedstatus')){						if($r->value == true){					        if ($r=get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','objectiveprogressstatus')){						        if($r->value == true){					               $res= true;						        }				            }						}				    }				break;				case 'objectiveStatusKnown':                    if ($r=get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','objectiveprogressstatus')){						if($r->value == true){					        $res= true;						}				    }				break;				case 'objectiveMeasureKnown':					if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','objectivemeasurestatus')){					    if($r->value == true){							$res = true;						}					    }				break;				case 'completed':					if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','attemptcompletionstatus')){					    if($r->value){							if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','attemptprogressstatus')){					           if($r->value){							      $res = true;						       }					            }						}					    }				break;				case 'attempted':					if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','activityprogressstatus')){					    if($r->value){							if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','activityattemptcount')){					            if($r->value > 0){							        $res = true;						        }					            }						}					    }				break;								case 'attemptLimitExceeded':					if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','activityprogressstatus')){					    if($r->value){							if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','limitconditionattemptlimitcontrol')){					            if($r->value){							       if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','activityattemptcount') && $r2 = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','limitconditionattemptlimit') ){					                   if($r->value >= $r2->value){							               $res = true;						               }					                   }											        }					            }											}					    }									break;				case 'activityProgressKnown':					if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','activityprogressstatus')){					    if($r->value){					        if ($r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','attemptprogressstatus')){					            if($r->value){							        $res = true;						        }					            }											}					    }									break;			}			return $res;}function scorm_seq_check_child ($sco, $action, $userid){	$included = false;	$sco=scorm_get_sco($sco->id);	$r = get_record('scorm_scoes_track','scoid',$sco->id,'userid',$userid,'element','activityattemptcount');	if ($action == 'satisfied' || $action == 'notsatisfied'){	  if (!$sco->rollupobjectivesatisfied){		$included = true;		if (($action == 'satisfied' && $sco->requiredforsatisfied == 'ifnotsuspended') || ($action == 'notsatisfied' && $sco->requiredfornotsatisfied == 'ifnotsuspended')){						if (!scorm_seq_is('activityprogressstatus',$sco->id,$userid) || ((($r->value)>0)&& !scorm_seq_is('suspended',$sco->id,$userid))){				$included = false;			}		}		else{			if (($action == 'satisfied' && $sco->requiredforsatisfied == 'ifattempted') || ($action == 'notsatisfied' && $sco->requiredfornotsatisfied == 'ifattempted')){			    if (!scorm_seq_is('activityprogressstatus',$sco->id,$userid) || (($r->value) == 0)){				    $included = false;			    }            }			else{				if (($action == 'satisfied' && $sco->requiredforsatisfied == 'ifnotskipped') || ($action == 'notsatisfied' && $sco->requiredfornotsatisfied == 'ifnotskipped')){					$rulch = scorm_seq_rules_check($sco, 'skip');					if ($rulch != null){						$included = false;					}			    }			}		}      }	}    if ($action == 'completed' || $action == 'incomplete'){		if (!$sco->rollupprogresscompletion){		    $included = true;            if (($action == 'completed' && $sco->requiredforcompleted == 'ifnotsuspended') || ($action == 'incomplete' && $sco->requiredforincomplete == 'ifnotsuspended')){			    if (!scorm_seq_is('activityprogressstatus',$sco->id,$userid) || ( (($r->value)>0)&& !scorm_seq_is('suspended',$sco->id,$userid))){				    $included = false;			    }		    }			else{								if (($action == 'completed' && $sco->requiredforcompleted == 'ifattempted') || ($action == 'incomplete' && $sco->requiredforincomplete == 'ifattempted')){			        if (!scorm_seq_is('activityprogressstatus',$sco->id,$userid) || (($r->value)==0)){				        $included = false;			        }		        }				else{					if (($action == 'completed' && $sco->requiredforsatisfied == 'ifnotskipped') || ($action == 'incomplete' && $sco->requiredfornotsatisfied == 'ifnotskipped')){					    $rulch = scorm_seq_rules_check($sco, 'skip');					    if ($rulch != null){						    $included = false;					    }			        }				}			}		}	}    return $included;}function scorm_seq_sequencing ($scoid,$userid,$seq) {    switch ($seq->sequencing) {        case 'start':			 $seq = scorm_seq_start_sequencing($sco,$userid,$seq); //We'll see the parameters we have to send, this should update delivery and end			$seq->sequencing = true;           					    break;			        case 'resumeall':			$seq = scorm_seq_resume_sequencing($sco,$userid,$seq); //We'll see the parameters we have to send, this should update delivery and end			$seq->sequencing = true;					                          break;        case 'exit':			 $seq = scorm_seq_exit_sequencing($sco,$userid,$seq); //We'll see the parameters we have to send, this should update delivery and end			$seq->sequencing = true;                                 break;        case 'retry':            $seq = scorm_seq_retry_sequencing($sco,$userid,$seq); //We'll see the parameters we have to send, this should update delivery and end            $seq->sequencing = true;			                      break;		case 'previous':			$seq = scorm_seq_previous_sequencing($sco,$userid,$seq);// We'll see the parameters we have to send, this should update delivery and end			$seq->sequencing = true;                     break;		case 'choice':			$seq = scorm_seq_choice_sequencing($sco,$userid,$seq);// We'll see the parameters we have to send, this should update delivery and end             $seq->sequencing = true; 			       		    break;    }	if ($seq->exception != null){		$seq->sequencing = false;		return $seq;	}		$seq->sequencing= true;    return $seq;}function scorm_seq_start_sequencing($scoid,$userid,$seq){	if (!empty($seq->currentactivity)) {		$seq->delivery = null;		$seq->exception = 'SB.2.5-1';		return $seq;	}	$sco = get_record('scorm_scoes','scoid',$scoid,'userid',$userid);	if (($sco->parent == '/') && scorm_is_leaf($sco)) {//if the activity is the root and is leaf		$seq->delivery = $sco;	}	else{		$ancestors = scorm_get_ancestors($sco);		$ancestorsroot = array_reverse($ancestors);		$res = scorm_seq_flow($ancestorsroot[0],'forward',$seq,true,$userid);		if($res){			return $res;		}		else{			//return end and exception		}	}}function scorm_seq_resume_all_sequencing($scoid,$userid,$seq){	if (!empty($seq->currentactivity)){		$seq->delivery = null;		$seq->exception = 'SB.2.6-1';		return $seq;	}	$track = get_record('scorm_scoes_track','scoid',$scoid,'userid',$userid,'element','suspendedactivity');    if (!$track) {		$seq->delivery = null;	    $seq->exception = 'SB.2.6-2';	    return $seq;	}	$seq->delivery = get_record('scorm_scoes','scoid',$scoid,'userid',$userid);//we assign the sco to the delivery	}function scorm_seq_continue_sequencing($scoid,$userid,$seq){	if (empty($seq->currentactivity)) {		$seq->delivery = null;		$seq->exception = 'SB.2.7-1';		return $seq;	}	$currentact= $seq->currentactivity;	if ($currentact->parent != '/') {//if the activity is the root and is leaf	    $parent = scorm_get_parent ($currentact);		 if (!isset($parent->flow) || ($parent->flow == false)) {			$seq->delivery = null;	        $seq->exception = 'SB.2.7-2';	        return $seq;		}		$res = scorm_seq_flow($currentact,'forward',$seq,false,$userid);		if($res){			return $res;		}		else{			//return end and exception		}	}}function scorm_seq_previous_sequencing($scoid,$userid,$seq){	if (empty($seq->currentactivity)) {		$seq->delivery = null;		$seq->exception = 'SB.2.8-1';		return $seq;	}		$currentact= $seq->currentactivity;	if ($currentact->parent != '/') {//if the activity is the root and is leaf	    $parent = scorm_get_parent ($activity);		if (!isset($parent->flow) || ($parent->flow == false)) {			$seq->delivery = null;	        $seq->exception = 'SB.2.8-2';	        return $seq;		}		$res = scorm_seq_flow($currentact,'backward',$seq,false,$userid);		if($res){			return $res;		}		else{			//return end and exception		}	}}function scorm_seq_exit_sequencing($scoid,$userid,$seq){	if (empty($seq->currentactivity)) {		$seq->delivery = null;		$seq->exception = 'SB.2.11-1';		return $seq;	}	 if ($seq->active){		 $seq->endsession = false;		 $seq->exception = 'SB.2.11-2';		 return $seq;	 }	 $currentact= $seq->currentactivity;	 if ($currentact->parent == '/'){		 $seq->endsession = true;		 return $seq;	 }			$seq->endsession = false;	return $seq;}function scorm_seq_retry_sequencing($scoid,$userid,$seq){	if (empty($seq->currentactivity)) {		$seq->delivery = null;		$seq->exception = 'SB.2.10-1';		return $seq;	}	if ($seq->active || $seq->suspended){		$seq->delivery = null;		$seq->exception = 'SB.2.10-2';		return $seq;	}		if (!scorm_is_leaf($seq->currentactivity)){	    $res = scorm_seq_flow($seq->currentactivity,'forward',$seq,true,$userid);		if($res != null){			return $res;			//return deliver		}		else{			$seq->delivery = null;		    $seq->exception = 'SB.2.10-3';		    return $seq;		}	}	else{		$seq->delivery = $seq->currentactivity;		return $seq;	}}function scorm_seq_flow ($candidate,$direction,$seq,$childrenflag,$userid){	//$PREVDIRECTION NOT DEFINED YET	$activity=$candidate;	$deliverable=false;	$previdirection = null;	$seq = scorm_seq_flow_tree_traversal ($activity,$direction,$childrenflag,$prevdirection,$seq,$userid);	if($seq->identifiedactivity == null){//if identifies		$seq->identifiedactivity = $candidate;		$seq->deliverable = false;		return $seq;	}	else{		$activity = $seq->identifiedactivity;		$seq = scorm_seq_flow_activity_traversal($activity,$userid,$direction,$childrenflag,$prevdirection,$seq,$userid);//		return $seq;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -