From ed2cc2a70e75a3bfe30181cf366b06647d040051 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 3 Aug 2009 17:16:41 -0500 Subject: [PATCH 1/3] Minor - Fix var lang --- main/auth/inscription.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/auth/inscription.php b/main/auth/inscription.php index 921dafb2bc..e0f55a5043 100644 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -322,7 +322,7 @@ if (get_setting('allow_terms_conditions')=='true') { $form->addElement('hidden', 'password',$_SESSION['info_current_user'][2]); } if($term_preview['type'] == 1) { - $form->addElement('checkbox', 'legal_accept', null, get_lang('IhaveReadAndAgree').' '.get_lang('TermsAndConditions').''); + $form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').' '.get_lang('TermsAndConditions').''); $form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required'); } else { if (!empty($term_preview['content'])) { From 80c196f46b9d072502372b457bcb4231812e7ed9 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 3 Aug 2009 17:32:00 -0500 Subject: [PATCH 2/3] Minor - lang var fixed --- main/inc/lib/legal.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/inc/lib/legal.lib.php b/main/inc/lib/legal.lib.php index 103edc73ec..fa9f3d975d 100644 --- a/main/inc/lib/legal.lib.php +++ b/main/inc/lib/legal.lib.php @@ -103,7 +103,7 @@ class LegalManager // html case 0: $preview = ''; - $preview .= '
'.get_lang('ByClickingAccept'); + $preview .= '
'.get_lang('ByClickingRegisterYouAgreeTermsAndConditions'); break; // page link case 1: From fd917b287b2bfbacbe5e38e68229395bfb1fb673 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 4 Aug 2009 20:10:10 -0500 Subject: [PATCH 3/3] partial fix to DT#4444 --- main/newscorm/learnpathItem.class.php | 89 ++++++++++++--------------- main/newscorm/scorm_api.php | 13 ++-- 2 files changed, 50 insertions(+), 52 deletions(-) mode change 100644 => 100755 main/newscorm/learnpathItem.class.php mode change 100644 => 100755 main/newscorm/scorm_api.php diff --git a/main/newscorm/learnpathItem.class.php b/main/newscorm/learnpathItem.class.php old mode 100644 new mode 100755 index 4c8c6c613a..0707beada6 --- a/main/newscorm/learnpathItem.class.php +++ b/main/newscorm/learnpathItem.class.php @@ -2195,19 +2195,19 @@ function get_terms() $save=true; } - if(($save===false && $this->type == 'sco') ||(($this->type == 'sco') && ($credit == 'no-credit' OR $mode == 'review' OR $mode == 'browse'))) + if (($save===false && $this->type == 'sco') ||(($this->type == 'sco') && ($credit == 'no-credit' OR $mode == 'review' OR $mode == 'browse'))) { //this info shouldn't be saved as the credit or lesson mode info prevent it if($this->debug>1){error_log('New LP - In learnpathItem::write_to_db() - credit('.$credit.') or lesson_mode('.$mode.') prevent recording!',0);} - }else{ + } else { //check the row exists $inserted = false; - // this a special case for multiple attepmts and Dokeos exercises - if ($this->type == 'quiz' && $this->get_prevent_reinit()==0 && $this->get_status()=='completed') { + // this a special case for multiple attempts and Dokeos exercises + if ($this->type == 'quiz' && $this->get_prevent_reinit()==0 && $this->get_status()=='completed') { // we force the item to be restarted $this->restart(); - + $sql = "INSERT INTO $item_view_table " . "(total_time, " . "start_time, " . @@ -2281,10 +2281,10 @@ function get_terms() if($this->debug>2){error_log('New LP - In learnpathItem::write_to_db() - Inserting into item_view: '.$sql,0);} $res = api_sql_query($sql,__FILE__,__LINE__); $this->db_item_view_id = Database::get_last_insert_id(); - }else{ + } else { $sql = ''; - if($this->type=='hotpotatoes') - { //make an exception for HotPotatoes, don't update the score + if($this->type=='hotpotatoes') { + //make an exception for HotPotatoes, don't update the score //because it has been saved outside of this tool $sql = "UPDATE $item_view_table " . "SET total_time = ".$this->get_total_time().", " . @@ -2297,43 +2297,39 @@ function get_terms() "WHERE lp_item_id = ".$this->db_id." " . "AND lp_view_id = ".$this->view_id." " . "AND view_count = ".$this->attempt_id; - } - else - { //for all other content types... + } else { + //for all other content types... if ($this->type=='quiz') { $my_status = ' '; $total_time = ' '; if (!empty($_REQUEST['exeId'])) { - $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); - - $safe_exe_id = Database::escape_string($_REQUEST['exeId']); - $sql = 'SELECT start_date,exe_date FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = '.(int)$safe_exe_id; - $res = api_sql_query($sql,__FILE__,__LINE__); - $row_dates = Database::fetch_array($res); - - $time_start_date = convert_mysql_date($row_dates['start_date']); - $time_exe_date = convert_mysql_date($row_dates['exe_date']); - $mytime = ((int)$time_exe_date-(int)$time_start_date); - $total_time =" total_time = ".$mytime.", "; - } - - - }else { + $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); + + $safe_exe_id = Database::escape_string($_REQUEST['exeId']); + $sql = 'SELECT start_date,exe_date FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = '.(int)$safe_exe_id; + $res = api_sql_query($sql,__FILE__,__LINE__); + $row_dates = Database::fetch_array($res); + + $time_start_date = convert_mysql_date($row_dates['start_date']); + $time_exe_date = convert_mysql_date($row_dates['exe_date']); + $mytime = ((int)$time_exe_date-(int)$time_start_date); + $total_time =" total_time = ".$mytime.", "; + } + } else { $my_type_lp=learnpath::get_type_static($this->lp_id); // this is a array containing values finished $case_completed=array('completed','passed','browsed'); //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 - // if not is completed or passed or browsed and learnig path is scorm + 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: 1=lp dokeos and 2=scorm + // if not is completed or passed or browsed and learning path is scorm if(!in_array($this->get_status(false),$case_completed) && $my_type_lp==2 ) {//&& $this->type!='dir' $total_time =" total_time = total_time +".$this->get_total_time().", "; $my_status = " status = '".$this->get_status(false)."' ,"; @@ -2346,31 +2342,28 @@ function get_terms() $total_time =" total_time = total_time +".$this->get_total_time().", "; $my_status = " status = '".$this->get_status(false)."' ,"; }else { - //&& !in_array($row_verified['status'],$case_completed) - + //&& !in_array($row_verified['status'],$case_completed) //is lp dokeos if ($my_type_lp==1 && $this->type!='chapter') { $total_time =" total_time = total_time + ".$this->get_total_time().", "; $my_status = " status = '".$this->get_status(false)."' ,"; } - } - + } } } else { - // is multipe attempts + // is multiple attempts if (in_array($this->get_status(false),$case_completed) && $my_type_lp==2) { - //reset zero new attempt ? + //reset zero new attempt ? + $my_status = " status = '".$this->get_status(false)."' ,"; } elseif (!in_array($this->get_status(false),$case_completed) && $my_type_lp==2){ $total_time =" total_time = ".$this->get_total_time().", "; - $my_status = " status = '".$this->get_status(false)."' ,"; + $my_status = " status = '".$this->get_status(false)."' ,"; } else { - //is lp dokeos + //is dokeos LP $total_time =" total_time = total_time +".$this->get_total_time().", "; $my_status = " status = '".$this->get_status(false)."' ,"; - } - - } - + } + } /*if ($my_type_lp==1 && !in_array($row_verified['status'],$case_completed)) { $total_time =" total_time = total_time + ".$this->get_total_time().", "; }*/ @@ -2442,7 +2435,7 @@ function get_terms() "latency = '".Database::escape_string($interaction[7])."'" . "WHERE id = $iva_id"; $ivau_res = api_sql_query($ivau_sql,__FILE__,__LINE__); - }else{ + } else { //insert new one $ivai_sql = "INSERT INTO $iva_table " . "(order_id, lp_iv_id, interaction_id, interaction_type, " . diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php old mode 100644 new mode 100755 index d9985936f9..f98b27d455 --- a/main/newscorm/scorm_api.php +++ b/main/newscorm/scorm_api.php @@ -740,7 +740,6 @@ function reinit_update_table_list () { } function savedata(origin) { - //origin can be 'commit', 'finish' or 'terminate' if ((lesson_status != 'completed') && (lesson_status != 'passed') && (mastery_score >=0) && (score >= mastery_score)) { lesson_status = 'passed'; @@ -781,6 +780,7 @@ function savedata(origin) { logit_lms('saving data (status='+lesson_status+' - interactions: '+ interactions.length +')',1); old_item_id=info_lms_item[0]; + // xajax_save_item is replaced to xajax_save_item_scorm for scorm LP's //xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location, interactions, lms_item_core_exit); xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, old_item_id,my_get_value_scorm); @@ -1231,7 +1231,13 @@ function switch_item(current_item, next_item) { //(1) save the current item logit_lms('Called switch_item with params '+lms_item_id+' and '+next_item+'',0); if (lms_lp_type==1 || lms_item_type=='asset' || session_time == '0' || session_time == '0:00:00'){ - xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, asset_timer, suspend_data, lesson_location,interactions, lms_item_core_exit); + if (lms_lp_type==1) { + xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, asset_timer, suspend_data, lesson_location,interactions, lms_item_core_exit); + } else { + my_get_value_scorm=new Array(); + my_get_value_scorm=ProcessValueScorm(); + xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, lms_item_id,my_get_value_scorm); + } if(item_objectives.length>0) { xajax_save_objectives(lms_lp_id,lms_user_id,lms_view_id,lms_item_id,item_objectives); } @@ -1262,6 +1268,7 @@ function switch_item(current_item, next_item) { //savedata('finish'); //} // xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location,interactions, lms_item_core_exit); + } execute_stats=false; //(2) Refresh all the values inside this SCORM API object - use AJAX @@ -1410,8 +1417,6 @@ function xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score } ); } - - } function xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, lms_item_id,info_get_lms) {