"courseLog.php", "name"=> "Statistics");
$htmlHeadXtra[] = "
";
Display::display_header($nameTools,"Tracking");
?>
";
echo " |
";
if(isset($_cid)) echo "$_cid : ";
echo " ".get_lang('ToolList')."
|
";
$results = getManyResults2Col($sql);
echo "";
echo "
$langToolTitleToolnameColumn
|
$langToolTitleCountColumn
|
";
if (is_array($results)) {
for($j = 0 ; $j < count($results) ; $j++) {
echo "";
echo "".get_lang($results[$j][0])." | ";
echo "".$results[$j][1]." | ";
echo"
";
}
} else {
echo "";
echo "".get_lang('NoResult')." | ";
echo"
";
}
echo "
";
}
else
{
// this can prevent bug if there is special chars in $tool
$encodedTool = urlencode($tool);
$tool = urldecode($tool);
if( !isset($reqdate) )
$reqdate = time();
echo "
";
if(isset($_cid)) echo "$_cid : ";
echo " ".get_lang($tool)."
|
";
/* ------ display ------ */
// displayed period
echo "";
switch($period)
{
case "month" :
echo $MonthsLong[date("n", $reqdate)-1].date(" Y", $reqdate);
break;
case "week" :
$weeklowreqdate = ($reqdate-(86400*date("w" , $reqdate)));
$weekhighreqdate = ($reqdate+(86400*(6-date("w" , $reqdate)) ));
echo "".$langFrom." ".date("d " , $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate)-1].date(" Y" , $weeklowreqdate);
echo " ".$langTo." ".date("d " , $weekhighreqdate ).$MonthsLong[date("n", $weekhighreqdate)-1].date(" Y" , $weekhighreqdate);
break;
// default == day
default :
$period = "day";
case "day" :
echo $DaysLong[date("w" , $reqdate)].date(" d " , $reqdate).$MonthsLong[date("n", $reqdate)-1].date(" Y" , $reqdate);
break;
}
echo " |
";
// periode choice
echo "
[$langPeriodDay]
[$langPeriodWeek]
[$langPeriodMonth]
||
";
switch($period)
{
case "month" :
// previous and next date must be evaluated
// 30 days should be a good approximation
$previousReqDate = mktime(1,1,1,date("m",$reqdate)-1,1,date("Y",$reqdate));
$nextReqDate = mktime(1,1,1,date("m",$reqdate)+1,1,date("Y",$reqdate));
echo "
[$langPreviousMonth]
[$langNextMonth]
";
break;
case "week" :
// previous and next date must be evaluated
$previousReqDate = $reqdate - 7*86400;
$nextReqDate = $reqdate + 7*86400;
echo "
[$langPreviousWeek]
[$langNextWeek]
";
break;
case "day" :
// previous and next date must be evaluated
$previousReqDate = $reqdate - 86400;
$nextReqDate = $reqdate + 86400;
echo "
[$langPreviousDay]
[$langNextDay]
";
break;
}
echo" ||
[$langViewToolList]
|
";
// display information about this period
switch($period)
{
// all days
case "month" :
$sql = "SELECT UNIX_TIMESTAMP(access_date)
FROM $TABLETRACK_ACCESS
WHERE access_tool = '$tool'
$courseCodeEqualcidIfNeeded
AND MONTH(access_date) = MONTH(FROM_UNIXTIME('$reqdate'))
AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
ORDER BY access_date ASC";
$days_array = daysTab($sql);
makeHitsTable($days_array,$langDay);
break;
// all days
case "week" :
$sql = "SELECT UNIX_TIMESTAMP(access_date)
FROM $TABLETRACK_ACCESS
WHERE access_tool = '$tool'
$courseCodeEqualcidIfNeeded
AND WEEK(access_date) = WEEK(FROM_UNIXTIME('$reqdate'))
AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
ORDER BY access_date ASC";
$days_array = daysTab($sql);
makeHitsTable($days_array,$langDay);
break;
// all hours
case "day" :
$sql = "SELECT UNIX_TIMESTAMP(access_date)
FROM $TABLETRACK_ACCESS
WHERE access_tool = '$tool'
$courseCodeEqualcidIfNeeded
AND DAYOFYEAR(access_date) = DAYOFYEAR(FROM_UNIXTIME('$reqdate'))
AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
ORDER BY access_date ASC";
$hours_array = hoursTab($sql,$reqdate);
makeHitsTable($hours_array,$langHour);
break;
}
}
} else { // not allowed to track
echo get_lang('NotAllowed');
}
echo '
';
Display::display_footer();