[svn r20613] Fixed bug problema al exportar un csv desde reporte - see FS#4189 (by rvelasquez)

skala
Cristian Fasanando 17 years ago
parent 79fe24a85a
commit 901575e398
  1. 42
      main/newscorm/lp_stats.php

@ -213,10 +213,10 @@ if (is_array($list) && count($list) > 0){
" ORDER BY iv.view_count $qry_order "; " ORDER BY iv.view_count $qry_order ";
} }
$result = api_sql_query($sql, __FILE__, __LINE__); $result = api_sql_query($sql, __FILE__, __LINE__);
$num = Database :: num_rows($result); $num = Database :: num_rows($result);
$time_for_total = 'NaN'; $time_for_total = 'NaN';
if (($extend_this || $extend_all) && $num > 0) { if (($extend_this || $extend_all) && $num > 0) {
$row = Database :: fetch_array($result); $row = Database :: fetch_array($result);
$result_disabled_ext_all = false; $result_disabled_ext_all = false;
@ -245,7 +245,6 @@ if (is_array($list) && count($list) > 0){
$extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'" border="0"></a>' . "\n"; $extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'" border="0"></a>' . "\n";
} }
$title = $row['mytitle']; $title = $row['mytitle'];
$title = stripslashes(api_html_entity_decode($title, ENT_QUOTES, $dokeos_charset));
if (empty ($title)) { if (empty ($title)) {
$title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']); $title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
@ -323,16 +322,38 @@ if (is_array($list) && count($list) > 0){
if ($row['item_type'] != 'dokeos_chapter') { if ($row['item_type'] != 'dokeos_chapter') {
if (!api_is_allowed_to_edit() && $result_disabled_ext_all) { if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
$view_score = '-'; $view_score = '/';
} else { } else {
$view_score = ($score == 0 ? '-' : ($maxscore === 0 ? $score : $score . '/' . $maxscore)); $view_score = ($score == 0 ? '/' : ($maxscore === 0 ? $score : $score . '/' . float_format($maxscore, 1)));
} }
$output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . "<td>$extend_attempt_link</td>\n" . '<td colspan="3">' . api_htmlentities(get_lang('Attempt'), ENT_QUOTES, $dokeos_charset) . ' ' . $row['iv_view_count'] . "</td>\n" $output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . "<td>$extend_attempt_link</td>\n" . '<td colspan="3">' . api_htmlentities(get_lang('Attempt'), ENT_QUOTES, $dokeos_charset) . ' ' . $row['iv_view_count'] . "</td>\n"
//."<td><font color='$color'><div class='mystatus'>".htmlentities($array_status[$lesson_status],ENT_QUOTES,$lp_charset)."</div></font></td>\n" //."<td><font color='$color'><div class='mystatus'>".htmlentities($array_status[$lesson_status],ENT_QUOTES,$lp_charset)."</div></font></td>\n"
. '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . "</div></font></td>\n" . '<td colspan="2"><div class="mystatus" align="center">' . $view_score . "</div></td>\n" . '<td colspan="2"><div class="mystatus">'.$time.'</div></td><td></td></tr>'; . '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . "</div></font></td>\n" . '<td colspan="2"><div class="mystatus" align="center">' . $view_score . "</div></td>\n" . '<td colspan="2"><div class="mystatus">'.$time.'</div></td><td></td></tr>';
if (!empty($export_csv)) {
$temp = array ();
$temp[] = api_html_entity_decode($title, ENT_QUOTES, $lp_charset);
$temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES, $lp_charset);
if ($row['item_type'] == 'quiz') {
if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
$temp[] = '/';
} else {
$temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
}
} else {
$temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
}
$temp[] = $time;
$csv_content[] = $temp;
}
} }
$counter++; $counter++;
if ($extend_this_attempt OR $extend_all) { if ($extend_this_attempt OR $extend_all) {
$list1 = learnpath :: get_iv_interactions_array($row['iv_id']); $list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
foreach ($list1 as $id => $interaction) { foreach ($list1 as $id => $interaction) {
@ -567,13 +588,13 @@ if (is_array($list) && count($list) > 0){
if ($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
if (!api_is_allowed_to_edit() && $result_disabled_ext_all) { if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
$output .= '-'; $output .= '/';
} else { } else {
$output .= ($score == 0 ? '0/'.float_format($maxscore, 1) : ($maxscore == 0 ? $score : float_format($score, 1) . '/' . float_format($maxscore, 1))); $output .= ($score == 0 ? '0/'.float_format($maxscore, 1) : ($maxscore == 0 ? $score : float_format($score, 1) . '/' . float_format($maxscore, 1)));
} }
} else { } else {
$output .= ($score == 0 ? '-' : ($maxscore == 0 ? $score : $score . '/' . $maxscore)); $output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
} }
$output .= "</div></td>\n" . '<td colspan="2"><div class="mystatus">' . $time . "</div></td><td>$correct_test_link</td>\n"; $output .= "</div></td>\n" . '<td colspan="2"><div class="mystatus">' . $time . "</div></td><td>$correct_test_link</td>\n";
$output .= "</tr>\n"; $output .= "</tr>\n";
@ -583,21 +604,23 @@ if (is_array($list) && count($list) > 0){
$temp = array (); $temp = array ();
$temp[] = api_html_entity_decode($title, ENT_QUOTES, $lp_charset); $temp[] = api_html_entity_decode($title, ENT_QUOTES, $lp_charset);
$temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES, $lp_charset); $temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES, $lp_charset);
if ($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
if (!api_is_allowed_to_edit() && $result_disabled_ext_all) { if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
$temp[] = '-'; $temp[] = '/';
} else { } else {
$temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . $maxscore)); $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
} }
} else { } else {
$temp[] = ($score == 0 ? '-' : ($maxscore == 0 ? $score : $score . '/' . $maxscore)); $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
} }
$temp[] = $time; $temp[] = $time;
$csv_content[] = $temp; $csv_content[] = $temp;
} }
} }
$counter++; $counter++;
@ -692,7 +715,6 @@ if (is_array($list) && count($list) > 0){
$output .= '<tr><td colspan="12">&nbsp;</td></tr>'; $output .= '<tr><td colspan="12">&nbsp;</td></tr>';
} }
} }
} }
$total_time += $time_for_total; $total_time += $time_for_total;

Loading…
Cancel
Save