Merge pull request #4074 from christianbeeznest/majorel-19309-2

Lp: Add option to display max or average progress in reporting - refs BT#19309
pull/4086/head
Nicolas Ducoulombier 4 years ago committed by GitHub
commit cbdd70c875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      main/course_info/infocours.php
  2. 4
      main/inc/lib/course.lib.php
  3. 17
      main/inc/lib/tracking.lib.php
  4. 2
      main/install/configuration.dist.php
  5. 16
      main/tracking/courseLog.php

@ -710,6 +710,26 @@ if ($allowLPReturnLink === 'true') {
$form->addGroup($group, '', [get_lang('LpReturnLink')]);
}
if (api_get_configuration_value('lp_show_max_progress_or_average_enable_course_level_redefinition')) {
$group = [
$form->createElement(
'radio',
'lp_show_max_or_average_progress',
null,
get_lang('LpMaxProgress'),
'max'
),
$form->createElement(
'radio',
'lp_show_max_or_average_progress',
null,
get_lang('LpAverageProgress'),
'average'
),
];
$form->addGroup($group, '', [get_lang('lpShowMaxProgressOrAverage')]);
}
$exerciseInvisible = api_get_setting('exercise_invisible_in_session');
$configureExerciseVisibility = api_get_setting('configure_exercise_visibility_in_course');

@ -5822,6 +5822,10 @@ class CourseManager
$courseSettings[] = 'portfolio_max_score';
}
if (api_get_configuration_value('lp_show_max_progress_or_average_enable_course_level_redefinition')) {
$courseSettings[] = 'lp_show_max_or_average_progress';
}
if (!empty($pluginCourseSettings)) {
$courseSettings = array_merge(
$courseSettings,

@ -5237,7 +5237,6 @@ class Tracking
if (!empty($session_id)) {
$sessionCondition = " AND s.id = $session_id";
}
$lpShowMaxProgress = api_get_configuration_value('lp_show_max_progress_instead_of_average');
// Get the list of sessions where the user is subscribed as student
if (api_is_multiple_url_enabled()) {
@ -5345,6 +5344,13 @@ class Tracking
foreach ($courses as $course_code => $course_title) {
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
$lpShowMaxProgress = api_get_configuration_value('lp_show_max_progress_instead_of_average');
if (api_get_configuration_value('lp_show_max_progress_or_average_enable_course_level_redefinition')) {
$lpShowProgressCourseSetting = api_get_course_setting('lp_show_max_or_average_progress', $courseInfo, true);
if (in_array($lpShowProgressCourseSetting, ['max', 'average'])) {
$lpShowMaxProgress = ('max' === $lpShowProgressCourseSetting);
}
}
$total_time_login = self::get_time_spent_on_the_course(
$user_id,
@ -8977,6 +8983,14 @@ class TrackingCourseLog
}
}
$lpShowMaxProgress = api_get_configuration_value('lp_show_max_progress_instead_of_average');
if (api_get_configuration_value('lp_show_max_progress_or_average_enable_course_level_redefinition')) {
$lpShowProgressCourseSetting = api_get_course_setting('lp_show_max_or_average_progress', $courseInfo, true);
if (in_array($lpShowProgressCourseSetting, ['max', 'average'])) {
$lpShowMaxProgress = ('max' === $lpShowProgressCourseSetting);
}
}
while ($user = Database::fetch_array($res, 'ASSOC')) {
$userIdList[] = $user['user_id'];
$user['official_code'] = $user['col0'];
@ -9006,7 +9020,6 @@ class TrackingCourseLog
true
);
$lpShowMaxProgress = api_get_configuration_value('lp_show_max_progress_instead_of_average');
$avg_student_progress = Tracking::get_avg_student_progress(
$user['user_id'],
$course_code,

@ -492,6 +492,8 @@ ALTER TABLE sys_announcement ADD COLUMN visible_boss INT DEFAULT 0;
//$_configuration['lp_category_accordion'] = false;
// Show the best progress instead of averages in reporting of learnpaths
// $_configuration['lp_show_max_progress_instead_of_average'] = false;
// Enable redefinition of the setting to show the best progress instead of averages in reporting of learnpaths at a course level.
// $_configuration['lp_show_max_progress_or_average_enable_course_level_redefinition'] = false;
// Show view accordion lp_item_view
// $_configuration['lp_view_accordion'] = false;
// Allow export learning paths to students

@ -30,6 +30,12 @@ $from_myspace = false;
$from = isset($_GET['from']) ? $_GET['from'] : null;
$origin = api_get_origin();
$lpShowMaxProgress = api_get_configuration_value('lp_show_max_progress_instead_of_average');
if (api_get_configuration_value('lp_show_max_progress_or_average_enable_course_level_redefinition')) {
$lpShowProgressCourseSetting = api_get_course_setting('lp_show_max_or_average_progress');
if (in_array($lpShowProgressCourseSetting, ['max', 'average'])) {
$lpShowMaxProgress = ('max' === $lpShowProgressCourseSetting);
}
}
// Starting the output buffering when we are exporting the information.
$export_csv = isset($_GET['export']) && 'csv' === $_GET['export'] ? true : false;
@ -779,10 +785,12 @@ if ($nbStudents > 0) {
}
}
if (isset($defaultExtraFields)) {
foreach ($defaultExtraInfo as $field) {
$table->set_header($counter, $field['display_text'], false);
$headers[$field['variable']] = $field['display_text'];
$counter++;
if (!empty($defaultExtraInfo)) {
foreach ($defaultExtraInfo as $field) {
$table->set_header($counter, $field['display_text'], false);
$headers[$field['variable']] = $field['display_text'];
$counter++;
}
}
}
$table->set_header($counter, get_lang('Details'), false);

Loading…
Cancel
Save