'../index.php', 'name' => get_lang('PlatformAdmin')]; $report = isset($_REQUEST['report']) ? $_REQUEST['report'] : ''; $sessionDuration = isset($_GET['session_duration']) ? (int) $_GET['session_duration'] : ''; if ( in_array( $report, ['recentlogins', 'tools', 'courses', 'coursebylanguage', 'users'] ) ) { $htmlHeadXtra[] = api_get_js('chartjs/Chart.min.js'); // Prepare variables for the JS charts $url = $reportName = $reportType = $reportOptions = ''; switch ($report) { case 'recentlogins': $url = api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=recent_logins&session_duration='.$sessionDuration; $reportName = ''; $reportType = 'line'; $reportOptions = ''; $htmlHeadXtra[] = Statistics::getJSChartTemplate($url, $reportType, $reportOptions); break; case 'tools': $url = api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=tools_usage'; $reportName = 'PlatformToolAccess'; $reportType = 'pie'; $reportOptions = ' legend: { position: "left" }, title: { text: "'.get_lang($reportName).'", display: true }, cutoutPercentage: 25 '; $htmlHeadXtra[] = Statistics::getJSChartTemplate($url, $reportType, $reportOptions); break; case 'courses': $url = api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=courses'; $reportName = 'CountCours'; $reportType = 'pie'; $reportOptions = ' legend: { position: "left" }, title: { text: "'.get_lang($reportName).'", display: true }, cutoutPercentage: 25 '; $htmlHeadXtra[] = Statistics::getJSChartTemplate($url, $reportType, $reportOptions); break; case 'coursebylanguage': $url = api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=courses_by_language'; $reportName = 'CountCourseByLanguage'; $reportType = 'pie'; $reportOptions = ' legend: { position: "left" }, title: { text: "'.get_lang($reportName).'", display: true }, cutoutPercentage: 25 '; $htmlHeadXtra[] = Statistics::getJSChartTemplate($url, $reportType, $reportOptions); break; case 'users': $invisible = isset($_GET['count_invisible_courses']) ? intval($_GET['count_invisible_courses']) : null; $urlBase = api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?'; $url1 = $urlBase.'a=users&count_invisible='.$invisible; $url2 = $urlBase.'a=users_teachers&count_invisible='.$invisible; $url3 = $urlBase.'a=users_students&count_invisible='.$invisible; $reportName1 = get_lang('NumberOfUsers'); $reportName2 = get_lang('Teachers'); $reportName3 = get_lang('Students'); $reportType = 'pie'; $reportOptions = ' legend: { position: "left" }, title: { text: "%s", display: true }, cutoutPercentage: 25 '; $reportOptions1 = sprintf($reportOptions, $reportName1); $reportOptions2 = sprintf($reportOptions, $reportName2); $reportOptions3 = sprintf($reportOptions, $reportName3); $htmlHeadXtra[] = Statistics::getJSChartTemplate( $url1, $reportType, $reportOptions1, 'canvas1' ); $htmlHeadXtra[] = Statistics::getJSChartTemplate( $url2, $reportType, $reportOptions2, 'canvas2' ); $htmlHeadXtra[] = Statistics::getJSChartTemplate( $url3, $reportType, $reportOptions3, 'canvas3' ); break; } } if ($report == 'user_session') { $htmlHeadXtra[] = api_get_jqgrid_js(); } $tool_name = get_lang('Statistics'); Display::display_header($tool_name); echo Display::page_header($tool_name); $strCourse = get_lang('Courses'); $strUsers = get_lang('Users'); $strSystem = get_lang('System'); $strSocial = get_lang('Social'); $strSession = get_lang('Session'); // courses ... $tools[$strCourse]['report=courses'] = get_lang('CountCours'); $tools[$strCourse]['report=tools'] = get_lang('PlatformToolAccess'); $tools[$strCourse]['report=courselastvisit'] = get_lang('LastAccess'); $tools[$strCourse]['report=coursebylanguage'] = get_lang('CountCourseByLanguage'); // users ... $tools[$strUsers]['report=users'] = get_lang('CountUsers'); $tools[$strUsers]['report=recentlogins'] = get_lang('Logins'); $tools[$strUsers]['report=logins&type=month'] = get_lang('Logins').' ('.get_lang('PeriodMonth').')'; $tools[$strUsers]['report=logins&type=day'] = get_lang('Logins').' ('.get_lang('PeriodDay').')'; $tools[$strUsers]['report=logins&type=hour'] = get_lang('Logins').' ('.get_lang('PeriodHour').')'; $tools[$strUsers]['report=pictures'] = get_lang('CountUsers').' ('.get_lang('UserPicture').')'; $tools[$strUsers]['report=no_login_users'] = get_lang('StatsUsersDidNotLoginInLastPeriods'); $tools[$strUsers]['report=zombies'] = get_lang('Zombies'); // system ... $tools[$strSystem]['report=activities'] = get_lang('ImportantActivities'); if (api_is_global_platform_admin() && api_is_multiple_url_enabled()) { $tools[$strSystem]['report=user_session'] = get_lang('PortalUserSessionStats'); } // social ... $tools[$strSocial]['report=messagesent'] = get_lang('MessagesSent'); $tools[$strSocial]['report=messagereceived'] = get_lang('MessagesReceived'); $tools[$strSocial]['report=friends'] = get_lang('CountFriends'); echo '
';
echo ''.$section.''; echo '
| ';
}
echo '