diff --git a/src/HTMLBuilder/Manager/FileManager.php b/src/HTMLBuilder/Manager/FileManager.php index 03adda5ad..018113fba 100644 --- a/src/HTMLBuilder/Manager/FileManager.php +++ b/src/HTMLBuilder/Manager/FileManager.php @@ -58,7 +58,10 @@ class FileManager implements ManagerInterface foreach ($categories as $category) { $category = $category['category']; - $result .= ' + $rs = $dbo->fetchArray('SELECT * FROM `zz_files` WHERE `category`'.(!empty($category) ? '= '.prepare($category) : 'IS NULL').' AND `id_record` = '.prepare($options['id_record']).' AND '.$where); + + if (!empty($rs)) { + $result .= '

'.(!empty($category) ? $category : tr('Generale')).'

@@ -76,10 +79,8 @@ class FileManager implements ManagerInterface '.tr('Opzioni').' '; - $rs = $dbo->fetchArray('SELECT * FROM `zz_files` WHERE `category`'.(!empty($category) ? '= '.prepare($category) : 'IS NULL').' AND `id_record` = '.prepare($options['id_record']).' AND '.$where); - - foreach ($rs as $r) { - $result .= ' + foreach ($rs as $r) { + $result .= ' @@ -92,56 +93,57 @@ class FileManager implements ManagerInterface '; - // Anteprime supportate dal browser - $extension = pathinfo($r['original'])['extension']; - $supported_extensions = ['pdf', 'jpg', 'png', 'gif', 'jpeg', 'bmp']; - if (in_array($extension, $supported_extensions)) { - $result .= " + // Anteprime supportate dal browser + $extension = pathinfo($r['original'])['extension']; + $supported_extensions = ['pdf', 'jpg', 'png', 'gif', 'jpeg', 'bmp']; + if (in_array($extension, $supported_extensions)) { + $result .= "
"; - if ($extension == 'pdf') { - $result .= ' + if ($extension == 'pdf') { + $result .= ' '; - } else { - $result .= ' + } else { + $result .= ' '; - } + } - $result .= ' + $result .= '
'; - $result .= ' + $result .= ' '; - } else { - $result .= ' + } else { + $result .= ' '; - } + } - if (!$options['readonly']) { - $result .= ' + if (!$options['readonly']) { + $result .= ' '; - } + } - $result .= ' + $result .= ' '; - ++$count; - } + ++$count; + } - $result .= ' + $result .= '

'; + } } // Form per l'upload di un nuovo file