[svn r14945] Minor - Warning messages avoided.

skala
Julio Montoya 17 years ago
parent 3a05756381
commit eef4dfa0bb
  1. 33
      main/mySpace/lp_tracking.php
  2. 63
      main/mySpace/myStudents.php
  3. 119
      main/newscorm/lp_stats.php

@ -1,11 +1,30 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2008 Dokeos SPRL
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/*
* Created on 26 mars 07 by Eric Marguin
*
* Script to display the tracking of the students in the learning paths.
*/
$language_file = array ('registration', 'index', 'tracking', 'exercice', 'scorm', 'learnpath');
$cidReset = true;
include ('../inc/global.inc.php');
@ -131,8 +150,8 @@ $sql = 'SELECT name
FROM '.Database::get_course_table(TABLE_LP_MAIN, $_course['db_name']).'
WHERE id='.$lp_id;
$rs = api_sql_query($sql, __FILE__, __LINE__);
$lp_title = mysql_result($rs, 0, 0);
$lp_title = Database::result($rs, 0, 0);
echo '<div align="left" style="float:left"><h4>'.$_course['title'].' - '.$lp_title.' - '.$name.'</h4></div>
<div align="right">
@ -146,7 +165,6 @@ $list = learnpath :: get_flat_ordered_items_list($lp_id);
$origin = 'tracking';
if($export_csv)
{
include_once('../newscorm/lp_stats.php');
@ -159,9 +177,8 @@ else
include_once('../newscorm/lp_stats.php');
$tracking_content = ob_get_contents();
ob_end_clean();
echo utf8_decode($tracking_content);
echo utf8_decode($tracking_content);
}
Display :: display_footer();
?>
?>

