From 0c18776fa8ea64d0e3ed98d470d51606dd770b61 Mon Sep 17 00:00:00 2001 From: NicoDucou Date: Fri, 4 Oct 2024 12:52:55 +0200 Subject: [PATCH] Session: Learnpath: Document: add 3 options to limit edition and modification of content in session context session_hide_lp_copy session_hide_lp_creation session_hide_document_upload - refs BT#21982 --- main/document/document.php | 10 ++++--- main/install/configuration.dist.php | 7 +++++ main/lp/lp_list.php | 41 ++++++++++++++++------------- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/main/document/document.php b/main/document/document.php index 1191720b8ba..b83f2b1e4fb 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -1785,10 +1785,12 @@ function convertModal (id, format) { .'&id='.$current_folder_id.'&certificate=true' ); } else { - $actionsLeft .= Display::url( - Display::return_icon('upload_file.png', get_lang('UplUploadDocument'), '', ICON_SIZE_MEDIUM), - api_get_path(WEB_CODE_PATH).'document/upload.php?'.api_get_cidreq().'&id='.$current_folder_id - ); + if (!(api_get_configuration_value('session_hide_document_upload') === true && (isset($sessionId) && $sessionId != 0))) { + $actionsLeft .= Display::url( + Display::return_icon('upload_file.png', get_lang('UplUploadDocument'), '', ICON_SIZE_MEDIUM), + api_get_path(WEB_CODE_PATH).'document/upload.php?'.api_get_cidreq().'&id='.$current_folder_id + ); + } } // Create directory diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 767d99f1687..a2dd68ef016 100644 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -2565,6 +2565,13 @@ // Define the default time in seconds to be registered if the user does logout from a course and there is no recent entry in track_e_course_access. //$_configuration['tracking_default_course_extra_time_on_logout'] = 600; +// Set to true to hide lp creation icon on lp list if in a session +//$_configuration['session_hide_lp_creation'] = false; +// Set to true to hide lp copy icon on lp list if in a session +//$_configuration['session_hide_lp_copy'] = false; +// Set to true to hide document upload icon on document list if in a session +//$_configuration['session_hide_document_upload'] = false; + // Define a special path token for the Common Cartridge export content. // Due to changes in naming by the responsible organization, the Chamilo default // is '$1EdTech-CC-FILEBASE$' (the latest), but previous versions of the standard diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index 91288068103..68fec8d6dea 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -80,24 +80,26 @@ function confirmation(name) { if ($is_allowed_to_edit) { $actionLeft = ''; - $actionLeft .= Display::url( - Display::return_icon( - 'new_learnpath.png', - get_lang('LearnpathAddLearnpath'), - '', - ICON_SIZE_MEDIUM - ), - api_get_self().'?'.api_get_cidreq().'&action=add_lp' - ); - $actionLeft .= Display::url( - Display::return_icon( - 'import_scorm.png', - get_lang('UploadScorm'), - '', - ICON_SIZE_MEDIUM - ), - '../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH - ); + if (!(api_get_configuration_value('session_hide_lp_creation') === true && (isset($sessionId) && $sessionId != 0))) { + $actionLeft .= Display::url( + Display::return_icon( + 'new_learnpath.png', + get_lang('LearnpathAddLearnpath'), + '', + ICON_SIZE_MEDIUM + ), + api_get_self().'?'.api_get_cidreq().'&action=add_lp' + ); + $actionLeft .= Display::url( + Display::return_icon( + 'import_scorm.png', + get_lang('UploadScorm'), + '', + ICON_SIZE_MEDIUM + ), + '../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH + ); + } if (api_get_setting('service_ppt2lp', 'active') === 'true') { $actionLeft .= Display::url( @@ -200,6 +202,7 @@ function confirmation(name) { $hideScormExportLink = api_get_setting('hide_scorm_export_link'); $hideScormCopyLink = api_get_setting('hide_scorm_copy_link'); $hideScormPdfLink = api_get_setting('hide_scorm_pdf_link'); +$hideLpCopyInSession = (api_get_configuration_value('session_hide_lp_copy') === true && (isset($sessionId) && $sessionId != 0)); $options = learnpath::getIconSelect(); $cidReq = api_get_cidreq(); @@ -925,7 +928,7 @@ function confirmation(name) { $dsp_disk = null; } - if ($hideScormCopyLink === 'true') { + if ($hideScormCopyLink === 'true' || $hideLpCopyInSession) { $copy = null; }