|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
use Chamilo\CourseBundle\Entity\CLpCategory; |
|
|
|
|
@ -9,8 +10,6 @@ use ChamiloSession as Session; |
|
|
|
|
* the direct file view is not needed anymore, if the user uploads a scorm zip file, a directory |
|
|
|
|
* will be automatically created for it, and the files will be uncompressed there for example ;. |
|
|
|
|
* |
|
|
|
|
* @package chamilo.learnpath |
|
|
|
|
* |
|
|
|
|
* @author Yannick Warnier <ywarnier@beeznest.org> - redesign |
|
|
|
|
* @author Denes Nagy, principal author |
|
|
|
|
* @author Isthvan Mandak, several new features |
|
|
|
|
@ -293,12 +292,12 @@ if ($debug) { |
|
|
|
|
error_log('$type_quiz: '.$type_quiz); |
|
|
|
|
error_log('$_REQUEST[exeId]: '.intval($_REQUEST['exeId'])); |
|
|
|
|
error_log('$lp_id: '.$lp_id); |
|
|
|
|
error_log('$_GET[lp_item_id]: '.intval($_GET['lp_item_id'])); |
|
|
|
|
error_log('$_REQUEST[lp_item_id]: '.intval($_REQUEST['lp_item_id'])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($_REQUEST['exeId']) && |
|
|
|
|
isset($lp_id) && |
|
|
|
|
isset($_GET['lp_item_id']) |
|
|
|
|
isset($_REQUEST['lp_item_id']) |
|
|
|
|
) { |
|
|
|
|
global $src; |
|
|
|
|
$lp->items[$lp->current]->write_to_db(); |
|
|
|
|
@ -306,73 +305,15 @@ if (!empty($_REQUEST['exeId']) && |
|
|
|
|
$TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
|
|
|
$TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
|
|
|
|
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$safe_item_id = (int) $_GET['lp_item_id']; |
|
|
|
|
$safe_item_id = (int) $_REQUEST['lp_item_id']; |
|
|
|
|
$safe_id = $lp_id; |
|
|
|
|
$safe_exe_id = (int) $_REQUEST['exeId']; |
|
|
|
|
|
|
|
|
|
if (!empty($safe_id) && !empty($safe_item_id)) { |
|
|
|
|
$sql = 'SELECT start_date, exe_date, exe_result, exe_weighting, exe_exo_id, exe_duration |
|
|
|
|
FROM '.$TBL_TRACK_EXERCICES.' |
|
|
|
|
WHERE exe_id = '.$safe_exe_id; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
$row_dates = Database::fetch_array($res); |
|
|
|
|
|
|
|
|
|
$duration = (int) $row_dates['exe_duration']; |
|
|
|
|
$score = (float) $row_dates['exe_result']; |
|
|
|
|
$max_score = (float) $row_dates['exe_weighting']; |
|
|
|
|
|
|
|
|
|
$sql = "UPDATE $TBL_LP_ITEM SET |
|
|
|
|
max_score = '$max_score' |
|
|
|
|
WHERE iid = $safe_item_id"; |
|
|
|
|
Database::query($sql); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT id FROM $TBL_LP_ITEM_VIEW |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
lp_item_id = $safe_item_id AND |
|
|
|
|
lp_view_id = ".$lp->get_view_id()." |
|
|
|
|
ORDER BY id DESC |
|
|
|
|
LIMIT 1"; |
|
|
|
|
$res_last_attempt = Database::query($sql); |
|
|
|
|
|
|
|
|
|
if (Database::num_rows($res_last_attempt) && !api_is_invitee()) { |
|
|
|
|
$row_last_attempt = Database::fetch_row($res_last_attempt); |
|
|
|
|
$lp_item_view_id = $row_last_attempt[0]; |
|
|
|
|
|
|
|
|
|
$exercise = new Exercise(api_get_course_int_id()); |
|
|
|
|
$exercise->read($row_dates['exe_exo_id']); |
|
|
|
|
$status = 'completed'; |
|
|
|
|
|
|
|
|
|
if (!empty($exercise->pass_percentage)) { |
|
|
|
|
$status = 'failed'; |
|
|
|
|
$success = ExerciseLib::isSuccessExerciseResult( |
|
|
|
|
$score, |
|
|
|
|
$max_score, |
|
|
|
|
$exercise->pass_percentage |
|
|
|
|
); |
|
|
|
|
if ($success) { |
|
|
|
|
$status = 'passed'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "UPDATE $TBL_LP_ITEM_VIEW SET |
|
|
|
|
status = '$status', |
|
|
|
|
score = $score, |
|
|
|
|
total_time = $duration |
|
|
|
|
WHERE iid = $lp_item_view_id"; |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log($sql); |
|
|
|
|
} |
|
|
|
|
Database::query($sql); |
|
|
|
|
|
|
|
|
|
$sql = "UPDATE $TBL_TRACK_EXERCICES SET |
|
|
|
|
orig_lp_item_view_id = $lp_item_view_id |
|
|
|
|
WHERE exe_id = ".$safe_exe_id; |
|
|
|
|
Database::query($sql); |
|
|
|
|
} |
|
|
|
|
Exercise::saveExerciseInLp($safe_item_id, $safe_exe_id); |
|
|
|
|
} |
|
|
|
|
if (intval($_GET['fb_type']) != EXERCISE_FEEDBACK_TYPE_END) { |
|
|
|
|
$src = 'blank.php?msg=exerciseFinished'; |
|
|
|
|
$src = 'blank.php?msg=exerciseFinished&'.api_get_cidreq(true, true, 'learnpath'); |
|
|
|
|
} else { |
|
|
|
|
$src = api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$safe_exe_id.'&'.api_get_cidreq(true, true, 'learnpath'); |
|
|
|
|
if ($debug) { |
|
|
|
|
@ -391,7 +332,7 @@ $_setting['show_navigation_menu'] = 'false'; |
|
|
|
|
$scorm_css_header = true; |
|
|
|
|
$lp_theme_css = $lp->get_theme(); |
|
|
|
|
// Sets the css theme of the LP this call is also use at the frames (toc, nav, message). |
|
|
|
|
if ($lp->mode == 'fullscreen') { |
|
|
|
|
if ($lp->mode === 'fullscreen') { |
|
|
|
|
$htmlHeadXtra[] = "<script> |
|
|
|
|
window.open('$src','content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1'); |
|
|
|
|
</script>"; |
|
|
|
|
@ -580,7 +521,7 @@ if (Tracking::minimumTimeAvailable(api_get_session_id(), api_get_course_int_id() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Minimum time for each learning path |
|
|
|
|
$time_min = intval($pl * $tc * $perc / 100); |
|
|
|
|
$time_min = (int) ($pl * $tc * $perc / 100); |
|
|
|
|
|
|
|
|
|
if ($_SESSION['oLP']->getAccumulateWorkTime() > 0) { |
|
|
|
|
$lpMinTime = '('.$time_min.' min)'; |
|
|
|
|
|