From c577fe041042abfe3203edb1700b0ff0877d776e Mon Sep 17 00:00:00 2001
From: Cristiano Magro <cristiano.magro@vola.it>
Date: Fri, 15 May 2026 15:33:05 +0200
Subject: [PATCH] add MgrFiles
---
src/Vola/UploadFile/FilterExt.class.php | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/src/Vola/UploadFile/FilterExt.class.php b/src/Vola/UploadFile/FilterExt.class.php
index a557613..6a379e2 100644
--- a/src/Vola/UploadFile/FilterExt.class.php
+++ b/src/Vola/UploadFile/FilterExt.class.php
@@ -1,27 +1,60 @@
<?php
/**
+ * Costruzione di un filtro
* User: Cristiano Magro
* Date: 09/07/2019
*/
-class FilterExt {
-
-
+class FilterExt
+{
private $titolo;
private $extensions;
- public function __construct($titolo = null, $ext = null )
+ public function __construct($titolo = null, $ext = null)
{
$this->titolo = $titolo;
$this->extensions[$ext] = $ext;
}
+ /**
+ * Costruisco la struttura json del filtro.
+ * La lista viene collassata in una stringa
+ * @return string struttura json del filtro
+ */
public function getFilter()
{
$new = new stdClass();
- $new->titolo = $this->titolo;
+ $new->title = $this->titolo;
+
+ //riordino le chiavi
+ sort($this->extensions);
+
$new->extensions = implode(',', $this->extensions);
return json_encode($new);
}
+
+ /**
+ * Aggiungo alla lista una estensione.
+ * @param string $newExt
+ * @return FilterExt
+ */
+ public function addExt($newExt)
+ {
+ $this->extensions[$newExt] = $newExt;
+ return $this;
+ }
+
+ /**
+ * @return string Titolo del filtro
+ */
+ public function getTitolo()
+ {
+ return $this->titolo;
+ }
+
+ public function getFilterObj()
+ {
+ return json_decode($this->getFilter());
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0