skala
Noël Dieschburg 16 years ago
commit fd46436a6a
  1. 2
      main/auth/inscription.php
  2. 2
      main/inc/lib/legal.lib.php
  3. 89
      main/newscorm/learnpathItem.class.php
  4. 13
      main/newscorm/scorm_api.php

@ -323,7 +323,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').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>');
$form->addElement('checkbox', 'legal_accept', null, get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>');
$form->addRule('extra_legal_accept', get_lang('ThisFieldIsRequired'), 'required');
} else {
if (!empty($term_preview['content'])) {

@ -101,7 +101,7 @@ class LegalManager {
// html
case 0:
$preview = '<div class="legal-terms"> '.$term_preview['content'].' </div>';
$preview .= '<br/>'.get_lang('ByClickingAccept');
$preview .= '<br/>'.get_lang('ByClickingRegisterYouAgreeTermsAndConditions');
break;
// page link
case 1:

@ -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, " .

@ -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) {

Loading…
Cancel
Save