}
            break;
            // all days
        // all days
        case "month":
            $sql = "SELECT UNIX_TIMESTAMP( access_date )\n                            FROM {$TABLETRACK_ACCESS}\n                            WHERE MONTH(access_date) = MONTH (FROM_UNIXTIME( '{$reqdate}' ) )\n                            AND YEAR( access_date ) = YEAR( FROM_UNIXTIME( '{$reqdate}' ) )\n                            AND c_id = '{$courseId}'\n                            AND access_tool IS NULL ";
            if ($displayType == "day") {
                $sql .= "ORDER BY DAYOFYEAR( access_date)";
                $days_array = daysTab($sql);
                makeHitsTable($days_array, get_lang('PeriodDay'));
            } else {
                $sql .= "ORDER BY HOUR( access_date)";
                $hours_array = hoursTab($sql);
                makeHitsTable($hours_array, get_lang('PeriodHour'));
            }
            break;
            // all hours
        // all hours
        case "day":
            $sql = "SELECT UNIX_TIMESTAMP( access_date )\n                            FROM {$TABLETRACK_ACCESS}\n                            WHERE DAYOFMONTH(access_date) = DAYOFMONTH(FROM_UNIXTIME( '{$reqdate}' ) )\n                            AND MONTH(access_date) = MONTH (FROM_UNIXTIME( '{$reqdate}' ) )\n                            AND YEAR( access_date ) = YEAR( FROM_UNIXTIME( '{$reqdate}' ) )\n                            AND c_id = '{$courseId}'\n                            AND access_tool IS NULL\n                            ORDER BY HOUR( access_date )";
            $hours_array = hoursTab($sql, $reqdate);
            makeHitsTable($hours_array, get_lang('PeriodHour'));
            break;
    }
} else {
    api_not_allowed();
}
?>
</table>
<?php 
Display::display_footer();
            $hours_array = hoursTab($sql);
            $html .= makeHitsTable($hours_array, get_lang('Hour'));
        }
        break;
        // all days
    // all days
    case "month":
        $sql = "SELECT UNIX_TIMESTAMP( `date` )\n                    FROM `" . $tbl_course_tracking_event . "`\n                    WHERE `type` = 'course_access'\n                    AND MONTH(`date`) = MONTH (FROM_UNIXTIME( {$reqdate} ) )\n                    AND YEAR( `date` ) = YEAR( FROM_UNIXTIME( {$reqdate} ) )";
        if ($displayType == "day") {
            $sql .= "ORDER BY DAYOFYEAR( `date`)";
            $days_array = daysTab($sql);
            $html .= makeHitsTable($days_array, get_lang('Day'));
        } else {
            $sql .= "ORDER BY HOUR( `date`)";
            $hours_array = hoursTab($sql);
            $html .= makeHitsTable($hours_array, get_lang('Hour'));
        }
        break;
        // all hours
    // all hours
    case "day":
        $sql = "SELECT UNIX_TIMESTAMP( `date` )\n                    FROM `" . $tbl_course_tracking_event . "`\n                    WHERE `type` = 'course_access'\n                    AND DAYOFMONTH(`date`) = DAYOFMONTH(FROM_UNIXTIME( {$reqdate} ) )\n                    AND MONTH(`date`) = MONTH (FROM_UNIXTIME( {$reqdate} ) )\n                    AND YEAR( `date` ) = YEAR( FROM_UNIXTIME( {$reqdate} ) )\n                    ORDER BY HOUR( `date` )";
        $hours_array = hoursTab($sql, $reqdate);
        $html .= makeHitsTable($hours_array, get_lang('Hour'));
        break;
}
/*
 * Output rendering
 */
$claroline->display->body->setContent($html);
echo $claroline->display->render();
        echo "   &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;\n                    [<a href='" . api_get_self() . "' class='specialLink'>{$langViewToolList}</a>]\n                    </small>\n                    </td>\n                </tr>\n            ";
        // display information about this period
        switch ($period) {
            // all days
            case "month":
                $sql = "SELECT UNIX_TIMESTAMP(access_date)\n                            FROM {$TABLETRACK_ACCESS}\n                            WHERE access_tool = '{$tool}'\n                                {$courseCodeEqualcidIfNeeded}\n                                AND MONTH(access_date) = MONTH(FROM_UNIXTIME('{$reqdate}'))\n                                AND YEAR(access_date) = YEAR(FROM_UNIXTIME('{$reqdate}'))\n                                ORDER BY access_date ASC";
                $days_array = daysTab($sql);
                makeHitsTable($days_array, $langDay);
                break;
                // all days
            // all days
            case "week":
                $sql = "SELECT UNIX_TIMESTAMP(access_date)\n                            FROM {$TABLETRACK_ACCESS}\n                            WHERE access_tool = '{$tool}'\n                                {$courseCodeEqualcidIfNeeded}\n                                AND WEEK(access_date) = WEEK(FROM_UNIXTIME('{$reqdate}'))\n                                AND YEAR(access_date) = YEAR(FROM_UNIXTIME('{$reqdate}'))\n                                ORDER BY access_date ASC";
                $days_array = daysTab($sql);
                makeHitsTable($days_array, $langDay);
                break;
                // all hours
            // all hours
            case "day":
                $sql = "SELECT UNIX_TIMESTAMP(access_date)\n                                FROM {$TABLETRACK_ACCESS}\n                                WHERE access_tool = '{$tool}'\n                                    {$courseCodeEqualcidIfNeeded}\n                                    AND DAYOFYEAR(access_date) = DAYOFYEAR(FROM_UNIXTIME('{$reqdate}'))\n                                    AND YEAR(access_date) = YEAR(FROM_UNIXTIME('{$reqdate}'))\n                                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 '</table>';
Display::display_footer();