From fe0aaebfeab671316a6f3f99ecee0741e7049759 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Fri, 20 Apr 2018 08:17:58 +0200 Subject: [PATCH] Add setting "allow_lp_chamilo_export" to export LP with course builder BT#10885 --- main/install/configuration.dist.php | 3 +++ main/lp/lp_controller.php | 3 ++- main/lp/lp_list.php | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index b5a0602715..9f3d6fda7c 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -819,6 +819,9 @@ INSERT INTO settings_current(variable, subkey, type, category, selected_value, t //ALTER TABLE c_group_info ADD document_access INT DEFAULT 0 NOT NULL; //$_configuration['group_document_access'] = false; +// Allow LP export to chamilo format (CourseBackup) +//$_configuration['allow_lp_chamilo_export'] = false; + // ------ Custom DB changes (keep this at the end) // Add user activation by confirmation email // This option prevents the new user to login in the platform if your account is not confirmed via email diff --git a/main/lp/lp_controller.php b/main/lp/lp_controller.php index bcef81dadd..90d2cf9469 100755 --- a/main/lp/lp_controller.php +++ b/main/lp/lp_controller.php @@ -860,7 +860,8 @@ switch ($action) { } break; case 'export_to_course_build': - if (api_is_allowed_to_edit()) { + $allowExport = api_get_configuration_value('allow_lp_chamilo_export'); + if (api_is_allowed_to_edit() && $allowExport) { if (!$lp_found) { require 'lp_list.php'; } else { diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index 5eb3706ead..d99f85ce28 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -403,6 +403,7 @@ foreach ($categories as $item) { $actionSeriousGame = null; $actionUpdateScormFile = ''; $actionExportToCourseBuild = ''; + $allowChamiloExport = api_get_configuration_value('allow_lp_chamilo_export'); if ($is_allowed_to_edit) { // EDIT LP @@ -795,14 +796,16 @@ foreach ($categories as $item) { ); } - $actionExportToCourseBuild = Display::url( - Display::return_icon( - 'backup.png', - get_lang('ExportToChamiloFormat') - ), - api_get_self().'?'.api_get_cidreq() - ."&action=export_to_course_build&lp_id=$id" - ); + if ($allowChamiloExport) { + $actionExportToCourseBuild = Display::url( + Display::return_icon( + 'backup.png', + get_lang('ExportToChamiloFormat') + ), + api_get_self().'?'.api_get_cidreq() + ."&action=export_to_course_build&lp_id=$id" + ); + } if ($is_allowed_to_edit) { $start_time = $start_time;