Skip to content

Commit

Permalink
Reporting: Add option to hide block of assignments in reporting expor…
Browse files Browse the repository at this point in the history
…t - refs BT#19335
  • Loading branch information
cfasanando committed Nov 15, 2021
1 parent 2bd523e commit 280156c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions main/mySpace/student_follow_export.php
Expand Up @@ -74,9 +74,12 @@ function generateForm(int $studentId, array $coursesInSessions): FormValidator
[],
FormValidator::LAYOUT_BOX
);
// Option to hide the column Time in lp tables
$form->addCheckBox('hide_connection_time', null, get_lang('HideConnectionTime'));
$form->addCheckBox('hide_skills', null, get_lang('HideSkills'));
// Options to hide columns or blocks in export pdf
$hideOptionsExport['connection_time'] = get_lang('HideConnectionTime');
$hideOptionsExport['skills'] = get_lang('HideSkills');
$hideOptionsExport['assignment'] = get_lang('HideAssignment');
$form->addCheckBoxGroup("hide_options", get_lang('OptionsToHideInExport'), $hideOptionsExport);

foreach ($coursesInSessions as $sId => $courses) {
if (empty($courses)) {
continue;
Expand Down Expand Up @@ -460,7 +463,7 @@ function generateHtmlForTasks(int $studentId, array $courseInfo, int $sessionId)
.Export::convert_array_to_html($taskTable);
}

function generateHtmlForCourse(int $studentId, array $coursesInSessions, int $courseId, int $sessionId, bool $hideConnectionTime = false): ?string
function generateHtmlForCourse(int $studentId, array $coursesInSessions, int $courseId, int $sessionId, bool $hideConnectionTime = false, bool $hideAssignment = false): ?string
{
if (empty($coursesInSessions[$sessionId]) || !in_array($courseId, $coursesInSessions[$sessionId])) {
return null;
Expand All @@ -485,7 +488,9 @@ function generateHtmlForCourse(int $studentId, array $coursesInSessions, int $co

$courseHtml[] = generateHtmlForLearningPaths($studentId, $courseInfo, $sessionId, $hideConnectionTime);
$courseHtml[] = generateHtmlForQuizzes($studentId, $courseInfo, $sessionId);
$courseHtml[] = generateHtmlForTasks($studentId, $courseInfo, $sessionId);
if (!$hideAssignment) {
$courseHtml[] = generateHtmlForTasks($studentId, $courseInfo, $sessionId);
}

return implode(PHP_EOL, $courseHtml);
}
Expand All @@ -510,13 +515,14 @@ function generateHtmlForCourse(int $studentId, array $coursesInSessions, int $co
);

$coursesInfo = [];
$hideConnectionTime = isset($values['hide_connection_time']);
$hideSkills = isset($values['hide_skills']);
$hideConnectionTime = isset($values['hide_options']['connection_time']);
$hideSkills = isset($values['hide_options']['skills']);
$hideAssignment = isset($values['hide_options']['assignment']);
if (!empty($values['sc'])) {
foreach ($values['sc'] as $courseKey) {
[$sessionId, $courseId] = explode('_', $courseKey);

$coursesInfo[] = generateHtmlForCourse($studentInfo['id'], $coursesInSessions, $courseId, $sessionId, $hideConnectionTime);
$coursesInfo[] = generateHtmlForCourse($studentInfo['id'], $coursesInSessions, $courseId, $sessionId, $hideConnectionTime, $hideAssignment);
}
}

Expand Down

0 comments on commit 280156c

Please sign in to comment.