getModules
This commit is contained in:
parent
fed10aa71d
commit
696d38b1f4
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
class helper {
|
||||
|
||||
/** Statut de la réécriture d'URL (pour éviter de lire le contenu du fichier .htaccess à chaque self::baseUrl()) */
|
||||
@ -135,34 +136,45 @@ class helper {
|
||||
* du numéro de version
|
||||
*/
|
||||
public static function getModules($folder = 'module') {
|
||||
$modules = array();
|
||||
// Le dossier existe-t-il ?
|
||||
if (is_dir($folder)) {
|
||||
$dirs = array_diff(scandir($folder), array('..', '.'));
|
||||
foreach ($dirs as $key => $value) {
|
||||
// Dossier non vide
|
||||
if (file_exists($folder . '/' . $value . '/' . $value . '.php')) {
|
||||
// Lire les constantes en gérant les erreurs de nom de classe
|
||||
try {
|
||||
// Chargement des classes externes
|
||||
if ($folder !== 'module') {
|
||||
include_once ($folder . '/' . $value . '/' . $value . '.php');
|
||||
if ( class_exists($value) ) {
|
||||
$e = new $value;
|
||||
}
|
||||
}
|
||||
$class_reflex = new \ReflectionClass($value);
|
||||
$class_constants = $class_reflex->getConstants();
|
||||
// Constante REALNAME
|
||||
if (array_key_exists('REALNAME', $class_constants)) {
|
||||
$realName = $value::REALNAME;
|
||||
} else {
|
||||
$realName = ucfirst($value);
|
||||
}
|
||||
// Constante VERSION
|
||||
if (array_key_exists('VERSION', $class_constants)) {
|
||||
$version = $value::VERSION;
|
||||
} else {
|
||||
$version = '0.0';
|
||||
}
|
||||
// Affection
|
||||
$modules [$value] = [
|
||||
'realName' => $realName,
|
||||
'version' => $version
|
||||
];
|
||||
|
||||
$dirs = array_diff(scandir($folder), array('..', '.'));
|
||||
foreach ($dirs as $key => $value) {
|
||||
// Dossier non vide
|
||||
if (file_exists($folder . '/' . $value . '/' . $value . '.php')) {
|
||||
// Lire les constantes
|
||||
try {
|
||||
$class_reflex = new \ReflectionClass($value);
|
||||
$class_constants = $class_reflex->getConstants();
|
||||
// Constante REALNAME
|
||||
if (array_key_exists('REALNAME', $class_constants)) {
|
||||
$realName = $value::REALNAME;
|
||||
} else {
|
||||
$realName = ucfirst($value);
|
||||
} catch (Exception $e){
|
||||
// on ne fait rien
|
||||
}
|
||||
// Constante VERSION
|
||||
if (array_key_exists('VERSION', $class_constants)) {
|
||||
$version = $value::VERSION;
|
||||
} else {
|
||||
$version = '0.0';
|
||||
}
|
||||
// Affection
|
||||
$modules [$value] = [
|
||||
'realName' => $realName,
|
||||
'version' => $version
|
||||
];
|
||||
} catch (Exception $e){
|
||||
// on ne fait rien
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class common {
|
||||
const ACCESS_TIMER = 1800;
|
||||
|
||||
// Numéro de version
|
||||
const ZWII_VERSION = '10.4.02.modules';
|
||||
const ZWII_VERSION = '10.5.00';
|
||||
const ZWII_UPDATE_CHANNEL = "v10";
|
||||
|
||||
public static $actions = [];
|
||||
|
@ -603,7 +603,7 @@ class config extends common {
|
||||
* Affichage des modules installés
|
||||
*/
|
||||
public function modules() {
|
||||
|
||||
var_dump(helper::getModules ());
|
||||
// Préparation du tableau des modules installés
|
||||
// Liste des modules installés (répertoire de module/)
|
||||
if ($dh = opendir( 'module/' )) {
|
||||
|
@ -441,8 +441,7 @@ class page extends common {
|
||||
]);
|
||||
}
|
||||
}
|
||||
self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arrayCollumn(helper::getModules(),'realName','SORT_ASC'));
|
||||
// Pages sans parent
|
||||
self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arrayCollumn(helper::getModules(),'realName','SORT_ASC')); // Pages sans parent
|
||||
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
|
||||
if($parentPageId !== $this->getUrl(2)) {
|
||||
self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
|
||||
|
Loading…
Reference in New Issue
Block a user