From 39e27d5082a2450760cad38ccafba9c544538d6a Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Wed, 22 Mar 2023 17:46:08 +0100 Subject: [PATCH] path select WIP --- core/module/user/user.php | 42 ++++- core/module/user/view/groupEdit/groupEdit.php | 178 +++++++++--------- 2 files changed, 130 insertions(+), 90 deletions(-) diff --git a/core/module/user/user.php b/core/module/user/user.php index 7c223485..5bc491ed 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -56,6 +56,10 @@ class user extends common public static $languagesInstalled = []; + public static $sharePath = [ + '/site/file/source/' + ]; + /** * Ajout */ @@ -488,12 +492,15 @@ class user extends common ]); // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . 'user/group', + 'redirect' => helper::baseUrl() . 'user/group', 'notification' => helper::translate('Modifications enregistrées'), 'state' => true ]); } + self::$sharePath = $this->getSubdirectories('./site/file/source'); + self::$sharePath = array_flip(self::$sharePath); + // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Editer groupe'), @@ -618,7 +625,7 @@ class user extends common } // Cas 3 le délai de bloquage court if ($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time()) { - $notification = sprintf(helper::translate('Accès bloqué %d minutes', ($this->getData(['config', 'connect', 'timeout']) / 60))); + $notification = sprintf(helper::translate('Accès bloqué %d minutes'), ($this->getData(['config', 'connect', 'timeout']) / 60)); } // Valeurs en sortie @@ -878,4 +885,35 @@ class user extends common exit(); } + /** + * Liste les dossier contenus dans RFM + */ + function getSubdirectories($dir, $basePath = '') { + $subdirs = array(); + // Ouvrez le répertoire spécifié + $dh = opendir($dir); + // Parcourez tous les fichiers et répertoires dans le répertoire + while (($file = readdir($dh)) !== false) { + // Ignorer les entrées de répertoire parent et actuel + if ($file == '.' || $file == '..') { + continue; + } + // Construisez le chemin complet du fichier ou du répertoire + $path = $dir . '/' . $file; + // Vérifiez si c'est un répertoire + if (is_dir($path)) { + // Construisez la clé et la valeur pour le tableau associatif + $key = $basePath . '/' . $file; + $value = $path . '/'; + // Ajouter la clé et la valeur au tableau associatif + $subdirs[$key] = $value; + // Appeler la fonction récursivement pour ajouter les sous-répertoires + $subdirs = array_merge($subdirs, $this->getSubdirectories($path, $key)); + } + } + // Fermez le gestionnaire de dossier + closedir($dh); + return $subdirs; + } + } \ No newline at end of file diff --git a/core/module/user/view/groupEdit/groupEdit.php b/core/module/user/view/groupEdit/groupEdit.php index e55d450a..2ccd9b5a 100644 --- a/core/module/user/view/groupEdit/groupEdit.php +++ b/core/module/user/view/groupEdit/groupEdit.php @@ -18,66 +18,62 @@
-
-
-
- $this->getData(['group', $this->getUrl(2), 'file', 'download']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'edit']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'create']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'rename']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'upload']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'delete']) - ]); ?> -
-
-
-
- $this->getData(['group', $this->getUrl(2), 'file', 'preview']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'duplicate']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'extract']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'copycut']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'file', 'permission']) - ]); ?> -
-
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'download']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'edit']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'create']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'rename']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'upload']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'delete']) + ]); ?> +
+
+
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'preview']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'duplicate']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'extract']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'copycut']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'file', 'permission']) + ]); ?>
@@ -90,34 +86,40 @@
-
-
-
- $this->getData(['group', $this->getUrl(2), 'folder', 'create']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'folder', 'delete']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'folder', 'rename']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'folder', 'copycut']) - ]); ?> -
-
- $this->getData(['group', $this->getUrl(2), 'folder', 'permission']) - ]); ?> -
-
+ +
+ $this->getData(['group', $this->getUrl(2), 'folder', 'create']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'folder', 'delete']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'folder', 'rename']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'folder', 'copycut']) + ]); ?> +
+
+ $this->getData(['group', $this->getUrl(2), 'folder', 'permission']) + ]); ?> +
+ +
+
+
+ 'Racinde du dossier partagé', + 'selected' => $this->getData(['group', $this->getUrl(2), 'path']) + ]); ?>