<?PHP 
// +----------------------------------------------------------------------------+
// | <G a n e s h a> - Free Web Based Training System                           |
// +----------------------------------------------------------------------------+
// | <G a n e s h a> - Plate-forme de téléformation gratuite et en open source  |
// +----------------------------------------------------------------------------|
// | Copyright (C) 2001-2003  Anéma Formation  <http://www.anema.fr/>           |
// +----------------------------------------------------------------------------+
// |           Developer : Georges CALDEIRA <gcaldeira@anemalab.org>            |
// +----------------------------------------------------------------------------+
// |              Infos on project <http://anemalab.org/>                       |
// +----------------------------------------------------------------------------+
// | 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.                                        |
// |                                                                            |
// | This program is distributed in the hope that it will be useful,            |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of             |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              |
// | GNU General Public License for more details.                               |
// |                                                                            |
// | You should have received a copy of the GNU General Public License          |
// | along with this program; if not, write to the Free Software                |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   |
// +----------------------------------------------------------------------------+

/**
* Gestion des messages SCORM
*
* @author		Georges Caldeira <gcaldeira@anemalab.org>
* @package		GaneshaStagiaire
*/
	/**
	* include des fichiers + verification de la cnx
	*/
	include_once("anema.inc.php");
	include_once($class_path.'norme.class.php');

	$groupe	= isset($HTTP_GET_VARS['groupe'])?$HTTP_GET_VARS['groupe']:0 ;
	$module = isset($HTTP_GET_VARS['module'])?$HTTP_GET_VARS['module']:0 ;
	$chapitre = isset($HTTP_GET_VARS['chapitre'])?$HTTP_GET_VARS['chapitre']:0 ;


	if (! $ClsFormation->ModuleIsValid($module,$guserid,$groupe) ) {
		PageErreur();
		exit ()		;
	}	

	$score = (isset($HTTP_GET_VARS['score'])?$HTTP_GET_VARS['score']:0);
	$max_score = (isset($HTTP_GET_VARS['max'])?$HTTP_GET_VARS['max']:0);
	$status = $scorm->GetStatus((isset($HTTP_GET_VARS['status'])?$HTTP_GET_VARS['status']:0));
	$time = (isset($HTTP_GET_VARS['time'])?$HTTP_GET_VARS['time']:0);
	if (!is_integer($time))  {
		$pres = explode('.',$time);
		$rest = (isset($pres[1])?($pres[1]>50?1:0):0);
 		$tab = explode(':',$pres[0]);
		for($i=0;$i<count($tab);$i++) {
			$time = 0 + $tab[$i];
		}
		$time = $time + $rest ;
	}
	$date = getdate()  ;
	$date = $date["0"] ;

	$ClsTracking->Add($guserid,$module,$chapitre,$score,$time,$groupe,$max_score,$status);

	$url = HTTP_STAGIAIRE."p_tracking".$ext."?connexion=".$gconnexionid ;
	$url.= "&module=".$module."&chapitre=".$chapitre."&groupe=".$groupe."&affiche=1" ;
	location($url);
	exit();

?>