forked from ZwiiCMS-Team/ZwiiCMS
folder config wip
This commit is contained in:
parent
69852c82bc
commit
90a5a8a96a
@ -26,9 +26,15 @@ class folder extends common
|
||||
'index' => self::GROUP_VISITOR,
|
||||
];
|
||||
|
||||
static $folders = '';
|
||||
// Contenu du chemin sélectionné
|
||||
public static $folders = '';
|
||||
|
||||
public function index() {
|
||||
public static $sharePath = [
|
||||
'/site/file/source/'
|
||||
];
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
self::$folders = $this->listerSousDossier(self::FILE_DIR . 'source/partage');
|
||||
|
||||
@ -40,7 +46,30 @@ class folder extends common
|
||||
]);
|
||||
}
|
||||
|
||||
private function listerSousDossier($chemin) {
|
||||
|
||||
public function config()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData(['module', $this->getUrl(0), 'path', preg_replace('/^\\./', '', $this->getInput('folderEditPath')) ]);
|
||||
|
||||
}
|
||||
|
||||
self::$sharePath = $this->getSubdirectories('./site/file/source');
|
||||
self::$sharePath = array_flip(self::$sharePath);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'view' => 'config'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function listerSousDossier($chemin)
|
||||
{
|
||||
// Vérifier si le chemin existe et est un dossier
|
||||
if (is_dir($chemin)) {
|
||||
// Ouvrir le dossier
|
||||
@ -79,4 +108,36 @@ class folder extends common
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les dossier contenus dans RFM
|
||||
*/
|
||||
private 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 === '' ? ucfirst($file) : $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;
|
||||
}
|
||||
|
||||
}
|
19
module/folder/view/config/config.css
Executable file
19
module/folder/view/config/config.css
Executable file
@ -0,0 +1,19 @@
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2024, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?php echo template::formOpen('folderConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('folderConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('folderConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo helper::translate('Paramètres'); ?></h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('folderEditPath', $module::$sharePath, [
|
||||
'label' => 'Dossier',
|
||||
'class' => 'filemanager',
|
||||
'selected' => '.' . $this->getData(['module', $this->getUrl(0), 'path'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user