Fixing variables definitions (fixing revision f3f748e5c3)

skala
Julio Montoya 14 years ago
parent 46c0dfe066
commit f5ef9a59dd
  1. 39
      main/inc/lib/events.lib.inc.php
  2. 58
      main/inc/lib/tracking.lib.php

@ -699,19 +699,19 @@ function get_all_exercise_results($exercise_id, $course_code, $session_id = 0) {
*
*/
function get_all_best_exercise_results_by_user($exercise_id, $course_code, $session_id = 0) {
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course_code = Database::escape_string($course_code);
$exercise_id = intval($exercise_id);
$session_id = intval($session_id);
$sql = "SELECT * FROM $TABLETRACK_EXERCICES WHERE status = '' AND exe_cours_id = '$course_code' AND exe_exo_id = '$exercise_id' AND session_id = $session_id AND orig_lp_id =0 AND orig_lp_item_id = 0 ORDER BY exe_id";
$sql = "SELECT * FROM $table_track_exercises WHERE status = '' AND exe_cours_id = '$course_code' AND exe_exo_id = '$exercise_id' AND session_id = $session_id AND orig_lp_id =0 AND orig_lp_item_id = 0 ORDER BY exe_id";
$res = Database::query($sql);
$list = array();
while($row = Database::fetch_array($res,'ASSOC')) {
$list[$row['exe_id']] = $row;
$sql = "SELECT * FROM $TBL_TRACK_ATTEMPT WHERE exe_id = {$row['exe_id']}";
$sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
$res_question = Database::query($sql);
while($row_q = Database::fetch_array($res_question,'ASSOC')) {
$list[$row['exe_id']]['question_list'][$row_q['question_id']] = $row_q;
@ -739,9 +739,6 @@ function get_all_best_exercise_results_by_user($exercise_id, $course_code, $sess
}
/**
* Gets all exercise results (NO Exercises in LPs ) from a given exercise id, course, session
* @param int exercise id
@ -751,8 +748,8 @@ function get_all_best_exercise_results_by_user($exercise_id, $course_code, $sess
*
*/
function get_all_exercise_results_by_course($course_code, $session_id = 0, $get_count = true) {
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course_code = Database::escape_string($course_code);
$session_id = intval($session_id);
@ -760,7 +757,7 @@ function get_all_exercise_results_by_course($course_code, $session_id = 0, $get_
if ($get_count) {
$select = 'count(*) as count';
}
$sql = "SELECT $select FROM $TABLETRACK_EXERCICES WHERE status = '' AND exe_cours_id = '$course_code' AND session_id = $session_id AND orig_lp_id =0 AND orig_lp_item_id = 0 ORDER BY exe_id";
$sql = "SELECT $select FROM $table_track_exercises WHERE status = '' AND exe_cours_id = '$course_code' AND session_id = $session_id AND orig_lp_id =0 AND orig_lp_item_id = 0 ORDER BY exe_id";
$res = Database::query($sql);
if ($get_count) {
$row = Database::fetch_array($res,'ASSOC');
@ -769,7 +766,7 @@ function get_all_exercise_results_by_course($course_code, $session_id = 0, $get_
$list = array();
while($row = Database::fetch_array($res,'ASSOC')) {
$list[$row['exe_id']] = $row;
$sql = "SELECT * FROM $TBL_TRACK_ATTEMPT WHERE exe_id = {$row['exe_id']}";
$sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
$res_question = Database::query($sql);
while($row_q = Database::fetch_array($res_question,'ASSOC')) {
$list[$row['exe_id']]['question_list'][$row_q['question_id']] = $row_q;
@ -789,20 +786,20 @@ function get_all_exercise_results_by_course($course_code, $session_id = 0, $get_
*
*/
function get_all_exercise_results_by_user($user_id, $exercise_id, $course_code, $session_id = 0) {
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course_code = Database::escape_string($course_code);
$exercise_id = intval($exercise_id);
$session_id = intval($session_id);
$user_id = intval($user_id);
$sql = "SELECT * FROM $TABLETRACK_EXERCICES WHERE status = '' AND exe_cours_id = '$course_code' AND exe_exo_id = $exercise_id AND session_id = $session_id AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND exe_user_id = $user_id ORDER by exe_id";
$sql = "SELECT * FROM $table_track_exercises WHERE status = '' AND exe_cours_id = '$course_code' AND exe_exo_id = $exercise_id AND session_id = $session_id AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND exe_user_id = $user_id ORDER by exe_id";
$res = Database::query($sql);
$list = array();
while($row = Database::fetch_array($res,'ASSOC')) {
$list[$row['exe_id']] = $row;
$sql = "SELECT * FROM $TBL_TRACK_ATTEMPT WHERE exe_id = {$row['exe_id']}";
$sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
$res_question = Database::query($sql);
while($row_q = Database::fetch_array($res_question,'ASSOC')) {
$list[$row['exe_id']]['question_list'][$row_q['question_id']] = $row_q;
@ -821,20 +818,20 @@ function get_all_exercise_results_by_user($user_id, $exercise_id, $course_code,
* @return array
*/
function get_all_exercise_event_from_lp($exercise_id, $course_code, $session_id = 0) {
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course_code = Database::escape_string($course_code);
$exercise_id = intval($exercise_id);
$session_id = intval($session_id);
$sql = "SELECT * FROM $TABLETRACK_EXERCICES WHERE status = '' AND exe_cours_id = '$course_code' AND exe_exo_id = '$exercise_id' AND session_id = $session_id AND orig_lp_id !=0 AND orig_lp_item_id != 0";
$sql = "SELECT * FROM $table_track_exercises WHERE status = '' AND exe_cours_id = '$course_code' AND exe_exo_id = '$exercise_id' AND session_id = $session_id AND orig_lp_id !=0 AND orig_lp_item_id != 0";
$res = Database::query($sql);
$list = array();
while($row = Database::fetch_array($res,'ASSOC')) {
$list[$row['exe_id']] = $row;
$sql = "SELECT * FROM $TBL_TRACK_ATTEMPT WHERE exe_id = {$row['exe_id']}";
$sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
$res_question = Database::query($sql);
while($row_q = Database::fetch_array($res_question,'ASSOC')) {
$list[$row['exe_id']]['question_list'][$row_q['question_id']] = $row_q;
@ -889,8 +886,8 @@ function get_all_exercises_from_lp($lp_id, $course_db) {
* @return str the comment
*/
function get_comments($id,$question_id) {
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT teacher_comment FROM ".$TBL_TRACK_ATTEMPT." where exe_id='".Database::escape_string($id)."' and question_id = '".Database::escape_string($question_id)."' ORDER by question_id";
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT teacher_comment FROM ".$table_track_attempt." where exe_id='".Database::escape_string($id)."' and question_id = '".Database::escape_string($question_id)."' ORDER by question_id";
$sqlres = Database::query($sql);
$comm = Database::result($sqlres,0,"teacher_comment");
return $comm;

@ -2404,18 +2404,18 @@ class Tracking {
$main_width = 80;
$main_height = 35;
$Test = new pChart($main_width, $main_height);
$thumbnail_graph = new pChart($main_width, $main_height);
$Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
//$Test->setGraphArea(50,30,680,200);
$Test->drawFilledRoundedRectangle(2,2,$main_width-2,$main_height-2,2,230,230,230);
$Test->setGraphArea(5,5,$main_width-5,$main_height-5);
$Test->drawGraphArea(255,255,255);
$thumbnail_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
//$thumbnail_graph->setGraphArea(50,30,680,200);
$thumbnail_graph->drawFilledRoundedRectangle(2,2,$main_width-2,$main_height-2,2,230,230,230);
$thumbnail_graph->setGraphArea(5,5,$main_width-5,$main_height-5);
$thumbnail_graph->drawGraphArea(255,255,255);
//SCALE_NORMAL, SCALE_START0, SCALE_ADDALLSTART0
$Test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALLSTART0, 150,150,150,FALSE,0,1,TRUE);
$thumbnail_graph->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALLSTART0, 150,150,150,FALSE,0,1,TRUE);
$Test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
$thumbnail_graph->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
// Finish the graph
$graph_id = 'thumbnail_exercise_result_graph_'.Security::remove_XSS($_GET['course']).'-'.intval($_GET['session_id']).'-'.api_get_user_id();
@ -2426,9 +2426,9 @@ class Tracking {
//echo 'in cache';
$img_file = $cache->GetHash($graph_id,$data_set->GetData());
} else {
$cache->WriteToCache($graph_id, $data_set->GetData(), $Test);
$cache->WriteToCache($graph_id, $data_set->GetData(), $thumbnail_graph);
ob_start();
$Test->Stroke();
$thumbnail_graph->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
@ -2536,39 +2536,39 @@ class Tracking {
$main_width = 500;
$main_height = 250;
$Test = new pChart($main_width,$main_height);
$main_graph = new pChart($main_width,$main_height);
$Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$Test->setGraphArea(50,30, $main_width -20,$main_height -50);
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$main_graph->setGraphArea(50,30, $main_width -20,$main_height -50);
$Test->drawFilledRoundedRectangle(10,10, $main_width- 10,$main_height -10,5,240,240,240);
$Test->drawRoundedRectangle(7,7,$main_width - 7,$main_height - 7,5,230,230,230);
$main_graph->drawFilledRoundedRectangle(10,10, $main_width- 10,$main_height -10,5,240,240,240);
$main_graph->drawRoundedRectangle(7,7,$main_width - 7,$main_height - 7,5,230,230,230);
$Test->drawGraphArea(255,255,255,TRUE);
$main_graph->drawGraphArea(255,255,255,TRUE);
//SCALE_NORMAL, SCALE_START0, SCALE_ADDALLSTART0
$Test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALLSTART0, 150,150,150,TRUE,0,1,TRUE);
$main_graph->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALLSTART0, 150,150,150,TRUE,0,1,TRUE);
$Test->drawGrid(4,TRUE,230,230,230,50);
$main_graph->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
// $Test->drawTreshold(0,143,55,72,TRUE,TRUE);
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
// $main_graph->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$data_set->RemoveSerie("Serie3");
//$Test->drawBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE);
//$main_graph->drawBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE);
//$Test->drawStackedBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE);
$Test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
//$main_graph->drawStackedBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE);
$main_graph->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
// Finish the graph
$Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$Test->drawLegend($main_width - 120,$main_height -100,$data_set->GetDataDescription(),255,255,255);
$Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$Test->drawTitle(180,22,$exercise_title,50,50,50);
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$main_graph->drawLegend($main_width - 120,$main_height -100,$data_set->GetDataDescription(),255,255,255);
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$main_graph->drawTitle(180,22,$exercise_title,50,50,50);
$graph_id = 'exercise_result_graph'.Security::remove_XSS($_GET['course']).'-'.intval($_GET['session_id']).'-'.api_get_user_id();
//if ($cache->IsInCache($graph_id, $data_set->GetData())) {
if (0) {
@ -2576,9 +2576,9 @@ class Tracking {
//echo 'in cache';
$img_file = $cache->GetHash($graph_id,$data_set->GetData());
} else {
$cache->WriteToCache($graph_id, $data_set->GetData(), $Test);
$cache->WriteToCache($graph_id, $data_set->GetData(), $main_graph);
ob_start();
$Test->Stroke();
$main_graph->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}

Loading…
Cancel
Save