|
|
|
@ -5328,6 +5328,15 @@ class DocumentManager |
|
|
|
|
$document_data['file_extension'] = $extension; |
|
|
|
|
|
|
|
|
|
if (!$show_as_icon) { |
|
|
|
|
// to force download if a document can be downloaded or not |
|
|
|
|
$hideDownloadIcon = false; |
|
|
|
|
if (true === api_get_configuration_value('documents_hide_download_icon')) { |
|
|
|
|
$hideDownloadIcon = true; |
|
|
|
|
} |
|
|
|
|
if (self::getHideDownloadIcon($document_data['id'])) { |
|
|
|
|
$hideDownloadIcon = false; |
|
|
|
|
} |
|
|
|
|
if (!$hideDownloadIcon) { |
|
|
|
|
if ($filetype == 'folder') { |
|
|
|
|
if ($isAllowedToEdit || |
|
|
|
|
api_is_platform_admin() || |
|
|
|
@ -5354,6 +5363,7 @@ class DocumentManager |
|
|
|
|
$force_download_html = $size == 0 ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.' download="'.$document_data['basename'].'">'. |
|
|
|
|
Display::return_icon($forcedownload_icon, get_lang('Download'), [], ICON_SIZE_SMALL).'</a>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Copy files to user's myfiles |
|
|
|
|
if (api_get_setting('allow_my_files') === 'true' && |
|
|
|
@ -7461,4 +7471,23 @@ class DocumentManager |
|
|
|
|
|
|
|
|
|
return $btn; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* It gest extra value to define if download icon is visible or not. |
|
|
|
|
* |
|
|
|
|
* @param $documentId |
|
|
|
|
* |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public static function getHideDownloadIcon($documentId) |
|
|
|
|
{ |
|
|
|
|
$extraFieldValue = new ExtraFieldValue('document'); |
|
|
|
|
$extraValue = $extraFieldValue->get_values_by_handler_and_field_variable($documentId, 'can_be_downloaded'); |
|
|
|
|
$canBeDownloadedIcon = false; |
|
|
|
|
if (!empty($extraValue) && isset($extraValue['value'])) { |
|
|
|
|
$canBeDownloadedIcon = (bool) $extraValue['value']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $canBeDownloadedIcon; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|