diff --git a/main/exercice/addlimits.php b/main/exercice/addlimits.php index 89996a1fed..6ed41fc679 100644 --- a/main/exercice/addlimits.php +++ b/main/exercice/addlimits.php @@ -81,8 +81,8 @@ $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_REPONSES = Database::get_course_table('quiz_answer'); $main_user_table = Database :: get_main_table(TABLE_MAIN_USER); $main_course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); -$TABLETRACK_ATTEMPT = $_configuration['statistics_database']."`.`track_e_attempt"; -$TABLETRACK_EXERCICES = $_configuration['statistics_database']."`.`track_e_exercices"; +$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); +$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $dsp_percent = false; $debug=0; diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php index 562b8359c6..5704dbb46e 100644 --- a/main/exercice/exercise_result.php +++ b/main/exercice/exercise_result.php @@ -25,7 +25,7 @@ * @package dokeos.exercise * @author Olivier Brouckaert, main author * @author Roan Embrechts, some refactoring -* @version $Id: exercise_result.php 12888 2007-08-12 19:04:33Z yannoo $ +* @version $Id: exercise_result.php 12889 2007-08-12 19:21:05Z yannoo $ * * @todo split more code up in functions, move functions to library? */ @@ -113,7 +113,7 @@ if ( empty ( $objExercise ) ) { } $main_user_table = Database :: get_main_table(TABLE_MAIN_USER); $main_admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN); -$courseName = $_SESSION[_course][name]; +$courseName = $_SESSION['_course']['name']; $query = "select user_id from $main_admin_table"; $admin_id = mysql_result(api_sql_query($query),0,"user_id"); $query1 = "select email,firstname,lastname from $main_user_table where user_id = $admin_id"; diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index fb63f9fa5c..a78c4c3d08 100644 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -58,8 +58,8 @@ $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER); $main_user_table = Database :: get_main_table(TABLE_MAIN_USER); $main_course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); -$TABLETRACK_ATTEMPT = $_configuration['statistics_database']."`.`track_e_attempt"; -$TABLETRACK_EXERCICES = $_configuration['statistics_database']."`.`track_e_exercices"; +$TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); +$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $dsp_percent = false; $debug=0; @@ -184,8 +184,8 @@ function getFCK(vals,marksid){ //functions function get_comments($id,$question_id) { - global $TABLETRACK_ATTEMPT; - $sql = "select teacher_comment from `".$TABLETRACK_ATTEMPT."` where exe_id=$id and question_id = '$question_id' order by question_id"; + global $TBL_TRACK_ATTEMPT; + $sql = "select teacher_comment from ".$TBL_TRACK_ATTEMPT." where exe_id=$id and question_id = '$question_id' order by question_id"; $sqlres = api_sql_query($sql, __FILE__, __LINE__); $comm = mysql_result($sqlres,0,"teacher_comment"); return $comm; @@ -300,15 +300,15 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme selectComment($answerId); $answerCorrect=$objAnswerTmp->isCorrect($answerId); $answerWeighting=$objAnswerTmp->selectWeighting($answerId); - $queryans = "select * from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; + $queryans = "select * from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resultans = api_sql_query($queryans, __FILE__, __LINE__); while ($row = mysql_fetch_array($resultans)) { @@ -459,7 +459,7 @@ $result =api_sql_query($query, __FILE__, __LINE__); $answerComment=$objAnswerTmp->selectComment($answerId); $answerCorrect=$objAnswerTmp->isCorrect($answerId); $answerWeighting=$objAnswerTmp->selectWeighting($answerId); - $queryans = "select answer from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; + $queryans = "select answer from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resultans = api_sql_query($queryans, __FILE__, __LINE__); $choice = mysql_result($resultans,0,"answer"); $studentChoice=($choice == $answerId)?1:0; @@ -540,7 +540,7 @@ $result =api_sql_query($query, __FILE__, __LINE__); { break; } - $queryfill = "select answer from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; + $queryfill = "select answer from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resfill = api_sql_query($queryfill, __FILE__, __LINE__); $str=mysql_result($resfill,0,"answer"); preg_match_all ('#\[([^[/]*)/#', $str, $arr); @@ -586,7 +586,7 @@ $result =api_sql_query($query, __FILE__, __LINE__); $objAnswerTmp=new Answer($questionId); $nbrAnswers=$objAnswerTmp->selectNbrAnswers(); $questionScore=0; - $query = "select answer, marks from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; + $query = "select answer, marks from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resq=api_sql_query($query); $choice = mysql_result($resq,0,"answer"); $questionScore = mysql_result($resq,0,"marks"); @@ -609,7 +609,7 @@ $result =api_sql_query($query, __FILE__, __LINE__); $objAnswerTmp=new Answer($questionId); $table_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER); - $TABLETRACK_ATTEMPT = $_configuration['statistics_database']."`.`track_e_attempt"; + $TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $sql_select_answer = 'SELECT id, answer, correct, position FROM '.$table_ans.' WHERE question_id="'.$questionId.'" AND correct<>0'; $res_answers = api_sql_query($sql_select_answer, __FILE__, __LINE__); @@ -632,7 +632,7 @@ $result =api_sql_query($query, __FILE__, __LINE__); $i_answer_position = $a_answers['position']; $sql_user_answer = 'SELECT answers.answer - FROM `'.$TABLETRACK_ATTEMPT.'` as track_e_attempt, '.$table_ans.' as answers + FROM '.$TBL_TRACK_ATTEMPT.' as track_e_attempt, '.$table_ans.' as answers WHERE track_e_attempt.answer=answers.position AND track_e_attempt.position="'.$i_answer_position.'" AND answers.question_id ="'.$questionId.'" @@ -698,7 +698,7 @@ $result =api_sql_query($query, __FILE__, __LINE__); $answerCorrect=$objAnswerTmp->isCorrect($answerId); $answerWeighting=$objAnswerTmp->selectWeighting($answerId); - $query = "select answer from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; + $query = "select answer from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resq=api_sql_query($query); $choice = mysql_result($resq,0,"answer"); @@ -706,7 +706,7 @@ $result =api_sql_query($query, __FILE__, __LINE__); $i++; } - $queryfree = "select marks from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; + $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resfree = api_sql_query($queryfree, __FILE__, __LINE__); $questionScore= mysql_result($resfree,0,"marks"); $totalScore+=$questionScore; @@ -821,7 +821,7 @@ $totalWeighting+=$questionWeighting; } ?> '.get_lang('YourTotalScore')." "; if($dsp_percent == true) diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index 934c94e1fa..6a57085afa 100644 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -501,7 +501,7 @@ function exercise_attempt($score,$answer,$quesId,$exeId,$j) global $_configuration; global $_user; global $_cid; - global $TABLETRACK_ATTEMPT; + global $TBL_TRACK_ATTEMPT; global $origin, $learnpath_id, $learnpath_item_id; // if tracking is disabled record nothing @@ -519,7 +519,7 @@ function exercise_attempt($score,$answer,$quesId,$exeId,$j) { $user_id = "NULL"; } - $sql = "INSERT INTO `".$TABLETRACK_ATTEMPT."` + $sql = "INSERT INTO ".$TBL_TRACK_ATTEMPT." (`exe_id`, `user_id`, `question_id`,