Skip to content

Commit c479248

Browse files
committed
Add setting course_log_hide_columns default columns to hide see BT#9609
1 parent aced0a6 commit c479248

File tree

2 files changed

+51
-39
lines changed

2 files changed

+51
-39
lines changed

main/install/configuration.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,5 @@
293293
//$_configuration['prevent_session_admins_to_manage_all_users'] = false;
294294
// Show delete option in attendance
295295
//$_configuration['allow_delete_attendance'] = false;
296+
// Course log - Default columns to hide
297+
//$_configuration['course_log_hide_columns'] = array(1, 9);

main/tracking/courseLog.php

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100
}
101101
ob_start();
102102
}
103+
$columnsToHideFromSetting = api_get_configuration_value('course_log_hide_columns');
104+
$columnsToHide = empty($columnsToHideFromSetting) ? array(1, 9, 10, 11, 12) : $columnsToHideFromSetting;
105+
$columnsToHide = json_encode($columnsToHide);
103106

104107
$csv_content = array();
105108
// Scripts for reporting array hide/show columns
@@ -130,14 +133,14 @@ function(index) {
130133
131134
// hide some column at startup
132135
// be sure that these columns always exists
133-
// see tab_table_header = array(); // tab of header texts
136+
// see headers = array();
137+
// tab of header texts
134138
$(document).ready( function() {
135139
init_hide();
136-
foldup(1);
137-
foldup(9);
138-
foldup(10);
139-
foldup(11);
140-
foldup(12);
140+
var columnsToHide = ".$columnsToHide.";
141+
columnsToHide.forEach(function(id) {
142+
foldup(id);
143+
});
141144
})
142145
</script>";
143146

@@ -184,9 +187,6 @@ function(index) {
184187
$view = isset($_REQUEST['view']) ? $_REQUEST['view'] : '';
185188
$nameTools = get_lang('Tracking');
186189

187-
// Display the header.
188-
Display::display_header($nameTools, 'Tracking');
189-
190190
// getting all the students of the course
191191
if (empty($session_id)) {
192192
// Registered students in a course outside session.
@@ -224,6 +224,9 @@ function(index) {
224224
);
225225
}
226226

227+
// Display the header.
228+
Display::display_header($nameTools, 'Tracking');
229+
227230
/* MAIN CODE */
228231

229232
echo '<div class="actions">';
@@ -366,7 +369,8 @@ function(index) {
366369
$el = $form->addElement(
367370
'select',
368371
'since',
369-
'<img width="ICON_SIZE_SMALL" align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" border="0" />'.get_lang('RemindInactivesLearnersSince'),
372+
'<img align="middle" src="'.api_get_path(WEB_IMG_PATH).'messagebox_warning.gif" border="0" />'.
373+
get_lang('RemindInactivesLearnersSince'),
370374
$options
371375
);
372376
$el->setSelected(7);
@@ -404,78 +408,84 @@ function(index) {
404408
$parameters['from'] = isset($_GET['myspace']) ? Security::remove_XSS($_GET['myspace']) : null;
405409

406410
$table->set_additional_parameters($parameters);
407-
$tab_table_header = array();
411+
$headers = array();
408412
// tab of header texts
409413
$table->set_header(0, get_lang('OfficialCode'), true);
410-
$tab_table_header[] = get_lang('OfficialCode');
414+
$headers['official_code'] = get_lang('OfficialCode');
411415
if ($is_western_name_order) {
412416
$table->set_header(1, get_lang('FirstName'), true);
413-
$tab_table_header[] = get_lang('FirstName');
417+
$headers['firstname'] = get_lang('FirstName');
414418
$table->set_header(2, get_lang('LastName'), true);
415-
$tab_table_header[] = get_lang('LastName');
419+
$headers['lastname'] = get_lang('LastName');
416420
} else {
417421
$table->set_header(1, get_lang('LastName'), true);
418-
$tab_table_header[] = get_lang('LastName');
422+
$headers['lastname'] = get_lang('LastName');
419423
$table->set_header(2, get_lang('FirstName'), true);
420-
$tab_table_header[] = get_lang('FirstName');
424+
$headers['firstname'] = get_lang('FirstName');
421425
}
422426
$table->set_header(3, get_lang('Login'), false);
423-
$tab_table_header[] = get_lang('Login');
427+
$headers['login'] = get_lang('Login');
424428

425429
$table->set_header(4, get_lang('TrainingTime').'&nbsp;'.Display::return_icon('info3.gif', get_lang('TrainingTimeInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
426-
$tab_table_header[] = get_lang('TrainingTime');
430+
$headers['training_time'] = get_lang('TrainingTime');
427431
$table->set_header(5, get_lang('CourseProgress').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
428-
$tab_table_header[] = get_lang('CourseProgress');
432+
$headers['course_progress'] = get_lang('CourseProgress');
429433

430434
$table->set_header(6, get_lang('ExerciseProgress').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ExerciseProgressInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
431-
$tab_table_header[] = get_lang('ExerciseProgress');
435+
$headers['exercise_progress'] = get_lang('ExerciseProgress');
432436
$table->set_header(7, get_lang('ExerciseAverage').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ExerciseAverageInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
433-
$tab_table_header[] = get_lang('ExerciseAverage');
437+
$headers['exercise_average'] = get_lang('ExerciseAverage');
434438
$table->set_header(8, get_lang('Score').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
435-
$tab_table_header[] = get_lang('Score');
439+
$headers['score'] = get_lang('Score');
436440
$table->set_header(9, get_lang('Student_publication'), false);
437-
$tab_table_header[] = get_lang('Student_publication');
441+
$headers['student_publication'] = get_lang('Student_publication');
438442
$table->set_header(10, get_lang('Messages'), false);
439-
$tab_table_header[] = get_lang('Messages');
443+
$headers['messages'] = get_lang('Messages');
440444

441445
if (empty($session_id)) {
442446
$table->set_header(11, get_lang('Survey'), false);
443-
$tab_table_header[] = get_lang('Survey');
447+
$headers['survey'] = get_lang('Survey');
444448
$table->set_header(12, get_lang('FirstLogin'), false);
445-
$tab_table_header[] = get_lang('FirstLogin');
449+
$headers['first_login'] = get_lang('FirstLogin');
446450
$table->set_header(13, get_lang('LatestLogin'), false);
447-
$tab_table_header[] = get_lang('LatestLogin');
451+
$headers['latest_login'] = get_lang('LatestLogin');
448452
if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) {
449453
$table->set_header(14, $extra_info['field_display_text'], false);
450-
$tab_table_header[] = $extra_info['field_display_text'];
454+
$headers['field_display_text'] = $extra_info['field_display_text'];
451455
$table->set_header(15, get_lang('Details'), false);
452-
$tab_table_header[] = get_lang('Details');
456+
$headers['details'] = get_lang('Details');
453457
} else {
454458
$table->set_header(14, get_lang('Details'), false);
455-
$tab_table_header[] = get_lang('Details');
459+
$headers['details'] = get_lang('Details');
456460
}
457-
458461
} else {
459462
$table->set_header(11, get_lang('FirstLogin'), false);
460-
$tab_table_header[] = get_lang('FirstLogin');
463+
$headers['first_login'] = get_lang('FirstLogin');
461464
$table->set_header(12, get_lang('LatestLogin'), false);
462-
$tab_table_header[] = get_lang('LatestLogin');
465+
$headers['latest_login'] = get_lang('LatestLogin');
463466

464467
if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) {
465468
$table->set_header(13, $extra_info['field_display_text'], false);
466-
$tab_table_header[] = $extra_info['field_display_text'];
469+
$headers['field_display_text'] = $extra_info['field_display_text'];
467470
$table->set_header(14, get_lang('Details'), false);
468-
$tab_table_header[] = get_lang('Details');
471+
$headers['Details'] = get_lang('Details');
469472
} else {
470473
$table->set_header(13, get_lang('Details'), false);
471-
$tab_table_header[] = get_lang('Details');
474+
$headers['Details'] = get_lang('Details');
472475
}
473476
}
474477
// display buttons to un hide hidden columns
475478
echo "<br/><br/><div id='unhideButtons'>";
476-
for ($i=0; $i < count($tab_table_header); $i++) {
477-
$index = $i + 1;
478-
echo "<span title='".get_lang('DisplayColumn')." ".$tab_table_header[$i]."' class='unhide_button hide' onclick='foldup($index)'>".Display :: return_icon('move.png', get_lang('DisplayColumn'), array('align'=>'absmiddle', 'hspace'=>'3px'), 16)." ".$tab_table_header[$i]."</span>";
479+
$index = 0;
480+
foreach ($headers as $header) {
481+
echo "<span title='".get_lang('DisplayColumn')." ".$header."' class='unhide_button hide' onclick='foldup($index)'>".
482+
Display :: return_icon(
483+
'move.png',
484+
get_lang('DisplayColumn'),
485+
array('align'=>'absmiddle', 'hspace'=>'3px'),
486+
16
487+
)." ".$header."</span>";
488+
$index++;
479489
}
480490
echo "</div>";
481491
// Display the table

0 commit comments

Comments
 (0)