From a12bdcd5ea659b164b1b99ebaaa0acfcbff01c07 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 7 Nov 2018 08:16:18 +0100 Subject: [PATCH] Minor - flint fixes --- main/course_progress/index.php | 1 - main/inc/lib/usermanager.lib.php | 2 +- main/tracking/courseLog.php | 29 ++++++++----------- plugin/card_game/resources/ajax.card.php | 3 -- .../CoreBundle/Component/Utils/ChamiloApi.php | 12 +++++--- 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/main/course_progress/index.php b/main/course_progress/index.php index 36bf4d4b20..c066146815 100755 --- a/main/course_progress/index.php +++ b/main/course_progress/index.php @@ -181,7 +181,6 @@ function check_per_custom_date(obj) { $thematicControl = Session::read('thematic_control'); - if ($action == 'thematic_list') { $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('ThematicControl')]; } diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 255ad29ebc..be0e93faa1 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -1292,6 +1292,7 @@ class UserManager $emailBody = $tplContent->fetch($layoutContent); $mailTemplateManager = new MailTemplateManager(); + if (!empty($emailTemplate) && isset($emailTemplate['user_edit_content.tpl']) && !empty($emailTemplate['user_edit_content.tpl']) @@ -1299,7 +1300,6 @@ class UserManager $userInfo = api_get_user_info($user_id); $emailBody = $mailTemplateManager->parseTemplate($emailTemplate['user_edit_content.tpl'], $userInfo); } - api_mail_html( $recipient_name, $email, diff --git a/main/tracking/courseLog.php b/main/tracking/courseLog.php index a28d2d8f9e..21ac2f68fd 100755 --- a/main/tracking/courseLog.php +++ b/main/tracking/courseLog.php @@ -1,8 +1,8 @@ 0) { $numberStudentsCompletedLP = 0; $averageStudentsTestScore = 0; $scoresDistribution = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - + $userScoreList = []; $listStudentIds = []; $timeStudent = []; @@ -368,7 +367,7 @@ if ($nbStudents > 0) { } $averageStudentTestScore = substr($userTracking[7], 0, -1); $averageStudentsTestScore += $averageStudentTestScore; - + if ($averageStudentTestScore === '100') { $reducedAverage = 9; } else { @@ -380,30 +379,30 @@ if ($nbStudents > 0) { $scoreStudent = substr($userTracking[5], 0, -1) + substr($userTracking[7], 0, -1); list($hours, $minutes, $seconds) = preg_split('/:/', $userTracking[4]); $minutes = round((3600 * $hours + 60 * $minutes + $seconds) / 60); - + $certificate = false; if (isset($category[0]) && $category[0]->is_certificate_available($userId)) { $certificate = true; $certificateCount++; } - + $listStudent = [ 'id' => $userId, - 'fullname' => $userTracking[2] . ', ' . $userTracking[1], + 'fullname' => $userTracking[2].', '.$userTracking[1], 'score' => floor($scoreStudent / 2), 'total_time' => $minutes, 'avatar' => UserManager::getUserPicture($userId), - 'certicate' => $certificate + 'certicate' => $certificate, ]; $listStudentIds[] = $userId; $userScoreList[] = $listStudent; } - + uasort($userScoreList, 'sort_by_order'); $averageStudentsTestScore = round($averageStudentsTestScore / $nbStudents); - + $colors = ChamiloApi::getColorPalette(true, true, 10); - + $tpl->assign('chart_colors', json_encode($colors)); $tpl->assign('certificate_count', $certificateCount); $tpl->assign('score_distribution', json_encode($scoresDistribution)); @@ -412,11 +411,10 @@ if ($nbStudents > 0) { $tpl->assign('students_completed_lp', $numberStudentsCompletedLP); $tpl->assign('number_students', $nbStudents); $tpl->assign('top_students', $userScoreList); - - + $trackingSummaryLayout = $tpl->get_template("tracking/tracking_course_log.tpl"); $content = $tpl->fetch($trackingSummaryLayout); - + echo $content; } @@ -492,7 +490,6 @@ if (count($a_students) > 0) { $table->set_additional_parameters($parameters); - $headers = []; // tab of header texts $table->set_header(0, get_lang('OfficialCode'), true); @@ -653,9 +650,7 @@ if ($export_csv) { } Display::display_footer(); - function sort_by_order($a, $b) { return $a['score'] <= $b['score']; } - diff --git a/plugin/card_game/resources/ajax.card.php b/plugin/card_game/resources/ajax.card.php index 231aa425ee..7441207a8f 100644 --- a/plugin/card_game/resources/ajax.card.php +++ b/plugin/card_game/resources/ajax.card.php @@ -16,7 +16,6 @@ require_once __DIR__.'/../../../main/inc/global.inc.php'; $cardGameSession = Session::read('cardgame'); if (!empty($cardGameSession)) { - if ($cardGameSession == 'havedeck') { $part = '1'; if (isset($_GET['part'])) { @@ -24,7 +23,6 @@ if (!empty($cardGameSession)) { $userId = api_get_user_id(); if (isset($userId)) { - $sql = "UPDATE plugin_card_game SET access_date = CURDATE(), parts = CONCAT(parts,'!!$part;!') WHERE user_id = $userId"; @@ -47,7 +45,6 @@ if (!empty($cardGameSession)) { Database::query($sql); Session::write('cardgame', 'done'); } - } } } diff --git a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php index df161994b2..ba8df78c99 100644 --- a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php +++ b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php @@ -289,12 +289,15 @@ class ChamiloApi return api_get_path(WEB_CSS_PATH).'editor_content.css'; } + /** * Get a list of colors from the palette at main/palette/pchart/default.color - * and return it as an array of strings + * and return it as an array of strings. + * * @param bool $decimalOpacity Whether to return the opacity as 0..100 or 0..1 - * @param bool $wrapInRGBA Whether to return it as 1,1,1,100 or rgba(1,1,1,100) - * @param int $fillUpTo If the number of colors is smaller than this number, generate more colors + * @param bool $wrapInRGBA Whether to return it as 1,1,1,100 or rgba(1,1,1,100) + * @param int $fillUpTo If the number of colors is smaller than this number, generate more colors + * * @return array An array of string colors */ public static function getColorPalette( @@ -324,9 +327,10 @@ class ChamiloApi $count = count($palette); if (isset($fillUpTo) && $fillUpTo > $count) { for ($i = $count; $i < $fillUpTo; $i++) { - $palette[$i] = $palette[$i%$count]; + $palette[$i] = $palette[$i % $count]; } } + return $palette; } }