From e698c479f7e8fa530c8c649d5fadbacc2947a8b8 Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 22 May 2018 17:17:08 +0200 Subject: [PATCH] Aggiunte anteprime per filelist_and_upload --- src/HTMLBuilder/Manager/FileManager.php | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/HTMLBuilder/Manager/FileManager.php b/src/HTMLBuilder/Manager/FileManager.php index c171bbbb2..38105a467 100644 --- a/src/HTMLBuilder/Manager/FileManager.php +++ b/src/HTMLBuilder/Manager/FileManager.php @@ -3,10 +3,22 @@ namespace HTMLBuilder\Manager; /** + * Gestione allegati. + * * @since 2.3 */ class FileManager implements ManagerInterface { + + /** + * Gestione "filelist_and_upload". + * Esempio: {( "name": "filelist_and_upload", "id_module": "2", "id_record": "1", "readonly": "false", "ajax": "true" )}. + * + * @param array $options + * + * @return string + */ + public function manage($options) { $options['readonly'] = ($options['readonly']=='true') ? true : false; @@ -54,10 +66,29 @@ $result .= ' '.\Translator::timestampToLocale($r['created_at']).' + '; + + //Anteprime supportate dal browser + // + $extension = end((explode('.', $r['nome']))); + $supported_extensions = ['pdf','jpg','png','gif','jpeg','bmp']; + if ( in_array($extension, $supported_extensions)){ + $result .= " +
+ + alt : ".$r['filename']." + plugin ".$extension." mancante. + +
+ "; + }else{ + $result .= "\n"; + } + if (!$options['readonly']){ $result .= '