[svn r19667] logic changes -fixed total time in scorm and lp - (partial FS#3994)

skala
Isaac Flores 17 years ago
parent f7f03dd81e
commit 663622a04d
  1. 45
      main/newscorm/learnpathItem.class.php

@ -1108,6 +1108,7 @@ function get_terms()
if($this->current_start_time == 0){ //shouldn't be necessary thanks to the open() method
$this->current_start_time = time();
}
$this->current_stop_time=time();
$time = $this->current_stop_time - $this->current_start_time;
if($time < 0){
return 0;
@ -2260,8 +2261,50 @@ function get_terms()
}else {
$my_type_lp=learnpath::get_type_static($this->lp_id);
// this is a array containing values finished
$case_completed=array('completed','passed','browsed');
$my_status = " status = '".$this->get_status(false)."' ,";
$total_time =" total_time = ".$this->get_total_time().", ";
//is not multiple attempts
if ($this->get_prevent_reinit()==1) {
// process of status verified into data base
$sql_verified='SELECT status FROM '.$item_view_table.' WHERE lp_item_id="'.$this->db_id.'" AND lp_view_id="'.$this->view_id.'" AND view_count="'.$this->attempt_id.'" ;';
$rs_verified=api_sql_query($sql_verified,__FILE__,__LINE__);
$row_verified=Database::fetch_array($rs_verified);
//get type lp i.e 2=scorm and 1=lp dokeos
//error_log($my_type_lp);
// if not is completed or passed or browsed and learnig path is scorm
if(!in_array($this->get_status(false),$case_completed) && $my_type_lp==2) {
$total_time =" total_time = total_time +".$this->get_total_time().", ";
} else {
//verified into data base
if (!in_array($row_verified['status'],$case_completed) && $my_type_lp==2) {
$total_time =" total_time = total_time +".$this->get_total_time().", ";
}
}
} else {
// is multipe attempts
if (in_array($this->get_status(false),$case_completed) && $my_type_lp==2) {
//reset zero new attempt ?
}elseif(!in_array($this->get_status(false),$case_completed) && $my_type_lp==2){
$total_time =" total_time = ".$this->get_total_time().", ";
} else {
//is lp dokeos
$total_time =" total_time = total_time +".$this->get_total_time().", ";
}
}
// if is learning path of dokeos
if ($my_type_lp==1) {
//$total_time =" total_time = ".$this->get_total_time().", ";
}
}
$sql = "UPDATE $item_view_table " .
"SET " .$total_time.

Loading…
Cancel
Save