diff --git a/assets/css/app.scss b/assets/css/app.scss index 71ce011e65..1bcb94c9a7 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -843,6 +843,16 @@ form .field { } } +.row { + @apply flex flex-wrap -mx-4; +} +.col-md-4 { + @apply w-full md:w-1/3 px-4; +} +.col-md-6 { + @apply w-full md:w-1/2 px-4; +} + //@import 'primevue-md-light-indigo/theme.css'; //@import '~primevue/resources/primevue.min.css'; //@import '~primeflex/primeflex.css'; diff --git a/package.json b/package.json index 62e82ae4ef..5347a4f214 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "blueimp-load-image": "^5.16.0", "bootstrap-daterangepicker": "^3.1.0", "bootstrap-select": "^1.13.18", - "chart.js": "^3.9.1", + "chart.js": "^4.0.0", "colorjs.io": "^0.5.0", "cropper": "^4.1.0", "datepair.js": "^0.4.17", diff --git a/public/main/admin/statistics/index.php b/public/main/admin/statistics/index.php index c2b05148dd..6494818663 100644 --- a/public/main/admin/statistics/index.php +++ b/public/main/admin/statistics/index.php @@ -26,7 +26,7 @@ in_array( ['recentlogins', 'tools', 'courses', 'coursebylanguage', 'users', 'users_active', 'session_by_date'] ) ) { - //$htmlHeadXtra[] = api_get_js('chartjs/Chart.min.js'); + $htmlHeadXtra[] = api_get_build_js('libs/chartjs/chart.js'); //$htmlHeadXtra[] = api_get_asset('chartjs-plugin-labels/build/chartjs-plugin-labels.min.js'); // Prepare variables for the JS charts $url = $reportName = $reportType = $reportOptions = ''; @@ -828,7 +828,7 @@ switch ($report) { $contract = false; $legalAccept = $extraFieldValueUser->get_values_by_handler_and_field_variable($userId, 'legal_accept'); - if ($legalAccept && isset($legalAccept['value'])) { + if ($legalAccept && !empty($legalAccept['value'])) { list($legalId, $legalLanguageId, $legalTime) = explode(':', $legalAccept['value']); if ($legalId) { $contract = true; @@ -925,7 +925,8 @@ switch ($report) { $data['chart'], 'pie', $reportOptions1, - 'canvas1' + 'canvas1', + false ); $scoreDisplay = ScoreDisplay::instance(); @@ -1009,7 +1010,8 @@ switch ($report) { $data['chart'], 'pie', $reportOptions2, - 'canvas2' + 'canvas2', + false ); $extraTables .= $data['table']; } @@ -1017,8 +1019,8 @@ switch ($report) { // graph 3 $languages = api_get_languages(); $all = []; - foreach ($languages as $language) { - $conditions = ['language' => $language]; + foreach ($languages as $locale => $language) { + $conditions = ['locale' => $locale]; $key = $language; if ('2' === substr($language, -1)) { $key = str_replace(2, '', $language); @@ -1044,7 +1046,8 @@ switch ($report) { $data['chart'], 'pie', $reportOptions3, - 'canvas3' + 'canvas3', + false ); $extraTables .= $data['table']; @@ -1092,7 +1095,8 @@ switch ($report) { $data['chart'], 'pie', $reportOptions4, - 'canvas4' + 'canvas4', + false ); $extraTables .= $data['table']; } @@ -1160,7 +1164,8 @@ switch ($report) { $data['chart'], 'pie', $reportOptions8, - 'canvas8' + 'canvas8', + false ); $extraTables .= $data['table']; } @@ -1211,7 +1216,8 @@ switch ($report) { $data['chart'], 'pie', $reportOptions5, - 'canvas5' + 'canvas5', + false ); $extraTables .= $data['table']; } @@ -1253,7 +1259,8 @@ switch ($report) { $data['chart'], 'pie', $reportOptions6, - 'canvas6' + 'canvas6', + false ); $extraTables .= $data['table']; } @@ -1294,12 +1301,13 @@ switch ($report) { $data['chart'], 'pie', $reportOptions7, - 'canvas7' + 'canvas7', + false ); $extraTables .= $data['table']; } - $header = Display::page_subheader2(get_lang('TotalNumberOfStudents').': '.$studentCount); + $header = Display::page_subheader2(get_lang('Total number of students').': '.$studentCount); $content = $header.$extraTables.$graph.$content; } @@ -1321,7 +1329,7 @@ switch ($report) { $counts[$minutes] = $row[0]; } } - $content = '