Skip to content

Commit 0c18776

Browse files
committed
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
1 parent 7cf2c49 commit 0c18776

File tree

3 files changed

+35
-23
lines changed

3 files changed

+35
-23
lines changed

main/document/document.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -1785,10 +1785,12 @@ function convertModal (id, format) {
17851785
.'&id='.$current_folder_id.'&certificate=true'
17861786
);
17871787
} else {
1788-
$actionsLeft .= Display::url(
1789-
Display::return_icon('upload_file.png', get_lang('UplUploadDocument'), '', ICON_SIZE_MEDIUM),
1790-
api_get_path(WEB_CODE_PATH).'document/upload.php?'.api_get_cidreq().'&id='.$current_folder_id
1791-
);
1788+
if (!(api_get_configuration_value('session_hide_document_upload') === true && (isset($sessionId) && $sessionId != 0))) {
1789+
$actionsLeft .= Display::url(
1790+
Display::return_icon('upload_file.png', get_lang('UplUploadDocument'), '', ICON_SIZE_MEDIUM),
1791+
api_get_path(WEB_CODE_PATH).'document/upload.php?'.api_get_cidreq().'&id='.$current_folder_id
1792+
);
1793+
}
17921794
}
17931795

17941796
// Create directory

main/install/configuration.dist.php

+7
Original file line numberDiff line numberDiff line change
@@ -2565,6 +2565,13 @@
25652565
// 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.
25662566
//$_configuration['tracking_default_course_extra_time_on_logout'] = 600;
25672567

2568+
// Set to true to hide lp creation icon on lp list if in a session
2569+
//$_configuration['session_hide_lp_creation'] = false;
2570+
// Set to true to hide lp copy icon on lp list if in a session
2571+
//$_configuration['session_hide_lp_copy'] = false;
2572+
// Set to true to hide document upload icon on document list if in a session
2573+
//$_configuration['session_hide_document_upload'] = false;
2574+
25682575
// Define a special path token for the Common Cartridge export content.
25692576
// Due to changes in naming by the responsible organization, the Chamilo default
25702577
// is '$1EdTech-CC-FILEBASE$' (the latest), but previous versions of the standard

main/lp/lp_list.php

+22-19
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,26 @@ function confirmation(name) {
8080

8181
if ($is_allowed_to_edit) {
8282
$actionLeft = '';
83-
$actionLeft .= Display::url(
84-
Display::return_icon(
85-
'new_learnpath.png',
86-
get_lang('LearnpathAddLearnpath'),
87-
'',
88-
ICON_SIZE_MEDIUM
89-
),
90-
api_get_self().'?'.api_get_cidreq().'&action=add_lp'
91-
);
92-
$actionLeft .= Display::url(
93-
Display::return_icon(
94-
'import_scorm.png',
95-
get_lang('UploadScorm'),
96-
'',
97-
ICON_SIZE_MEDIUM
98-
),
99-
'../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH
100-
);
83+
if (!(api_get_configuration_value('session_hide_lp_creation') === true && (isset($sessionId) && $sessionId != 0))) {
84+
$actionLeft .= Display::url(
85+
Display::return_icon(
86+
'new_learnpath.png',
87+
get_lang('LearnpathAddLearnpath'),
88+
'',
89+
ICON_SIZE_MEDIUM
90+
),
91+
api_get_self().'?'.api_get_cidreq().'&action=add_lp'
92+
);
93+
$actionLeft .= Display::url(
94+
Display::return_icon(
95+
'import_scorm.png',
96+
get_lang('UploadScorm'),
97+
'',
98+
ICON_SIZE_MEDIUM
99+
),
100+
'../upload/index.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH
101+
);
102+
}
101103

102104
if (api_get_setting('service_ppt2lp', 'active') === 'true') {
103105
$actionLeft .= Display::url(
@@ -200,6 +202,7 @@ function confirmation(name) {
200202
$hideScormExportLink = api_get_setting('hide_scorm_export_link');
201203
$hideScormCopyLink = api_get_setting('hide_scorm_copy_link');
202204
$hideScormPdfLink = api_get_setting('hide_scorm_pdf_link');
205+
$hideLpCopyInSession = (api_get_configuration_value('session_hide_lp_copy') === true && (isset($sessionId) && $sessionId != 0));
203206
$options = learnpath::getIconSelect();
204207
$cidReq = api_get_cidreq();
205208

@@ -925,7 +928,7 @@ function confirmation(name) {
925928
$dsp_disk = null;
926929
}
927930

928-
if ($hideScormCopyLink === 'true') {
931+
if ($hideScormCopyLink === 'true' || $hideLpCopyInSession) {
929932
$copy = null;
930933
}
931934

0 commit comments

Comments
 (0)