@ -11,20 +11,25 @@ require_once '../../inc/global.inc.php';
api_protect_admin_script();
api_protect_admin_script();
$interbreadcrumb[] = array('url' => '../index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => '../index.php', 'name' => get_lang('PlatformAdmin'));
$htmlHeadXtra[] = api_get_js('chartjs/Chart.min.js');
$htmlHeadXtra[] = ''
$report = isset($_REQUEST['report']) ? $_REQUEST['report'] : '';
. '< script type = "text/javascript" > '
. '$(document).ready(function() {'
if ($report) {
. '$.ajax({'
$htmlHeadXtra[] = api_get_js('chartjs/Chart.min.js');
. 'url: "'. api_get_path(WEB_CODE_PATH) .'inc/ajax/statistics.ajax.php?a=recentlogins",'
$htmlHeadXtra[] = ''
. 'type: "POST",'
. '< script type = "text/javascript" > '
. 'success: function(data) {'
. '$(document).ready(function() {'
. 'Chart.defaults.global.responsive = true;'
. '$.ajax({'
. 'var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Line(data);'
. 'url: "'. api_get_path(WEB_CODE_PATH) .'inc/ajax/statistics.ajax.php?a=recentlogins",'
. '}'
. 'type: "POST",'
. '});'
. 'success: function(data) {'
. '});'
. 'Chart.defaults.global.responsive = true;'
. '< / script > ';
. 'var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Line(data);'
. '}'
. '});'
. '});'
. '< / script > ';
}
$tool_name = get_lang('Statistics');
$tool_name = get_lang('Statistics');
Display::display_header($tool_name);
Display::display_header($tool_name);
@ -75,7 +80,7 @@ echo '</tr></table>';
$course_categories = Statistics::getCourseCategories();
$course_categories = Statistics::getCourseCategories();
echo '< br / > < br / > ';//@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
echo '< br / > < br / > ';//@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
$report = isset($_REQUEST['report']) ? $_REQUEST['report'] : '';
switch ($report) {
switch ($report) {
case 'courses':
case 'courses':
// total amount of courses
// total amount of courses
@ -116,7 +121,8 @@ switch ($report) {
Statistics::printStats(get_lang('Students'), $students);
Statistics::printStats(get_lang('Students'), $students);
break;
break;
case 'recentlogins':
case 'recentlogins':
echo '< canvas class = "col-md-12" id = "canvas" > < / canvas > ';
echo '< h2 > '. sprintf(get_lang('LastXDays'), '15') . '< / h2 > ';
echo '< canvas class = "col-md-12" id = "canvas" height = "100px" > < / canvas > ';
Statistics::printRecentLoginStats();
Statistics::printRecentLoginStats();
Statistics::printRecentLoginStats(true);
Statistics::printRecentLoginStats(true);
break;
break;