|
|
|
@ -1,28 +1,29 @@ |
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
/** |
|
|
|
|
* Saving the scores. |
|
|
|
|
* @package chamilo.exercise |
|
|
|
|
* @author |
|
|
|
|
* @version $Id: savescores.php 15602 2008-06-18 08:52:24Z pcool $ |
|
|
|
|
*/ |
|
|
|
|
* Saving the scores. |
|
|
|
|
* @package chamilo.exercise |
|
|
|
|
* @author |
|
|
|
|
* @version $Id: savescores.php 15602 2008-06-18 08:52:24Z pcool $ |
|
|
|
|
*/ |
|
|
|
|
/** |
|
|
|
|
* Code |
|
|
|
|
*/ |
|
|
|
|
// name of the language file that needs to be included |
|
|
|
|
$language_file = 'learnpath'; |
|
|
|
|
|
|
|
|
|
if ($_GET['origin'] == 'learnpath') { |
|
|
|
|
require_once '../newscorm/learnpath.class.php'; |
|
|
|
|
require_once '../newscorm/learnpathItem.class.php'; |
|
|
|
|
require_once '../newscorm/scorm.class.php'; |
|
|
|
|
require_once '../newscorm/scormItem.class.php'; |
|
|
|
|
require_once '../newscorm/aicc.class.php'; |
|
|
|
|
require_once '../newscorm/aiccItem.class.php'; |
|
|
|
|
if (isset($_GET['origin']) && $_GET['origin'] == 'learnpath') { |
|
|
|
|
require_once '../newscorm/learnpath.class.php'; |
|
|
|
|
require_once '../newscorm/learnpathItem.class.php'; |
|
|
|
|
require_once '../newscorm/scorm.class.php'; |
|
|
|
|
require_once '../newscorm/scormItem.class.php'; |
|
|
|
|
require_once '../newscorm/aicc.class.php'; |
|
|
|
|
require_once '../newscorm/aiccItem.class.php'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
require_once '../inc/global.inc.php'; |
|
|
|
|
$this_section=SECTION_COURSES; |
|
|
|
|
$this_section = SECTION_COURSES; |
|
|
|
|
|
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; |
|
|
|
|
|
|
|
|
@ -32,8 +33,8 @@ $full_file_path = $documentPath.$test; |
|
|
|
|
my_delete($full_file_path.$_user['user_id'].".t.html"); |
|
|
|
|
|
|
|
|
|
$TABLETRACK_HOTPOTATOES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
|
|
|
$tbl_learnpath_user = Database::get_course_table(TABLE_LEARNPATH_USER); |
|
|
|
|
$TABLE_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
|
|
|
|
$tbl_learnpath_user = Database::get_course_table(TABLE_LEARNPATH_USER); |
|
|
|
|
$TABLE_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
|
|
|
|
|
|
|
|
|
$_cid = api_get_course_id(); |
|
|
|
|
$test = $_REQUEST['test']; |
|
|
|
@ -51,37 +52,37 @@ $jscript2run = ''; |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
function save_scores($file, $score) { |
|
|
|
|
global $origin, $_user, $_cid, |
|
|
|
|
$TABLETRACK_HOTPOTATOES; |
|
|
|
|
// if tracking is disabled record nothing |
|
|
|
|
$weighting = 100; // 100% |
|
|
|
|
$date = api_get_utc_datetime(); |
|
|
|
|
global $origin, $_user, $_cid, |
|
|
|
|
$TABLETRACK_HOTPOTATOES; |
|
|
|
|
// if tracking is disabled record nothing |
|
|
|
|
$weighting = 100; // 100% |
|
|
|
|
$date = api_get_utc_datetime(); |
|
|
|
|
|
|
|
|
|
if ($_user['user_id']) { |
|
|
|
|
$user_id = $_user['user_id']; |
|
|
|
|
} else { |
|
|
|
|
// anonymous |
|
|
|
|
$user_id = "NULL"; |
|
|
|
|
} |
|
|
|
|
$sql = "INSERT INTO $TABLETRACK_HOTPOTATOES ". |
|
|
|
|
"(exe_name, exe_user_id, exe_date,exe_cours_id,exe_result,exe_weighting)" . |
|
|
|
|
"VALUES" . |
|
|
|
|
"( |
|
|
|
|
if ($_user['user_id']) { |
|
|
|
|
$user_id = $_user['user_id']; |
|
|
|
|
} else { |
|
|
|
|
// anonymous |
|
|
|
|
$user_id = "NULL"; |
|
|
|
|
} |
|
|
|
|
$sql = "INSERT INTO $TABLETRACK_HOTPOTATOES ". |
|
|
|
|
"(exe_name, exe_user_id, exe_date,exe_cours_id,exe_result,exe_weighting)". |
|
|
|
|
"VALUES". |
|
|
|
|
"( |
|
|
|
|
'".Database::escape_string($file)."', |
|
|
|
|
'".Database::escape_string($user_id)."', |
|
|
|
|
'".Database::escape_string($date)."', |
|
|
|
|
'".Database::escape_string($_cid)."', |
|
|
|
|
'".Database::escape_string($score)."', |
|
|
|
|
'".Database::escape_string($weighting)."')"; |
|
|
|
|
Database::query($sql); |
|
|
|
|
Database::query($sql); |
|
|
|
|
|
|
|
|
|
if ($origin == 'learnpath') { |
|
|
|
|
//if we are in a learning path, save the score in the corresponding |
|
|
|
|
//table to get tracking in there as well |
|
|
|
|
global $jscript2run; |
|
|
|
|
//record the results in the learning path, using the SCORM interface (API) |
|
|
|
|
$jscript2run .= "<script>window.parent.API.void_save_asset('$score', '$weighting', 0, 'completed');</script>"; |
|
|
|
|
} |
|
|
|
|
if ($origin == 'learnpath') { |
|
|
|
|
//if we are in a learning path, save the score in the corresponding |
|
|
|
|
//table to get tracking in there as well |
|
|
|
|
global $jscript2run; |
|
|
|
|
//record the results in the learning path, using the SCORM interface (API) |
|
|
|
|
$jscript2run .= "<script>window.parent.API.void_save_asset('$score', '$weighting', 0, 'completed');</script>"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Save the Scores |
|
|
|
@ -89,9 +90,9 @@ save_scores($test, $score); |
|
|
|
|
|
|
|
|
|
// Back |
|
|
|
|
if ($origin != 'learnpath') { |
|
|
|
|
$url = "exercice.php"; // back to exercices |
|
|
|
|
$jscript2run .= '<script>'."window.open('$url', '_top', '')".'</script>'; |
|
|
|
|
echo $jscript2run; |
|
|
|
|
$url = "exercice.php"; // back to exercices |
|
|
|
|
$jscript2run .= '<script>'."window.open('$url', '_top', '')".'</script>'; |
|
|
|
|
echo $jscript2run; |
|
|
|
|
} else { |
|
|
|
|
$htmlHeadXtra[] = $jscript2run; |
|
|
|
|
Display::display_header(); |
|
|
|
|