@ -1,4 +1,4 @@
<?php //$Id: myStudents.php 14848 2008-04-11 13:21:04Z elixir_inter $
<?php //$Id: myStudents.php 14945 2008-04-17 21:53:37Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
@ -19,7 +19,7 @@
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
*/
// name of the language file that needs to be included
$language_file = array ('registration', 'index', 'tracking', 'exercice');
@ -133,8 +133,9 @@ function is_teacher($course_code){
global $_user;
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql="SELECT 1 FROM $tbl_course_user WHERE user_id='".$_user["user_id"]."' AND course_code='".$course_code."' AND status='1'";
$result=api_sql_query($sql);
if(mysql_result($result)!=1){
$result=api_sql_query($sql,__FILE__,__LINE__);
if(Database::result($result)!=1)
{
return true;
}
else{
@ -465,7 +466,7 @@ if(!empty($_GET['student']))
ORDER BY id_session DESC';
$rs = api_sql_query($sql,__FILE__,__LINE__);
$le_session_id = intval(mysql_result($rs,0,0));
$le_session_id = intval(Database::result($rs,0,0));
if($le_session_id>0)
{
@ -473,15 +474,15 @@ if(!empty($_GET['student']))
$sql = 'SELECT name, id_coach FROM '.$tbl_session.'
WHERE id='.$le_session_id;
$rs = api_sql_query($sql,__FILE__,__LINE__);
$session_name = mysql_result($rs,0,'name');
$session_coach_id = intval(mysql_result($rs,0,'id_coach'));
$session_name = Database::result($rs,0,'name');
$session_coach_id = intval(Database::result($rs,0,'id_coach'));
// get coach of the course in the session
$sql = 'SELECT id_coach FROM '.$tbl_session_course.'
WHERE id_session='.$le_session_id.'
AND course_code = "'.Database::escape_string($_GET['course']).'"';
$rs = api_sql_query($sql,__FILE__,__LINE__);
$session_course_coach_id = intval(mysql_result($rs,0,0));
$session_course_coach_id = intval(Database::result($rs,0,0));
if($session_course_coach_id!=0)
{
@ -544,7 +545,7 @@ if(!empty($_GET['student']))
FROM ".$a_infosCours['db_name'].".".$tbl_course_lp." AS lp ORDER BY lp.name ASC
";
$resultLearnpath = api_sql_query($sqlLearnpath);
$resultLearnpath = api_sql_query($sqlLearnpath,__FILE__,__LINE__);
$csv_content[] = array();
$csv_content[] = array(get_lang('Learnpath'),get_lang('Time'),get_lang('Score'),get_lang('Progress'),get_lang('LastConnexion'));
@ -624,7 +625,12 @@ if(!empty($_GET['student']))
AND lp_view_id = "'.$lp_view_id.'"';
$rsScores = api_sql_query($sql, __FILE__, __LINE__);
$total_score += mysql_result($rsScores, 0, 0);
if (Database::num_rows($rsScores) > 0)
{
$total_score += Database::result($rsScores, 0, 0);
}
$total_weighting += $item['max_score'];
}
$any_result = true;
@ -749,20 +755,20 @@ if(!empty($_GET['student']))
$a_infosCours = CourseManager :: get_course_information($_GET['course']);
$sql='SELECT visibility FROM '.$a_infosCours['db_name'].'.'.TABLE_TOOL_LIST.' WHERE name="quiz"';
$resultVisibilityQuizz = api_sql_query($sql);
$resultVisibilityQuizz = api_sql_query($sql,__FILE__,__LINE__);
if(mysql_result($resultVisibilityQuizz,0,'visibility')==1){
if(Database::result($resultVisibilityQuizz,0,'visibility')==1){
$sqlExercices = " SELECT quiz.title,id
FROM ".$a_infosCours['db_name'].".".$tbl_course_quiz." AS quiz
WHERE active='1' ORDER BY quiz.title ASC
";
$resultExercices = api_sql_query($sqlExercices);
$resultExercices = api_sql_query($sqlExercices,__FILE__,__LINE__);
$i = 0;
if(mysql_num_rows($resultExercices)>0)
if(Database::num_rows($resultExercices)>0)
{
while($a_exercices = mysql_fetch_array($resultExercices))
while($a_exercices = Database::fetch_array($resultExercices))
{
$sqlEssais = " SELECT COUNT(ex.exe_id) as essais
FROM $tbl_stats_exercices AS ex
@ -770,8 +776,8 @@ if(!empty($_GET['student']))
AND ex.exe_exo_id = ".$a_exercices['id']."
AND exe_user_id='".$_GET["student"]."'"
;
$resultEssais = api_sql_query($sqlEssais);
$a_essais = mysql_fetch_array($resultEssais);
$resultEssais = api_sql_query($sqlEssais,__FILE__,__LINE__);
$a_essais = Database::fetch_array($resultEssais);
$sqlScore = "SELECT exe_id, exe_result,exe_weighting
FROM $tbl_stats_exercices
@ -780,9 +786,9 @@ if(!empty($_GET['student']))
AND exe_exo_id = ".$a_exercices['id']."
ORDER BY exe_date DESC LIMIT 1";
$resultScore = api_sql_query($sqlScore);
$resultScore = api_sql_query($sqlScore,__FILE__,__LINE__);
$score = 0;
while($a_score = mysql_fetch_array($resultScore))
while($a_score = Database::fetch_array($resultScore))
{
$score = $score + $a_score['exe_result'];
$weighting = $weighting + $a_score['exe_weighting'];
@ -825,18 +831,17 @@ if(!empty($_GET['student']))
";
$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$a_exercices['id'].'" AND exe_user_id="'.$_GET['student'].'" AND exe_cours_id="'.$a_infosCours['code'].'" ORDER BY exe_date DESC LIMIT 1';
$resultLastAttempt = api_sql_query($sql_last_attempt);
$resultLastAttempt = api_sql_query($sql_last_attempt,__FILE__,__LINE__);
if(Database::num_rows($resultLastAttempt)>0)
{
$id_last_attempt=mysql_result($resultLastAttempt,0,0);
$id_last_attempt=Database::result($resultLastAttempt,0,0);
if($a_essais['essais']>0)
echo '<a href="../exercice/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$a_infosCours['code'].'&student='.$_GET['student'].'&origin='.(empty($_GET['origin']) ? 'tracking' : $_GET['origin']).'"> <img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif" border="0"> </a>';
}
echo " </td>
</tr>
";
";
$dataExercices[$i][] = $a_exercices['title'];
$dataExercices[$i][] = $pourcentageScore.'%';
$dataExercices[$i][] = $a_essais['essais'];
@ -1030,7 +1035,7 @@ if(!empty($_GET['student']))
;
$resultExerciceDetails = api_sql_query($sqlExerciceDetails);
$resultExerciceDetails = api_sql_query($sqlExerciceDetails,__FILE__,__LINE__);
$sqlExName = " SELECT quiz.title
@ -1038,8 +1043,8 @@ if(!empty($_GET['student']))
WHERE quiz.id = ".$_GET['exe_id']
;
$resultExName = api_sql_query($sqlExName);
$a_exName = mysql_fetch_array($resultExName);
$resultExName = api_sql_query($sqlExName,__FILE__,__LINE__);
$a_exName = Database::fetch_array($resultExName);
echo "<table class='data_table'>
<tr>
@ -1049,14 +1054,14 @@ if(!empty($_GET['student']))
</tr>
";
while($a_exerciceDetails = mysql_fetch_array($resultExerciceDetails))
while($a_exerciceDetails = Database::fetch_array($resultExerciceDetails))
{
$sqlAnswer = " SELECT qa.comment, qa.answer
FROM ".$a_infosCours['db_name'].".".$course_quiz_answer." as qa
WHERE qa.question_id = ".$a_exerciceDetails['id']
;
$resultAnswer = api_sql_query($sqlAnswer);
$resultAnswer = api_sql_query($sqlAnswer,__FILE__,__LINE__);
echo "<a name='infosExe'></a>";
@ -1067,7 +1072,7 @@ if(!empty($_GET['student']))
</td>
</tr>
";
while($a_answer = mysql_fetch_array($resultAnswer))
while($a_answer = Database::fetch_array($resultAnswer))
{
echo"
<tr>

@ -1,5 +1,24 @@
<?php
//$id:$
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2008 Dokeos SPRL
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
* This script displays statistics on the current learning path (scorm)
*
@ -7,9 +26,7 @@
* @package dokeos.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Script
*/
require_once('learnpath.class.php');
//require_once('scorm.class.php');
require_once ('resourcelinker.inc.php');
@ -51,9 +68,12 @@ if($origin != 'tracking')
}
//if display in fullscreen required
if (strcmp($_GET["fs"], "true") == 0) {
if (strcmp($_GET["fs"], "true") == 0)
{
$output .= "<table align='center'>";
} else {
}
else
{
$output .= "<table class='margin_table'>";
}
@ -70,10 +90,13 @@ else
$url_suffix = '';
}
if (!empty ($_GET['extend_all'])) {
if (!empty ($_GET['extend_all']))
{
$extend_all_link = '<a href="'.api_get_self().'?action=stats'.$url_suffix.'"><img src="../img/view_less_stats.gif" alt="fold_view" border="0"></a>';
$extend_all = 1;
} else {
}
else
{
$extend_all_link = '<a href="'.api_get_self().'?action=stats&extend_all=1'.$url_suffix.'"><img src="../img/view_more_stats.gif" alt="extend_view" border="0"></a>';
}
@ -81,7 +104,7 @@ if($origin != 'tracking')
{
$output .= "<tr><td><div class='title'>".htmlentities(get_lang('ScormMystatus'), ENT_QUOTES, $dokeos_charset)."</div></td></tr>";
}
$output .= "<tr><td>&nbsp;</td></tr>"."<tr><td>"."<table border='0' class='data_table'><tr>\n".'<td width="16">'.$extend_all_link.'</td>'.'<td colspan="4" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormLessonTitle'), ENT_QUOTES, $dokeos_charset)."</div></td>\n".'<td colspan="2" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormStatus'), ENT_QUOTES, $dokeos_charset)."</div></td>\n".'<td colspan="2" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormScore'), ENT_QUOTES, $dokeos_charset)."</div></td>\n".'<td colspan="2" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormTime'), ENT_QUOTES, $dokeos_charset)."</div></td><td class='title'><div class='mystatusfirstrow'>".get_lang('Actions')."</div></td></tr>\n";
$output .= "<tr><td>&nbsp;</td></tr>"."<tr><td>"."<table border='0' class='data_table'><tr>\n".'<td width="16">'.$extend_all_link.'</td>'.'<td colspan="4" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormLessonTitle'), ENT_QUOTES, $dokeos_charset)."</div></td>\n".'<td colspan="2" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormStatus'), ENT_QUOTES, $dokeos_charset)."</div></td>\n".'<td colspan="2" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormScore'), ENT_QUOTES, $dokeos_charset)."</div></td>\n".'<td colspan="2" class="title"><div class="mystatusfirstrow">'.htmlentities(get_lang('ScormTime'), ENT_QUOTES, $dokeos_charset)."</div></td><td class='title'><div class='mystatusfirstrow'>".htmlentities(get_lang('Actions'), ENT_QUOTES, $dokeos_charset)."</div></td></tr>\n";
//going through the items using the $items[] array instead of the database order ensures
// we get them in the same order as in the imsmanifest file, which is rather random when using
// the database table
@ -93,7 +116,9 @@ $sql = "SELECT max(view_count) FROM $TBL_LP_VIEW " .
"WHERE lp_id = $lp_id AND user_id = '".$user_id."'";
$res = api_sql_query($sql, __FILE__, __LINE__);
$view = '';
if (Database :: num_rows($res) > 0) {
if (Database :: num_rows($res) > 0)
{
$myrow = Database :: fetch_array($res);
$view = $myrow[0];
}
@ -115,14 +140,16 @@ if($export_csv)
);
}
foreach ($list as $my_item_id) {
foreach ($list as $my_item_id)
{
$extend_this = 0;
$qry_order = 'DESC';
if ((!empty ($_GET['extend_id']) and $_GET['extend_id'] == $my_item_id) OR $extend_all) {
$extend_this = 1;
$qry_order = 'ASC';
}
if (!empty ($view)) {
if (!empty ($view))
{
$sql = "SELECT iv.status as mystatus, v.view_count as mycount, " .
"iv.score as myscore, iv.total_time as mytime, i.id as myid, " .
"i.title as mytitle, i.max_score as mymaxscore, " .
@ -155,41 +182,57 @@ foreach ($list as $my_item_id) {
$result = api_sql_query($sql, __FILE__, __LINE__);
$num = Database :: num_rows($result);
$time_for_total = 'NaN';
if (($extend_this OR $extend_all) && $num > 0) {
if (($extend_this OR $extend_all) && $num > 0)
{
$row = Database :: fetch_array($result);
//if there are several attempts, and the link to extend has been clicked...
if (($counter % 2) == 0) {
if (($counter % 2) == 0)
{
$oddclass = "row_odd";
} else {
}
else
{
$oddclass = "row_even";
}
if ($inter_num)
$extend_link = '<a href="'.api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix.'"><img src="../img/visible.gif" alt="fold_view" border="0"></a>'."\n";
$title = $row['mytitle'];
$title = stripslashes($title);
if (empty ($title)) {
$title = stripslashes(html_entity_decode($title,ENT_QUOTES, $dokeos_charset));
if (empty ($title))
{
$title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
}
if ($row['item_type'] != 'dokeos_chapter') {
if($row['item_type'] == 'quiz'){
if ($row['item_type'] != 'dokeos_chapter')
{
if($row['item_type'] == 'quiz')
{
if($origin != 'tracking'){
if($origin != 'tracking')
{
$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$row['path'].'" AND exe_user_id="'.api_get_user_id().'" AND exe_cours_id="'.$course_code.'" ORDER BY exe_date DESC LIMIT 1';
}
else{
$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$row['path'].'" AND exe_user_id="'.$_GET['student_id'].'" AND exe_cours_id="'.$course_code.'" ORDER BY exe_date DESC LIMIT 1';
}
$resultLastAttempt = api_sql_query($sql_last_attempt);
$id_last_attempt=mysql_result($resultLastAttempt,0,0);
$resultLastAttempt = api_sql_query($sql_last_attempt,__FILE__,__LINE__);
$num = Database::num_rows($resultLastAttempt);
if($num>0)
{
$id_last_attempt=Database::result($resultLastAttempt,0,0);
}
if($origin != 'tracking'){
if($origin != 'tracking')
{
$correct_test_link = '<a href="../exercice/exercise_show.php?origin=student_progress&id='.$id_last_attempt.'&cidReq='.$course_code.'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';
}
else{
else
{
$correct_test_link = '<a href="../exercice/exercise_show.php?origin=tracking_course&id='.$id_last_attempt.'&cidReq='.$course_code.'&student='.$_GET['student_id'].'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';
}
}
@ -215,7 +258,8 @@ foreach ($list as $my_item_id) {
}
}
if (($counter % 2) == 0) {
if (($counter % 2) == 0)
{
$oddclass = "row_odd";
} else {
$oddclass = "row_even";
@ -333,18 +377,23 @@ foreach ($list as $my_item_id) {
$score = $row['myscore'];
$subtotal_time = $row['mytime'];
//if($row['mytime']==0){
while ($tmp_row = Database :: fetch_array($result)) {
while ($tmp_row = Database :: fetch_array($result))
{
$subtotal_time += $tmp_row['mytime'];
}
//}
$time_for_total = $subtotal_time;
$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
$scoIdentifier = $row['myid'];
$title = $row['mytitle'];
$title = stripslashes($title);
if ($score == 0) {
$title = $row['mytitle'];
$title = stripslashes(html_entity_decode($title,ENT_QUOTES, $dokeos_charset));
if ($score == 0)
{
$maxscore = 0;
} else {
}
else
{
if($row['item_type'] == 'sco')
{
if(!empty($row['myviewmaxscore']) and $row['myviewmaxscore']>0)
@ -365,7 +414,8 @@ foreach ($list as $my_item_id) {
$maxscore = $row['mymaxscore'];
}
}
if (empty ($title)) {
if (empty ($title))
{
$title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
}
//Remove "NaN" if any (@todo: locate the source of these NaN)
@ -390,7 +440,7 @@ foreach ($list as $my_item_id) {
$sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$row['path'].'" AND exe_user_id="'.Database::escape_string($_GET['student_id']).'" AND exe_cours_id="'.Database::escape_string($_GET['course']).'" ORDER BY exe_date';
}
$resultLastAttempt = api_sql_query($sql_last_attempt);
$resultLastAttempt = api_sql_query($sql_last_attempt,__FILE__,__LINE__);
$num = Database::num_rows($resultLastAttempt);
if($num>0)
{
@ -400,7 +450,8 @@ foreach ($list as $my_item_id) {
while($rowLA = Database::fetch_array($resultLastAttempt))
{
$laid = $rowLA['exe_id'];
if($origin != 'tracking'){
if($origin != 'tracking')
{
$correct_test_link .= '<a href="../exercice/exercise_show.php?origin=student_progress&id='.$laid.'&cidReq='.$course_code.'" target="_parent" title="'.get_lang('Attempt').' '.$i.'"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a> ';
}
else
@ -413,7 +464,7 @@ foreach ($list as $my_item_id) {
}
else
{
$id_last_attempt=mysql_result($resultLastAttempt,0,0);
$id_last_attempt=Database::result($resultLastAttempt,0,0);
if($origin != 'tracking'){
$correct_test_link = '<a href="../exercice/exercise_show.php?origin=student_progress&id='.$id_last_attempt.'&cidReq='.$course_code.'" target="_parent"><img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif"></a>';

Loading…
Cancel
Save