"../auth/profile.php", "name"=> get_lang('ModifyProfile'));
$nameTools = get_lang('ToolName');
$htmlHeadXtra[] = "
";
//Remove all characters different than 0 and 1 from $view parameter
$view = preg_replace('/[^01]/','',$_REQUEST['view']);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$TABLETRACK_LOGIN = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$limitOfDisplayedLogins = 25; // number of logins to display
include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");
Display::display_header($nameTools,"Tracking");
api_display_tool_title($nameTools);
// MAIN SECTION
// show all : view must be equal to the sum of all view values (1024+512+...+64)
// show none : 0
echo "
[".get_lang('ShowAll')."]
[".get_lang('ShowNone')."]
|
";
if(empty($view)) $view ="0000000";
/***************************************************************************
*
* Logins
*
***************************************************************************/
$tempView = $view;
if($tempView[0] == '1')
{
$tempView[0] = '0';
echo "
-
".get_lang('Logins')."
[".get_lang('Close')."]
|
";
$sql = "SELECT login_date
FROM ".$TABLETRACK_LOGIN."
WHERE login_user_id = '".$_user['user_id']."'
ORDER BY login_date DESC
LIMIT ".$limitOfDisplayedLogins."";
echo "".get_lang('LoginsExplaination')." ";
$results = getManyResults1Col($sql);
echo "
";
if (is_array($results))
{
while ( list($key,$value) = each($results))
{
$beautifulDate = api_convert_and_format_date($value, null, date_default_timezone_get());
echo "
".$beautifulDate."
|
";
if(!isset($previousDate))
{
$sql = "SELECT NOW()";
$previousDate = getOneResult($sql);
}
$sql = "SELECT access_tool, count(access_tool), c_id
FROM $TABLETRACK_ACCESS
WHERE access_user_id = '".$_user['user_id']."'".
//AND access_tool IS NOT NULL
"AND access_date > '".$value."'
AND access_date < '".$previousDate."'
GROUP BY access_tool, c_id
ORDER BY access_cours_code ASC";
$results2 = getManyResults3Col($sql);
if (is_array($results2)) {
echo "
";
$previousCourse = "???";
for($j = 0 ; $j < count($results2) ; $j++)
{
// if course is different, write the name of the course
if($results2[$j][2] != $previousCourse)
{
echo "
".$results2[$j][2]."
|
";
}
// if count != de 0 then display toolname et number of visits, else its a course visit
if( $results2[$j][1] != 0 )
{
echo "";
echo "".get_lang(ucfirst($results2[$j][0]))." | ";
echo "".$results2[$j][1]." ".get_lang('Visits')." | ";
echo " ";
}
$previousCourse = $results2[$j][2];
}
echo " ";
echo " | ";
}
$previousDate = $value;
}
}
else
{
echo "";
echo "".get_lang('NoResult')." | ";
echo" ";
}
echo " ";
echo " |
";
}
else
{
$tempView[0] = '1';
echo "
+ ".get_lang('Logins')."
|
";
}
/** Exercises */
/*
$tempView = $view;
if($view[1] == '1')
{
$tempView[1] = '0';
echo "
- ".get_lang('ExercicesResults')." [".get_lang('Close')."]
|
";
echo " Ceci est amen etre dplac vers la page de garde des exercices ";
$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, te.exe_date
FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te
WHERE te.exe_user_id = '".$_user['user_id']."'
AND te.exe_exo_id = ce.id
ORDER BY te.c_id ASC, ce.title ASC, te.exe_date ASC";
echo "";
$results = getManyResultsXCol($sql,4);
echo "";
echo "
".get_lang('ExercicesTitleExerciceColumn')."
|
".get_lang('Date')."
|
".get_lang('ExercicesTitleScoreColumn')."
|
";
if (is_array($results))
{
for($i = 0; $i < sizeof($results); $i++)
{
if( $results[$i][1] < ($results[$i][2]/2) )
$scoreColor = "red";
elseif( $results[$i][1] > ($results[$i][2]/100*60) )
$scoreColor = "green";
else
$scoreColor = "#FF8C00";
echo "";
echo "".$results[$i][0]." | ";
echo "".$results[$i][3]." | ";
echo "".$results[$i][1]." / ".$results[$i][2]." | ";
echo" ";
}
}
else
{
echo "";
echo "".get_lang('NoResult')." | ";
echo" ";
}
echo " ";
echo " |
";
}
else
{
$tempView[1] = '1';
echo "
+ ".get_lang('ExercicesResults')."
|
";
}
*/
echo "
";
Display::display_footer();