diff --git a/main/auth/inscription.php b/main/auth/inscription.php index 837bb6cf6d..c3ff85082f 100755 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -75,11 +75,11 @@ if ($extraConditions && isset($extraConditions['conditions'])) { if (CustomPages::enabled() && CustomPages::exists(CustomPages::REGISTRATION)) { $layoutForm = FormValidator::LAYOUT_GRID; -} else{ +} else { $layoutForm = FormValidator::LAYOUT_HORIZONTAL; } -$form = new FormValidator('registration','post','','',[],$layoutForm); +$form = new FormValidator('registration', 'post', '', '', [], $layoutForm); $user_already_registered_show_terms = false; if (api_get_setting('allow_terms_conditions') === 'true') { $user_already_registered_show_terms = isset($_SESSION['term_and_condition']['user_id']); @@ -314,7 +314,6 @@ if ($user_already_registered_show_terms === false && ); } - if (api_get_setting('extended_profile') === 'true') { // MY PERSONAL OPEN AREA if (api_get_setting('extendedprofile_registration', 'mypersonalopenarea') === 'true' && diff --git a/main/exercise/TestCategory.php b/main/exercise/TestCategory.php index 64c45fd868..65d25d500d 100644 --- a/main/exercise/TestCategory.php +++ b/main/exercise/TestCategory.php @@ -750,8 +750,8 @@ class TestCategory * * @param Exercise $exercise * @param array $category_list - * pre filled array with the category_id, score, and weight - * example: array(1 => array('score' => '10', 'total' => 20)); + * pre filled array with the category_id, score, and weight + * example: array(1 => array('score' => '10', 'total' => 20)); * * @return string */ @@ -811,7 +811,7 @@ class TestCategory true ) ); - $resultsArray[] = round($category_item['score']/$category_item['total']*10); + $resultsArray[] = round($category_item['score'] / $category_item['total'] * 10); $row++; } diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index 19485c8f59..ba436b97b5 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -10412,6 +10412,138 @@ class Exercise return $content; } + public function getRadarsFromUsers($userList, $exercises, $courseId, $sessionId) + { + $dataSet = []; + $labels = []; + /** @var Exercise $exercise */ + foreach ($exercises as $exercise) { + if (empty($labels)) { + $categoryNameList = TestCategory::getListOfCategoriesNameForTest($exercise->iId); + $labels = array_column($categoryNameList, 'title'); + } + + foreach ($userList as $userId) { + $results = Event::getExerciseResultsByUser( + $userId, + $exercise->iId, + $courseId, + $sessionId + ); + + if ($results) { + $firstAttempt = current($results); + $exeId = $firstAttempt['exe_id']; + + ob_start(); + $stats = ExerciseLib::displayQuestionListByAttempt( + $exercise, + $exeId, + false + ); + ob_end_clean(); + + $categoryList = $stats['category_list']; + $resultsArray = []; + foreach ($categoryList as $category_id => $category_item) { + $resultsArray[] = round($category_item['score'] / $category_item['total'] * 10); + } + $dataSet[] = $resultsArray; + } + } + } + + return $this->getRadar($labels, $dataSet); + } + + public function getRadar($labels, $dataSet) + { + if (empty($labels) || empty($dataSet)) { + return ''; + } + + $labels = json_encode($labels); + + // Default preset, after that colors are generated randomly. @todo improve colors. Use a js lib? + $colorList = [ + 'rgb(255, 99, 132, 1.0)', + 'rgb(0,0,200,1.0)', // red + 'rgb(255, 159, 64, 1.0)', // orange + 'rgb(255, 205, 86, 1.0)', //yellow + 'rgb(75, 192, 192, 1.0)', // green + 'rgb(54, 162, 235, 1.0)', // blue + 'rgb(153, 102, 255, 1.0)', // purple + //'rgb(201, 203, 207)' grey + ]; + + $dataSetToJson = []; + $counter = 0; + foreach ($dataSet as $resultsArray) { + $color = isset($colorList[$counter]) ? $colorList[$counter] : 'rgb('.rand(0, 255).', '.rand(0, 255).', '.rand(0, 255).', 1.0)'; + + $background = str_replace('1.0', '0.2', $color); + $dataSetToJson[] = [ + 'fill' => true, + //'label' => '".get_lang('Categories')."', + 'backgroundColor' => $background, + 'borderColor' => $color, + 'pointBackgroundColor' => $color, + 'pointBorderColor' => '#fff', + 'pointHoverBackgroundColor' => '#fff', + 'pointHoverBorderColor' => $color, + 'pointRadius' => 6, + 'pointBorderWidth' => 3, + 'pointHoverRadius' => 10, + 'data' => $resultsArray, + ]; + $counter++; + } + $resultsToJson = json_encode($dataSetToJson); + + return " + + + "; + } + /** * Get number of questions in exercise by user attempt. * @@ -10934,136 +11066,4 @@ class Exercise get_lang('ShowResultsToStudents') ); } - - public function getRadarsFromUsers($userList, $exercises, $courseId, $sessionId) - { - $dataSet = []; - $labels = []; - /** @var Exercise $exercise */ - foreach ($exercises as $exercise) { - if (empty($labels)) { - $categoryNameList = TestCategory::getListOfCategoriesNameForTest($exercise->iId); - $labels = array_column($categoryNameList, 'title'); - } - - foreach ($userList as $userId) { - $results = Event::getExerciseResultsByUser( - $userId, - $exercise->iId, - $courseId, - $sessionId - ); - - if ($results) { - $firstAttempt = current($results); - $exeId = $firstAttempt['exe_id']; - - ob_start(); - $stats = ExerciseLib::displayQuestionListByAttempt( - $exercise, - $exeId, - false - ); - ob_end_clean(); - - $categoryList = $stats['category_list']; - $resultsArray = []; - foreach ($categoryList as $category_id => $category_item) { - $resultsArray[] = round($category_item['score'] / $category_item['total'] * 10); - } - $dataSet[] = $resultsArray; - } - } - } - - return $this->getRadar($labels, $dataSet); - } - - public function getRadar($labels, $dataSet) - { - if (empty($labels) || empty($dataSet)) { - return ''; - } - - $labels = json_encode($labels); - - // Default preset, after that colors are generated randomly. @todo improve colors. Use a js lib? - $colorList = [ - 'rgb(255, 99, 132, 1.0)', - 'rgb(0,0,200,1.0)', // red - 'rgb(255, 159, 64, 1.0)', // orange - 'rgb(255, 205, 86, 1.0)', //yellow - 'rgb(75, 192, 192, 1.0)', // green - 'rgb(54, 162, 235, 1.0)', // blue - 'rgb(153, 102, 255, 1.0)', // purple - //'rgb(201, 203, 207)' grey - ]; - - $dataSetToJson = []; - $counter = 0; - foreach ($dataSet as $resultsArray) { - $color = isset($colorList[$counter]) ? $colorList[$counter] : 'rgb('.rand(0,255).', '.rand(0,255).', '.rand(0,255).', 1.0)'; - - $background = str_replace('1.0', '0.2', $color); - $dataSetToJson[] = [ - 'fill' => true, - //'label' => '".get_lang('Categories')."', - 'backgroundColor' => $background, - 'borderColor' => $color, - 'pointBackgroundColor' => $color, - 'pointBorderColor' => '#fff', - 'pointHoverBackgroundColor' => '#fff', - 'pointHoverBorderColor' => $color, - 'pointRadius' => 6, - 'pointBorderWidth' => 3, - 'pointHoverRadius' => 10, - 'data' => $resultsArray, - ]; - $counter++; - } - $resultsToJson = json_encode($dataSetToJson); - - return " - - - "; - } } diff --git a/main/inc/ajax/lp.ajax.php b/main/inc/ajax/lp.ajax.php index 12a048d50c..74bcbc5c6a 100755 --- a/main/inc/ajax/lp.ajax.php +++ b/main/inc/ajax/lp.ajax.php @@ -25,7 +25,7 @@ switch ($action) { $session_id = (isset($_GET['session_id']) && !empty($_GET['session_id'])) ? (int) $_GET['session_id'] : 0; $onlyActiveLp = !(api_is_platform_admin(true) || api_is_course_admin()); $results = learnpath::getLpList($course_id, $session_id, $onlyActiveLp); - $data= []; + $data = []; if (!empty($results)) { foreach ($results as $lp) { diff --git a/main/inc/lib/TicketManager.php b/main/inc/lib/TicketManager.php index a77961125c..0ee2e6587f 100644 --- a/main/inc/lib/TicketManager.php +++ b/main/inc/lib/TicketManager.php @@ -1226,7 +1226,7 @@ class TicketManager $dataExercise = [ 'cidReq' => $course['code'], 'id_session' => $sessionId, - 'exerciseId' => $row['exercise_id'] + 'exerciseId' => $row['exercise_id'], ]; $urlParamsExercise = http_build_query($dataExercise); @@ -1241,7 +1241,7 @@ class TicketManager 'cidReq' => $course['code'], 'id_session' => $sessionId, 'lp_id' => $row['lp_id'], - 'action' => 'view' + 'action' => 'view', ]; $urlParamsLp = http_build_query($dataLp); diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 6d0bf3f26b..5052673693 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -1261,7 +1261,7 @@ function api_protect_course_script($print_headers = false, $allow_session_admins '/plugin/positioning/start.php', '/plugin/positioning/start_student.php', '/main/course_home/course_home.php', - '/main/exercise/overview.php' + '/main/exercise/overview.php', ]; if (!in_array($currentPath, $paths, true)) { diff --git a/main/inc/lib/extra_field.lib.php b/main/inc/lib/extra_field.lib.php index d7f94599d3..3ee375a1ae 100755 --- a/main/inc/lib/extra_field.lib.php +++ b/main/inc/lib/extra_field.lib.php @@ -1003,7 +1003,6 @@ class ExtraField extends Model || $field_details['variable'] == 'price' ) { $authors = true; - } if (!api_is_platform_admin() && $authors == true) { continue; diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index a31eee56cc..21ed491fd0 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -924,7 +924,7 @@ class SocialManager extends UserManager } $myExtendedProfileEdit = ''; - if( $user_id == api_get_user_id()){ + if ($user_id == api_get_user_id()) { $myExtendedProfileEdit .= ''. Display::return_icon('edit.png', get_lang('EditExtendProfile'), '', 16).''; } @@ -967,7 +967,7 @@ class SocialManager extends UserManager $portfolioIcon = Display::return_icon('wiki_task.png', get_lang('Portfolio')); $personalDataIcon = Display::return_icon('database.png', get_lang('PersonalDataReport')); $messageSocialIcon = Display::return_icon('promoted_message.png', get_lang('PromotedMessages')); - $portfolio = Display::return_icon('portfolio.png', get_lang('Portfolio ')); + $portfolio = Display::return_icon('portfolio.png', get_lang('Portfolio ')); $forumCourseId = api_get_configuration_value('global_forums_course_id'); $groupUrl = api_get_path(WEB_CODE_PATH).'social/groups.php'; @@ -1000,7 +1000,6 @@ class SocialManager extends UserManager '; if ($settingExtendedProfileEnabled == true) { - $active = $show === 'portfolio' ? 'active' : null; $links .= '
  • @@ -1231,7 +1230,7 @@ class SocialManager extends UserManager 'data-title' => $sendMessageText, ] ); - if($settingExtendedProfileEnabled == true) { + if ($settingExtendedProfileEnabled == true) { $active = $show === 'portfolio' ? 'active' : null; $links .= '
  • @@ -1467,7 +1466,6 @@ class SocialManager extends UserManager } // MY PRODUCTIONS self::display_productions($user_object->user_id); - } else { $html .= '
    '; $html .= get_lang('UsersOnLineList'); @@ -2455,7 +2453,7 @@ class SocialManager extends UserManager /** * Show middle section for Portfolio extended. - * Must be active on main/admin/settings.php?category=User into extended_profile + * Must be active on main/admin/settings.php?category=User into extended_profile. * * @param string $urlForm * @@ -2563,7 +2561,7 @@ class SocialManager extends UserManager $form->addHtml('
    '); $form->addHidden('url_content', ''); - return Display::panel($more_info, get_lang('Portfolio') . $editPorfolioLink); + return Display::panel($more_info, get_lang('Portfolio').$editPorfolioLink); } /** diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index 9e6066d65e..b73544ea24 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -1831,7 +1831,7 @@ class learnpath } /** - * Get the learning path name by id + * Get the learning path name by id. * * @param int $lpId * @@ -4948,6 +4948,7 @@ class learnpath if ($debug) { error_log("Skip saving score with value: $score"); } + return false; } diff --git a/main/lp/lp_add.php b/main/lp/lp_add.php index 556f58dfe8..0c03ac60bc 100755 --- a/main/lp/lp_add.php +++ b/main/lp/lp_add.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ /** - * This is a learning path creation and player tool in Chamilo + * This is a learning path creation and player tool in Chamilo. * * @author Patrick Cool * @author Denes Nagy diff --git a/main/lp/lp_report.php b/main/lp/lp_report.php index 78030fa8d4..8751ad6abf 100644 --- a/main/lp/lp_report.php +++ b/main/lp/lp_report.php @@ -381,7 +381,7 @@ $parameters = [ 'group_filter' => $groupFilter, 'cidReq' => $courseCode, 'id_session' => $sessionId, - 'lp_id' => $lpId + 'lp_id' => $lpId, ]; $table = new SortableTableFromArrayConfig($userList, 1, 20, 'lp'); diff --git a/main/ticket/new_ticket.php b/main/ticket/new_ticket.php index 819801b25f..6e69ee7f31 100644 --- a/main/ticket/new_ticket.php +++ b/main/ticket/new_ticket.php @@ -54,7 +54,7 @@ function updateExerciseList(courseId, sessionId) { }, function (exerciseList) { $("