Skip to content

Commit 1957a39

Browse files
committed
Session : #add option to limit number of letter to show for extra field value, define specific value for course field #change date format and show learner variable for each student line in Excel export - refs BT#22775
1 parent a037586 commit 1957a39

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

main/inc/lib/sessionmanager.lib.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10047,9 +10047,9 @@ public static function exportCourseSessionReport(int $sessionId, string $courseC
1004710047
}
1004810048

1004910049
// 2. SESSION DATA
10050-
$row2 = [$courseInfo['title']];
10051-
$row2[] = $sessionInfo['access_start_date'];
10052-
$row2[] = $sessionInfo['access_end_date'];
10050+
$row2 = $config['course_field_value'] ? [$config['course_field_value']] : [$courseInfo['title']];
10051+
$row2[] = (new DateTime($sessionInfo['access_start_date']))->format('d/m/Y');
10052+
$row2[] = (new DateTime($sessionInfo['access_end_date']))->format('d/m/T');
1005310053

1005410054
$extraValuesObj = new ExtraFieldValue('session');
1005510055
$sessionExtra = $extraValuesObj->getAllValuesByItem($sessionId);
@@ -10058,6 +10058,9 @@ public static function exportCourseSessionReport(int $sessionId, string $courseC
1005810058
foreach ($sessionFields as $entry) {
1005910059
if (!empty($entry['field'])) {
1006010060
$value = $sessionExtraMap[$entry['field']] ?? '';
10061+
if (!empty($entry['numberOfLetter']) && $entry['numberOfLetter'] > 0) {
10062+
$value = mb_substr($value, 0, $entry['numberOfLetter']);
10063+
}
1006110064
} else {
1006210065
$value = '';
1006310066
}
@@ -10104,7 +10107,7 @@ public static function exportCourseSessionReport(int $sessionId, string $courseC
1010410107
$userInfo = api_get_user_info($userId);
1010510108

1010610109
$row = [];
10107-
$row[] = $rowIndex === 0 ? get_lang('Learners') : '';
10110+
$row[] = get_lang('Learners');
1010810111

1010910112
$userExtraObj = new ExtraFieldValue('user');
1011010113
$userExtra = $userExtraObj->getAllValuesByItem($userId);

main/install/configuration.dist.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2668,10 +2668,12 @@
26682668
'session_end_date_header' => 'Fecha Fin',
26692669
'user_firstname_header' => 'Nombre',
26702670
'user_lastname_header' => 'Apellido 1',
2671+
'course_field_value' => 'CURSO',
26712672
'session_fields' => [
26722673
'0' => [
26732674
'header' => '1st session header',
2674-
'field' => 'modalidad'
2675+
'field' => 'modalidad',
2676+
'numberOfLetter' => 3
26752677
],
26762678
'1' => [
26772679
'header' => 'Sesion header without value',

0 commit comments

Comments
 (0)