Should fix fatal error see #5347

skala
Julio Montoya 13 years ago
parent 2a18363089
commit 6852a4272e
  1. 7
      main/inc/lib/tracking.lib.php
  2. 7
      main/mySpace/lp_tracking.php
  3. 20
      main/newscorm/lp_stats.php

@ -831,18 +831,19 @@ class Tracking {
// made of (we need to make this call dynamic because of random questions selection)
$sql = "SELECT SUM(t.ponderation) as maxscore FROM
(
SELECT distinct question_id, marks, ponderation
SELECT DISTINCT question_id, marks, ponderation
FROM $tbl_stats_attempts AS at INNER JOIN $tbl_quiz_questions AS q ON (q.id = at.question_id)
WHERE exe_id ='$id_last_attempt' AND q.c_id = $course_id
)
AS t";
if ($debug) echo '$sql: '.$sql.' <br />';
$res_max_score_bis = Database::query($sql);
$row_max_score_bis = Database :: fetch_array($res_max_score_bis);
$row_max_score_bis = Database::fetch_array($res_max_score_bis);
if (!empty($row_max_score_bis['maxscore'])) {
$max_score = $row_max_score_bis['maxscore'];
}
if (!empty($max_score)) {
if (!empty($max_score) && floatval($max_score) > 0) {
$lp_partial_total += $score/$max_score;
}
if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';

@ -85,8 +85,10 @@ $table_title = ($session_name? Display::return_icon('session.png', get_lang('Ses
Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name;
echo Display::page_header($table_title);
echo Display::page_subheader('<h3>'.Display::return_icon('learnpath.png', get_lang('ToolLearnpath'), array(), ICON_SIZE_SMALL).' '.$lp_title.'</h3>');
//Needed in newscorm/lp_stats.php
$list = learnpath :: get_flat_ordered_items_list($lp_id, 0, $course_info['real_id']);
$origin = 'tracking';
if ($export_csv) {
require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
@ -95,7 +97,8 @@ if ($export_csv) {
ob_start();
require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
$tracking_content = ob_get_contents();
ob_end_clean();
ob_end_clean();
echo api_utf8_decode($tracking_content, $charset);
}
Display :: display_footer();

@ -17,9 +17,20 @@ require_once '../exercice/exercise.lib.php';
$course_code = api_get_course_id();
$user_id = api_get_user_id();
// Declare variables to be used in lp_stats.php.
$lp_id = $_SESSION['oLP']->get_id();
$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
// Declare variables to be used in lp_stats.php
//When checking the reporting myspace/lp_tracking.php
if (isset($_GET['lp_id']) && isset($lp_id) && !empty($lp_id)) {
$lp_id = intval($lp_id);
} else {
if (isset($_SESSION['oLP'])) {
$lp_id = $_SESSION['oLP']->get_id();
$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
}
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@ -93,9 +104,6 @@ $TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST);
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_stats_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
//It cames from myspace/lp_tracking.php
$lp_id = intval($lp_id);
$sql = "SELECT max(view_count) FROM $TBL_LP_VIEW WHERE c_id = $course_id AND lp_id = $lp_id AND user_id = '" . $user_id . "' $session_condition";
$res = Database::query($sql);
$view = '';

Loading…
Cancel
Save