* @copyright Copyright (C) 2008-2018, Rémi Jean * @author Frédéric Tempez * @copyright Copyright (C) 2018-2024, Frédéric Tempez * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International * @link http://zwiicms.fr/ */ class folder extends common { const VERSION = '0.1'; const REALNAME = 'Partage de dossier'; const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) public static $actions = [ 'config' => self::GROUP_EDITOR, 'index' => self::GROUP_VISITOR, ]; // Contenu du chemin sélectionné public static $folders = ''; public static $sharePath = [ '/site/file/source/' ]; public function index() { self::$folders = $this->listerSousDossier(self::FILE_DIR . 'source/partage'); // Valeurs en sortie $this->addOutput([ 'showBarEditButton' => true, 'showPageContent' => true, 'view' => 'index' ]); } 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 if ($dh = opendir($chemin)) { $items = isset($items) ? $items . '