Skip to content

Commit 73ae4cf

Browse files
committed
Add new options "hide gradebook graph" and "pdf report button" BT#14385
// Hide gradebook graph // $_configuration['gradebook_hide_graph'] = false; // Hide gradebook "download report in PDF" button // $_configuration['gradebook_hide_pdf_report_button'] = false;
1 parent ce1d208 commit 73ae4cf

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

main/gradebook/index.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,11 @@ function confirmation() {
401401
}
402402
break;
403403
case 'export_table':
404+
$hidePdfReport = api_get_configuration_value('gradebook_hide_pdf_report_button');
405+
if ($hidePdfReport) {
406+
api_not_allowed(true);
407+
}
408+
404409
//table will be export below
405410
ob_start();
406411
break;
@@ -754,11 +759,14 @@ function confirmation() {
754759
}
755760

756761
if (!api_is_allowed_to_edit(null, true)) {
757-
$actionsLeft .= Display::url(
758-
Display::returnFontAwesomeIcon('file-pdf-o').get_lang('DownloadReportPdf'),
759-
api_get_self().'?action=export_table',
760-
['class' => 'btn btn-default']
761-
);
762+
$allowButton = api_get_configuration_value('gradebook_hide_pdf_report_button') === false;
763+
if ($allowButton) {
764+
$actionsLeft .= Display::url(
765+
Display::returnFontAwesomeIcon('file-pdf-o').get_lang('DownloadReportPdf'),
766+
api_get_self().'?action=export_table&'.api_get_cidreq(),
767+
['class' => 'btn btn-default']
768+
);
769+
}
762770
}
763771

764772
if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)) {
@@ -965,7 +973,12 @@ function confirmation() {
965973
}
966974

967975
$table = $gradebookTable->return_table();
968-
$graph = $gradebookTable->getGraph();
976+
977+
$allowGraph = api_get_configuration_value('gradebook_hide_graph') === false;
978+
$graph = '';
979+
if ($allowGraph) {
980+
$graph = $gradebookTable->getGraph();
981+
}
969982

970983
if ($action == 'export_table') {
971984
ob_clean();

main/install/configuration.dist.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,12 @@
852852
// Hide announcement "sent to" label
853853
// $_configuration['hide_announcement_sent_to_users_info'] = false;
854854

855+
// Hide gradebook graph
856+
// $_configuration['gradebook_hide_graph'] = false;
857+
858+
// Hide gradebook "download report in PDF" button
859+
// $_configuration['gradebook_hide_pdf_report_button'] = false;
860+
855861
// ------ Custom DB changes (keep this at the end)
856862
// Add user activation by confirmation email
857863
// This option prevents the new user to login in the platform if your account is not confirmed via email

0 commit comments

Comments
 (0)