Gradebook: Add gradebook_display_extra_stats config setting - refs BT#20250

[1] = Ranking
[2] = Best Score
[3] = Average

Enable specific columns in gradebook table.

It deprecates the gradebook_enable_best_score config setting
pull/4586/head
Angel Fernando Quiroz Campos 3 years ago
parent 142514c95a
commit 354f083045
  1. 11
      main/gradebook/gradebook_display_summary.php
  2. 19
      main/gradebook/index.php
  3. 9
      main/gradebook/lib/GradebookUtils.php
  4. 18
      main/gradebook/lib/fe/gradebooktable.class.php
  5. 8
      main/install/configuration.dist.php

@ -27,15 +27,6 @@ $userList = CourseManager::get_user_list_from_course_code(
$statusToFilter
);
$loadStats = [];
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
$loadStats = [1, 2, 3];
} else {
if (api_get_configuration_value('gradebook_enable_best_score') !== false) {
$loadStats = [2];
}
}
/*Session::write('use_gradebook_cache', false);
$useCache = api_get_configuration_value('gradebook_use_apcu_cache');
$cacheAvailable = api_get_configuration_value('apc') && $useCache;
@ -70,6 +61,8 @@ switch ($action) {
api_get_session_id()
);
$loadStats = GradebookTable::getExtraStatsColumnsToDisplay();
$gradebooktable = new GradebookTable(
$cat,
$allcat,

@ -945,7 +945,7 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
$allcat = [];
$model = ExerciseLib::getCourseScoreModel();
$allowGraph = api_get_configuration_value('gradebook_hide_graph') === false;
$isAllow = api_is_allowed_to_edit(null, true);
$isAllowed = api_is_allowed_to_edit(null, true);
$settings = api_get_configuration_value('gradebook_pdf_export_settings');
$showFeedBack = true;
if (isset($settings['hide_feedback_textarea']) && $settings['hide_feedback_textarea']) {
@ -977,7 +977,7 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
$certificate
);
if ($isAllow && api_get_setting('gradebook_enable_grade_model') === 'true') {
if ($isAllowed && api_get_setting('gradebook_enable_grade_model') === 'true') {
// Showing the grading system
if (!empty($grade_models[$grade_model_id])) {
echo Display::return_message(
@ -991,16 +991,7 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
$exportToPdf = true;
}
$loadStats = [];
if (!$isAllow) {
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
$loadStats = [1, 2, 3];
} else {
if (api_get_configuration_value('gradebook_enable_best_score') !== false) {
$loadStats = [2];
}
}
}
$loadStats = $isAllowed ? [] : GradebookTable::getExtraStatsColumnsToDisplay();
$gradebookTable = new GradebookTable(
$cat,
@ -1015,14 +1006,14 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
$loadStats
);
if ($isAllow) {
if ($isAllowed) {
$gradebookTable->td_attributes = [
4 => 'class="text-center"',
];
}
$table = '';
if ($isAllow) {
if ($isAllowed) {
$table = $gradebookTable->return_table();
} else {
if ($allowTable) {

@ -1575,14 +1575,7 @@ class GradebookUtils
$alleval = $cats[0]->get_evaluations($userId);
$alllink = $cats[0]->get_links($userId);
$loadStats = [];
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
$loadStats = [1, 2, 3];
} else {
if (api_get_configuration_value('gradebook_enable_best_score') !== false) {
$loadStats = [2];
}
}
$loadStats = GradebookTable::getExtraStatsColumnsToDisplay();
$gradebooktable = new GradebookTable(
$cat,

@ -28,9 +28,9 @@ class GradebookTable extends SortableTable
/**
* @var array Indicates which columns should be shown in gradebook
*
* @example [1] For add Ranking column
* [2] For add Best Score column
* [3] For add Average column
* @example [1] To add Ranking column
* [2] To add Best Score column
* [3] To add Average column
*/
private $loadStats = [];
@ -1154,6 +1154,18 @@ class GradebookTable extends SortableTable
return '';
}
public static function getExtraStatsColumnsToDisplay(): array
{
if (api_get_configuration_value('gradebook_enable_best_score') === true) {
return [2];
}
$gradebookDisplayExtraStats = api_get_configuration_value('gradebook_display_extra_stats');
/** @see GradebookTable::$loadStats */
return $gradebookDisplayExtraStats['columns'] ?? [1, 2, 3];
}
/**
* @return array
*/

@ -1088,8 +1088,16 @@ ALTER TABLE portfolio_rel_tag ADD CONSTRAINT FK_DB734472613FECDF FOREIGN KEY (se
// - launch composer install to rebuild the autoload.php
//$_configuration['allow_portfolio_tool'] = false;
// DEPRECATED: gradebook_enable_best_score is deprecated. Use gradebook_display_extra_stats instead.
// Enable best score column in gradebook. Previously called disable_gradebook_stats
//$_configuration['gradebook_enable_best_score'] = false;
/*
Enable specific columns in gradebook table.
[1] = Ranking
[2] = Best Score
[3] = Average
*/
//$_configuration['gradebook_display_extra_stats'] = ['columns' => [1, 2, 3]];
// Allow teachers to access student skills BT#14161 (skills setting must be enabled in the platform)
//$_configuration['allow_teacher_access_student_skills'] = false;

Loading…
Cancel
Save