[svn r12167] Fixed errors with unique db mode (see forum http://www.dokeos.com/forum/viewtopic.php?t=8084 )

skala
Yannick Warnier 18 years ago
parent 3e86bf9448
commit c4f440387c
  1. 20
      main/newscorm/scorm.class.php

@ -354,18 +354,8 @@ class scorm extends learnpath {
function import_manifest($course_code){ function import_manifest($course_code){
if($this->debug>0){error_log('New LP - Entered import_manifest('.$course_code.')',0);} if($this->debug>0){error_log('New LP - Entered import_manifest('.$course_code.')',0);}
//get table names //get table names
$new_lp = 'lp'; $new_lp = Database::get_course_table('lp',$course_code);
$new_lp_item = 'lp_item'; $new_lp_item = Database::get_course_table('lp_item',$course_code);
//The previous method wasn't safe to get the database name, so do it manually with the course_code
$sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." WHERE code='$course_code'";
$res = api_sql_query($sql,__FILE__,__LINE__);
if(Database::num_rows($res)<1){ error_log('Database for '.$course_code.' not found '.__FILE__.' '.__LINE__,0);return -1;}
$row = Database::fetch_array($res);
$dbname = Database::get_course_table_prefix().$row['db_name'];
$new_lp = $dbname.'.lp';
$new_lp_item = $dbname.'.lp_item';
foreach($this->organizations as $id => $dummy) foreach($this->organizations as $id => $dummy)
{ {
@ -847,9 +837,7 @@ class scorm extends learnpath {
//TODO make it flexible to use any course_code (still using env course code here) //TODO make it flexible to use any course_code (still using env course code here)
//$lp_table = Database::get_course_table(LEARNPATH_TABLE); //$lp_table = Database::get_course_table(LEARNPATH_TABLE);
$lp_db = Database::get_current_course_database(); $lp_table = Database::get_course_table('lp');
$lp_pref = Database::get_course_table_prefix();
$lp_table = $lp_db.'.'.$lp_pref.'lp';
//$id = Database::escape_integer($id); //$id = Database::escape_integer($id);
$lp_id = $this->escape_string($lp_id); $lp_id = $this->escape_string($lp_id);
@ -898,4 +886,4 @@ class scorm extends learnpath {
return false; return false;
} }
} }
?> ?>
Loading…
Cancel
Save